Example #1
0
def render(title):
	realTitle,year, zhTitle = MovieUtil.splitLinkName(title)

	movieInfo = MovieUtil.fetchFromIMDB(realTitle, year)

	if len(movieInfo) > 1:
		movieID, date, genre, director, actors, rating, votes, plot = MovieUtil.fetchFromIMDB(realTitle, year)
		doubanLink, summary, doubanRate = MovieUtil.fetchFromDouban(movieID)
	else:
		movieID, date, genre, director, actors, rating, votes, plot,doubanLink, summary, doubanRate = [PEANUT_UNKNOW] * 11

	template_values = {
		'movietitle' : zhTitle + "\t" + realTitle + "\t" + year,
		'genre' : genre,
		'date' : date,
		'director' : director,
		'actors' : actors,
		'imdbRating' : rating,
		'doubanRating' : doubanRate,
		'imdbLink' : movieID,
		'doubanLink' : doubanLink,
		'summary' : summary}

	template = JINJA_ENVIRONMENT.get_template('description.html')
	return template.render(template_values)
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs):
    toon = drop['toon']
    if drop.has_key('npc'):
        toon = drop['npc']
    
    battle = drop['battle']
    majorObject = level >= 3
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    hpbonus = drop['hpbonus']
    if hp > 0:
        suitTrack = Sequence()
        showDamage = Func(suit.showHpText, -hp, openEnded = 0)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        if majorObject:
            anim = 'flatten'
        else:
            anim = 'drop-react'
        suitReact = ActorInterval(suit, anim)
        suitTrack.append(Wait(delay + tObjectAppears))
        suitTrack.append(showDamage)
        suitTrack.append(updateHealthBar)
        suitGettingHit = Parallel(suitReact)
        if level == UBER_GAG_LEVEL_INDEX:
            gotHitSound = globalBattleSoundCache.getSound('AA_drop_boat_cog.mp3')
            suitGettingHit.append(SoundInterval(gotHitSound, node = toon))
        
        suitTrack.append(suitGettingHit)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Sequence(Wait(delay + tObjectAppears + 0.75), Func(suit.showHpText, -hpbonus, 1, openEnded = 0))
        
        if revived != 0:
            suitTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle, npcs))
        elif died != 0:
            suitTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle, npcs))
        else:
            suitTrack.append(Func(suit.loop, 'neutral'))
        if bonusTrack != None:
            suitTrack = Parallel(suitTrack, bonusTrack)
        
    elif kbbonus == 0:
        suitTrack = Sequence(Wait(delay + tObjectAppears), Func(MovieUtil.indicateMissed, suit, 0.59999999999999998), Func(suit.loop, 'neutral'))
    elif alreadyDodged > 0:
        return None
    
    if level >= 3:
        if alreadyTeased > 0:
            return None
        else:
            suitTrack = MovieUtil.createSuitTeaseMultiTrack(suit, delay = delay + tObjectAppears)
    else:
        suitTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
    return suitTrack
def __healJuggle(heal, hasInteractivePropHealBonus):
    npcId = 0
    if 'npcId' in heal:
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon is None:
            return
    else:
        toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    delay = 4.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = Func(
            __healToon,
            targetToon,
            hp,
            ineffective,
            hasInteractivePropHealBonus)
        if first == 1:
            targetTrack.append(Wait(delay))
            first = 0
        targetTrack.append(reactIval)

    cube = globalPropPool.getProp('cubes')
    cube2 = MovieUtil.copyProp(cube)
    cubes = [cube, cube2]
    hips = [
        toon.getLOD(
            toon.getLODNames()[0]).find('**/joint_hips'),
        toon.getLOD(
            toon.getLODNames()[1]).find('**/joint_hips')]
    cubeTrack = Sequence(
        Func(
            MovieUtil.showProps, cubes, hips), MovieUtil.getActorIntervals(
            cubes, 'cubes'), Func(
                MovieUtil.removeProps, cubes))
    mtrack = Parallel(
        cubeTrack, __getSoundTrack(
            level, 0.7, duration=7.7, node=toon), ActorInterval(
            toon, 'juggle'), targetTrack)
    track.append(mtrack)
    if npcId != 0:
        track.append(MovieNPCSOS.teleportOut(heal, toon))
    else:
        track.append(__returnToBase(heal))
    for target in targets:
        targetToon = target['toon']
        track.append(Func(targetToon.clearChat))

    return track
Example #4
0
def __healDance(heal, hasInteractivePropHealBonus):
    npcId = 0
    if "npcId" in heal:
        npcId = heal["npcId"]
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return
    else:
        toon = heal["toon"]
    targets = heal["target"]
    ineffective = heal["sidestep"]
    level = heal["level"]
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    delay = 3.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target["toon"]
        hp = target["hp"]
        reactIval = Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus)
        if first:
            targetTrack.append(Wait(delay))
            first = 0
        targetTrack.append(reactIval)

    hat = globalPropPool.getProp("hat")
    hat2 = MovieUtil.copyProp(hat)
    hats = [hat, hat2]
    cane = globalPropPool.getProp("cane")
    cane2 = MovieUtil.copyProp(cane)
    canes = [cane, cane2]
    leftHands = toon.getLeftHands()
    rightHands = toon.getRightHands()
    dScale = 0.5
    propTrack = Sequence(
        Func(MovieUtil.showProps, hats, rightHands, Point3(0.23, 0.09, 0.69), Point3(180, 0, 0)),
        Func(MovieUtil.showProps, canes, leftHands, Point3(-0.28, 0.0, 0.14), Point3(0.0, 0.0, -150.0)),
        MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE),
        Wait(toon.getDuration("happy-dance") - 2.0 * dScale),
        MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO),
        Func(MovieUtil.removeProps, hats + canes),
    )
    mtrack = Parallel(
        propTrack, ActorInterval(toon, "happy-dance"), __getSoundTrack(level, 0.2, duration=6.4, node=toon), targetTrack
    )
    track.append(Func(toon.loop, "neutral"))
    track.append(Wait(0.1))
    track.append(mtrack)
    if npcId != 0:
        track.append(MovieNPCSOS.teleportOut(heal, toon))
    else:
        track.append(__returnToBase(heal))
    for target in targets:
        targetToon = target["toon"]
        track.append(Func(targetToon.clearChat))

    return track
Example #5
0
def __healTickle(heal, hasInteractivePropHealBonus):
    toon = heal["toon"]
    target = heal["target"]["toon"]
    hp = heal["target"]["hp"]
    ineffective = heal["sidestep"]
    level = heal["level"]
    track = Sequence(__runToHealSpot(heal))
    feather = globalPropPool.getProp("feather")
    feather2 = MovieUtil.copyProp(feather)
    feathers = [feather, feather2]
    hands = toon.getRightHands()

    def scaleFeathers(feathers, toon=toon, target=target):
        toon.pose("tickle", 63)
        toon.update(0)
        hand = toon.getRightHands()[0]
        horizDistance = Vec3(hand.getPos(render) - target.getPos(render))
        horizDistance.setZ(0)
        distance = horizDistance.length()
        if target.style.torso[0] == "s":
            distance -= 0.5
        else:
            distance -= 0.3
        featherLen = 2.4
        scale = distance / (featherLen * hand.getScale(render)[0])
        for feather in feathers:
            feather.setScale(scale)

    tFeatherScaleUp = 0.5
    dFeatherScaleUp = 0.5
    dFeatherScaleDown = 0.5
    featherTrack = Parallel(
        MovieUtil.getActorIntervals(feathers, "feather"),
        Sequence(
            Wait(tFeatherScaleUp),
            Func(MovieUtil.showProps, feathers, hands),
            Func(scaleFeathers, feathers),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleUp, MovieUtil.PNT3_NEARZERO, feathers[0].getScale),
        ),
        Sequence(
            Wait(toon.getDuration("tickle") - dFeatherScaleDown),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleDown, None, MovieUtil.PNT3_NEARZERO),
        ),
    )
    tHeal = 3.0
    mtrack = Parallel(
        featherTrack,
        ActorInterval(toon, "tickle"),
        __getSoundTrack(level, 1, node=toon),
        Sequence(
            Wait(tHeal),
            Func(__healToon, target, hp, ineffective, hasInteractivePropHealBonus),
            ActorInterval(target, "cringe", startTime=20.0 / target.getFrameRate("cringe")),
        ),
    )
    track.append(mtrack)
    track.append(Func(MovieUtil.removeProps, feathers))
    track.append(__returnToBase(heal))
    track.append(Func(target.clearChat))
    return track
Example #6
0
def __doFoghorn(sound, delay, toon, targets, level):
    tracks = Parallel()
    instrMin = Vec3(0.001, 0.001, 0.001)
    instrMax1 = Vec3(0.10000000000000001, 0.10000000000000001, 0.10000000000000001)
    instrMax1 *= INSTRUMENT_SCALE_MODIFIER
    instrMax2 = Vec3(0.29999999999999999, 0.29999999999999999, 0.29999999999999999)
    instrMax2 *= INSTRUMENT_SCALE_MODIFIER
    instrStretch = Vec3(0.40000000000000002, 0.40000000000000002, 0.40000000000000002)
    instrStretch *= INSTRUMENT_SCALE_MODIFIER
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [
        megaphone,
        megaphone2]
    instrument = globalPropPool.getProp('fog_horn')
    instrument2 = MovieUtil.copyProp(instrument)
    instruments = [
        instrument,
        instrument2]
    
    def setInstrumentStats(instrument = instrument, instrument2 = instrument2):
        instrument.setPos(-0.80000000000000004, -0.90000000000000002, 0.20000000000000001)
        instrument.setHpr(145, 0, 0)
        instrument.setScale(instrMin)
        instrument2.setPos(-0.80000000000000004, -0.90000000000000002, 0.20000000000000001)
        instrument2.setHpr(145, 0, 0)
        instrument2.setScale(instrMin)

    hands = toon.getRightHands()
    megaphoneShow = Sequence(Func(MovieUtil.showProps, megaphones, hands), Func(MovieUtil.showProps, instruments, hands), Func(setInstrumentStats))
    megaphoneHide = Sequence(Func(MovieUtil.removeProps, megaphones), Func(MovieUtil.removeProps, instruments))
    instrumentAppearSfx = globalBattleSoundCache.getSound(appearSoundFiles[level])
    grow1 = getScaleIntervals(instruments, duration = 1, startScale = instrMin, endScale = instrMax1)
    grow2 = getScaleIntervals(instruments, duration = 0.10000000000000001, startScale = instrMax1, endScale = instrMax2)
    instrumentAppear = Parallel(Sequence(grow1, grow2), Sequence(Wait(0.050000000000000003), SoundInterval(instrumentAppearSfx, node = toon)))
    stretchInstr = getScaleBlendIntervals(instruments, duration = 0.29999999999999999, startScale = instrMax2, endScale = instrStretch, blendType = 'easeOut')
    backInstr = getScaleBlendIntervals(instruments, duration = 1.0, startScale = instrStretch, endScale = instrMin, blendType = 'easeIn')
    spinInstr1 = LerpHprInterval(instrument, duration = 1.5, startHpr = Vec3(145, 0, 0), hpr = Vec3(145, 0, 90), blendType = 'easeInOut')
    spinInstr2 = LerpHprInterval(instrument2, duration = 1.5, startHpr = Vec3(145, 0, 0), hpr = Vec3(145, 0, 90), blendType = 'easeInOut')
    spinInstr = Parallel(spinInstr1, spinInstr2)
    attackTrack = Parallel(Sequence(Wait(0.20000000000000001), spinInstr), Sequence(stretchInstr, Wait(0.5), backInstr))
    hasLuredSuits = __hasLuredSuits(sound)
    delayTime = delay
    if hasLuredSuits:
        delayTime += TIME_TO_WALK_BACK
    
    megaphoneTrack = Sequence(Wait(delayTime), megaphoneShow, Wait(1.0), instrumentAppear, Wait(3.0), megaphoneHide)
    tracks.append(megaphoneTrack)
    toonTrack = __createToonInterval(sound, delay, toon)
    tracks.append(toonTrack)
    soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
    if soundEffect:
        delayTime = delay + tSound
        if hasLuredSuits:
            delayTime += TIME_TO_WALK_BACK
        
        soundTrack = Sequence(Wait(delayTime), Parallel(attackTrack, SoundInterval(soundEffect, node = toon)))
        tracks.append(soundTrack)
    
    return tracks
def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet = 1, npcs = []):
    toon = lure['toon']
    if 'npc' in lure:
        toon = lure['npc']
    battle = lure['battle']
    sidestep = lure['sidestep']
    targets = lure['target']
    tracks = Parallel()
    tracks.append(Sequence(ActorInterval(toon, 'hold-magnet'), Func(toon.loop, 'neutral')))
    hands = toon.getLeftHands()
    magnet2 = MovieUtil.copyProp(magnet)
    magnets = [magnet, magnet2]
    magnetTrack = Sequence(Wait(0.7), Func(MovieUtil.showProps, magnets, hands, pos, hpr, scale), Wait(6.3), Func(MovieUtil.removeProps, magnets))
    tracks.append(magnetTrack)
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            revived = target['revived']
            if kbbonus == 1 or hp > 0:
                suitDelay = 2.6
                suitMoveDuration = 0.8
                suitTrack = Sequence()
                opos, ohpr = battle.getActorPosHpr(suit)
                reachDist = MovieUtil.SUIT_LURE_DISTANCE
                reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
                numShakes = 3
                shakeTotalDuration = 0.8
                shakeDuration = shakeTotalDuration / float(numShakes)
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Wait(suitDelay))
                suitTrack.append(ActorInterval(suit, 'landing', startTime=2.37, endTime=1.82))
                for i in xrange(0, numShakes):
                    suitTrack.append(ActorInterval(suit, 'landing', startTime=1.82, endTime=1.16, duration=shakeDuration))

                suitTrack.append(ActorInterval(suit, 'landing', startTime=1.16, endTime=0.7))
                suitTrack.append(ActorInterval(suit, 'landing', startTime=0.7, duration=1.3))
                suitTrack.append(Func(suit.loop, 'lured'))
                suitTrack.append(Func(battle.lureSuit, suit))
                if hp > 0:
                    suitTrack.append(__createSuitDamageTrack(battle, suit, hp, lure, trapProp))
                if revived != 0:
                    suitTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle, npcs))
                elif died != 0:
                    if not (trapProp.getName() == 'tnt' and suit.maxHP <= 42):
                        suitTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle, npcs))
                tracks.append(suitTrack)
                tracks.append(lerpSuit(suit, suitDelay + 0.55 + shakeTotalDuration, suitMoveDuration, reachPos, battle, trapProp))
        else:
            tracks.append(Sequence(Wait(3.7), Func(MovieUtil.indicateMissed, suit)))

    if isSmallMagnet == 1:
        tracks.append(getSoundTrack('TL_small_magnet.ogg', delay=0.7, node=toon))
    else:
        tracks.append(getSoundTrack('TL_large_magnet.ogg', delay=0.7, node=toon))
    return tracks
Example #8
0
def __doBugle(sound, delay, toon, targets, level):
    tracks = Parallel()
    instrMin = Vec3(0.001, 0.001, 0.001)
    instrMax = Vec3(0.4, 0.4, 0.4)
    instrMax *= INSTRUMENT_SCALE_MODIFIER
    instrStretch = Vec3(0.5, 0.5, 0.5)
    instrStretch *= INSTRUMENT_SCALE_MODIFIER
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [megaphone, megaphone2]
    instrument = globalPropPool.getProp('bugle')
    instrument2 = MovieUtil.copyProp(instrument)
    instruments = [instrument, instrument2]

    def setInstrumentStats(instrument = instrument, instrument2 = instrument2):
        instrument.setPos(-1.3, -1.4, 0.1)
        instrument.setHpr(145, 0, 85)
        instrument.setScale(instrMin)
        instrument2.setPos(-1.3, -1.4, 0.1)
        instrument2.setHpr(145, 0, 85)
        instrument2.setScale(instrMin)

    def longshake(models, num):
        inShake = getScaleBlendIntervals(models, duration=0.2, startScale=instrMax, endScale=instrStretch, blendType='easeInOut')
        outShake = getScaleBlendIntervals(models, duration=0.2, startScale=instrStretch, endScale=instrMax, blendType='easeInOut')
        i = 1
        seq = Sequence()
        while i < num:
            if i % 2 == 0:
                seq.append(inShake)
            else:
                seq.append(outShake)
            i += 1

        seq.start()

    hands = toon.getRightHands()
    megaphoneShow = Sequence(Func(MovieUtil.showProps, megaphones, hands), Func(MovieUtil.showProps, instruments, hands), Func(setInstrumentStats))
    megaphoneHide = Sequence(Func(MovieUtil.removeProps, megaphones), Func(MovieUtil.removeProps, instruments))
    instrumentAppearSfx = globalBattleSoundCache.getSound(appearSoundFiles[level])
    grow = getScaleBlendIntervals(instruments, duration=1, startScale=instrMin, endScale=instrMax, blendType='easeInOut')
    instrumentshrink = getScaleIntervals(instruments, duration=0.1, startScale=instrMax, endScale=instrMin)
    instrumentAppear = Sequence(grow, Wait(0), Func(longshake, instruments, 5))
    hasLuredSuits = __hasLuredSuits(sound)
    delayTime = delay
    if hasLuredSuits:
        delayTime += TIME_TO_WALK_BACK
    soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
    megaphoneTrack = Parallel(Sequence(Wait(delay + 1.7), SoundInterval(soundEffect, node=toon)), Sequence(Wait(delayTime), megaphoneShow, Wait(1.7), instrumentAppear, Wait(1), instrumentshrink, Wait(1.5), megaphoneHide))
    tracks.append(megaphoneTrack)
    toonTrack = __createToonInterval(sound, delay, toon)
    tracks.append(toonTrack)
    if soundEffect:
        delayTime = delay + tSound
        if hasLuredSuits:
            delayTime += TIME_TO_WALK_BACK
        soundTrack = Wait(delayTime)
        tracks.append(soundTrack)
    return tracks
def __doSmooch(attack, hp=0):
    toon = NPCToons.createLocalNPC(attack["npcId"])
    if toon == None:
        return
    targets = attack["toons"]
    level = 2
    battle = attack["battle"]
    track = Sequence(teleportIn(attack, toon))
    lipstick = globalPropPool.getProp("lipstick")
    lipstick2 = MovieUtil.copyProp(lipstick)
    lipsticks = [lipstick, lipstick2]
    rightHands = toon.getRightHands()
    dScale = 0.5
    lipstickTrack = Sequence(
        Func(MovieUtil.showProps, lipsticks, rightHands, Point3(-0.27, -0.24, -0.95), Point3(-118, -10.6, -25.9)),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE),
        Wait(toon.getDuration("smooch") - 2.0 * dScale),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO),
    )
    lips = globalPropPool.getProp("lips")
    dScale = 0.5
    tLips = 2.5
    tThrow = 115.0 / toon.getFrameRate("smooch")
    dThrow = 0.5

    def getLipPos(toon=toon):
        toon.pose("smooch", 57)
        toon.update(0)
        hand = toon.getRightHands()[0]
        return hand.getPos(render)

    effectTrack = Sequence()
    for target in targets:
        lipcopy = MovieUtil.copyProp(lips)
        lipsTrack = Sequence(
            Wait(tLips),
            Func(MovieUtil.showProp, lipcopy, render, getLipPos),
            Func(lipcopy.setBillboardPointWorld),
            LerpScaleInterval(lipcopy, dScale, Point3(3, 3, 3), startScale=MovieUtil.PNT3_NEARZERO),
            Wait(tThrow - tLips - dScale),
            LerpPosInterval(lipcopy, dThrow, Point3(target.getPos() + Point3(0, 0, target.getHeight()))),
            Func(MovieUtil.removeProp, lipcopy),
        )
        delay = tThrow + dThrow
        mtrack = Parallel(
            lipstickTrack,
            lipsTrack,
            __getSoundTrack(level, 2, node=toon),
            Sequence(ActorInterval(toon, "smooch")),
            Sequence(Wait(delay), ActorInterval(target, "conked")),
            Sequence(Wait(delay), Func(__healToon, target, hp)),
        )
        effectTrack.append(mtrack)

    effectTrack.append(Func(MovieUtil.removeProps, lipsticks))
    track.append(effectTrack)
    track.append(teleportOut(attack, toon))
    track.append(Func(target.clearChat))
    return track
def __doAoogah(sound, delay, toon, targets, level):
    tracks = Parallel()
    instrMin = Vec3(0.001, 0.001, 0.001)
    instrMax = Vec3(0.5, 0.5, 0.5)
    instrMax *= INSTRUMENT_SCALE_MODIFIER
    instrStretch = Vec3(1.1, 0.9, 0.4)
    instrStretch *= INSTRUMENT_SCALE_MODIFIER
    megaphone = globalPropPool.getProp("megaphone")
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [megaphone, megaphone2]
    instrument = globalPropPool.getProp("aoogah")
    instrument2 = MovieUtil.copyProp(instrument)
    instruments = [instrument, instrument2]

    def setInstrumentStats(instrument=instrument, instrument2=instrument2):
        instrument.setPos(-1.0, -1.5, 0.2)
        instrument.setHpr(145, 0, 85)
        instrument.setScale(instrMin)
        instrument2.setPos(-1.0, -1.5, 0.2)
        instrument2.setHpr(145, 0, 85)
        instrument2.setScale(instrMin)

    hands = toon.getRightHands()
    megaphoneShow = Sequence(
        Func(MovieUtil.showProps, megaphones, hands),
        Func(MovieUtil.showProps, instruments, hands),
        Func(setInstrumentStats),
    )
    megaphoneHide = Sequence(Func(MovieUtil.removeProps, megaphones), Func(MovieUtil.removeProps, instruments))
    instrumentAppearSfx = globalBattleSoundCache.getSound(appearSoundFiles[level])
    grow = getScaleIntervals(instruments, duration=0.2, startScale=instrMin, endScale=instrMax)
    instrumentAppear = Parallel(grow, Sequence(Wait(0.05), SoundInterval(instrumentAppearSfx, node=toon)))
    stretchInstr = getScaleBlendIntervals(
        instruments, duration=0.2, startScale=instrMax, endScale=instrStretch, blendType="easeOut"
    )
    backInstr = getScaleBlendIntervals(
        instruments, duration=0.2, startScale=instrStretch, endScale=instrMax, blendType="easeInOut"
    )
    attackTrack = Sequence(stretchInstr, Wait(1), backInstr)
    hasLuredSuits = __hasLuredSuits(sound)
    delayTime = delay
    if hasLuredSuits:
        delayTime += TIME_TO_WALK_BACK
    megaphoneTrack = Sequence(Wait(delayTime), megaphoneShow, Wait(1.0), instrumentAppear, Wait(3.0), megaphoneHide)
    tracks.append(megaphoneTrack)
    toonTrack = __createToonInterval(sound, delay, toon)
    tracks.append(toonTrack)
    soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
    instrumentshrink = getScaleIntervals(instruments, duration=0.1, startScale=instrMax, endScale=instrMin)
    if soundEffect:
        delayTime = delay + tSound
        if hasLuredSuits:
            delayTime += TIME_TO_WALK_BACK
        soundTrack = Sequence(
            Wait(delayTime),
            Parallel(attackTrack, SoundInterval(soundEffect, node=toon), Sequence(Wait(1.5), instrumentshrink)),
        )
        tracks.append(soundTrack)
    return tracks
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs):
    toon = drop["toon"]
    if drop.has_key("npc"):
        toon = drop["npc"]
    battle = drop["battle"]
    majorObject = level >= 3
    suit = target["suit"]
    hp = target["hp"]
    hitSuit = hp > 0
    died = target["died"]
    revived = target["revived"]
    leftSuits = target["leftSuits"]
    rightSuits = target["rightSuits"]
    kbbonus = target["kbbonus"]
    hpbonus = drop["hpbonus"]
    if hp > 0:
        suitTrack = Sequence()
        showDamage = Func(suit.showHpText, -hp, openEnded=0)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        if majorObject:
            anim = "flatten"
        else:
            anim = "drop-react"
        suitReact = ActorInterval(suit, anim)
        suitTrack.append(Wait(delay + tObjectAppears))
        suitTrack.append(showDamage)
        suitTrack.append(updateHealthBar)
        suitGettingHit = Parallel(suitReact)
        if level == UBER_GAG_LEVEL_INDEX:
            gotHitSound = globalBattleSoundCache.getSound("AA_drop_boat_cog.mp3")
            suitGettingHit.append(SoundInterval(gotHitSound, node=toon))
        suitTrack.append(suitGettingHit)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Sequence(Wait(delay + tObjectAppears + 0.75), Func(suit.showHpText, -hpbonus, 1, openEnded=0))
        if revived != 0:
            suitTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle, npcs))
        elif died != 0:
            suitTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle, npcs))
        else:
            suitTrack.append(Func(suit.loop, "neutral"))
        if bonusTrack != None:
            suitTrack = Parallel(suitTrack, bonusTrack)
    elif kbbonus == 0:
        suitTrack = Sequence(
            Wait(delay + tObjectAppears), Func(MovieUtil.indicateMissed, suit, 0.6), Func(suit.loop, "neutral")
        )
    else:
        if alreadyDodged > 0:
            return
        if level >= 3:
            if alreadyTeased > 0:
                return
            else:
                suitTrack = MovieUtil.createSuitTeaseMultiTrack(suit, delay=delay + tObjectAppears)
        else:
            suitTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
    return suitTrack
def __healDance(heal, hasInteractivePropHealBonus):
    npcId = 0
    if heal.has_key('npcId'):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return None
        
    else:
        toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    delay = 3.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus)
        if first:
            targetTrack.append(Wait(delay))
            first = 0
        
        targetTrack.append(reactIval)
    
    hat = globalPropPool.getProp('hat')
    hat2 = MovieUtil.copyProp(hat)
    hats = [
        hat,
        hat2]
    cane = globalPropPool.getProp('cane')
    cane2 = MovieUtil.copyProp(cane)
    canes = [
        cane,
        cane2]
    leftHands = toon.getLeftHands()
    rightHands = toon.getRightHands()
    dScale = 0.5
    propTrack = Sequence(Func(MovieUtil.showProps, hats, rightHands, Point3(0.23000000000000001, 0.089999999999999997, 0.68999999999999995), Point3(180, 0, 0)), Func(MovieUtil.showProps, canes, leftHands, Point3(-0.28000000000000003, 0.0, 0.14000000000000001), Point3(0.0, 0.0, -150.0)), MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE), Wait(toon.getDuration('happy-dance') - 2.0 * dScale), MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO), Func(MovieUtil.removeProps, hats + canes))
    mtrack = Parallel(propTrack, ActorInterval(toon, 'happy-dance'), __getSoundTrack(level, 0.20000000000000001, duration = 6.4000000000000004, node = toon), targetTrack)
    track.append(Func(toon.loop, 'neutral'))
    track.append(Wait(0.10000000000000001))
    track.append(mtrack)
    if npcId != 0:
        track.append(MovieNPCSOS.teleportOut(heal, toon))
    else:
        track.append(__returnToBase(heal))
    for target in targets:
        targetToon = target['toon']
        track.append(Func(targetToon.clearChat))
    
    return track
def __createHypnoGogglesMultiTrack(lure, npcs = []):
    toon = lure['toon']
    if lure.has_key('npc'):
        toon = lure['npc']
    
    targets = lure['target']
    battle = lure['battle']
    sidestep = lure['sidestep']
    goggles = globalPropPool.getProp('hypno-goggles')
    goggles2 = MovieUtil.copyProp(goggles)
    bothGoggles = [
        goggles,
        goggles2]
    pos = Point3(-1.03, 1.04, -0.29999999999999999)
    hpr = Point3(-96.549999999999997, 36.140000000000001, -170.59)
    scale = Point3(1.5, 1.5, 1.5)
    hands = toon.getLeftHands()
    gogglesTrack = Sequence(Wait(0.59999999999999998), Func(MovieUtil.showProps, bothGoggles, hands, pos, hpr, scale), ActorInterval(goggles, 'hypno-goggles', duration = 2.2000000000000002), Func(MovieUtil.removeProps, bothGoggles))
    toonTrack = Sequence(ActorInterval(toon, 'hypnotize'), Func(toon.loop, 'neutral'))
    tracks = Parallel(gogglesTrack, toonTrack)
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            revived = target['revived']
            if kbbonus == 1 or hp > 0:
                suitTrack = Sequence()
                suitDelay = 1.6000000000000001
                suitAnimDuration = 1.5
                (opos, ohpr) = battle.getActorPosHpr(suit)
                reachDist = MovieUtil.SUIT_LURE_DISTANCE
                reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Wait(suitDelay))
                suitTrack.append(ActorInterval(suit, 'hypnotized', duration = 3.1000000000000001))
                suitTrack.append(Func(suit.setPos, battle, reachPos))
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Func(battle.lureSuit, suit))
                if hp > 0:
                    suitTrack.append(__createSuitDamageTrack(battle, suit, hp, lure, trapProp))
                
                if revived != 0:
                    suitTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle, npcs))
                elif died != 0:
                    suitTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle, npcs))
                
                tracks.append(suitTrack)
                tracks.append(lerpSuit(suit, suitDelay + 1.7, 0.69999999999999996, reachPos, battle, trapProp))
            
        hp > 0
        tracks.append(Sequence(Wait(2.2999999999999998), Func(MovieUtil.indicateMissed, suit, 1.1000000000000001)))
    
    tracks.append(getSoundTrack('TL_hypnotize.mp3', delay = 0.5, node = toon))
    return tracks
Example #14
0
def __doElephant(sound, delay, toon, targets, level):
    tracks = Parallel()
    instrMin = Vec3(0.001, 0.001, 0.001)
    instrMax1 = Vec3(0.3, 0.4, 0.2)
    instrMax1 *= INSTRUMENT_SCALE_MODIFIER
    instrMax2 = Vec3(0.3, 0.3, 0.3)
    instrMax2 *= INSTRUMENT_SCALE_MODIFIER
    instrStretch1 = Vec3(0.3, 0.5, 0.25)
    instrStretch1 *= INSTRUMENT_SCALE_MODIFIER
    instrStretch2 = Vec3(0.3, 0.7, 0.3)
    instrStretch2 *= INSTRUMENT_SCALE_MODIFIER
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [megaphone, megaphone2]
    instrument = globalPropPool.getProp('elephant')
    instrument2 = MovieUtil.copyProp(instrument)
    instruments = [instrument, instrument2]

    def setInstrumentStats(instrument = instrument, instrument2 = instrument2):
        instrument.setPos(-.6, -.9, 0.15)
        instrument.setHpr(145, 0, 85)
        instrument.setScale(instrMin)
        instrument2.setPos(-.6, -.9, 0.15)
        instrument2.setHpr(145, 0, 85)
        instrument2.setScale(instrMin)

    hands = toon.getRightHands()
    megaphoneShow = Sequence(Func(MovieUtil.showProps, megaphones, hands), Func(MovieUtil.showProps, instruments, hands), Func(setInstrumentStats))
    megaphoneHide = Sequence(Func(MovieUtil.removeProps, megaphones), Func(MovieUtil.removeProps, instruments))
    instrumentAppearSfx = globalBattleSoundCache.getSound(appearSoundFiles[level])
    grow1 = getScaleIntervals(instruments, duration=0.3, startScale=instrMin, endScale=instrMax1)
    grow2 = getScaleIntervals(instruments, duration=0.3, startScale=instrMax1, endScale=instrMax2)
    instrumentAppear = Parallel(Sequence(grow1, grow2), Sequence(Wait(0.05), SoundInterval(instrumentAppearSfx, node=toon)))
    stretchInstr1 = getScaleBlendIntervals(instruments, duration=0.1, startScale=instrMax2, endScale=instrStretch1, blendType='easeOut')
    stretchInstr2 = getScaleBlendIntervals(instruments, duration=0.1, startScale=instrStretch1, endScale=instrStretch2, blendType='easeOut')
    stretchInstr = Sequence(stretchInstr1, stretchInstr2)
    backInstr = getScaleBlendIntervals(instruments, duration=0.1, startScale=instrStretch2, endScale=instrMax2, blendType='easeOut')
    attackTrack = Sequence(stretchInstr, Wait(1), backInstr)
    hasLuredSuits = __hasLuredSuits(sound)
    delayTime = delay
    if hasLuredSuits:
        delayTime += TIME_TO_WALK_BACK
    megaphoneTrack = Sequence(Wait(delayTime), megaphoneShow, Wait(1.0), instrumentAppear, Wait(3.0), megaphoneHide)
    tracks.append(megaphoneTrack)
    toonTrack = __createToonInterval(sound, delay, toon)
    tracks.append(toonTrack)
    soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
    instrumentshrink = getScaleIntervals(instruments, duration=0.1, startScale=instrMax2, endScale=instrMin)
    if soundEffect:
        delayTime = delay + tSound
        if hasLuredSuits:
            delayTime += TIME_TO_WALK_BACK
        soundTrack = Sequence(Wait(delayTime), Parallel(attackTrack, SoundInterval(soundEffect, node=toon), Sequence(Wait(1.5), instrumentshrink)))
        tracks.append(soundTrack)
    return tracks
Example #15
0
def __doOpera(sound, delay, toon, targets, level):
    tracks = Parallel()
    delay = delay
    instrMin = Vec3(0.001, 0.001, 0.001)
    instrMax1 = Vec3(1.7, 1.7, 1.7)
    instrMax1 *= INSTRUMENT_SCALE_MODIFIER
    instrMax2 = Vec3(2.2, 2.2, 2.2)
    instrMax2 *= INSTRUMENT_SCALE_MODIFIER
    instrStretch = Vec3(0.4, 0.4, 0.4)
    instrStretch *= INSTRUMENT_SCALE_MODIFIER
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [megaphone, megaphone2]
    instrument = globalPropPool.getProp('singing')
    instrument2 = MovieUtil.copyProp(instrument)
    instruments = [instrument, instrument2]
    head = instrument2.find('**/opera_singer')
    head.setPos(0, 0, 0)

    def setInstrumentStats(instrument = instrument, instrument2 = instrument2):
        notify.debug('setInstrumentStats')
        newPos = Vec3(-0.8, -0.9, 0.2)
        newPos *= 1.3
        instrument.setPos(newPos[0], newPos[1], newPos[2])
        instrument.setHpr(145, 0, 90)
        instrument.setScale(instrMin)
        instrument2.setPos(newPos[0], newPos[1], newPos[2])
        instrument2.setHpr(145, 0, 90)
        instrument2.setScale(instrMin)

    hands = toon.getRightHands()
    megaphoneShow = Sequence(Func(MovieUtil.showProps, megaphones, hands), Func(MovieUtil.showProps, instruments, hands), Func(setInstrumentStats))
    megaphoneHide = Sequence(Func(MovieUtil.removeProps, megaphones), Func(MovieUtil.removeProps, instruments))
    instrumentAppearSfx = globalBattleSoundCache.getSound(appearSoundFiles[level])
    grow1 = getScaleBlendIntervals(instruments, duration=1, startScale=instrMin, endScale=instrMax1, blendType='easeOut')
    grow2 = getScaleBlendIntervals(instruments, duration=1.1, startScale=instrMax1, endScale=instrMax2, blendType='easeIn')
    shrink2 = getScaleIntervals(instruments, duration=0.1, startScale=instrMax2, endScale=instrMin)
    instrumentAppear = Parallel(Sequence(grow1, grow2, Wait(6.0), shrink2), Sequence(Wait(0.0), SoundInterval(instrumentAppearSfx, node=toon)))
    hasLuredSuits = __hasLuredSuits(sound)
    delayTime = delay
    if hasLuredSuits:
        delayTime += TIME_TO_WALK_BACK
    megaphoneTrack = Sequence(Wait(delayTime), megaphoneShow, Wait(1.0), instrumentAppear, Wait(2.0), megaphoneHide)
    tracks.append(megaphoneTrack)
    toonTrack = __createToonInterval(sound, delay, toon, operaInstrument=instrument)
    tracks.append(toonTrack)
    soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
    if soundEffect:
        delayTime = delay + tSound - 0.3
        if hasLuredSuits:
            delayTime += TIME_TO_WALK_BACK
        soundTrack = Sequence(Wait(delayTime), SoundInterval(soundEffect, node=toon))
        tracks.append(Sequence(Wait(0)))
        tracks.append(soundTrack)
    return tracks
Example #16
0
def __healSmooch(heal, hasInteractivePropHealBonus):
    toon = heal["toon"]
    target = heal["target"]["toon"]
    level = heal["level"]
    hp = heal["target"]["hp"]
    ineffective = heal["sidestep"]
    track = Sequence(__runToHealSpot(heal))
    lipstick = globalPropPool.getProp("lipstick")
    lipstick2 = MovieUtil.copyProp(lipstick)
    lipsticks = [lipstick, lipstick2]
    rightHands = toon.getRightHands()
    dScale = 0.5
    lipstickTrack = Sequence(
        Func(MovieUtil.showProps, lipsticks, rightHands, Point3(-0.27, -0.24, -0.95), Point3(-118, -10.6, -25.9)),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE),
        Wait(toon.getDuration("smooch") - 2.0 * dScale),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO),
        Func(MovieUtil.removeProps, lipsticks),
    )
    lips = globalPropPool.getProp("lips")
    dScale = 0.5
    tLips = 2.5
    tThrow = 115.0 / toon.getFrameRate("smooch")
    dThrow = 0.5

    def getLipPos(toon=toon):
        toon.pose("smooch", 57)
        toon.update(0)
        hand = toon.getRightHands()[0]
        return hand.getPos(render)

    lipsTrack = Sequence(
        Wait(tLips),
        Func(MovieUtil.showProp, lips, render, getLipPos),
        Func(lips.setBillboardPointWorld),
        LerpScaleInterval(lips, dScale, Point3(3, 3, 3), startScale=MovieUtil.PNT3_NEARZERO),
        Wait(tThrow - tLips - dScale),
        LerpPosInterval(lips, dThrow, Point3(target.getPos() + Point3(0, 0, target.getHeight()))),
        Func(MovieUtil.removeProp, lips),
    )
    delay = tThrow + dThrow
    mtrack = Parallel(
        lipstickTrack,
        lipsTrack,
        __getSoundTrack(level, 2, node=toon),
        Sequence(ActorInterval(toon, "smooch"), *__returnToBase(heal)),
        Sequence(Wait(delay), ActorInterval(target, "conked"), Func(target.loop, "neutral")),
        Sequence(Wait(delay), Func(__healToon, target, hp, ineffective, hasInteractivePropHealBonus)),
    )
    track.append(mtrack)
    track.append(Func(target.clearChat))
    return track
def __doSoundsLevel(sounds, delay, hitCount, npcs):
    lastSoundThatHit = None
    totalDamage = 0
    for sound in sounds:
        for target in sound['target']:
            if target['hp'] > 0:
                lastSoundThatHit = sound
                totalDamage += target['hp']
                break

    mainTrack = Sequence()
    tracks = Parallel()
    deathTracks = Parallel()
    for sound in sounds:
        toon = sound['toon']
        if 'npc' in sound:
            toon = sound['npc']
        level = sound['level']
        targets = sound['target']
        hpbonus = sound['hpbonus']
        attackMTrack = soundfn_array[sound['level']](
            sound, delay, toon, targets, level)
        tracks.append(Sequence(Wait(delay), attackMTrack))
        tracks.append(
            __getSuitTrack(
                sound,
                lastSoundThatHit,
                delay,
                hitCount,
                targets,
                totalDamage,
                hpbonus,
                toon,
                npcs))
        for target in targets:
            battle = sound['battle']
            suit = target['suit']
            died = target['died']
            revived = target['revived']
            if revived:
                deathTracks.append(
                    MovieUtil.createSuitReviveTrack(
                        suit, toon, battle, npcs))
            elif died:
                deathTracks.append(
                    MovieUtil.createSuitDeathTrack(
                        suit, toon, battle, npcs))

    mainTrack.append(tracks)
    mainTrack.append(deathTracks)
    return mainTrack
Example #18
0
def __healJuggle(heal):
    toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    ivals = __runToHealSpot(heal)
    delay = 4.0
    first = 1
    targetIvals = []
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = FunctionInterval(__healToon, extraArgs = [
            targetToon,
            hp,
            ineffective])
        if first == 1:
            targetIvals.append((delay, reactIval, PREVIOUS_END))
            first = 0
        else:
            targetIvals.append(reactIval)
    
    cube = globalPropPool.getProp('cubes')
    cube2 = MovieUtil.copyProp(cube)
    cubes = [
        cube,
        cube2]
    hips = [
        toon.getLOD(toon.getLODNames()[0]).find('**/joint-hips'),
        toon.getLOD(toon.getLODNames()[1]).find('**/joint-hips')]
    cubeIvals = [
        FunctionInterval(MovieUtil.showProps, extraArgs = [
            cubes,
            hips]),
        MovieUtil.getActorIntervals(cubes, 'cubes'),
        FunctionInterval(MovieUtil.removeProps, extraArgs = [
            cubes])]
    mtrack = MultiTrack([
        Track(cubeIvals),
        __getSoundTrack(level, 0.69999999999999996, duration = 7.7000000000000002, node = toon),
        Track([
            ActorInterval(toon, 'juggle')]),
        Track(targetIvals)])
    ivals.append(mtrack)
    ivals += __returnToBase(heal)
    for target in targets:
        targetToon = target['toon']
        ivals.append(FunctionInterval(targetToon.clearChat))
    
    return Track(ivals)
def midairSuitExplodeTrack(suit, battle):
    suitTrack = Sequence()
    suitPos, suitHpr = battle.getActorPosHpr(suit)
    suitPos.setZ(suitPos.getZ() + 17)
    suitTrack.append(Wait(0.15))
    suitTrack.append(Func(MovieUtil.avatarHide, suit))
    deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
    deathSoundTrack = Sequence(Wait(0.5), SoundInterval(deathSound, volume=0.8))
    BattleParticles.loadParticles()
    smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
    singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
    smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
    bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
    gearPoint = Point3(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.2)
    smallGears.setPos(gearPoint)
    singleGear.setPos(gearPoint)
    smallGears.setDepthWrite(False)
    singleGear.setDepthWrite(False)
    smallGearExplosion.setPos(gearPoint)
    bigGearExplosion.setPos(gearPoint)
    smallGearExplosion.setDepthWrite(False)
    bigGearExplosion.setDepthWrite(False)
    explosionTrack = Sequence()
    explosionTrack.append(MovieUtil.createKapowExplosionTrack(battle, explosionPoint=gearPoint))
    gears1Track = Sequence(Wait(0.5), ParticleInterval(smallGears, battle, worldRelative=0, duration=1.0, cleanup=True), name='gears1Track')
    gears2MTrack = Track(
        (0.1, ParticleInterval(singleGear, battle, worldRelative=0, duration=0.4, cleanup=True)),
        (0.5, ParticleInterval(smallGearExplosion, battle, worldRelative=0, duration=0.5, cleanup=True)),
        (0.9, ParticleInterval(bigGearExplosion, battle, worldRelative=0, duration=2.0, cleanup=True)), name='gears2MTrack'
    )

    return Parallel(suitTrack, explosionTrack, deathSoundTrack, gears1Track, gears2MTrack, Wait(4.5))
 def placeTrap(trapProp, suit, battle=battle, trapName=trapName):
     if not trapProp or trapProp.isEmpty():
         return
     trapProp.wrtReparentTo(suit)
     trapProp.show()
     if trapName == 'rake':
         trapProp.setPos(0, MovieUtil.SUIT_TRAP_RAKE_DISTANCE, 0)
         trapProp.setHpr(Point3(0, 270, 0))
         trapProp.setScale(Point3(0.7, 0.7, 0.7))
         rakeOffset = MovieUtil.getSuitRakeOffset(suit)
         trapProp.setY(trapProp.getY() + rakeOffset)
     elif trapName == 'banana':
         trapProp.setHpr(0, 0, 0)
         trapProp.setPos(0, MovieUtil.SUIT_TRAP_DISTANCE, -0.35)
         trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
     elif trapName == 'marbles':
         trapProp.setHpr(Point3(94, 0, 0))
         trapProp.setPos(0, MovieUtil.SUIT_TRAP_MARBLES_DISTANCE, 0)
         trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
     elif trapName == 'tnt':
         trapProp.setHpr(0, 90, 0)
         trapProp.setPos(0, MovieUtil.SUIT_TRAP_TNT_DISTANCE, 0.4)
     else:
         notify.warning(
             'placeTrap() - Incorrect trap: %s placed on a suit' %
             trapName)
def __healJoke(heal, hasInteractivePropHealBonus):
    npcId = 0
    if heal.has_key('npcId'):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return None
        
    else:
        toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    jokeIndex = heal['hpbonus'] % len(HealJokes.toonHealJokes)
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    tracks = Parallel()
    fSpeakPunchline = 58
    tSpeakSetup = 0.0
    tSpeakPunchline = 3.0
    dPunchLine = 3.0
    tTargetReact = tSpeakPunchline + 1.0
    dTargetLaugh = 1.5
    tRunBack = tSpeakPunchline + dPunchLine
    tDoSoundAnimation = tSpeakPunchline - float(fSpeakPunchline) / toon.getFrameRate('sound')
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [
        megaphone,
        megaphone2]
    hands = toon.getRightHands()
    dMegaphoneScale = 0.5
    tracks.append(Sequence(Wait(tDoSoundAnimation), Func(MovieUtil.showProps, megaphones, hands), MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE), Wait(toon.getDuration('sound') - 2.0 * dMegaphoneScale), MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO), Func(MovieUtil.removeProps, megaphones)))
    tracks.append(Sequence(Wait(tDoSoundAnimation), ActorInterval(toon, 'sound')))
    soundTrack = __getSoundTrack(level, 2.0, node = toon)
    tracks.append(soundTrack)
    joke = HealJokes.toonHealJokes[jokeIndex]
    tracks.append(Sequence(Wait(tSpeakSetup), Func(toon.setChatAbsolute, joke[0], CFSpeech | CFTimeout)))
    tracks.append(Sequence(Wait(tSpeakPunchline), Func(toon.setChatAbsolute, joke[1], CFSpeech | CFTimeout)))
    reactTrack = Sequence(Wait(tTargetReact))
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactTrack.append(Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus))
    
    reactTrack.append(Wait(dTargetLaugh))
    for target in targets:
        targetToon = target['toon']
        reactTrack.append(Func(targetToon.clearChat))
    
    tracks.append(reactTrack)
    if npcId != 0:
        track.append(Sequence(Wait(tRunBack), Func(toon.clearChat), *MovieNPCSOS.teleportOut(heal, toon)))
    else:
        tracks.append(Sequence(Wait(tRunBack), Func(toon.clearChat), *__returnToBase(heal)))
    track.append(tracks)
    return track
Example #22
0
def __doWaterGun(squirt, delay, fShowStun):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    target = squirt['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    battle = squirt['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    hitSuit = hp > 0
    scale = sprayScales[level]
    tPistol = 0.0
    dPistolScale = 0.5
    dPistolHold = 1.8
    tSpray = 48.0 / toon.getFrameRate('water-gun')
    sprayPoseFrame = 63
    dSprayScale = 0.1
    dSprayHold = 0.3
    tContact = tSpray + dSprayScale
    tSuitDodges = 1.1
    tracks = Parallel()
    toonTrack = Sequence(Func(toon.headsUp, battle, suitPos), ActorInterval(toon, 'water-gun'), Func(toon.loop, 'neutral'), Func(toon.setHpr, battle, origHpr))
    tracks.append(toonTrack)
    soundTrack = __getSoundTrack(level, hitSuit, 1.8, toon)
    tracks.append(soundTrack)
    pistol = globalPropPool.getProp('water-gun')
    hands = toon.getRightHands()
    hand_jointpath0 = hands[0].attachNewNode('handJoint0-path')
    hand_jointpath1 = hand_jointpath0.instanceTo(hands[1])
    targetPoint = lambda suit = suit: __suitTargetPoint(suit)

    def getSprayStartPos(pistol = pistol, toon = toon):
        toon.update(0)
        joint = pistol.find('**/joint_nozzle')
        p = joint.getPos(render)
        return p

    sprayTrack = MovieUtil.getSprayTrack(battle, WaterSprayColor, getSprayStartPos, targetPoint, dSprayScale, dSprayHold, dSprayScale, horizScale=scale, vertScale=scale)
    pistolPos = Point3(0.28, 0.1, 0.08)
    pistolHpr = VBase3(85.6, -4.44, 94.43)
    pistolTrack = Sequence(Func(MovieUtil.showProp, pistol, hand_jointpath0, pistolPos, pistolHpr), LerpScaleInterval(pistol, dPistolScale, pistol.getScale(), startScale=MovieUtil.PNT3_NEARZERO), Wait(tSpray - dPistolScale))
    pistolTrack.append(sprayTrack)
    pistolTrack.append(Wait(dPistolHold))
    pistolTrack.append(LerpScaleInterval(pistol, dPistolScale, MovieUtil.PNT3_NEARZERO))
    pistolTrack.append(Func(hand_jointpath1.removeNode))
    pistolTrack.append(Func(hand_jointpath0.removeNode))
    pistolTrack.append(Func(MovieUtil.removeProp, pistol))
    tracks.append(pistolTrack)
    if hp > 0:
        tracks.append(__getSplashTrack(targetPoint, 0.3, tSpray + dSprayScale, battle))
    if hp > 0 or delay <= 0:
        tracks.append(__getSuitTrack(suit, tContact, tSuitDodges, hp, hpbonus, kbbonus, 'squirt-small-react', died, leftSuits, rightSuits, battle, toon, fShowStun, revived=revived))
    return tracks
Example #23
0
    def reset(self, finish = 0):
        if self.hasBeenReset == 1:
            return
        self.hasBeenReset = 1
        self.stop()
        self._deleteTrack()
        if finish == 1:
            self.restore()
        self.toonAttackDicts = []
        self.suitAttackDicts = []
        self.restoreColor = 0
        self.restoreHips = 0
        self.restoreHeadScale = 0
        self.restoreToonScale = 0
        self.specialParticleEffects = []
        for prop in self.renderProps:
            MovieUtil.removeProp(prop)

        self.renderProps = []
Example #24
0
def __propPreflight(props, suit, toon, battle):
    prop = props[0]
    toon.update(0)
    prop.wrtReparentTo(battle)
    props[1].reparentTo(hidden)
    for ci in xrange(prop.getNumChildren()):
        prop.getChild(ci).setHpr(0, -90, 0)

    targetPnt = MovieUtil.avatarFacePoint(suit, other=battle)
    prop.lookAt(targetPnt)
Example #25
0
        def getGeyserTrack(geyser, suit, geyserPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, geyserHold, useEffect, battle = battle):
            geyserMound = MovieUtil.copyProp(geyser)
            geyserRemoveM = geyserMound.findAllMatches('**/Splash*')
            geyserRemoveM.addPathsFrom(geyserMound.findAllMatches('**/spout'))
            for i in range(geyserRemoveM.getNumPaths()):
                geyserRemoveM[i].removeNode()

            geyserWater = MovieUtil.copyProp(geyser)
            geyserRemoveW = geyserWater.findAllMatches('**/hole')
            geyserRemoveW.addPathsFrom(geyserWater.findAllMatches('**/shadow'))
            for i in range(geyserRemoveW.getNumPaths()):
                geyserRemoveW[i].removeNode()

            track = Sequence(Wait(rainDelay), Func(MovieUtil.showProp, geyserMound, battle, suit.getPos(battle)), Func(MovieUtil.showProp, geyserWater, battle, suit.getPos(battle)), LerpScaleInterval(geyserWater, 1.0, scaleUpPoint, startScale=MovieUtil.PNT3_NEARZERO), Wait(geyserHold * 0.5), LerpScaleInterval(geyserWater, 0.5, MovieUtil.PNT3_NEARZERO, startScale=scaleUpPoint))
            track.append(LerpScaleInterval(geyserMound, 0.5, MovieUtil.PNT3_NEARZERO))
            track.append(Func(MovieUtil.removeProp, geyserMound))
            track.append(Func(MovieUtil.removeProp, geyserWater))
            track.append(Func(MovieUtil.removeProp, geyser))
            return track
def __doSoundsLevel(sounds, delay, hitCount, npcs):
    lastSoundThatHit = None
    totalDamage = 0
    for sound in sounds:
        for target in sound["target"]:
            if target["hp"] > 0:
                lastSoundThatHit = sound
                totalDamage += target["hp"]
                break
                continue

    mainTrack = Sequence()
    tracks = Parallel()
    deathTracks = Parallel()
    for sound in sounds:
        toon = sound["toon"]
        if sound.has_key("npc"):
            toon = sound["npc"]

        level = sound["level"]
        targets = sound["target"]
        hpbonus = sound["hpbonus"]
        attackMTrack = soundfn_array[sound["level"]](sound, delay, toon, targets, level)
        tracks.append(Sequence(Wait(delay), attackMTrack))
        tracks.append(
            __getSuitTrack(sound, lastSoundThatHit, delay, hitCount, targets, totalDamage, hpbonus, toon, npcs)
        )
        for target in targets:
            battle = sound["battle"]
            suit = target["suit"]
            died = target["died"]
            revived = target["revived"]
            if revived:
                deathTracks.append(MovieUtil.createSuitReviveTrack(suit, toon, battle, npcs))
                continue
            if died:
                deathTracks.append(MovieUtil.createSuitDeathTrack(suit, toon, battle, npcs))
                continue

    mainTrack.append(tracks)
    mainTrack.append(deathTracks)
    return mainTrack
Example #27
0
def __getSuitTrack(sound, lastSoundThatHit, delay, hitCount, targets, totalDamage, hpbonus, toon, npcs):
    tracks = Parallel()
    attacks = 0
    uberDelay = 0.0
    isUber = 0
    if sound['level'] >= ToontownBattleGlobals.UBER_GAG_LEVEL_INDEX:
        uberDelay = 3.0
        isUber = 1
    for target in targets:
        suit = target['suit']
        if totalDamage > 0 and sound == lastSoundThatHit:
            hp = target['hp']
            died = target['died']
            battle = sound['battle']
            kbbonus = target['kbbonus']
            suitTrack = Sequence()
            showDamage = Func(suit.showHpText, -totalDamage, openEnded=0)
            updateHealthBar = Func(suit.updateHealthBar, totalDamage)
            if isUber:
                breakEffect = BattleParticles.createParticleEffect(file='soundBreak')
                breakEffect.setDepthWrite(0)
                breakEffect.setDepthTest(0)
                breakEffect.setTwoSided(1)
                breakEffect.setBin('fixed', 10)
                soundEffect = globalBattleSoundCache.getSound(hitSoundFiles[0])
            suitTrack.append(Wait(delay + tSuitReact))
            if isUber:
                delayTime = random.random()
                suitTrack.append(Wait(delayTime + 2.0))
                suitTrack.append(Func(setPosFromOther, breakEffect, suit, Point3(0, 0.0, suit.getHeight() - 1.0)))
                suitTrack.append(Parallel(showDamage, updateHealthBar, SoundInterval(soundEffect, node=suit), __getPartTrack(breakEffect, 0.0, 1.0, [breakEffect, suit, 0], softStop=-0.5)))
            else:
                suitTrack.append(showDamage)
                suitTrack.append(updateHealthBar)
            if hitCount == 1:
                suitTrack.append(Parallel(ActorInterval(suit, 'squirt-small-react'), MovieUtil.createSuitStunInterval(suit, 0.5, 1.8)))
            else:
                suitTrack.append(ActorInterval(suit, 'squirt-small-react'))
            if kbbonus == 0:
                suitTrack.append(__createSuitResetPosTrack(suit, battle))
                suitTrack.append(Func(battle.unlureSuit, suit))
            bonusTrack = None
            if hpbonus > 0:
                bonusTrack = Sequence(Wait(delay + tSuitReact + delay + 0.75 + uberDelay), Func(suit.showHpText, -hpbonus, 1, openEnded=0))
            suitTrack.append(Func(suit.loop, 'neutral'))
            if bonusTrack == None:
                tracks.append(suitTrack)
            else:
                tracks.append(Parallel(suitTrack, bonusTrack))
        elif totalDamage <= 0:
            tracks.append(Sequence(Wait(2.9), Func(MovieUtil.indicateMissed, suit, 1.0)))

    return tracks
Example #28
0
def __propPreflightGroup(props, suits, toon, battle):
    prop = props[0]
    toon.update(0)
    prop.wrtReparentTo(battle)
    props[1].reparentTo(hidden)
    for ci in xrange(prop.getNumChildren()):
        prop.getChild(ci).setHpr(0, -90, 0)

    avgTargetPt = Point3(0, 0, 0)
    for suit in suits:
        avgTargetPt += MovieUtil.avatarFacePoint(suit, other=battle)

    avgTargetPt /= len(suits)
    prop.lookAt(avgTargetPt)
Example #29
0
def __throwPie(throw, delay, hitCount, showCannon = 1):
    toon = throw['toon']
    hpbonus = throw['hpbonus']
    target = throw['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    sidestep = throw['sidestep']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    level = throw['level']
    battle = throw['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    notify.debug('toon: %s throws tart at suit: %d for hp: %d died: %d' % (toon.getName(),
     suit.doId,
     hp,
     died))
    pieName = pieNames[0]
    hitSuit = hp > 0
    button = globalPropPool.getProp('button')
    buttonType = globalPropPool.getPropType('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    hands = toon.getLeftHands()
    toonTrack = Sequence()
    toonFace = Func(toon.headsUp, battle, suitPos)
    toonTrack.append(Wait(delay))
    toonTrack.append(toonFace)
    toonTrack.append(ActorInterval(toon, 'pushbutton'))
    toonTrack.append(ActorInterval(toon, 'wave', duration=2.0))
    toonTrack.append(ActorInterval(toon, 'duck'))
    toonTrack.append(Func(toon.loop, 'neutral'))
    toonTrack.append(Func(toon.setHpr, battle, origHpr))
    buttonTrack = Sequence()
    buttonShow = Func(MovieUtil.showProps, buttons, hands)
    buttonScaleUp = LerpScaleInterval(button, 1.0, button.getScale(), startScale=Point3(0.01, 0.01, 0.01))
    buttonScaleDown = LerpScaleInterval(button, 1.0, Point3(0.01, 0.01, 0.01), startScale=button.getScale())
    buttonHide = Func(MovieUtil.removeProps, buttons)
    buttonTrack.append(Wait(delay))
    buttonTrack.append(buttonShow)
    buttonTrack.append(buttonScaleUp)
    buttonTrack.append(Wait(2.5))
    buttonTrack.append(buttonScaleDown)
    buttonTrack.append(buttonHide)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    suitResponseTrack = Sequence()
    reactIval = Sequence()
    if showCannon:
        showDamage = Func(suit.showHpText, -hp, openEnded=0)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        cannon = loader.loadModel('phase_4/models/minigames/toon_cannon')
        barrel = cannon.find('**/cannon')
        barrel.setHpr(0, 90, 0)
        cannonHolder = render.attachNewNode('CannonHolder')
        cannon.reparentTo(cannonHolder)
        cannon.setPos(0, 0, -8.6)
        cannonHolder.setPos(suit.getPos(render))
        cannonHolder.setHpr(suit.getHpr(render))
        cannonAttachPoint = barrel.attachNewNode('CannonAttach')
        kapowAttachPoint = barrel.attachNewNode('kapowAttach')
        scaleFactor = 1.6
        iScale = 1 / scaleFactor
        barrel.setScale(scaleFactor, 1, scaleFactor)
        cannonAttachPoint.setScale(iScale, 1, iScale)
        cannonAttachPoint.setPos(0, 6.7, 0)
        kapowAttachPoint.setPos(0, -0.5, 1.9)
        suit.reparentTo(cannonAttachPoint)
        suit.setPos(0, 0, 0)
        suit.setHpr(0, -90, 0)
        suitLevel = suit.getActualLevel()
        deep = 2.5 + suitLevel * 0.2
        suitScale = 0.9
        import math
        suitScale = 0.9 - math.sqrt(suitLevel) * 0.1
        sival = []
        posInit = cannonHolder.getPos()
        posFinal = Point3(posInit[0] + 0.0, posInit[1] + 0.0, posInit[2] + 7.0)
        kapow = globalPropPool.getProp('kapow')
        kapow.reparentTo(kapowAttachPoint)
        kapow.hide()
        kapow.setScale(0.25)
        kapow.setBillboardPointEye()
        smoke = loader.loadModel('phase_4/models/props/test_clouds')
        smoke.reparentTo(cannonAttachPoint)
        smoke.setScale(0.5)
        smoke.hide()
        smoke.setBillboardPointEye()
        soundBomb = base.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.ogg')
        playSoundBomb = SoundInterval(soundBomb, node=cannonHolder)
        soundFly = base.loadSfx('phase_4/audio/sfx/firework_whistle_01.ogg')
        playSoundFly = SoundInterval(soundFly, node=cannonHolder)
        soundCannonAdjust = base.loadSfx('phase_4/audio/sfx/MG_cannon_adjust.ogg')
        playSoundCannonAdjust = SoundInterval(soundCannonAdjust, duration=0.6, node=cannonHolder)
        soundCogPanic = base.loadSfx('phase_5/audio/sfx/ENC_cogafssm.ogg')
        playSoundCogPanic = SoundInterval(soundCogPanic, node=cannonHolder)
        reactIval = Parallel(ActorInterval(suit, 'pie-small-react'), Sequence(Wait(0.0), LerpPosInterval(cannonHolder, 2.0, posFinal, startPos=posInit, blendType='easeInOut'), Parallel(LerpHprInterval(barrel, 0.6, Point3(0, 45, 0), startHpr=Point3(0, 90, 0), blendType='easeIn'), playSoundCannonAdjust), Wait(2.0), Parallel(LerpHprInterval(barrel, 0.6, Point3(0, 90, 0), startHpr=Point3(0, 45, 0), blendType='easeIn'), playSoundCannonAdjust), LerpPosInterval(cannonHolder, 1.0, posInit, startPos=posFinal, blendType='easeInOut')), Sequence(Wait(0.0), Parallel(ActorInterval(suit, 'flail'), suit.scaleInterval(1.0, suitScale), LerpPosInterval(suit, 0.25, Point3(0, -1.0, 0.0)), Sequence(Wait(0.25), Parallel(playSoundCogPanic, LerpPosInterval(suit, 1.5, Point3(0, -deep, 0.0), blendType='easeIn')))), Wait(2.5), Parallel(playSoundBomb, playSoundFly, Sequence(Func(smoke.show), Parallel(LerpScaleInterval(smoke, 0.5, 3), LerpColorScaleInterval(smoke, 0.5, Vec4(2, 2, 2, 0))), Func(smoke.hide)), Sequence(Func(kapow.show),
ActorInterval(kapow, 'kapow'), Func(kapow.hide)), LerpPosInterval(suit, 3.0, Point3(0, 150.0, 0.0)), suit.scaleInterval(3.0, 0.01)), Func(suit.hide)))
        if hitCount == 1:
            sival = Sequence(Parallel(reactIval, MovieUtil.createSuitStunInterval(suit, 0.3, 1.3)), Wait(0.0), Func(cannonHolder.remove))
        else:
            sival = reactIval
        suitResponseTrack.append(Wait(delay + tPieHitsSuit))
        suitResponseTrack.append(showDamage)
        suitResponseTrack.append(updateHealthBar)
        suitResponseTrack.append(sival)
        bonusTrack = Sequence(Wait(delay + tPieHitsSuit))
        if kbbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(Func(suit.showHpText, -kbbonus, 2, openEnded=0))
        if hpbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0))
        suitResponseTrack = Parallel(suitResponseTrack, bonusTrack)
    return [toonTrack,
     soundTrack,
     buttonTrack,
     suitResponseTrack]
Example #30
0
def __doSmooch(attack, hp=0):
    toon = NPCToons.createLocalNPC(attack['npcId'])
    if toon == None:
        return
    targets = attack['toons']
    level = 2
    battle = attack['battle']
    track = Sequence(teleportIn(attack, toon))
    lipstick = globalPropPool.getProp('lipstick')
    lipstick2 = MovieUtil.copyProp(lipstick)
    lipsticks = [lipstick, lipstick2]
    rightHands = toon.getRightHands()
    dScale = 0.5
    lipstickTrack = Sequence(
        Func(MovieUtil.showProps, lipsticks, rightHands,
             Point3(-0.27, -0.24, -0.95), Point3(-118, -10.6, -25.9)),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_NEARZERO,
                                    MovieUtil.PNT3_ONE),
        Wait(toon.getDuration('smooch') - 2.0 * dScale),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_ONE,
                                    MovieUtil.PNT3_NEARZERO))
    lips = globalPropPool.getProp('lips')
    dScale = 0.5
    tLips = 2.5
    tThrow = 115.0 / toon.getFrameRate('smooch')
    dThrow = 0.5

    def getLipPos(toon=toon):
        toon.pose('smooch', 57)
        toon.update(0)
        hand = toon.getRightHands()[0]
        return hand.getPos(render)

    effectTrack = Sequence()
    for target in targets:
        lipcopy = MovieUtil.copyProp(lips)
        lipsTrack = Sequence(
            Wait(tLips), Func(MovieUtil.showProp, lipcopy, render, getLipPos),
            Func(lipcopy.setBillboardPointWorld),
            LerpScaleInterval(lipcopy,
                              dScale,
                              Point3(3, 3, 3),
                              startScale=MovieUtil.PNT3_NEARZERO),
            Wait(tThrow - tLips - dScale),
            LerpPosInterval(
                lipcopy, dThrow,
                Point3(target.getPos() + Point3(0, 0, target.getHeight()))),
            Func(MovieUtil.removeProp, lipcopy))
        delay = tThrow + dThrow
        mtrack = Parallel(
            lipstickTrack, lipsTrack, __getSoundTrack(level, 2, node=toon),
            Sequence(ActorInterval(toon, 'smooch')),
            Sequence(Wait(delay), ActorInterval(target, 'conked')),
            Sequence(Wait(delay), Func(__healToon, target, hp)))
        effectTrack.append(mtrack)

    effectTrack.append(Func(MovieUtil.removeProps, lipsticks))
    track.append(effectTrack)
    track.append(teleportOut(attack, toon))
    track.append(Func(target.clearChat))
    return track
Example #31
0
def __createPlacedTrapMultiTrack(trap,
                                 prop,
                                 propName,
                                 propPos=None,
                                 propHpr=None,
                                 explode=0):
    toon = trap['toon']
    level = trap['level']
    battle = trap['battle']
    target = trap['target']
    suit = target['suit']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    targetPos = suitPos
    trapProp = prop
    trapPoint = Point3(0, MovieUtil.SUIT_TRAP_DISTANCE, 0)
    trapDelay = 2.5
    hands = toon.getLeftHands()
    trapIvals = []
    trapIvals.append(WaitInterval(trapDelay))
    trapIvals.append(FunctionInterval(trapProp.show))
    trapIvals.append(
        FunctionInterval(trapProp.setScale, extraArgs=[Point3(0.1, 0.1, 0.1)]))
    trapIvals.append(FunctionInterval(trapProp.reparentTo, extraArgs=[suit]))
    trapIvals.append(FunctionInterval(trapProp.setPos, extraArgs=[trapPoint]))
    trapIvals.append(LerpScaleInterval(trapProp, 1.2, Point3(1.7, 1.7, 1.7)))
    dustNode = hidden.attachNewNode('DustNode')

    def placeDustExplosion(dustNode=dustNode,
                           trapProp=trapProp,
                           battle=battle):
        dustNode.reparentTo(battle)
        dustNode.setPos(trapProp.getPos(battle))

    if explode == 1:
        trapIvals.append(
            FunctionInterval(trapProp.wrtReparentTo, extraArgs=[hidden]))
        trapIvals.append(FunctionInterval(placeDustExplosion))
        trapIvals.extend(
            createCartoonExplosionIvals(dustNode,
                                        'dust',
                                        explosionPoint=Point3(0, 0, 0)))
        trapIvals.append(
            FunctionInterval(MovieUtil.removeProp, extraArgs=[trapProp]))
        trapIvals.append(FunctionInterval(battle.removeTrap, extraArgs=[suit]))
        trapTrack = Track(trapIvals)
    else:
        trapTrack = Track(trapIvals)
        if suit.battleTrap != NO_TRAP:
            notify.debug('trapSuit() - trap: %d destroyed existing trap: %d' %
                         (level, suit.battleTrap))
            battle.removeTrap(suit)
        suit.battleTrapProp = trapProp
        suit.battleTrap = level
        suit.battleTrapIsFresh = 1
    button = globalPropPool.getProp('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    toonIvals = []
    toonIvals.append(
        FunctionInterval(MovieUtil.showProps, extraArgs=[buttons, hands]))
    toonIvals.append(
        FunctionInterval(toon.headsUp, extraArgs=[battle, suitPos]))
    toonIvals.append(ActorInterval(toon, 'pushbutton'))
    toonIvals.append(
        FunctionInterval(MovieUtil.removeProps, extraArgs=[buttons]))
    toonIvals.append(FunctionInterval(toon.loop, extraArgs=['neutral']))
    toonIvals.append(FunctionInterval(toon.setHpr, extraArgs=[battle,
                                                              origHpr]))
    toonTrack = Track(toonIvals)
    if propName == 'quicksand':
        propSound = globalBattleSoundCache.getSound('TL_quicksand.mp3')
    else:
        propSound = globalBattleSoundCache.getSound('TL_trap_door.mp3')
    soundTrack = Track([
        WaitInterval(2.3),
        SoundInterval(
            globalBattleSoundCache.getSound('AA_drop_trigger_box.mp3'),
            node=toon),
        WaitInterval(0.3),
        SoundInterval(propSound, duration=0.5, node=toon)
    ])
    return MultiTrack([trapTrack, toonTrack, soundTrack])
def __createMagnetMultiTrack(lure,
                             magnet,
                             pos,
                             hpr,
                             scale,
                             isSmallMagnet=1,
                             npcs=[]):
    toon = lure['toon']
    if lure.has_key('npc'):
        toon = lure['npc']
    battle = lure['battle']
    sidestep = lure['sidestep']
    targets = lure['target']
    tracks = Parallel()
    tracks.append(
        Sequence(ActorInterval(toon, 'hold-magnet'),
                 Func(toon.loop, 'neutral')))
    hands = toon.getLeftHands()
    magnet2 = MovieUtil.copyProp(magnet)
    magnets = [magnet, magnet2]
    magnetTrack = Sequence(
        Wait(0.7), Func(MovieUtil.showProps, magnets, hands, pos, hpr, scale),
        Wait(6.3), Func(MovieUtil.removeProps, magnets))
    tracks.append(magnetTrack)
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            revived = target['revived']
            if kbbonus == 1 or hp > 0:
                suitDelay = 2.6
                suitMoveDuration = 0.8
                suitTrack = Sequence()
                opos, ohpr = battle.getActorPosHpr(suit)
                reachDist = MovieUtil.SUIT_LURE_DISTANCE
                reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
                numShakes = 3
                shakeTotalDuration = 0.8
                shakeDuration = shakeTotalDuration / float(numShakes)
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Wait(suitDelay))
                suitTrack.append(
                    ActorInterval(suit,
                                  'landing',
                                  startTime=2.37,
                                  endTime=1.82))
                for i in xrange(0, numShakes):
                    suitTrack.append(
                        ActorInterval(suit,
                                      'landing',
                                      startTime=1.82,
                                      endTime=1.16,
                                      duration=shakeDuration))

                suitTrack.append(
                    ActorInterval(suit, 'landing', startTime=1.16,
                                  endTime=0.7))
                suitTrack.append(
                    ActorInterval(suit, 'landing', startTime=0.7,
                                  duration=1.3))
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Func(battle.lureSuit, suit))
                if hp > 0:
                    suitTrack.append(
                        __createSuitDamageTrack(battle, suit, hp, lure,
                                                trapProp))
                if revived != 0:
                    suitTrack.append(
                        MovieUtil.createSuitReviveTrack(
                            suit, toon, battle, npcs))
                elif died != 0:
                    suitTrack.append(
                        MovieUtil.createSuitDeathTrack(suit, toon, battle,
                                                       npcs))
                tracks.append(suitTrack)
                tracks.append(
                    lerpSuit(suit, suitDelay + 0.55 + shakeTotalDuration,
                             suitMoveDuration, reachPos, battle, trapProp))
        else:
            tracks.append(
                Sequence(Wait(3.7), Func(MovieUtil.indicateMissed, suit)))

    if isSmallMagnet == 1:
        tracks.append(
            getSoundTrack('TL_small_magnet.ogg', delay=0.7, node=toon))
    else:
        tracks.append(
            getSoundTrack('TL_large_magnet.ogg', delay=0.7, node=toon))
    return tracks
def __createWeddingCakeFlight(throw, groupHitDict, pie, pies):
    toon = throw['toon']
    battle = throw['battle']
    level = throw['level']
    sidestep = throw['sidestep']
    hpbonus = throw['hpbonus']
    numTargets = len(throw['target'])
    pieName = pieNames[level]
    splatName = 'splat-' + pieName
    splat = globalPropPool.getProp(splatName)
    splats = [splat]
    for i in xrange(numTargets - 1):
        splats.append(MovieUtil.copyProp(splat))

    splatType = globalPropPool.getPropType(splatName)
    cakePartStrs = ['cake1',
     'cake2',
     'cake3',
     'caketop']
    cakeParts = []
    for part in cakePartStrs:
        cakeParts.append(pie.find('**/%s' % part))

    cakePartDivisions = {}
    cakePartDivisions[1] = [[cakeParts[0],
      cakeParts[1],
      cakeParts[2],
      cakeParts[3]]]
    cakePartDivisions[2] = [[cakeParts[0], cakeParts[1]], [cakeParts[2], cakeParts[3]]]
    cakePartDivisions[3] = [[cakeParts[0], cakeParts[1]], [cakeParts[2]], [cakeParts[3]]]
    cakePartDivisions[4] = [[cakeParts[0]],
     [cakeParts[1]],
     [cakeParts[2]],
     [cakeParts[3]]]
    cakePartDivToUse = cakePartDivisions[len(throw['target'])]
    groupPieTracks = Parallel()
    for i in xrange(numTargets):
        target = throw['target'][i]
        suit = target['suit']
        hitSuit = target['hp'] > 0
        singlePieTrack = Sequence()
        if hitSuit:
            piePartReparent = Func(reparentCakePart, pie, cakePartDivToUse[i])
            singlePieTrack.append(piePartReparent)
            cakePartTrack = Parallel()
            for cakePart in cakePartDivToUse[i]:
                pieFly = LerpPosInterval(cakePart, tPieHitsSuit - tPieLeavesHand, pos=MovieUtil.avatarFacePoint(suit, other=battle), name=pieFlyTaskName, other=battle)
                cakePartTrack.append(pieFly)

            singlePieTrack.append(cakePartTrack)
            pieRemoveCakeParts = Func(MovieUtil.removeProps, cakePartDivToUse[i])
            pieHide = Func(MovieUtil.removeProps, pies)
            splatShow = Func(__showProp, splats[i], suit, Point3(0, 0, suit.getHeight()))
            splatBillboard = Func(__billboardProp, splats[i])
            splatAnim = ActorInterval(splats[i], splatName)
            splatHide = Func(MovieUtil.removeProp, splats[i])
            singlePieTrack.append(pieRemoveCakeParts)
            singlePieTrack.append(pieHide)
            singlePieTrack.append(Func(battle.movie.clearRenderProp, pies[0]))
            singlePieTrack.append(splatShow)
            singlePieTrack.append(splatBillboard)
            singlePieTrack.append(splatAnim)
            singlePieTrack.append(splatHide)
        else:
            missDict = {}
            if sidestep:
                suitPoint = MovieUtil.avatarFacePoint(suit, other=battle)
            else:
                suitPoint = __suitMissPoint(suit, other=battle)
            piePartReparent = Func(reparentCakePart, pie, cakePartDivToUse[i])
            piePreMiss = Func(__piePreMissGroup, missDict, cakePartDivToUse[i], suitPoint, battle)
            pieMiss = LerpFunctionInterval(__pieMissGroupLerpCallback, extraArgs=[missDict], duration=(tPieHitsSuit - tPieLeavesHand) * ratioMissToHit)
            pieHide = Func(MovieUtil.removeProps, pies)
            pieRemoveCakeParts = Func(MovieUtil.removeProps, cakePartDivToUse[i])
            singlePieTrack.append(piePartReparent)
            singlePieTrack.append(piePreMiss)
            singlePieTrack.append(pieMiss)
            singlePieTrack.append(pieRemoveCakeParts)
            singlePieTrack.append(pieHide)
            singlePieTrack.append(Func(battle.movie.clearRenderProp, pies[0]))
        groupPieTracks.append(singlePieTrack)

    return groupPieTracks
def __createSlideshowMultiTrack(lure, npcs=[]):
    toon = lure['toon']
    battle = lure['battle']
    sidestep = lure['sidestep']
    origHpr = toon.getHpr(battle)
    slideshowDelay = 2.5
    hands = toon.getLeftHands()
    endPos = toon.getPos(battle)
    endPos.setY(endPos.getY() + 4)
    button = globalPropPool.getProp('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    toonTrack = Sequence()
    toonTrack.append(Func(MovieUtil.showProps, buttons, hands))
    toonTrack.append(Func(toon.headsUp, battle, endPos))
    toonTrack.append(ActorInterval(toon, 'pushbutton'))
    toonTrack.append(Func(MovieUtil.removeProps, buttons))
    toonTrack.append(Func(toon.loop, 'neutral'))
    toonTrack.append(Func(toon.setHpr, battle, origHpr))
    slideShowProp = globalPropPool.getProp('slideshow')
    propTrack = Sequence()
    propTrack.append(Wait(slideshowDelay))
    propTrack.append(Func(slideShowProp.show))
    propTrack.append(Func(slideShowProp.setScale, Point3(0.1, 0.1, 0.1)))
    propTrack.append(Func(slideShowProp.reparentTo, battle))
    propTrack.append(Func(slideShowProp.setPos, endPos))
    propTrack.append(
        LerpScaleInterval(slideShowProp, 1.2, Point3(1.0, 1.0, 1.0)))
    shrinkDuration = 0.4
    totalDuration = 7.1
    propTrackDurationAtThisPoint = propTrack.getDuration()
    waitTime = totalDuration - propTrackDurationAtThisPoint - shrinkDuration
    if waitTime > 0:
        propTrack.append(Wait(waitTime))
    propTrack.append(
        LerpScaleInterval(nodePath=slideShowProp,
                          scale=Point3(1.0, 1.0, 0.1),
                          duration=shrinkDuration))
    propTrack.append(Func(MovieUtil.removeProp, slideShowProp))
    tracks = Parallel(propTrack, toonTrack)
    targets = lure['target']
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            revived = target['revived']
            if kbbonus == 1 or hp > 0:
                suitTrack = Sequence()
                suitDelay = 3.8
                suitAnimDuration = 1.5
                opos, ohpr = battle.getActorPosHpr(suit)
                reachDist = MovieUtil.SUIT_LURE_DISTANCE
                reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Wait(suitDelay))
                suitTrack.append(
                    ActorInterval(suit, 'hypnotized', duration=3.1))
                suitTrack.append(Func(suit.setPos, battle, reachPos))
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Func(battle.lureSuit, suit))
                if hp > 0:
                    suitTrack.append(
                        __createSuitDamageTrack(battle, suit, hp, lure,
                                                trapProp))
                if revived != 0:
                    suitTrack.append(
                        MovieUtil.createSuitReviveTrack(
                            suit, toon, battle, npcs))
                elif died != 0:
                    suitTrack.append(
                        MovieUtil.createSuitDeathTrack(suit, toon, battle,
                                                       npcs))
                tracks.append(suitTrack)
                tracks.append(
                    lerpSuit(suit, suitDelay + 1.7, 0.7, reachPos, battle,
                             trapProp))
        else:
            tracks.append(
                Sequence(Wait(2.3), Func(MovieUtil.indicateMissed, suit, 1.1)))

    tracks.append(getSoundTrack('TL_presentation.ogg', delay=2.3, node=toon))
    tracks.append(
        getSoundTrack('AA_drop_trigger_box.ogg',
                      delay=slideshowDelay,
                      node=toon))
    return tracks
def __createSuitDamageTrack(battle, suit, hp, lure, trapProp):
    if trapProp == None or trapProp.isEmpty():
        return Func(suit.loop, 'neutral')
    trapProp.wrtReparentTo(battle)
    trapTrack = ToontownBattleGlobals.TRAP_TRACK
    trapLevel = suit.battleTrap
    trapTrackNames = ToontownBattleGlobals.AvProps[trapTrack]
    trapName = trapTrackNames[trapLevel]
    result = Sequence()

    def reparentTrap(trapProp=trapProp, battle=battle):
        if trapProp and not trapProp.isEmpty():
            trapProp.wrtReparentTo(battle)

    result.append(Func(reparentTrap))
    parent = battle
    if suit.battleTrapIsFresh == 1:
        if trapName == 'quicksand' or trapName == 'trapdoor':
            trapProp.hide()
            trapProp.reparentTo(suit)
            trapProp.setPos(Point3(0, MovieUtil.SUIT_TRAP_DISTANCE, 0))
            trapProp.setHpr(Point3(0, 0, 0))
            trapProp.wrtReparentTo(battle)
        elif trapName == 'rake':
            trapProp.hide()
            trapProp.reparentTo(suit)
            trapProp.setPos(0, MovieUtil.SUIT_TRAP_RAKE_DISTANCE, 0)
            trapProp.setHpr(Point3(0, 270, 0))
            trapProp.setScale(Point3(0.7, 0.7, 0.7))
            rakeOffset = MovieUtil.getSuitRakeOffset(suit)
            trapProp.setY(trapProp.getY() + rakeOffset)
        else:
            parent = render
    if trapName == 'banana':
        slidePos = trapProp.getPos(parent)
        slidePos.setY(slidePos.getY() - 5.1)
        moveTrack = Sequence(
            Wait(0.1), LerpPosInterval(trapProp, 0.1, slidePos, other=battle))
        animTrack = Sequence(
            ActorInterval(trapProp, 'banana', startTime=3.1), Wait(1.1),
            LerpScaleInterval(trapProp, 1, Point3(0.01, 0.01, 0.01)))
        suitTrack = ActorInterval(suit, 'slip-backward')
        damageTrack = Sequence(Wait(0.5),
                               Func(suit.showHpText, -hp, openEnded=0),
                               Func(suit.updateHealthBar, hp))
        soundTrack = Sequence(
            SoundInterval(
                globalBattleSoundCache.getSound('AA_pie_throw_only.ogg'),
                duration=0.55,
                node=suit),
            SoundInterval(
                globalBattleSoundCache.getSound('Toon_bodyfall_synergy.ogg'),
                node=suit))
        result.append(
            Parallel(moveTrack, animTrack, suitTrack, damageTrack, soundTrack))
    elif trapName == 'rake' or trapName == 'rake-react':
        hpr = trapProp.getHpr(parent)
        upHpr = Vec3(hpr[0], 179.9999, hpr[2])
        bounce1Hpr = Vec3(hpr[0], 120, hpr[2])
        bounce2Hpr = Vec3(hpr[0], 100, hpr[2])
        rakeTrack = Sequence(
            Wait(0.5), LerpHprInterval(trapProp, 0.1, upHpr, startHpr=hpr),
            Wait(0.7), LerpHprInterval(trapProp, 0.4, hpr, startHpr=upHpr),
            LerpHprInterval(trapProp, 0.15, bounce1Hpr, startHpr=hpr),
            LerpHprInterval(trapProp, 0.05, hpr, startHpr=bounce1Hpr),
            LerpHprInterval(trapProp, 0.15, bounce2Hpr, startHpr=hpr),
            LerpHprInterval(trapProp, 0.05, hpr, startHpr=bounce2Hpr),
            Wait(0.2),
            LerpScaleInterval(trapProp, 0.2, Point3(0.01, 0.01, 0.01)))
        rakeAnimDuration = 3.125
        suitTrack = ActorInterval(suit,
                                  'rake-react',
                                  duration=rakeAnimDuration)
        damageTrack = Sequence(Wait(0.5),
                               Func(suit.showHpText, -hp, openEnded=0),
                               Func(suit.updateHealthBar, hp))
        soundTrack = getSoundTrack('TL_step_on_rake.ogg', delay=0.6, node=suit)
        result.append(Parallel(rakeTrack, suitTrack, damageTrack, soundTrack))
    elif trapName == 'marbles':
        slidePos = trapProp.getPos(parent)
        slidePos.setY(slidePos.getY() - 6.5)
        moveTrack = Sequence(
            Wait(0.1), LerpPosInterval(trapProp, 0.8, slidePos, other=battle),
            Wait(1.1), LerpScaleInterval(trapProp, 1, Point3(0.01, 0.01,
                                                             0.01)))
        animTrack = ActorInterval(trapProp, 'marbles', startTime=3.1)
        suitTrack = ActorInterval(suit, 'slip-backward')
        damageTrack = Sequence(Wait(0.5),
                               Func(suit.showHpText, -hp, openEnded=0),
                               Func(suit.updateHealthBar, hp))
        soundTrack = Sequence(
            SoundInterval(
                globalBattleSoundCache.getSound('AA_pie_throw_only.ogg'),
                duration=0.55,
                node=suit),
            SoundInterval(
                globalBattleSoundCache.getSound('Toon_bodyfall_synergy.ogg'),
                node=suit))
        result.append(
            Parallel(moveTrack, animTrack, suitTrack, damageTrack, soundTrack))
    elif trapName == 'quicksand':
        sinkPos1 = trapProp.getPos(battle)
        sinkPos2 = trapProp.getPos(battle)
        dropPos = trapProp.getPos(battle)
        landPos = trapProp.getPos(battle)
        sinkPos1.setZ(sinkPos1.getZ() - 3.1)
        sinkPos2.setZ(sinkPos2.getZ() - 9.1)
        dropPos.setZ(dropPos.getZ() + 15)
        if base.config.GetBool('want-new-cogs', 0):
            nameTag = suit.find('**/def_nameTag')
        else:
            nameTag = suit.find('**/joint_nameTag')
        trapTrack = Sequence(
            Wait(2.4),
            LerpScaleInterval(trapProp, 0.8, Point3(0.01, 0.01, 0.01)))
        moveTrack = Sequence(
            Wait(0.9), LerpPosInterval(suit, 0.9, sinkPos1, other=battle),
            LerpPosInterval(suit, 0.4, sinkPos2, other=battle),
            Func(suit.setPos, battle, dropPos), Func(suit.wrtReparentTo,
                                                     hidden), Wait(1.1),
            Func(suit.wrtReparentTo, battle),
            LerpPosInterval(suit, 0.3, landPos, other=battle))
        animTrack = Sequence(ActorInterval(suit, 'flail'),
                             ActorInterval(suit, 'flail', startTime=1.1),
                             Wait(0.7),
                             ActorInterval(suit, 'slip-forward', duration=2.1))
        damageTrack = Sequence(Wait(3.5),
                               Func(suit.showHpText, -hp, openEnded=0),
                               Func(suit.updateHealthBar, hp))
        soundTrack = Sequence(
            Wait(0.7),
            SoundInterval(globalBattleSoundCache.getSound('TL_quicksand.ogg'),
                          node=suit), Wait(0.1),
            SoundInterval(
                globalBattleSoundCache.getSound('Toon_bodyfall_synergy.ogg'),
                node=suit))
        result.append(
            Parallel(trapTrack, moveTrack, animTrack, damageTrack, soundTrack))
    elif trapName == 'trapdoor':
        sinkPos = trapProp.getPos(battle)
        dropPos = trapProp.getPos(battle)
        landPos = trapProp.getPos(battle)
        sinkPos.setZ(sinkPos.getZ() - 9.1)
        dropPos.setZ(dropPos.getZ() + 15)
        trapTrack = Sequence(
            Wait(2.4),
            LerpScaleInterval(trapProp, 0.8, Point3(0.01, 0.01, 0.01)))
        moveTrack = Sequence(Wait(2.2),
                             LerpPosInterval(suit, 0.4, sinkPos, other=battle),
                             Func(suit.setPos, battle, dropPos),
                             Func(suit.wrtReparentTo, hidden), Wait(1.6),
                             Func(suit.wrtReparentTo, battle),
                             LerpPosInterval(suit, 0.3, landPos, other=battle))
        animTrack = Sequence(
            getSplicedLerpAnimsTrack(suit, 'flail', 0.7, 0.25),
            Func(trapProp.setColor, Vec4(0, 0, 0, 1)),
            ActorInterval(suit, 'flail', startTime=0.7, endTime=0),
            ActorInterval(suit, 'neutral', duration=0.5),
            ActorInterval(suit, 'flail', startTime=1.1), Wait(1.1),
            ActorInterval(suit, 'slip-forward', duration=2.1))
        damageTrack = Sequence(Wait(3.5),
                               Func(suit.showHpText, -hp, openEnded=0),
                               Func(suit.updateHealthBar, hp))
        soundTrack = Sequence(
            Wait(0.8),
            SoundInterval(globalBattleSoundCache.getSound('TL_trap_door.ogg'),
                          node=suit), Wait(0.8),
            SoundInterval(
                globalBattleSoundCache.getSound('Toon_bodyfall_synergy.ogg'),
                node=suit))
        result.append(
            Parallel(trapTrack, moveTrack, animTrack, damageTrack, soundTrack))
    elif trapName == 'tnt':
        tntTrack = ActorInterval(trapProp, 'tnt')
        explosionTrack = Sequence(
            Wait(2.3),
            createTNTExplosionTrack(battle,
                                    trapProp=trapProp,
                                    relativeTo=parent))
        suitTrack = Sequence(
            ActorInterval(suit, 'flail', duration=0.7),
            ActorInterval(suit, 'flail', startTime=0.7, endTime=0.0),
            ActorInterval(suit, 'neutral', duration=0.4),
            ActorInterval(suit, 'flail', startTime=0.6, endTime=0.7),
            Wait(0.4),
            ActorInterval(suit, 'slip-forward', startTime=2.48, duration=0.1),
            Func(battle.movie.needRestoreColor),
            Func(suit.setColorScale, Vec4(0.2, 0.2, 0.2, 1)),
            Func(trapProp.reparentTo, hidden),
            ActorInterval(suit, 'slip-forward', startTime=2.58),
            Func(suit.clearColorScale), Func(trapProp.sparksEffect.cleanup),
            Func(battle.movie.clearRestoreColor))
        damageTrack = Sequence(Wait(2.3),
                               Func(suit.showHpText, -hp, openEnded=0),
                               Func(suit.updateHealthBar, hp))
        explosionSound = base.loadSfx(
            'phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
        soundTrack = Sequence(
            SoundInterval(globalBattleSoundCache.getSound('TL_dynamite.ogg'),
                          duration=2.0,
                          node=suit),
            SoundInterval(explosionSound, duration=0.6, node=suit))
        result.append(
            Parallel(tntTrack, suitTrack, damageTrack, explosionTrack,
                     soundTrack))
    elif trapName == 'traintrack':
        trainInterval = createIncomingTrainInterval(battle, suit, hp, lure,
                                                    trapProp)
        result.append(trainInterval)
    else:
        notify.warning('unknown trapName: %s detected on suit: %s' %
                       (trapName, suit))
    suit.battleTrapProp = trapProp
    result.append(Func(battle.removeTrap, suit, True))
    result.append(Func(battle.unlureSuit, suit))
    result.append(__createSuitResetPosTrack(suit, battle))
    result.append(Func(suit.loop, 'neutral'))
    if trapName == 'traintrack':
        result.append(Func(MovieUtil.removeProp, trapProp))
    return result
Example #36
0
def __createPlacedTrapMultiTrack(trap,
                                 prop,
                                 propName,
                                 propPos=None,
                                 propHpr=None,
                                 explode=0,
                                 visibleOnlyForThisSuitId=None):
    toon = trap['toon']
    if trap.has_key('npc'):
        toon = trap['npc']

    level = trap['level']
    battle = trap['battle']
    origHpr = toon.getHpr(battle)
    trapPoint = Point3(0, MovieUtil.SUIT_TRAP_DISTANCE, 0.025000000000000001)
    trapDelay = 2.5
    hands = toon.getLeftHands()

    def placeDustExplosion(dustNode, trapProp, battle):
        dustNode.reparentTo(battle)
        dustNode.setPos(trapProp.getPos(battle))

    trapTracks = Parallel()
    firstTime = 1
    targets = trap['target']
    for target in targets:
        suit = target['suit']
        suitPos = suit.getPos(battle)
        targetPos = suitPos
        trapProp = MovieUtil.copyProp(prop)
        showThisTrap = True
        if visibleOnlyForThisSuitId and visibleOnlyForThisSuitId != suit.doId:
            showThisTrap = False

        trapTrack = Sequence()
        trapTrack.append(Wait(trapDelay))
        if showThisTrap:
            notify.debug('showing trap %s for %d' %
                         (trapProp.getName(), suit.doId))
            trapTrack.append(Func(trapProp.show))
        else:
            notify.debug('hiding trap %s for %d' %
                         (trapProp.getName(), suit.doId))
            trapTrack.append(Func(trapProp.hide))
        trapTrack.append(
            Func(
                trapProp.setScale,
                Point3(0.10000000000000001, 0.10000000000000001,
                       0.10000000000000001)))
        trapTrack.append(Func(trapProp.reparentTo, suit))
        trapTrack.append(Func(trapProp.setPos, trapPoint))
        trapTrack.append(
            LerpScaleInterval(trapProp, 1.2, Point3(1.7, 1.7, 1.7)))
        if explode == 1:
            dustNode = hidden.attachNewNode('DustNode')
            trapTrack.append(Func(trapProp.wrtReparentTo, hidden))
            trapTrack.append(
                Func(placeDustExplosion, dustNode, trapProp, battle))
            trapTrack.append(
                createCartoonExplosionTrack(dustNode,
                                            'dust',
                                            explosionPoint=Point3(0, 0, 0)))
            trapTrack.append(Func(MovieUtil.removeProp, trapProp))
            trapTrack.append(Func(battle.removeTrap, suit))
        elif suit.battleTrap != NO_TRAP:
            notify.debug('trapSuit() - trap: %d destroyed existing trap: %d' %
                         (level, suit.battleTrap))
            battle.removeTrap(suit)

        suit.battleTrapProp = trapProp
        suit.battleTrap = level
        suit.battleTrapIsFresh = 1
        trapTracks.append(trapTrack)

    button = globalPropPool.getProp('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    toonTrack = Sequence()
    toonTrack.append(Func(MovieUtil.showProps, buttons, hands))
    toonTrack.append(Func(toon.headsUp, battle, suitPos))
    toonTrack.append(ActorInterval(toon, 'pushbutton'))
    toonTrack.append(Func(MovieUtil.removeProps, buttons))
    toonTrack.append(Func(toon.loop, 'neutral'))
    toonTrack.append(Func(toon.setHpr, battle, origHpr))
    if propName == 'quicksand':
        propSound = globalBattleSoundCache.getSound('TL_quicksand.mp3')
    else:
        propSound = globalBattleSoundCache.getSound('TL_trap_door.mp3')
    buttonSound = globalBattleSoundCache.getSound('AA_drop_trigger_box.mp3')
    soundTrack = Sequence(
        Wait(2.2999999999999998),
        SoundInterval(buttonSound, duration=0.67000000000000004, node=toon),
        Wait(0.29999999999999999),
        SoundInterval(propSound, duration=0.5, node=toon))
    return Parallel(trapTracks, toonTrack, soundTrack)
Example #37
0
def __createPlacedGroupTrapTrack(trap,
                                 prop,
                                 propName,
                                 centerSuit,
                                 propPos=None,
                                 propHpr=None,
                                 explode=0):
    toon = trap['toon']
    if trap.has_key('npc'):
        toon = trap['npc']

    level = trap['level']
    battle = trap['battle']
    origHpr = toon.getHpr(battle)
    trapPoint = Point3(0, 5 - MovieUtil.SUIT_TRAP_DISTANCE,
                       0.025000000000000001)
    trapDelay = 2.5
    hands = toon.getLeftHands()

    def placeDustExplosion(dustNode, trapProp, battle):
        dustNode.reparentTo(battle)
        dustNode.setPos(trapProp.getPos(battle))

    trapTracks = Parallel()
    firstTime = 1
    targets = trap['target']
    if True:
        suit = centerSuit
        suitPos = suit.getPos(battle)
        targetPos = suitPos
        trapProp = MovieUtil.copyProp(prop)
        showThisTrap = True
        trapTrack = Sequence()
        trapTrack.append(Wait(trapDelay))
        if showThisTrap:
            notify.debug('showing trap %s for %d' %
                         (trapProp.getName(), suit.doId))
            trapTrack.append(Func(trapProp.show))
        else:
            notify.debug('hiding trap %s for %d' %
                         (trapProp.getName(), suit.doId))
            trapTrack.append(Func(trapProp.hide))
        trapTrack.append(
            Func(
                trapProp.setScale,
                Point3(0.10000000000000001, 0.10000000000000001,
                       0.10000000000000001)))
        trapTrack.append(Func(trapProp.reparentTo, battle))
        trapTrack.append(Func(trapProp.setPos, trapPoint))
        trapTrack.append(Func(trapProp.setH, 0))
        trapTrack.append(
            LerpScaleInterval(trapProp, 1.2, Point3(1.0, 1.0, 1.0)))
        if explode == 1:
            dustNode = hidden.attachNewNode('DustNode')
            removeTrapsParallel = Parallel()
            oneTrapTrack = Sequence()
            oneTrapTrack.append(Func(trapProp.wrtReparentTo, hidden))
            oneTrapTrack.append(
                Func(placeDustExplosion, dustNode, trapProp, battle))
            oneTrapTrack.append(
                createCartoonExplosionTrack(dustNode,
                                            'dust',
                                            explosionPoint=Point3(0, 0, 0)))
            oneTrapTrack.append(Func(MovieUtil.removeProp, trapProp))
            removeTrapsParallel.append(oneTrapTrack)
            for target in trap['target']:
                otherSuit = target['suit']
                if otherSuit.battleTrapProp:
                    otherDustNode = hidden.attachNewNode('DustNodeOtherSuit')
                    otherTrapTrack = Sequence()
                    otherTrapTrack.append(
                        Func(otherSuit.battleTrapProp.wrtReparentTo, hidden))
                    otherTrapTrack.append(
                        Func(placeDustExplosion, dustNode,
                             otherSuit.battleTrapProp, battle))
                    otherTrapTrack.append(
                        createCartoonExplosionTrack(otherDustNode,
                                                    'dust',
                                                    explosionPoint=Point3(
                                                        0, 0, 0)))
                    otherTrapTrack.append(Func(battle.removeTrap, otherSuit))
                    removeTrapsParallel.append(otherTrapTrack)
                    continue

            trapTrack.append(removeTrapsParallel)
        elif suit.battleTrap != NO_TRAP:
            notify.debug('trapSuit() - trap: %d destroyed existing trap: %d' %
                         (level, suit.battleTrap))
            battle.removeTrap(suit)

        suit.battleTrapProp = trapProp
        suit.battleTrap = level
        suit.battleTrapIsFresh = 1
        unlureSuits = Parallel()
        for target in targets:
            kbbonus = target['kbbonus']
            if kbbonus == 0:
                unluredSuit = target['suit']
                suitTrack = Sequence()
                suitTrack.append(createSuitResetPosTrack(unluredSuit, battle))
                suitTrack.append(Func(battle.unlureSuit, unluredSuit))
                unlureSuits.append(suitTrack)
                continue

        trapTrack.append(unlureSuits)
        for otherSuit in battle.suits:
            if not otherSuit == suit:
                if otherSuit.battleTrap != NO_TRAP:
                    notify.debug(
                        'trapSuit() - trap: %d destroyed existing trap: %d' %
                        (level, suit.battleTrap))
                    battle.removeTrap(otherSuit)

                otherSuit.battleTrapProp = trapProp
                otherSuit.battleTrap = level
                otherSuit.battleTrapIsFresh = 1
                continue

        trapTracks.append(trapTrack)

    button = globalPropPool.getProp('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    toonTrack = Sequence()
    toonTrack.append(Func(MovieUtil.showProps, buttons, hands))
    toonTrack.append(Func(toon.headsUp, battle, suitPos))
    toonTrack.append(ActorInterval(toon, 'pushbutton'))
    toonTrack.append(Func(MovieUtil.removeProps, buttons))
    toonTrack.append(Func(toon.loop, 'neutral'))
    toonTrack.append(Func(toon.setHpr, battle, origHpr))
    if propName == 'quicksand':
        propSound = globalBattleSoundCache.getSound('TL_quicksand.mp3')
    elif propName == 'traintrack':
        propSound = globalBattleSoundCache.getSound(
            'TL_train_track_appear.mp3')
    else:
        propSound = globalBattleSoundCache.getSound('TL_trap_door.mp3')
    buttonSound = globalBattleSoundCache.getSound('AA_drop_trigger_box.mp3')
    soundTrack = Sequence(
        Wait(2.2999999999999998),
        Parallel(
            SoundInterval(buttonSound, duration=0.67000000000000004,
                          node=toon), SoundInterval(propSound, node=toon)))
    return Parallel(trapTracks, toonTrack, soundTrack)
Example #38
0
def __createThrownTrapMultiTrack(trap,
                                 propList,
                                 propName,
                                 propPos=None,
                                 propHpr=None,
                                 anim=0,
                                 explode=0):
    toon = trap['toon']
    level = trap['level']
    battle = trap['battle']
    target = trap['target']
    suit = target[0]['suit']
    targetPos = suit.getPos(battle)
    thrownProp = propList[0]
    unthrownProp = propList[1]
    torso = toon.style.torso
    torso = torso[0]
    if torso == 'l':
        throwDelay = 2.2999999999999998
    elif torso == 'm':
        throwDelay = 2.2999999999999998
    else:
        throwDelay = 1.8999999999999999
    throwDuration = 0.90000000000000002
    animBreakPoint = throwDelay + throwDuration
    animDelay = 3.1000000000000001
    trapTrack = ToontownBattleGlobals.TRAP_TRACK
    trapTrackNames = ToontownBattleGlobals.AvProps[trapTrack]
    trapName = trapTrackNames[level]
    hands = toon.getRightHands()
    propTrack = Sequence()
    if propPos and propHpr:
        propTrack.append(
            Func(MovieUtil.showProps, propList, hands, propPos, propHpr))
    else:
        propTrack.append(Func(MovieUtil.showProps, propList, hands))
    if anim == 1:
        pTracks = Parallel()
        for prop in propList:
            pTracks.append(
                ActorInterval(prop, propName, duration=animBreakPoint))

        propTrack.append(pTracks)

    throwTrack = Sequence()
    throwTrack.append(Wait(throwDelay))
    throwTrack.append(Func(unthrownProp.reparentTo, hidden))
    throwTrack.append(Func(toon.update))
    if suit.battleTrap != NO_TRAP:
        notify.debug('trapSuit() - trap: %d destroyed existing trap: %d' %
                     (level, suit.battleTrap))
        battle.removeTrap(suit)

    if trapName == 'rake':
        trapProp = globalPropPool.getProp('rake-react')
    else:
        trapProp = MovieUtil.copyProp(thrownProp)
    suit.battleTrapProp = trapProp
    suit.battleTrap = level
    suit.battleTrapIsFresh = 1
    if trapName == 'banana':
        (trapPoint, trapHpr) = battle.getActorPosHpr(suit)
        trapPoint.setY(MovieUtil.SUIT_TRAP_DISTANCE)
        slidePoint = Vec3(trapPoint.getX(),
                          trapPoint.getY() - 2, trapPoint.getZ())
        throwingTrack = createThrowingTrack(thrownProp,
                                            slidePoint,
                                            duration=0.90000000000000002,
                                            parent=battle)
        moveTrack = LerpPosInterval(thrownProp,
                                    0.80000000000000004,
                                    pos=trapPoint,
                                    other=battle)
        animTrack = ActorInterval(thrownProp,
                                  propName,
                                  startTime=animBreakPoint)
        slideTrack = Parallel(moveTrack, animTrack)
        motionTrack = Sequence(throwingTrack, slideTrack)
        hprTrack = LerpHprInterval(thrownProp, 1.7, hpr=Point3(0, 0, 0))
        soundTrack = getSoundTrack('TL_banana.mp3', node=toon)
        scaleTrack = LerpScaleInterval(thrownProp,
                                       1.7,
                                       scale=MovieUtil.PNT3_ONE)
        throwTrack.append(Wait(0.25))
        throwTrack.append(Func(thrownProp.wrtReparentTo, suit))
        throwTrack.append(
            Parallel(motionTrack, hprTrack, scaleTrack, soundTrack))
    elif trapName == 'tnt':
        (trapPoint, trapHpr) = battle.getActorPosHpr(suit)
        trapPoint.setY(MovieUtil.SUIT_TRAP_TNT_DISTANCE - 3.8999999999999999)
        trapPoint.setZ(trapPoint.getZ() + 0.40000000000000002)
        throwingTrack = createThrowingTrack(thrownProp,
                                            trapPoint,
                                            duration=throwDuration,
                                            parent=battle)
        hprTrack = LerpHprInterval(thrownProp,
                                   0.90000000000000002,
                                   hpr=Point3(0, 90, 0))
        scaleTrack = LerpScaleInterval(thrownProp,
                                       0.90000000000000002,
                                       scale=MovieUtil.PNT3_ONE)
        soundTrack = getSoundTrack('TL_dynamite.mp3',
                                   delay=0.80000000000000004,
                                   duration=0.69999999999999996,
                                   node=suit)
        throwTrack.append(Wait(0.20000000000000001))
        throwTrack.append(
            Parallel(throwingTrack, hprTrack, scaleTrack, soundTrack))
    elif trapName == 'marbles':
        (trapPoint, trapHpr) = battle.getActorPosHpr(suit)
        trapPoint.setY(MovieUtil.SUIT_TRAP_MARBLES_DISTANCE)
        flingDuration = 0.20000000000000001
        rollDuration = 1.0
        throwDuration = flingDuration + rollDuration
        landPoint = Point3(0, trapPoint.getY() + 2, trapPoint.getZ())
        throwPoint = Point3(0, trapPoint.getY(), trapPoint.getZ())
        moveTrack = Sequence(
            Func(thrownProp.wrtReparentTo, suit),
            Func(thrownProp.setHpr, Point3(94, 0, 0)),
            LerpPosInterval(thrownProp,
                            flingDuration,
                            pos=landPoint,
                            other=suit),
            LerpPosInterval(thrownProp,
                            rollDuration,
                            pos=throwPoint,
                            other=suit))
        animTrack = ActorInterval(thrownProp,
                                  propName,
                                  startTime=throwDelay + 0.90000000000000002)
        scaleTrack = LerpScaleInterval(thrownProp,
                                       throwDuration,
                                       scale=MovieUtil.PNT3_ONE)
        soundTrack = getSoundTrack('TL_marbles.mp3',
                                   delay=0.10000000000000001,
                                   node=toon)
        throwTrack.append(Wait(0.20000000000000001))
        throwTrack.append(
            Parallel(moveTrack, animTrack, scaleTrack, soundTrack))
    elif trapName == 'rake':
        (trapPoint, trapHpr) = battle.getActorPosHpr(suit)
        trapPoint.setY(MovieUtil.SUIT_TRAP_RAKE_DISTANCE)
        throwDuration = 1.1000000000000001
        throwingTrack = createThrowingTrack(thrownProp,
                                            trapPoint,
                                            duration=throwDuration,
                                            parent=suit)
        hprTrack = LerpHprInterval(thrownProp,
                                   throwDuration,
                                   hpr=VBase3(63.43, -90.0, 63.43))
        scaleTrack = LerpScaleInterval(thrownProp,
                                       0.90000000000000002,
                                       scale=Point3(0.69999999999999996,
                                                    0.69999999999999996,
                                                    0.69999999999999996))
        soundTrack = SoundInterval(
            globalBattleSoundCache.getSound('TL_rake_throw_only.mp3'),
            duration=1.1000000000000001,
            node=suit)
        throwTrack.append(Wait(0.20000000000000001))
        throwTrack.append(
            Parallel(throwingTrack, hprTrack, scaleTrack, soundTrack))
    else:
        notify.warning(
            '__createThrownTrapMultiTrack() - Incorrect trap:                          %s thrown from toon'
            % trapName)

    def placeTrap(trapProp, suit, battle=battle, trapName=trapName):
        if not trapProp or trapProp.isEmpty():
            return None

        trapProp.wrtReparentTo(suit)
        trapProp.show()
        if trapName == 'rake':
            trapProp.setPos(0, MovieUtil.SUIT_TRAP_RAKE_DISTANCE, 0)
            trapProp.setHpr(Point3(0, 270, 0))
            trapProp.setScale(
                Point3(0.69999999999999996, 0.69999999999999996,
                       0.69999999999999996))
            rakeOffset = MovieUtil.getSuitRakeOffset(suit)
            trapProp.setY(trapProp.getY() + rakeOffset)
        elif trapName == 'banana':
            trapProp.setHpr(0, 0, 0)
            trapProp.setPos(0, MovieUtil.SUIT_TRAP_DISTANCE,
                            -0.34999999999999998)
            trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
        elif trapName == 'marbles':
            trapProp.setHpr(Point3(94, 0, 0))
            trapProp.setPos(0, MovieUtil.SUIT_TRAP_MARBLES_DISTANCE, 0)
            trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1)
        elif trapName == 'tnt':
            trapProp.setHpr(0, 90, 0)
            trapProp.setPos(0, MovieUtil.SUIT_TRAP_TNT_DISTANCE,
                            0.40000000000000002)
        else:
            notify.warning(
                'placeTrap() - Incorrect trap: %s placed on a suit' % trapName)

    dustNode = hidden.attachNewNode('DustNode')

    def placeDustExplosion(dustNode=dustNode,
                           thrownProp=thrownProp,
                           battle=battle):
        dustNode.reparentTo(battle)
        dustNode.setPos(thrownProp.getPos(battle))

    if explode == 1:
        throwTrack.append(Func(thrownProp.wrtReparentTo, hidden))
        throwTrack.append(Func(placeDustExplosion))
        throwTrack.append(
            createCartoonExplosionTrack(dustNode,
                                        'dust',
                                        explosionPoint=Point3(0, 0, 0)))
        throwTrack.append(Func(battle.removeTrap, suit))
    else:
        throwTrack.append(Func(placeTrap, trapProp, suit))
        if trapName == 'tnt':
            tip = trapProp.find('**/joint_attachEmitter')
            sparks = BattleParticles.createParticleEffect(file='tnt')
            trapProp.sparksEffect = sparks
            throwTrack.append(Func(sparks.start, tip))

    throwTrack.append(Func(MovieUtil.removeProps, propList))
    toonTrack = Sequence(Func(toon.headsUp, battle, targetPos),
                         ActorInterval(toon, 'toss'),
                         Func(toon.loop, 'neutral'))
    return Parallel(propTrack, throwTrack, toonTrack)
Example #39
0
def doTraps(traps):
    if len(traps) == 0:
        return (None, None)

    (npcArrivals, npcDepartures, npcs) = MovieNPCSOS.doNPCTeleports(traps)
    hasUberTrapConflict = False
    suitTrapsDict = {}
    for trap in traps:
        targets = trap['target']
        if len(targets) == 1:
            suitId = targets[0]['suit'].doId
            if suitTrapsDict.has_key(suitId):
                suitTrapsDict[suitId].append(trap)
            else:
                suitTrapsDict[suitId] = [trap]
        suitTrapsDict.has_key(suitId)
        for target in targets:
            suitId = target['suit'].doId
            if not suitTrapsDict.has_key(suitId):
                suitTrapsDict[suitId] = [trap]
                break
                continue

        if trap['level'] == UBER_GAG_LEVEL_INDEX:
            if len(traps) > 1:
                hasUberTrapConflict = True

            for oneTarget in trap['target']:
                suit = oneTarget['suit']
                if suit.battleTrap != NO_TRAP:
                    hasUberTrapConflict = True
                    continue

    suitTrapLists = suitTrapsDict.values()
    mtrack = Parallel()
    for trapList in suitTrapLists:
        trapPropList = []
        for i in range(len(trapList)):
            trap = trapList[i]
            level = trap['level']
            if level == 0:
                banana = globalPropPool.getProp('banana')
                banana2 = MovieUtil.copyProp(banana)
                trapPropList.append([banana, banana2])
                continue
            if level == 1:
                rake = globalPropPool.getProp('rake')
                rake2 = MovieUtil.copyProp(rake)
                rake.pose('rake', 0)
                rake2.pose('rake', 0)
                trapPropList.append([rake, rake2])
                continue
            if level == 2:
                marbles = globalPropPool.getProp('marbles')
                marbles2 = MovieUtil.copyProp(marbles)
                trapPropList.append([marbles, marbles2])
                continue
            if level == 3:
                trapPropList.append([globalPropPool.getProp('quicksand')])
                continue
            if level == 4:
                trapPropList.append([globalPropPool.getProp('trapdoor')])
                continue
            if level == 5:
                tnt = globalPropPool.getProp('tnt')
                tnt2 = MovieUtil.copyProp(tnt)
                trapPropList.append([tnt, tnt2])
                continue
            if level == 6:
                tnt = globalPropPool.getProp('traintrack')
                tnt2 = MovieUtil.copyProp(tnt)
                trapPropList.append([tnt, tnt2])
                continue
            notify.warning(
                '__doTraps() - Incorrect trap level:                 %d' %
                level)

        if len(trapList) == 1 and not hasUberTrapConflict:
            ival = __doTrapLevel(trapList[0], trapPropList[0])
            if ival:
                mtrack.append(ival)

        subMtrack = Parallel()
        for i in range(len(trapList)):
            trap = trapList[i]
            trapProps = trapPropList[i]
            ival = __doTrapLevel(trap, trapProps, explode=1)
            if ival:
                subMtrack.append(ival)
                continue

        mtrack.append(subMtrack)

    trapTrack = Sequence(npcArrivals, mtrack, npcDepartures)
    camDuration = mtrack.getDuration()
    enterDuration = npcArrivals.getDuration()
    exitDuration = npcDepartures.getDuration()
    camTrack = MovieCamera.chooseTrapShot(traps, camDuration, enterDuration,
                                          exitDuration)
    return (trapTrack, camTrack)
Example #40
0
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target,
                      npcs):
    toon = drop['toon']
    if drop.has_key('npc'):
        toon = drop['npc']
    battle = drop['battle']
    majorObject = level >= 3
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    hpbonus = drop['hpbonus']
    if hp > 0:
        suitTrack = Sequence()
        showDamage = Func(suit.showHpText, -hp, openEnded=0)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        if majorObject:
            anim = 'flatten'
        else:
            anim = 'drop-react'
        suitReact = ActorInterval(suit, anim)
        suitTrack.append(Wait(delay + tObjectAppears))
        suitTrack.append(showDamage)
        suitTrack.append(updateHealthBar)
        suitGettingHit = Parallel(suitReact)
        if level == UBER_GAG_LEVEL_INDEX:
            gotHitSound = globalBattleSoundCache.getSound(
                'AA_drop_boat_cog.ogg')
            suitGettingHit.append(SoundInterval(gotHitSound, node=toon))
        suitTrack.append(suitGettingHit)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Sequence(
                Wait(delay + tObjectAppears + 0.75),
                Func(suit.showHpText, -hpbonus, 1, openEnded=0))
        if revived != 0:
            suitTrack.append(
                MovieUtil.createSuitReviveTrack(suit, toon, battle, npcs))
        elif died != 0:
            suitTrack.append(
                MovieUtil.createSuitDeathTrack(suit, toon, battle, npcs))
        else:
            suitTrack.append(Func(suit.loop, 'neutral'))
        if bonusTrack != None:
            suitTrack = Parallel(suitTrack, bonusTrack)
    elif kbbonus == 0:
        suitTrack = Sequence(Wait(delay + tObjectAppears),
                             Func(MovieUtil.indicateMissed, suit, 0.6),
                             Func(suit.loop, 'neutral'))
    else:
        if alreadyDodged > 0:
            return
        if level >= 3:
            if alreadyTeased > 0:
                return
            else:
                suitTrack = MovieUtil.createSuitTeaseMultiTrack(suit,
                                                                delay=delay +
                                                                tObjectAppears)
        else:
            suitTrack = MovieUtil.createSuitDodgeMultitrack(
                delay + tSuitDodges, suit, leftSuits, rightSuits)
    return suitTrack
Example #41
0
def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased,
                 npcs, target, npcDrops):
    toon = drop['toon']
    repeatNPC = 0
    battle = drop['battle']
    if drop.has_key('npc'):
        toon = drop['npc']
        if npcDrops.has_key(toon):
            repeatNPC = 1
        else:
            npcDrops[toon] = 1
        origHpr = Vec3(0, 0, 0)
    else:
        origHpr = toon.getHpr(battle)
    hpbonus = drop['hpbonus']
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    suitPos = suit.getPos(battle)
    majorObject = level >= 3
    if repeatNPC == 0:
        button = globalPropPool.getProp('button')
        buttonType = globalPropPool.getPropType('button')
        button2 = MovieUtil.copyProp(button)
        buttons = [button, button2]
        hands = toon.getLeftHands()
    object = globalPropPool.getProp(objName)
    objectType = globalPropPool.getPropType(objName)
    if objName == 'weight':
        object.setScale(object.getScale() * 0.75)
    elif objName == 'safe':
        object.setScale(object.getScale() * 0.85)
    node = object.node()
    node.setBounds(OmniBoundingVolume())
    node.setFinal(1)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    toonTrack = Sequence()
    if repeatNPC == 0:
        toonFace = Func(toon.headsUp, battle, suitPos)
        toonTrack.append(Wait(delay))
        toonTrack.append(toonFace)
        toonTrack.append(ActorInterval(toon, 'pushbutton'))
        toonTrack.append(Func(toon.loop, 'neutral'))
        toonTrack.append(Func(toon.setHpr, battle, origHpr))
    buttonTrack = Sequence()
    if repeatNPC == 0:
        buttonShow = Func(MovieUtil.showProps, buttons, hands)
        buttonScaleUp = LerpScaleInterval(button,
                                          1.0,
                                          button.getScale(),
                                          startScale=Point3(0.01, 0.01, 0.01))
        buttonScaleDown = LerpScaleInterval(button,
                                            1.0,
                                            Point3(0.01, 0.01, 0.01),
                                            startScale=button.getScale())
        buttonHide = Func(MovieUtil.removeProps, buttons)
        buttonTrack.append(Wait(delay))
        buttonTrack.append(buttonShow)
        buttonTrack.append(buttonScaleUp)
        buttonTrack.append(Wait(2.5))
        buttonTrack.append(buttonScaleDown)
        buttonTrack.append(buttonHide)
    objectTrack = Sequence()

    def posObject(object, suit, level, majorObject, miss, battle=battle):
        object.reparentTo(battle)
        if battle.isSuitLured(suit):
            suitPos, suitHpr = battle.getActorPosHpr(suit)
            object.setPos(suitPos)
            object.setHpr(suitHpr)
            if level >= 3:
                object.setY(object.getY() + 2)
        else:
            object.setPos(suit.getPos(battle))
            object.setHpr(suit.getHpr(battle))
            if miss and level >= 3:
                object.setY(object.getY(battle) + 5)
        if not majorObject:
            if not miss:
                shoulderHeight = shoulderHeights[suit.style.body] * suit.scale
                object.setZ(object.getPos(battle)[2] + shoulderHeight)
        object.setZ(object.getPos(battle)[2] + objZOffsets[level])

    objectTrack.append(Func(battle.movie.needRestoreRenderProp, object))
    objInit = Func(posObject, object, suit, level, majorObject, hp <= 0)
    objectTrack.append(Wait(delay + tObjectAppears))
    objectTrack.append(objInit)
    if hp > 0 or level == 1 or level == 2:
        if hasattr(object, 'getAnimControls'):
            animProp = ActorInterval(object, objName)
            shrinkProp = LerpScaleInterval(object,
                                           dShrink,
                                           Point3(0.01, 0.01, 0.01),
                                           startScale=object.getScale())
            objAnimShrink = ParallelEndTogether(animProp, shrinkProp)
            objectTrack.append(objAnimShrink)
        else:
            startingScale = objStartingScales[level]
            object2 = MovieUtil.copyProp(object)
            posObject(object2, suit, level, majorObject, hp <= 0)
            endingPos = object2.getPos()
            startPos = Point3(endingPos[0], endingPos[1], endingPos[2] + 5)
            startHpr = object2.getHpr()
            endHpr = Point3(startHpr[0] + 90, startHpr[1], startHpr[2])
            animProp = LerpPosInterval(object,
                                       landFrames[level] / 24.0,
                                       endingPos,
                                       startPos=startPos)
            shrinkProp = LerpScaleInterval(object,
                                           dShrink,
                                           Point3(0.01, 0.01, 0.01),
                                           startScale=startingScale)
            bounceProp = Effects.createZBounce(object, 2, endingPos, 0.5, 1.5)
            objAnimShrink = Sequence(Func(object.setScale, startingScale),
                                     Func(object.setH, endHpr[0]), animProp,
                                     bounceProp, Wait(1.5), shrinkProp)
            objectTrack.append(objAnimShrink)
            MovieUtil.removeProp(object2)
    elif hasattr(object, 'getAnimControls'):
        animProp = ActorInterval(object,
                                 objName,
                                 duration=landFrames[level] / 24.0)

        def poseProp(prop, animName, level):
            prop.pose(animName, landFrames[level])

        poseProp = Func(poseProp, object, objName, level)
        wait = Wait(1.0)
        shrinkProp = LerpScaleInterval(object,
                                       dShrinkOnMiss,
                                       Point3(0.01, 0.01, 0.01),
                                       startScale=object.getScale())
        objectTrack.append(animProp)
        objectTrack.append(poseProp)
        objectTrack.append(wait)
        objectTrack.append(shrinkProp)
    else:
        startingScale = objStartingScales[level]
        object2 = MovieUtil.copyProp(object)
        posObject(object2, suit, level, majorObject, hp <= 0)
        endingPos = object2.getPos()
        startPos = Point3(endingPos[0], endingPos[1], endingPos[2] + 5)
        startHpr = object2.getHpr()
        endHpr = Point3(startHpr[0] + 90, startHpr[1], startHpr[2])
        animProp = LerpPosInterval(object,
                                   landFrames[level] / 24.0,
                                   endingPos,
                                   startPos=startPos)
        shrinkProp = LerpScaleInterval(object,
                                       dShrinkOnMiss,
                                       Point3(0.01, 0.01, 0.01),
                                       startScale=startingScale)
        bounceProp = Effects.createZBounce(object, 2, endingPos, 0.5, 1.5)
        objAnimShrink = Sequence(Func(object.setScale, startingScale),
                                 Func(object.setH, endHpr[0]), animProp,
                                 bounceProp, Wait(1.5), shrinkProp)
        objectTrack.append(objAnimShrink)
        MovieUtil.removeProp(object2)
    objectTrack.append(Func(MovieUtil.removeProp, object))
    objectTrack.append(Func(battle.movie.clearRenderProp, object))
    dropShadow = MovieUtil.copyProp(suit.getShadowJoint())
    if level == 0:
        dropShadow.setScale(0.5)
    elif level <= 2:
        dropShadow.setScale(0.8)
    elif level == 3:
        dropShadow.setScale(2.0)
    elif level == 4:
        dropShadow.setScale(2.3)
    else:
        dropShadow.setScale(3.6)

    def posShadow(dropShadow=dropShadow,
                  suit=suit,
                  battle=battle,
                  hp=hp,
                  level=level):
        dropShadow.reparentTo(battle)
        if battle.isSuitLured(suit):
            suitPos, suitHpr = battle.getActorPosHpr(suit)
            dropShadow.setPos(suitPos)
            dropShadow.setHpr(suitHpr)
            if level >= 3:
                dropShadow.setY(dropShadow.getY() + 2)
        else:
            dropShadow.setPos(suit.getPos(battle))
            dropShadow.setHpr(suit.getHpr(battle))
            if hp <= 0 and level >= 3:
                dropShadow.setY(dropShadow.getY(battle) + 5)
        dropShadow.setZ(dropShadow.getZ() + 0.5)

    shadowTrack = Sequence(
        Wait(delay + tButtonPressed),
        Func(battle.movie.needRestoreRenderProp, dropShadow), Func(posShadow),
        LerpScaleInterval(dropShadow,
                          tObjectAppears - tButtonPressed,
                          dropShadow.getScale(),
                          startScale=Point3(0.01, 0.01, 0.01)), Wait(0.3),
        Func(MovieUtil.removeProp, dropShadow),
        Func(battle.movie.clearRenderProp, dropShadow))
    return Parallel(toonTrack, soundTrack, buttonTrack, objectTrack,
                    shadowTrack)
Example #42
0
def __doWaterGun(squirt, delay, fShowStun):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    target = squirt['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    battle = squirt['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    hitSuit = hp > 0
    scale = sprayScales[level]
    tPistol = 0.0
    dPistolScale = 0.5
    dPistolHold = 1.8
    tSpray = 48.0 / toon.getFrameRate('water-gun')
    sprayPoseFrame = 63
    dSprayScale = 0.10000000000000001
    dSprayHold = 0.29999999999999999
    tContact = tSpray + dSprayScale
    tSuitDodges = 1.1000000000000001
    tracks = Parallel()
    toonTrack = Sequence(Func(toon.headsUp, battle, suitPos),
                         ActorInterval(toon, 'water-gun'),
                         Func(toon.loop, 'neutral'),
                         Func(toon.setHpr, battle, origHpr))
    tracks.append(toonTrack)
    soundTrack = __getSoundTrack(level, hitSuit, 1.8, toon)
    tracks.append(soundTrack)
    pistol = globalPropPool.getProp('water-gun')
    hands = toon.getRightHands()
    hand_jointpath0 = hands[0].attachNewNode('handJoint0-path')
    hand_jointpath1 = hand_jointpath0.instanceTo(hands[1])

    targetPoint = lambda suit=suit: __suitTargetPoint(suit)

    def getSprayStartPos(pistol=pistol, toon=toon):
        toon.update(0)
        joint = pistol.find('**/joint_nozzle')
        p = joint.getPos(render)
        return p

    sprayTrack = MovieUtil.getSprayTrack(battle,
                                         WaterSprayColor,
                                         getSprayStartPos,
                                         targetPoint,
                                         dSprayScale,
                                         dSprayHold,
                                         dSprayScale,
                                         horizScale=scale,
                                         vertScale=scale)
    pistolPos = Point3(0.28000000000000003, 0.10000000000000001,
                       0.080000000000000002)
    pistolHpr = VBase3(85.599999999999994, -4.4400000000000004,
                       94.430000000000007)
    pistolTrack = Sequence(
        Func(MovieUtil.showProp, pistol, hand_jointpath0, pistolPos,
             pistolHpr),
        LerpScaleInterval(pistol,
                          dPistolScale,
                          pistol.getScale(),
                          startScale=MovieUtil.PNT3_NEARZERO),
        Wait(tSpray - dPistolScale))
    pistolTrack.append(sprayTrack)
    pistolTrack.append(Wait(dPistolHold))
    pistolTrack.append(
        LerpScaleInterval(pistol, dPistolScale, MovieUtil.PNT3_NEARZERO))
    pistolTrack.append(Func(hand_jointpath1.removeNode))
    pistolTrack.append(Func(hand_jointpath0.removeNode))
    pistolTrack.append(Func(MovieUtil.removeProp, pistol))
    tracks.append(pistolTrack)
    if hp > 0:
        tracks.append(
            __getSplashTrack(targetPoint, 0.29999999999999999,
                             tSpray + dSprayScale, battle))

    if hp > 0 or delay <= 0:
        tracks.append(
            __getSuitTrack(suit,
                           tContact,
                           tSuitDodges,
                           hp,
                           hpbonus,
                           kbbonus,
                           'squirt-small-react',
                           died,
                           leftSuits,
                           rightSuits,
                           battle,
                           toon,
                           fShowStun,
                           revived=revived))

    return tracks
Example #43
0
def __doGeyser(squirt, delay, fShowStun, uberClone=0):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    tracks = Parallel()
    tButton = 0.0
    dButtonScale = 0.5
    dButtonHold = 3.0
    tContact = 2.8999999999999999
    tSpray = 1
    tSuitDodges = 1.8
    button = globalPropPool.getProp('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    hands = toon.getLeftHands()
    battle = squirt['battle']
    origHpr = toon.getHpr(battle)
    suit = squirt['target'][0]['suit']
    suitPos = suit.getPos(battle)
    toonTrack = Sequence(Func(MovieUtil.showProps, buttons, hands),
                         Func(toon.headsUp, battle, suitPos),
                         ActorInterval(toon, 'pushbutton'),
                         Func(MovieUtil.removeProps, buttons),
                         Func(toon.loop, 'neutral'),
                         Func(toon.setHpr, battle, origHpr))
    tracks.append(toonTrack)
    for target in squirt['target']:
        suit = target['suit']
        hp = target['hp']
        kbbonus = target['kbbonus']
        died = target['died']
        revived = target['revived']
        leftSuits = target['leftSuits']
        rightSuits = target['rightSuits']
        suitPos = suit.getPos(battle)
        hitSuit = hp > 0
        scale = sprayScales[level]
        soundTrack = __getSoundTrack(level, hitSuit, 1.8, toon)
        delayTime = random.random()
        tracks.append(Wait(delayTime))
        tracks.append(soundTrack)
        cloud = globalPropPool.getProp('geyser')
        cloud2 = MovieUtil.copyProp(cloud)
        BattleParticles.loadParticles()
        geyserHeight = battle.getH()
        geyserPosPoint = Point3(0, 0, geyserHeight)
        scaleUpPoint = Point3(1.8, 1.8, 1.8)
        rainEffects = []
        rainDelay = 2.5
        effectDelay = 0.29999999999999999
        if hp > 0:
            geyserHold = 1.5
        else:
            geyserHold = 0.5

        def getGeyserTrack(geyser,
                           suit,
                           geyserPosPoint,
                           scaleUpPoint,
                           rainEffects,
                           rainDelay,
                           effectDelay,
                           geyserHold,
                           useEffect,
                           battle=battle):
            geyserMound = MovieUtil.copyProp(geyser)
            geyserRemoveM = geyserMound.findAllMatches('**/Splash*')
            geyserRemoveM.addPathsFrom(geyserMound.findAllMatches('**/spout'))
            for i in range(geyserRemoveM.getNumPaths()):
                geyserRemoveM[i].removeNode()

            geyserWater = MovieUtil.copyProp(geyser)
            geyserRemoveW = geyserWater.findAllMatches('**/hole')
            geyserRemoveW.addPathsFrom(geyserWater.findAllMatches('**/shadow'))
            for i in range(geyserRemoveW.getNumPaths()):
                geyserRemoveW[i].removeNode()

            track = Sequence(
                Wait(rainDelay),
                Func(MovieUtil.showProp, geyserMound, battle,
                     suit.getPos(battle)),
                Func(MovieUtil.showProp, geyserWater, battle,
                     suit.getPos(battle)),
                LerpScaleInterval(geyserWater,
                                  1.0,
                                  scaleUpPoint,
                                  startScale=MovieUtil.PNT3_NEARZERO),
                Wait(geyserHold * 0.5),
                LerpScaleInterval(geyserWater,
                                  0.5,
                                  MovieUtil.PNT3_NEARZERO,
                                  startScale=scaleUpPoint))
            track.append(
                LerpScaleInterval(geyserMound, 0.5, MovieUtil.PNT3_NEARZERO))
            track.append(Func(MovieUtil.removeProp, geyserMound))
            track.append(Func(MovieUtil.removeProp, geyserWater))
            track.append(Func(MovieUtil.removeProp, geyser))
            return track

        if not uberClone:
            tracks.append(
                Sequence(
                    Wait(delayTime),
                    getGeyserTrack(cloud,
                                   suit,
                                   geyserPosPoint,
                                   scaleUpPoint,
                                   rainEffects,
                                   rainDelay,
                                   effectDelay,
                                   geyserHold,
                                   useEffect=1)))

        if hp > 0 or delay <= 0:
            tracks.append(
                Sequence(
                    Wait(delayTime),
                    __getSuitTrack(suit,
                                   tContact,
                                   tSuitDodges,
                                   hp,
                                   hpbonus,
                                   kbbonus,
                                   'soak',
                                   died,
                                   leftSuits,
                                   rightSuits,
                                   battle,
                                   toon,
                                   fShowStun,
                                   beforeStun=2.6000000000000001,
                                   afterStun=2.2999999999999998,
                                   geyser=1,
                                   uberRepeat=uberClone,
                                   revived=revived)))
            continue

    return tracks
Example #44
0
    def restore(self):
        return
        for toon in self.battle.activeToons:
            toon.loop('neutral')
            origPos, origHpr = self.battle.getActorPosHpr(toon)
            toon.setPosHpr(self.battle, origPos, origHpr)
            hands = toon.getRightHands()[:]
            hands += toon.getLeftHands()
            for hand in hands:
                props = hand.getChildren()
                for prop in props:
                    if prop.getName() != 'book':
                        MovieUtil.removeProp(prop)

            if self.restoreColor == 1:
                headParts = toon.getHeadParts()
                torsoParts = toon.getTorsoParts()
                legsParts = toon.getLegsParts()
                partsList = [headParts, torsoParts, legsParts]
                for parts in partsList:
                    for partNum in xrange(0, parts.getNumPaths()):
                        nextPart = parts.getPath(partNum)
                        nextPart.clearColorScale()
                        nextPart.clearTransparency()

            if self.restoreHips == 1:
                parts = toon.getHipsParts()
                for partNum in xrange(0, parts.getNumPaths()):
                    nextPart = parts.getPath(partNum)
                    props = nextPart.getChildren()
                    for prop in props:
                        if prop.getName() == 'redtape-tube.egg':
                            MovieUtil.removeProp(prop)

            if self.restoreHeadScale == 1:
                headScale = ToontownGlobals.toonHeadScales[toon.style.getAnimal()]
                for lod in toon.getLODNames():
                    toon.getPart('head', lod).setScale(headScale)

            if self.restoreToonScale == 1:
                toon.setScale(1)
            headParts = toon.getHeadParts()
            for partNum in xrange(0, headParts.getNumPaths()):
                part = headParts.getPath(partNum)
                part.setHpr(0, 0, 0)
                part.setPos(0, 0, 0)

            arms = toon.findAllMatches('**/arms')
            sleeves = toon.findAllMatches('**/sleeves')
            hands = toon.findAllMatches('**/hands')
            for partNum in xrange(0, arms.getNumPaths()):
                armPart = arms.getPath(partNum)
                sleevePart = sleeves.getPath(partNum)
                handsPart = hands.getPath(partNum)
                armPart.setHpr(0, 0, 0)
                sleevePart.setHpr(0, 0, 0)
                handsPart.setHpr(0, 0, 0)

        for suit in self.battle.activeSuits:
            if suit._Actor__animControlDict != None:
                suit.loop('neutral')
                suit.battleTrapIsFresh = 0
                origPos, origHpr = self.battle.getActorPosHpr(suit)
                suit.setPosHpr(self.battle, origPos, origHpr)
                hands = [suit.getRightHand(), suit.getLeftHand()]
                for hand in hands:
                    props = hand.getChildren()
                    for prop in props:
                        MovieUtil.removeProp(prop)

        for effect in self.specialParticleEffects:
            if effect != None:
                effect.cleanup()

        self.specialParticleEffects = []
        for prop in self.renderProps:
            MovieUtil.removeProp(prop)

        self.renderProps = []
        return
Example #45
0
def __throwPie(throw, delay, hitCount, showCannon = 1):
    toon = throw['toon']
    hpbonus = throw['hpbonus']
    target = throw['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    sidestep = throw['sidestep']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    level = throw['level']
    battle = throw['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    notify.debug('toon: %s throws tart at suit: %d for hp: %d died: %d' % (toon.getName(),
     suit.doId,
     hp,
     died))
    pieName = pieNames[0]
    hitSuit = hp > 0
    button = globalPropPool.getProp('button')
    buttonType = globalPropPool.getPropType('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    hands = toon.getLeftHands()
    toonTrack = Sequence()
    toonFace = Func(toon.headsUp, battle, suitPos)
    toonTrack.append(Wait(delay))
    toonTrack.append(toonFace)
    toonTrack.append(ActorInterval(toon, 'pushbutton'))
    toonTrack.append(ActorInterval(toon, 'wave', duration=2.0))
    toonTrack.append(ActorInterval(toon, 'duck'))
    toonTrack.append(Func(toon.loop, 'neutral'))
    toonTrack.append(Func(toon.setHpr, battle, origHpr))
    buttonTrack = Sequence()
    buttonShow = Func(MovieUtil.showProps, buttons, hands)
    buttonScaleUp = LerpScaleInterval(button, 1.0, button.getScale(), startScale=Point3(0.01, 0.01, 0.01))
    buttonScaleDown = LerpScaleInterval(button, 1.0, Point3(0.01, 0.01, 0.01), startScale=button.getScale())
    buttonHide = Func(MovieUtil.removeProps, buttons)
    buttonTrack.append(Wait(delay))
    buttonTrack.append(buttonShow)
    buttonTrack.append(buttonScaleUp)
    buttonTrack.append(Wait(2.5))
    buttonTrack.append(buttonScaleDown)
    buttonTrack.append(buttonHide)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    suitResponseTrack = Sequence()
    reactIval = Sequence()
    if showCannon:
        showDamage = Func(suit.showHpText, -hp, openEnded=0)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        cannon = loader.loadModel('phase_4/models/minigames/toon_cannon')
        barrel = cannon.find('**/cannon')
        barrel.setHpr(0, 90, 0)
        cannonHolder = render.attachNewNode('CannonHolder')
        cannon.reparentTo(cannonHolder)
        cannon.setPos(0, 0, -8.6)
        cannonHolder.setPos(suit.getPos(render))
        cannonHolder.setHpr(suit.getHpr(render))
        cannonAttachPoint = barrel.attachNewNode('CannonAttach')
        kapowAttachPoint = barrel.attachNewNode('kapowAttach')
        scaleFactor = 1.6
        iScale = 1 / scaleFactor
        barrel.setScale(scaleFactor, 1, scaleFactor)
        cannonAttachPoint.setScale(iScale, 1, iScale)
        cannonAttachPoint.setPos(0, 6.7, 0)
        kapowAttachPoint.setPos(0, -0.5, 1.9)
        suit.reparentTo(cannonAttachPoint)
        suit.setPos(0, 0, 0)
        suit.setHpr(0, -90, 0)
        suitLevel = suit.getActualLevel()
        deep = 2.5 + suitLevel * 0.2
        suitScale = 0.9
        import math
        suitScale = 0.9 - math.sqrt(suitLevel) * 0.1
        sival = []
        posInit = cannonHolder.getPos()
        posFinal = Point3(posInit[0] + 0.0, posInit[1] + 0.0, posInit[2] + 7.0)
        kapow = globalPropPool.getProp('kapow')
        kapow.reparentTo(kapowAttachPoint)
        kapow.hide()
        kapow.setScale(0.25)
        kapow.setBillboardPointEye()
        smoke = loader.loadModel('phase_4/models/props/test_clouds')
        smoke.reparentTo(cannonAttachPoint)
        smoke.setScale(0.5)
        smoke.hide()
        smoke.setBillboardPointEye()
        soundBomb = base.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.mp3')
        playSoundBomb = SoundInterval(soundBomb, node=cannonHolder)
        soundFly = base.loadSfx('phase_4/audio/sfx/firework_whistle_01.mp3')
        playSoundFly = SoundInterval(soundFly, node=cannonHolder)
        soundCannonAdjust = base.loadSfx('phase_4/audio/sfx/MG_cannon_adjust.mp3')
        playSoundCannonAdjust = SoundInterval(soundCannonAdjust, duration=0.6, node=cannonHolder)
        soundCogPanic = base.loadSfx('phase_5/audio/sfx/ENC_cogafssm.mp3')
        playSoundCogPanic = SoundInterval(soundCogPanic, node=cannonHolder)
        reactIval = Parallel(ActorInterval(suit, 'pie-small-react'), Sequence(Wait(0.0), LerpPosInterval(cannonHolder, 2.0, posFinal, startPos=posInit, blendType='easeInOut'), Parallel(LerpHprInterval(barrel, 0.6, Point3(0, 45, 0), startHpr=Point3(0, 90, 0), blendType='easeIn'), playSoundCannonAdjust), Wait(2.0), Parallel(LerpHprInterval(barrel, 0.6, Point3(0, 90, 0), startHpr=Point3(0, 45, 0), blendType='easeIn'), playSoundCannonAdjust), LerpPosInterval(cannonHolder, 1.0, posInit, startPos=posFinal, blendType='easeInOut')), Sequence(Wait(0.0), Parallel(ActorInterval(suit, 'flail'), suit.scaleInterval(1.0, suitScale), LerpPosInterval(suit, 0.25, Point3(0, -1.0, 0.0)), Sequence(Wait(0.25), Parallel(playSoundCogPanic, LerpPosInterval(suit, 1.5, Point3(0, -deep, 0.0), blendType='easeIn')))), Wait(2.5), Parallel(playSoundBomb, playSoundFly, Sequence(Func(smoke.show), Parallel(LerpScaleInterval(smoke, 0.5, 3), LerpColorScaleInterval(smoke, 0.5, Vec4(2, 2, 2, 0))), Func(smoke.hide)), Sequence(Func(kapow.show),
ActorInterval(kapow, 'kapow'), Func(kapow.hide)), LerpPosInterval(suit, 3.0, Point3(0, 150.0, 0.0)), suit.scaleInterval(3.0, 0.01)), Func(suit.hide)))
        if hitCount == 1:
            sival = Sequence(Parallel(reactIval, MovieUtil.createSuitStunInterval(suit, 0.3, 1.3)), Wait(0.0), Func(cannonHolder.remove))
        else:
            sival = reactIval
        suitResponseTrack.append(Wait(delay + tPieHitsSuit))
        suitResponseTrack.append(showDamage)
        suitResponseTrack.append(updateHealthBar)
        suitResponseTrack.append(sival)
        bonusTrack = Sequence(Wait(delay + tPieHitsSuit))
        if kbbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(Func(suit.showHpText, -kbbonus, 2, openEnded=0))
        if hpbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0))
        suitResponseTrack = Parallel(suitResponseTrack, bonusTrack)
    return [toonTrack,
     soundTrack,
     buttonTrack,
     suitResponseTrack]
Example #46
0
def __healTickle(heal, hasInteractivePropHealBonus):
    """ __healTickle(heal)
    """
    toon = heal['toon']
    target = heal['target']['toon']
    hp = heal['target']['hp']
    ineffective = heal['sidestep']
    level = heal['level']

    # Make a 'sandwich' around the track specific interval
    track = Sequence(__runToHealSpot(heal))
    feather = globalPropPool.getProp('feather')
    feather2 = MovieUtil.copyProp(feather)
    feathers = [feather, feather2]
    hands = toon.getRightHands()

    def scaleFeathers(feathers, toon=toon, target=target):
        toon.pose('tickle', 63)
        toon.update(0)  # make sure LOD 0 is posed
        hand = toon.getRightHands()[0]
        horizDistance = Vec3(hand.getPos(render) - target.getPos(render))
        horizDistance.setZ(0)
        distance = horizDistance.length()
        if target.style.torso[0] == 's':
            distance -= 0.5  # for fat toons
        else:
            distance -= 0.3  # for skinny toons
        featherLen = 2.4
        scale = distance / (featherLen * hand.getScale(render)[0])
        for feather in feathers:
            feather.setScale(scale)

    tFeatherScaleUp = 0.5
    dFeatherScaleUp = 0.5
    dFeatherScaleDown = 0.5
    featherTrack = Parallel(
        MovieUtil.getActorIntervals(feathers, 'feather'),
        Sequence(
            Wait(tFeatherScaleUp),
            Func(MovieUtil.showProps, feathers, hands),
            Func(scaleFeathers, feathers),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleUp,
                                        MovieUtil.PNT3_NEARZERO,
                                        feathers[0].getScale),
        ),
        Sequence(
            Wait(toon.getDuration('tickle') - dFeatherScaleDown),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleDown, None,
                                        MovieUtil.PNT3_NEARZERO)),
    )

    tHeal = 3.

    mtrack = Parallel(
        featherTrack,
        ActorInterval(toon, 'tickle'),
        __getSoundTrack(level, 1, node=toon),
        Sequence(
            Wait(tHeal),
            Func(__healToon, target, hp, ineffective,
                 hasInteractivePropHealBonus),
            ActorInterval(target,
                          'cringe',
                          startTime=20. / target.getFrameRate('cringe'))),
    )

    track.append(mtrack)
    track.append(Func(MovieUtil.removeProps, feathers))
    track.append(__returnToBase(heal))
    track.append(Func(target.clearChat))
    return track
def __createFishingPoleMultiTrack(lure, dollar, dollarName):
    toon = lure['toon']
    target = lure['target']
    battle = lure['battle']
    sidestep = lure['sidestep']
    hp = target['hp']
    kbbonus = target['kbbonus']
    suit = target['suit']
    targetPos = suit.getPos(battle)
    died = target['died']
    revived = target['revived']
    reachAnimDuration = 3.5
    trapProp = suit.battleTrapProp
    pole = globalPropPool.getProp('fishing-pole')
    pole2 = MovieUtil.copyProp(pole)
    poles = [pole, pole2]
    hands = toon.getRightHands()

    def positionDollar(dollar, suit):
        dollar.reparentTo(suit)
        dollar.setPos(0, MovieUtil.SUIT_LURE_DOLLAR_DISTANCE, 0)

    dollarTrack = Sequence(
        Func(positionDollar, dollar, suit), Func(dollar.wrtReparentTo, battle),
        ActorInterval(dollar, dollarName, duration=3),
        getSplicedLerpAnimsTrack(dollar, dollarName, 0.7, 2.0, startTime=3),
        LerpPosInterval(dollar, 0.2, Point3(0, -10, 7)),
        Func(MovieUtil.removeProp, dollar))
    poleTrack = Sequence(Func(MovieUtil.showProps, poles, hands),
                         ActorInterval(pole, 'fishing-pole'),
                         Func(MovieUtil.removeProps, poles))
    toonTrack = Sequence(Func(toon.headsUp, battle, targetPos),
                         ActorInterval(toon, 'battlecast'),
                         Func(toon.loop, 'neutral'))
    tracks = Parallel(dollarTrack, poleTrack, toonTrack)
    if sidestep == 0:
        if kbbonus == 1 or hp > 0:
            suitTrack = Sequence()
            opos, ohpr = battle.getActorPosHpr(suit)
            reachDist = MovieUtil.SUIT_LURE_DISTANCE
            reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
            suitTrack.append(Func(suit.loop, 'neutral'))
            suitTrack.append(Wait(3.5))
            suitName = suit.getStyleName()
            retardPos, retardHpr = battle.getActorPosHpr(suit)
            retardPos.setY(retardPos.getY() +
                           MovieUtil.SUIT_EXTRA_REACH_DISTANCE)
            if suitName in MovieUtil.largeSuits:
                moveTrack = lerpSuit(suit, 0.0, reachAnimDuration / 2.5,
                                     retardPos, battle, trapProp)
                reachTrack = ActorInterval(suit,
                                           'reach',
                                           duration=reachAnimDuration)
                suitTrack.append(Parallel(moveTrack, reachTrack))
            else:
                suitTrack.append(
                    ActorInterval(suit, 'reach', duration=reachAnimDuration))
            if trapProp:
                suitTrack.append(Func(trapProp.wrtReparentTo, battle))
            suitTrack.append(Func(suit.setPos, battle, reachPos))
            if trapProp:
                suitTrack.append(Func(trapProp.wrtReparentTo, suit))
                suit.battleTrapProp = trapProp
            suitTrack.append(Func(suit.loop, 'neutral'))
            suitTrack.append(Func(battle.lureSuit, suit))
            if hp > 0:
                suitTrack.append(
                    __createSuitDamageTrack(battle, suit, hp, lure, trapProp))
            if revived != 0:
                suitTrack.append(
                    MovieUtil.createSuitReviveTrack(suit, toon, battle))
            if died != 0:
                suitTrack.append(
                    MovieUtil.createSuitDeathTrack(suit, toon, battle))
            tracks.append(suitTrack)
    else:
        tracks.append(Sequence(Wait(3.7), Func(MovieUtil.indicateMissed,
                                               suit)))
    tracks.append(getSoundTrack('TL_fishing_pole.ogg', delay=0.5, node=toon))
    return tracks
Example #48
0
def __healJoke(heal, hasInteractivePropHealBonus):
    """ __healJoke(heal)
    """
    toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    jokeIndex = heal['hpbonus'] % len(HealJokes.toonHealJokes)

    # Make a 'sandwich' around the track specific interval
    track = Sequence(__runToHealSpot(heal))

    # start a multitrack
    tracks = Parallel()

    # frame
    fSpeakPunchline = 58

    tSpeakSetup = 0.
    tSpeakPunchline = 3.
    dPunchLine = 3.
    tTargetReact = tSpeakPunchline + 1.
    dTargetLaugh = 1.5
    tRunBack = tSpeakPunchline + dPunchLine

    tDoSoundAnimation = tSpeakPunchline - \
                        (float(fSpeakPunchline) / toon.getFrameRate('sound'))

    # megaphone track
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [megaphone, megaphone2]
    hands = toon.getRightHands()

    dMegaphoneScale = 0.5

    tracks.append(
        Sequence(
            Wait(tDoSoundAnimation),
            Func(MovieUtil.showProps, megaphones, hands),
            MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale,
                                        MovieUtil.PNT3_NEARZERO,
                                        MovieUtil.PNT3_ONE),
            Wait(toon.getDuration('sound') - (2.0 * dMegaphoneScale)),
            MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale,
                                        MovieUtil.PNT3_ONE,
                                        MovieUtil.PNT3_NEARZERO),
            Func(MovieUtil.removeProps, megaphones)))

    # toon track
    tracks.append(
        Sequence(Wait(tDoSoundAnimation), ActorInterval(toon, 'sound')))

    # add sound
    soundTrack = __getSoundTrack(level, 2.0, node=toon)
    tracks.append(soundTrack)

    assert (jokeIndex < len(HealJokes.toonHealJokes))
    joke = HealJokes.toonHealJokes[jokeIndex]
    # the set-up
    tracks.append(
        Sequence(
            Wait(tSpeakSetup),
            Func(toon.setChatAbsolute, joke[0], CFSpeech | CFTimeout),
        ))
    # the punchline
    tracks.append(
        Sequence(
            Wait(tSpeakPunchline),
            Func(toon.setChatAbsolute, joke[1], CFSpeech | CFTimeout),
        ))

    # do the target toon reaction(s)
    reactTrack = Sequence(Wait(tTargetReact), )
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactTrack.append(
            Func(__healToon, targetToon, hp, ineffective,
                 hasInteractivePropHealBonus))
    reactTrack.append(Wait(dTargetLaugh))
    for target in targets:
        targetToon = target['toon']
        reactTrack.append(Func(targetToon.clearChat))
    tracks.append(reactTrack)

    tracks.append(
        Sequence(Wait(tRunBack), Func(toon.clearChat), *__returnToBase(heal)))

    # lay down the multitrack
    track.append(tracks)

    return track
def __createHypnoGogglesMultiTrack(lure, npcs=[]):
    toon = lure['toon']
    if lure.has_key('npc'):
        toon = lure['npc']
    targets = lure['target']
    battle = lure['battle']
    sidestep = lure['sidestep']
    goggles = globalPropPool.getProp('hypno-goggles')
    goggles2 = MovieUtil.copyProp(goggles)
    bothGoggles = [goggles, goggles2]
    pos = Point3(-1.03, 1.04, -0.3)
    hpr = Point3(-96.55, 36.14, -170.59)
    scale = Point3(1.5, 1.5, 1.5)
    hands = toon.getLeftHands()
    gogglesTrack = Sequence(
        Wait(0.6),
        Func(MovieUtil.showProps, bothGoggles, hands, pos, hpr, scale),
        ActorInterval(goggles, 'hypno-goggles', duration=2.2),
        Func(MovieUtil.removeProps, bothGoggles))
    toonTrack = Sequence(ActorInterval(toon, 'hypnotize'),
                         Func(toon.loop, 'neutral'))
    tracks = Parallel(gogglesTrack, toonTrack)
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            revived = target['revived']
            if kbbonus == 1 or hp > 0:
                suitTrack = Sequence()
                suitDelay = 1.6
                suitAnimDuration = 1.5
                opos, ohpr = battle.getActorPosHpr(suit)
                reachDist = MovieUtil.SUIT_LURE_DISTANCE
                reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Wait(suitDelay))
                suitTrack.append(
                    ActorInterval(suit, 'hypnotized', duration=3.1))
                suitTrack.append(Func(suit.setPos, battle, reachPos))
                suitTrack.append(Func(suit.loop, 'neutral'))
                suitTrack.append(Func(battle.lureSuit, suit))
                if hp > 0:
                    suitTrack.append(
                        __createSuitDamageTrack(battle, suit, hp, lure,
                                                trapProp))
                if revived != 0:
                    suitTrack.append(
                        MovieUtil.createSuitReviveTrack(
                            suit, toon, battle, npcs))
                elif died != 0:
                    suitTrack.append(
                        MovieUtil.createSuitDeathTrack(suit, toon, battle,
                                                       npcs))
                tracks.append(suitTrack)
                tracks.append(
                    lerpSuit(suit, suitDelay + 1.7, 0.7, reachPos, battle,
                             trapProp))
        else:
            tracks.append(
                Sequence(Wait(2.3), Func(MovieUtil.indicateMissed, suit, 1.1)))

    tracks.append(getSoundTrack('TL_hypnotize.ogg', delay=0.5, node=toon))
    return tracks
Example #50
0
def __healSmooch(heal, hasInteractivePropHealBonus):
    """ __healSmooch(heal)
    """
    toon = heal['toon']
    target = heal['target']['toon']
    level = heal['level']
    hp = heal['target']['hp']
    ineffective = heal['sidestep']

    # Make a 'sandwich' around the track specific interval
    track = Sequence(__runToHealSpot(heal))

    lipstick = globalPropPool.getProp('lipstick')
    lipstick2 = MovieUtil.copyProp(lipstick)
    lipsticks = [lipstick, lipstick2]
    rightHands = toon.getRightHands()
    dScale = 0.5
    lipstickTrack = Sequence(
        Func(MovieUtil.showProps, lipsticks, rightHands,
             Point3(-0.27, -0.24, -0.95), Point3(-118, -10.6, -25.9)),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_NEARZERO,
                                    MovieUtil.PNT3_ONE),
        Wait(toon.getDuration('smooch') - (2. * dScale)),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_ONE,
                                    MovieUtil.PNT3_NEARZERO),
        Func(MovieUtil.removeProps, lipsticks),
    )

    lips = globalPropPool.getProp('lips')
    dScale = 0.5
    tLips = 2.5
    tThrow = 115. / toon.getFrameRate('smooch')
    dThrow = 0.5

    def getLipPos(toon=toon):
        toon.pose('smooch', 57)
        toon.update(0)
        hand = toon.getRightHands()[0]
        return hand.getPos(render)

    lipsTrack = Sequence(
        Wait(tLips),
        Func(MovieUtil.showProp, lips, render, getLipPos),
        Func(lips.setBillboardPointWorld),
        LerpScaleInterval(lips,
                          dScale,
                          Point3(3, 3, 3),
                          startScale=MovieUtil.PNT3_NEARZERO),
        Wait((tThrow - tLips) - dScale),
        LerpPosInterval(
            lips, dThrow,
            Point3(target.getPos() + Point3(0, 0, target.getHeight()))),
        Func(MovieUtil.removeProp, lips),
    )

    delay = tThrow + dThrow
    mtrack = Parallel(
        lipstickTrack,
        lipsTrack,
        __getSoundTrack(level, 2, node=toon),
        Sequence(ActorInterval(toon, 'smooch'), *__returnToBase(heal)),
        Sequence(Wait(delay), ActorInterval(target, 'conked')),
        Sequence(
            Wait(delay),
            Func(__healToon, target, hp, ineffective,
                 hasInteractivePropHealBonus)),
    )
    track.append(mtrack)
    #track.append(__returnToBase(heal))
    track.append(Func(target.clearChat))
    return track
def __throwGroupPie(throw, delay, groupHitDict):
    toon = throw['toon']
    battle = throw['battle']
    level = throw['level']
    sidestep = throw['sidestep']
    hpbonus = throw['hpbonus']
    numTargets = len(throw['target'])
    avgSuitPos = calcAvgSuitPos(throw)
    origHpr = toon.getHpr(battle)
    toonTrack = Sequence()
    toonFace = Func(toon.headsUp, battle, avgSuitPos)
    toonTrack.append(Wait(delay))
    toonTrack.append(toonFace)
    toonTrack.append(ActorInterval(toon, 'throw'))
    toonTrack.append(Func(toon.loop, 'neutral'))
    toonTrack.append(Func(toon.setHpr, battle, origHpr))
    suits = []
    for i in xrange(numTargets):
        suits.append(throw['target'][i]['suit'])

    pieName = pieNames[level]
    pie = globalPropPool.getProp(pieName)
    pieType = globalPropPool.getPropType(pieName)
    pie2 = MovieUtil.copyProp(pie)
    pies = [pie, pie2]
    hands = toon.getRightHands()
    pieShow = Func(MovieUtil.showProps, pies, hands)
    pieAnim = Func(__animProp, pies, pieName, pieType)
    pieScale1 = LerpScaleInterval(pie, 1.0, pie.getScale() * 1.5, startScale=MovieUtil.PNT3_NEARZERO)
    pieScale2 = LerpScaleInterval(pie2, 1.0, pie2.getScale() * 1.5, startScale=MovieUtil.PNT3_NEARZERO)
    pieScale = Parallel(pieScale1, pieScale2)
    piePreflight = Func(__propPreflightGroup, pies, suits, toon, battle)
    pieTrack = Sequence(Wait(delay), pieShow, pieAnim, pieScale, Func(battle.movie.needRestoreRenderProp, pies[0]), Wait(tPieLeavesHand - 1.0), piePreflight)
    if level == UBER_GAG_LEVEL_INDEX:
        groupPieTracks = __createWeddingCakeFlight(throw, groupHitDict, pie, pies)
    else:
        notify.error('unhandled throw level %d' % level)
    pieTrack.append(groupPieTracks)
    didThrowHitAnyone = False
    for i in xrange(numTargets):
        target = throw['target'][i]
        hitSuit = target['hp'] > 0
        if hitSuit:
            didThrowHitAnyone = True

    soundTrack = __getSoundTrack(level, didThrowHitAnyone, toon)
    groupSuitResponseTrack = Parallel()
    for i in xrange(numTargets):
        target = throw['target'][i]
        suit = target['suit']
        hitSuit = target['hp'] > 0
        leftSuits = target['leftSuits']
        rightSuits = target['rightSuits']
        hp = target['hp']
        kbbonus = target['kbbonus']
        died = target['died']
        revived = target['revived']
        if hitSuit:
            singleSuitResponseTrack = Sequence()
            showDamage = Func(suit.showHpText, -hp, openEnded=0, attackTrack=THROW_TRACK)
            updateHealthBar = Func(suit.updateHealthBar, hp)
            sival = []
            if kbbonus > 0:
                suitPos, suitHpr = battle.getActorPosHpr(suit)
                suitType = getSuitBodyType(suit.getStyleName())
                animTrack = Sequence()
                animTrack.append(ActorInterval(suit, 'pie-small-react', duration=0.2))
                if suitType == 'a':
                    animTrack.append(ActorInterval(suit, 'slip-forward', startTime=2.43))
                elif suitType == 'b':
                    animTrack.append(ActorInterval(suit, 'slip-forward', startTime=1.94))
                elif suitType == 'c':
                    animTrack.append(ActorInterval(suit, 'slip-forward', startTime=2.58))
                animTrack.append(Func(battle.unlureSuit, suit))
                moveTrack = Sequence(Wait(0.2), LerpPosInterval(suit, 0.6, pos=suitPos, other=battle))
                sival = Parallel(animTrack, moveTrack)
            elif groupHitDict[suit.doId] == 1:
                sival = Parallel(ActorInterval(suit, 'pie-small-react'), MovieUtil.createSuitStunInterval(suit, 0.3, 1.3))
            else:
                sival = ActorInterval(suit, 'pie-small-react')
            singleSuitResponseTrack.append(Wait(delay + tPieHitsSuit))
            singleSuitResponseTrack.append(showDamage)
            singleSuitResponseTrack.append(updateHealthBar)
            singleSuitResponseTrack.append(sival)
            bonusTrack = Sequence(Wait(delay + tPieHitsSuit))
            if kbbonus > 0:
                bonusTrack.append(Wait(0.75))
                bonusTrack.append(Func(suit.showHpText, -kbbonus, 2, openEnded=0, attackTrack=THROW_TRACK))
                bonusTrack.append(Func(suit.updateHealthBar, kbbonus))
            if hpbonus > 0:
                bonusTrack.append(Wait(0.75))
                bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0, attackTrack=THROW_TRACK))
                bonusTrack.append(Func(suit.updateHealthBar, hpbonus))
            if revived != 0:
                singleSuitResponseTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle))
            elif died != 0:
                singleSuitResponseTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
            else:
                singleSuitResponseTrack.append(Func(suit.loop, 'neutral'))
            singleSuitResponseTrack = Parallel(singleSuitResponseTrack, bonusTrack)
        else:
            groupHitValues = groupHitDict.values()
            if groupHitValues.count(0) == len(groupHitValues):
                singleSuitResponseTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
            else:
                singleSuitResponseTrack = Sequence(Wait(tPieHitsSuit - 0.1), Func(MovieUtil.indicateMissed, suit, 1.0))
        groupSuitResponseTrack.append(singleSuitResponseTrack)

    return [toonTrack,
     pieTrack,
     soundTrack,
     groupSuitResponseTrack]
Example #52
0
def __doWaterGlass(squirt, delay, fShowStun):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    target = squirt['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    battle = squirt['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    hitSuit = hp > 0
    scale = sprayScales[level]
    dGlassHold = 5.0
    dGlassScale = 0.5
    tSpray = 82.0 / toon.getFrameRate('spit')
    sprayPoseFrame = 88
    dSprayScale = 0.10000000000000001
    dSprayHold = 0.10000000000000001
    tContact = tSpray + dSprayScale
    tSuitDodges = max(tSpray - 0.5, 0.0)
    tracks = Parallel()
    tracks.append(ActorInterval(toon, 'spit'))
    soundTrack = __getSoundTrack(level, hitSuit, 1.7, toon)
    tracks.append(soundTrack)
    glass = globalPropPool.getProp('glass')
    hands = toon.getRightHands()
    hand_jointpath0 = hands[0].attachNewNode('handJoint0-path')
    hand_jointpath1 = hand_jointpath0.instanceTo(hands[1])
    glassTrack = Sequence(Func(MovieUtil.showProp, glass, hand_jointpath0),
                          ActorInterval(glass, 'glass'),
                          Func(hand_jointpath1.removeNode),
                          Func(hand_jointpath0.removeNode),
                          Func(MovieUtil.removeProp, glass))
    tracks.append(glassTrack)

    targetPoint = lambda suit=suit: __suitTargetPoint(suit)

    def getSprayStartPos(toon=toon):
        toon.update(0)
        lod0 = toon.getLOD(toon.getLODNames()[0])
        if base.config.GetBool('want-new-anims', 1):
            if not lod0.find('**/def_head').isEmpty():
                joint = lod0.find('**/def_head')
            else:
                joint = lod0.find('**/joint_head')
        else:
            joint = lod0.find('**/joint_head')
        n = hidden.attachNewNode('pointInFrontOfHead')
        n.reparentTo(toon)
        n.setPos(
            joint.getPos(toon) +
            Point3(0, 0.29999999999999999, -0.20000000000000001))
        p = n.getPos(render)
        n.removeNode()
        del n
        return p

    sprayTrack = MovieUtil.getSprayTrack(battle,
                                         WaterSprayColor,
                                         getSprayStartPos,
                                         targetPoint,
                                         dSprayScale,
                                         dSprayHold,
                                         dSprayScale,
                                         horizScale=scale,
                                         vertScale=scale)
    tracks.append(Sequence(Wait(tSpray), sprayTrack))
    if hp > 0:
        tracks.append(
            __getSplashTrack(targetPoint, scale, tSpray + dSprayScale, battle))

    if hp > 0 or delay <= 0:
        tracks.append(
            __getSuitTrack(suit,
                           tContact,
                           tSuitDodges,
                           hp,
                           hpbonus,
                           kbbonus,
                           'squirt-small-react',
                           died,
                           leftSuits,
                           rightSuits,
                           battle,
                           toon,
                           fShowStun,
                           revived=revived))

    return tracks
def __throwPie(throw, delay, hitCount):
    toon = throw['toon']
    hpbonus = throw['hpbonus']
    target = throw['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    sidestep = throw['sidestep']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    level = throw['level']
    battle = throw['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    notify.debug('toon: %s throws tart at suit: %d for hp: %d died: %d' % (toon.getName(),
     suit.doId,
     hp,
     died))
    pieName = pieNames[level]
    hitSuit = hp > 0
    pie = globalPropPool.getProp(pieName)
    pieType = globalPropPool.getPropType(pieName)
    pie2 = MovieUtil.copyProp(pie)
    pies = [pie, pie2]
    hands = toon.getRightHands()
    splatName = 'splat-' + pieName
    splat = globalPropPool.getProp(splatName)
    splatType = globalPropPool.getPropType(splatName)
    toonTrack = Sequence()
    toonFace = Func(toon.headsUp, battle, suitPos)
    toonTrack.append(Wait(delay))
    toonTrack.append(toonFace)
    toonTrack.append(ActorInterval(toon, 'throw'))
    toonTrack.append(Func(toon.loop, 'neutral'))
    toonTrack.append(Func(toon.setHpr, battle, origHpr))
    pieShow = Func(MovieUtil.showProps, pies, hands)
    pieAnim = Func(__animProp, pies, pieName, pieType)
    pieScale1 = LerpScaleInterval(pie, 1.0, pie.getScale(), startScale=MovieUtil.PNT3_NEARZERO)
    pieScale2 = LerpScaleInterval(pie2, 1.0, pie2.getScale(), startScale=MovieUtil.PNT3_NEARZERO)
    pieScale = Parallel(pieScale1, pieScale2)
    piePreflight = Func(__propPreflight, pies, suit, toon, battle)
    pieTrack = Sequence(Wait(delay), pieShow, pieAnim, pieScale, Func(battle.movie.needRestoreRenderProp, pies[0]), Wait(tPieLeavesHand - 1.0), piePreflight)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    if hitSuit:
        pieFly = LerpPosInterval(pie, tPieHitsSuit - tPieLeavesHand, pos=MovieUtil.avatarFacePoint(suit, other=battle), name=pieFlyTaskName, other=battle)
        pieHide = Func(MovieUtil.removeProps, pies)
        splatShow = Func(__showProp, splat, suit, Point3(0, 0, suit.getHeight()))
        splatBillboard = Func(__billboardProp, splat)
        splatAnim = ActorInterval(splat, splatName)
        splatHide = Func(MovieUtil.removeProp, splat)
        pieTrack.append(pieFly)
        pieTrack.append(pieHide)
        pieTrack.append(Func(battle.movie.clearRenderProp, pies[0]))
        pieTrack.append(splatShow)
        pieTrack.append(splatBillboard)
        pieTrack.append(splatAnim)
        pieTrack.append(splatHide)
    else:
        missDict = {}
        if sidestep:
            suitPoint = MovieUtil.avatarFacePoint(suit, other=battle)
        else:
            suitPoint = __suitMissPoint(suit, other=battle)
        piePreMiss = Func(__piePreMiss, missDict, pie, suitPoint, battle)
        pieMiss = LerpFunctionInterval(__pieMissLerpCallback, extraArgs=[missDict], duration=(tPieHitsSuit - tPieLeavesHand) * ratioMissToHit)
        pieHide = Func(MovieUtil.removeProps, pies)
        pieTrack.append(piePreMiss)
        pieTrack.append(pieMiss)
        pieTrack.append(pieHide)
        pieTrack.append(Func(battle.movie.clearRenderProp, pies[0]))
    if hitSuit:
        suitResponseTrack = Sequence()
        showDamage = Func(suit.showHpText, -hp, openEnded=0, attackTrack=THROW_TRACK)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        sival = []
        if kbbonus > 0:
            suitPos, suitHpr = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animTrack = Sequence()
            animTrack.append(ActorInterval(suit, 'pie-small-react', duration=0.2))
            if suitType == 'a':
                animTrack.append(ActorInterval(suit, 'slip-forward', startTime=2.43))
            elif suitType == 'b':
                animTrack.append(ActorInterval(suit, 'slip-forward', startTime=1.94))
            elif suitType == 'c':
                animTrack.append(ActorInterval(suit, 'slip-forward', startTime=2.58))
            animTrack.append(Func(battle.unlureSuit, suit))
            moveTrack = Sequence(Wait(0.2), LerpPosInterval(suit, 0.6, pos=suitPos, other=battle))
            sival = Parallel(animTrack, moveTrack)
        elif hitCount == 1:
            sival = Parallel(ActorInterval(suit, 'pie-small-react'), MovieUtil.createSuitStunInterval(suit, 0.3, 1.3))
        else:
            sival = ActorInterval(suit, 'pie-small-react')
        suitResponseTrack.append(Wait(delay + tPieHitsSuit))
        suitResponseTrack.append(showDamage)
        suitResponseTrack.append(updateHealthBar)
        suitResponseTrack.append(sival)
        bonusTrack = Sequence(Wait(delay + tPieHitsSuit))
        if kbbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(Func(suit.showHpText, -kbbonus, 2, openEnded=0, attackTrack=THROW_TRACK))
            bonusTrack.append(Func(suit.updateHealthBar, kbbonus))
        if hpbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0, attackTrack=THROW_TRACK))
            bonusTrack.append(Func(suit.updateHealthBar, hpbonus))
        if revived != 0:
            suitResponseTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle))
        elif died != 0:
            suitResponseTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitResponseTrack.append(Func(suit.loop, 'neutral'))
        suitResponseTrack = Parallel(suitResponseTrack, bonusTrack)
    else:
        suitResponseTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
    if not hitSuit and delay > 0:
        return [toonTrack, soundTrack, pieTrack]
    else:
        return [toonTrack,
         soundTrack,
         pieTrack,
         suitResponseTrack]
Example #54
0
def __doFlower(squirt, delay, fShowStun):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    target = squirt['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    battle = squirt['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    hitSuit = hp > 0
    scale = sprayScales[level]
    tTotalFlowerToonAnimationTime = 2.5
    tFlowerFirstAppears = 1.0
    dFlowerScaleTime = 0.5
    tSprayStarts = tTotalFlowerToonAnimationTime
    dSprayScale = 0.20000000000000001
    dSprayHold = 0.10000000000000001
    tContact = tSprayStarts + dSprayScale
    tSuitDodges = tTotalFlowerToonAnimationTime
    tracks = Parallel()
    button = globalPropPool.getProp('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    hands = toon.getLeftHands()
    toonTrack = Sequence(Func(MovieUtil.showProps, buttons, hands),
                         Func(toon.headsUp, battle, suitPos),
                         ActorInterval(toon, 'pushbutton'),
                         Func(MovieUtil.removeProps, buttons),
                         Func(toon.loop, 'neutral'),
                         Func(toon.setHpr, battle, origHpr))
    tracks.append(toonTrack)
    tracks.append(
        __getSoundTrack(level, hitSuit,
                        tTotalFlowerToonAnimationTime - 0.40000000000000002,
                        toon))
    flower = globalPropPool.getProp('squirting-flower')
    flower.setScale(1.5, 1.5, 1.5)

    targetPoint = lambda suit=suit: __suitTargetPoint(suit)

    def getSprayStartPos(flower=flower):
        toon.update(0)
        return flower.getPos(render)

    sprayTrack = MovieUtil.getSprayTrack(battle,
                                         WaterSprayColor,
                                         getSprayStartPos,
                                         targetPoint,
                                         dSprayScale,
                                         dSprayHold,
                                         dSprayScale,
                                         horizScale=scale,
                                         vertScale=scale)
    lodnames = toon.getLODNames()
    toonlod0 = toon.getLOD(lodnames[0])
    toonlod1 = toon.getLOD(lodnames[1])
    if base.config.GetBool('want-new-anims', 1):
        if not toonlod0.find('**/def_joint_attachFlower').isEmpty():
            flower_joint0 = toonlod0.find('**/def_joint_attachFlower')

    else:
        flower_joint0 = toonlod0.find('**/joint_attachFlower')
    if base.config.GetBool('want-new-anims', 1):
        if not toonlod1.find('**/def_joint_attachFlower').isEmpty():
            flower_joint1 = toonlod1.find('**/def_joint_attachFlower')

    else:
        flower_joint1 = toonlod1.find('**/joint_attachFlower')
    flower_jointpath0 = flower_joint0.attachNewNode(
        'attachFlower-InstanceNode')
    flower_jointpath1 = flower_jointpath0.instanceTo(flower_joint1)
    flowerTrack = Sequence(
        Wait(tFlowerFirstAppears), Func(flower.reparentTo, flower_jointpath0),
        LerpScaleInterval(flower,
                          dFlowerScaleTime,
                          flower.getScale(),
                          startScale=MovieUtil.PNT3_NEARZERO),
        Wait(tTotalFlowerToonAnimationTime - dFlowerScaleTime -
             tFlowerFirstAppears))
    if hp <= 0:
        flowerTrack.append(Wait(0.5))

    flowerTrack.append(sprayTrack)
    flowerTrack.append(
        LerpScaleInterval(flower, dFlowerScaleTime, MovieUtil.PNT3_NEARZERO))
    flowerTrack.append(Func(flower_jointpath1.removeNode))
    flowerTrack.append(Func(flower_jointpath0.removeNode))
    flowerTrack.append(Func(MovieUtil.removeProp, flower))
    tracks.append(flowerTrack)
    if hp > 0:
        tracks.append(
            __getSplashTrack(targetPoint, scale, tSprayStarts + dSprayScale,
                             battle))

    if hp > 0 or delay <= 0:
        tracks.append(
            __getSuitTrack(suit,
                           tContact,
                           tSuitDodges,
                           hp,
                           hpbonus,
                           kbbonus,
                           'squirt-small-react',
                           died,
                           leftSuits,
                           rightSuits,
                           battle,
                           toon,
                           fShowStun,
                           revived=revived))

    return tracks
Example #55
0
def doTraps(traps):
    if len(traps) == 0:
        return (None, None)
    suitTrapsDict = {}
    for trap in traps:
        suitId = trap['target']['suit'].doId
        if suitTrapsDict.has_key(suitId):
            suitTrapsDict[suitId].append(trap)
        else:
            suitTrapsDict[suitId] = [trap]

    suitTrapLists = suitTrapsDict.values()
    ivals = []
    for trapList in suitTrapLists:
        trapPropList = []
        for i in range(len(trapList)):
            trap = trapList[i]
            level = trap['level']
            if level == 0:
                banana = globalPropPool.getProp('banana')
                banana2 = MovieUtil.copyProp(banana)
                trapPropList.append([banana, banana2])
            else:
                if level == 1:
                    rake = globalPropPool.getProp('rake')
                    rake2 = MovieUtil.copyProp(rake)
                    rake.pose('rake', 0)
                    rake2.pose('rake', 0)
                    trapPropList.append([rake, rake2])
                else:
                    if level == 2:
                        marbles = globalPropPool.getProp('marbles')
                        marbles2 = MovieUtil.copyProp(marbles)
                        trapPropList.append([marbles, marbles2])
                    else:
                        if level == 3:
                            trapPropList.append(
                                [globalPropPool.getProp('quicksand')])
                        else:
                            if level == 4:
                                trapPropList.append(
                                    [globalPropPool.getProp('trapdoor')])
                            else:
                                if level == 5:
                                    tnt = globalPropPool.getProp('tnt')
                                    tnt2 = MovieUtil.copyProp(tnt)
                                    trapPropList.append([tnt, tnt2])
                                else:
                                    notify.warning(
                                        '__doTraps() - Incorrect trap level:                 %d'
                                        % level)

        if len(trapList) == 1:
            ival = __doTrapLevel(trapList[0], trapPropList[0])
            if ival:
                ivals.append(Track([ival]))
        else:
            subIvals = []
            for i in range(len(trapList)):
                trap = trapList[i]
                trapProps = trapPropList[i]
                ival = __doTrapLevel(trap, trapProps, explode=1)
                if ival:
                    subIvals.append(Track([ival]))

            ivals.append(MultiTrack(subIvals))

    mtrack = MultiTrack(ivals)
    camDuration = mtrack.getDuration()
    camTrack = MovieCamera.chooseTrapShot(traps, camDuration)
    return (mtrack, camTrack)
    return
Example #56
0
def __getSuitTrack(suit,
                   tContact,
                   tDodge,
                   hp,
                   hpbonus,
                   kbbonus,
                   anim,
                   died,
                   leftSuits,
                   rightSuits,
                   battle,
                   toon,
                   fShowStun,
                   beforeStun=0.5,
                   afterStun=1.8,
                   geyser=0,
                   uberRepeat=0,
                   revived=0):
    if hp > 0:
        suitTrack = Sequence()
        sival = ActorInterval(suit, anim)
        sival = []
        if kbbonus > 0 and not geyser:
            (suitPos, suitHpr) = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animTrack = Sequence()
            animTrack.append(
                ActorInterval(suit, anim, duration=0.20000000000000001))
            if suitType == 'a':
                animTrack.append(
                    ActorInterval(suit,
                                  'slip-forward',
                                  startTime=2.4300000000000002))
            elif suitType == 'b':
                animTrack.append(
                    ActorInterval(suit,
                                  'slip-forward',
                                  startTime=1.9399999999999999))
            elif suitType == 'c':
                animTrack.append(
                    ActorInterval(suit,
                                  'slip-forward',
                                  startTime=2.5800000000000001))

            animTrack.append(Func(battle.unlureSuit, suit))
            moveTrack = Sequence(
                Wait(0.20000000000000001),
                LerpPosInterval(suit,
                                0.59999999999999998,
                                pos=suitPos,
                                other=battle))
            sival = Parallel(animTrack, moveTrack)
        elif geyser:
            suitStartPos = suit.getPos()
            suitFloat = Point3(0, 0, 14)
            suitEndPos = Point3(suitStartPos[0] + suitFloat[0],
                                suitStartPos[1] + suitFloat[1],
                                suitStartPos[2] + suitFloat[2])
            suitType = getSuitBodyType(suit.getStyleName())
            if suitType == 'a':
                startFlailFrame = 16
                endFlailFrame = 16
            elif suitType == 'b':
                startFlailFrame = 15
                endFlailFrame = 15
            else:
                startFlailFrame = 15
                endFlailFrame = 15
            sival = Sequence(
                ActorInterval(suit,
                              'slip-backward',
                              playRate=0.5,
                              startFrame=0,
                              endFrame=startFlailFrame - 1),
                Func(suit.pingpong,
                     'slip-backward',
                     fromFrame=startFlailFrame,
                     toFrame=endFlailFrame), Wait(0.5),
                ActorInterval(suit,
                              'slip-backward',
                              playRate=1.0,
                              startFrame=endFlailFrame))
            sUp = LerpPosInterval(suit,
                                  1.1000000000000001,
                                  suitEndPos,
                                  startPos=suitStartPos,
                                  fluid=1)
            sDown = LerpPosInterval(suit,
                                    0.59999999999999998,
                                    suitStartPos,
                                    startPos=suitEndPos,
                                    fluid=1)
        elif fShowStun == 1:
            sival = Parallel(
                ActorInterval(suit, anim),
                MovieUtil.createSuitStunInterval(suit, beforeStun, afterStun))
        else:
            sival = ActorInterval(suit, anim)
        showDamage = Func(suit.showHpText,
                          -hp,
                          openEnded=0,
                          attackTrack=SQUIRT_TRACK)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        suitTrack.append(Wait(tContact))
        suitTrack.append(showDamage)
        suitTrack.append(updateHealthBar)
        if not geyser:
            suitTrack.append(sival)
        elif not uberRepeat:
            geyserMotion = Sequence(sUp, Wait(0.0), sDown)
            suitLaunch = Parallel(sival, geyserMotion)
            suitTrack.append(suitLaunch)
        else:
            suitTrack.append(Wait(5.5))
        bonusTrack = Sequence(Wait(tContact))
        if kbbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(
                Func(suit.showHpText,
                     -kbbonus,
                     2,
                     openEnded=0,
                     attackTrack=SQUIRT_TRACK))

        if hpbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(
                Func(suit.showHpText,
                     -hpbonus,
                     1,
                     openEnded=0,
                     attackTrack=SQUIRT_TRACK))

        if died != 0:
            suitTrack.append(MovieUtil.createSuitDeathTrack(
                suit, toon, battle))
        else:
            suitTrack.append(Func(suit.loop, 'neutral'))
        if revived != 0:
            suitTrack.append(
                MovieUtil.createSuitReviveTrack(suit, toon, battle))

        return Parallel(suitTrack, bonusTrack)
    else:
        return MovieUtil.createSuitDodgeMultitrack(tDodge, suit, leftSuits,
                                                   rightSuits)
Example #57
0
def __doFireHose(squirt, delay, fShowStun):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    target = squirt['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    battle = squirt['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    hitSuit = hp > 0
    scale = 0.29999999999999999
    tAppearDelay = 0.69999999999999996
    dHoseHold = 0.69999999999999996
    dAnimHold = 5.0999999999999996
    tSprayDelay = 2.7999999999999998
    tSpray = 0.20000000000000001
    dSprayScale = 0.10000000000000001
    dSprayHold = 1.8
    tContact = 2.8999999999999999
    tSuitDodges = 2.1000000000000001
    tracks = Parallel()
    toonTrack = Sequence(Wait(tAppearDelay), Func(toon.headsUp, battle,
                                                  suitPos),
                         ActorInterval(toon, 'firehose'),
                         Func(toon.loop, 'neutral'),
                         Func(toon.setHpr, battle, origHpr))
    tracks.append(toonTrack)
    soundTrack = __getSoundTrack(level, hitSuit, tSprayDelay, toon)
    tracks.append(soundTrack)
    hose = globalPropPool.getProp('firehose')
    hydrant = globalPropPool.getProp('hydrant')
    hose.reparentTo(hydrant)
    (hose.pose('firehose', 2), )
    hydrantNode = toon.attachNewNode('hydrantNode')
    hydrantNode.clearTransform(toon.getGeomNode().getChild(0))
    hydrantScale = hydrantNode.attachNewNode('hydrantScale')
    hydrant.reparentTo(hydrantScale)
    toon.pose('firehose', 30)
    toon.update(0)
    torso = toon.getPart('torso', '1000')
    if toon.style.torso[0] == 'm':
        hydrant.setPos(torso, 0, 0, -1.8500000000000001)
    else:
        hydrant.setPos(torso, 0, 0, -1.45)
    hydrant.setPos(0, 0, hydrant.getZ())
    base = hydrant.find('**/base')
    base.setColor(1, 1, 1, 0.5)
    base.setPos(toon, 0, 0, 0)
    toon.loop('neutral')

    targetPoint = lambda suit=suit: __suitTargetPoint(suit)

    def getSprayStartPos(hose=hose, toon=toon, targetPoint=targetPoint):
        toon.update(0)
        if hose.isEmpty() == 1:
            if callable(targetPoint):
                return targetPoint()
            else:
                return targetPoint

        joint = hose.find('**/joint_water_stream')
        n = hidden.attachNewNode('pointBehindSprayProp')
        n.reparentTo(toon)
        n.setPos(joint.getPos(toon) + Point3(0, -0.55000000000000004, 0))
        p = n.getPos(render)
        n.removeNode()
        del n
        return p

    sprayTrack = Sequence()
    sprayTrack.append(Wait(tSprayDelay))
    sprayTrack.append(
        MovieUtil.getSprayTrack(battle,
                                WaterSprayColor,
                                getSprayStartPos,
                                targetPoint,
                                dSprayScale,
                                dSprayHold,
                                dSprayScale,
                                horizScale=scale,
                                vertScale=scale))
    tracks.append(sprayTrack)
    hydrantNode.detachNode()
    propTrack = Sequence(
        Func(battle.movie.needRestoreRenderProp, hydrantNode),
        Func(hydrantNode.reparentTo, toon),
        LerpScaleInterval(hydrantScale,
                          tAppearDelay * 0.5,
                          Point3(1, 1, 1.3999999999999999),
                          startScale=Point3(1, 1, 0.01)),
        LerpScaleInterval(hydrantScale,
                          tAppearDelay * 0.29999999999999999,
                          Point3(1, 1, 0.80000000000000004),
                          startScale=Point3(1, 1, 1.3999999999999999)),
        LerpScaleInterval(hydrantScale,
                          tAppearDelay * 0.10000000000000001,
                          Point3(1, 1, 1.2),
                          startScale=Point3(1, 1, 0.80000000000000004)),
        LerpScaleInterval(hydrantScale,
                          tAppearDelay * 0.10000000000000001,
                          Point3(1, 1, 1),
                          startScale=Point3(1, 1, 1.2)),
        ActorInterval(hose, 'firehose', duration=dAnimHold),
        Wait(dHoseHold - 0.20000000000000001),
        LerpScaleInterval(hydrantScale,
                          0.20000000000000001,
                          Point3(1, 1, 0.01),
                          startScale=Point3(1, 1, 1)),
        Func(MovieUtil.removeProps, [hydrantNode, hose]),
        Func(battle.movie.clearRenderProp, hydrantNode))
    tracks.append(propTrack)
    if hp > 0:
        tracks.append(
            __getSplashTrack(targetPoint,
                             0.40000000000000002,
                             2.7000000000000002,
                             battle,
                             splashHold=1.5))

    if hp > 0 or delay <= 0:
        tracks.append(
            __getSuitTrack(suit,
                           tContact,
                           tSuitDodges,
                           hp,
                           hpbonus,
                           kbbonus,
                           'squirt-small-react',
                           died,
                           leftSuits,
                           rightSuits,
                           battle,
                           toon,
                           fShowStun,
                           revived=revived))

    return tracks
Example #58
0
def __doSeltzerBottle(squirt, delay, fShowStun):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    target = squirt['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    battle = squirt['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    hitSuit = hp > 0
    scale = sprayScales[level]
    tBottle = 0.0
    dBottleScale = 0.5
    dBottleHold = 3.0
    tSpray = 53.0 / toon.getFrameRate('hold-bottle') + 0.050000000000000003
    dSprayScale = 0.20000000000000001
    dSprayHold = 0.10000000000000001
    tContact = tSpray + dSprayScale
    tSuitDodges = max(tContact - 0.69999999999999996, 0.0)
    tracks = Parallel()
    toonTrack = Sequence(Func(toon.headsUp, battle, suitPos),
                         ActorInterval(toon, 'hold-bottle'),
                         Func(toon.loop, 'neutral'),
                         Func(toon.setHpr, battle, origHpr))
    tracks.append(toonTrack)
    soundTrack = __getSoundTrack(level, hitSuit, tSpray - 0.10000000000000001,
                                 toon)
    tracks.append(soundTrack)
    bottle = globalPropPool.getProp('bottle')
    hands = toon.getRightHands()

    targetPoint = lambda suit=suit: __suitTargetPoint(suit)

    def getSprayStartPos(bottle=bottle, toon=toon):
        toon.update(0)
        joint = bottle.find('**/joint_toSpray')
        n = hidden.attachNewNode('pointBehindSprayProp')
        n.reparentTo(toon)
        n.setPos(joint.getPos(toon) + Point3(0, -0.40000000000000002, 0))
        p = n.getPos(render)
        n.removeNode()
        del n
        return p

    sprayTrack = MovieUtil.getSprayTrack(battle,
                                         WaterSprayColor,
                                         getSprayStartPos,
                                         targetPoint,
                                         dSprayScale,
                                         dSprayHold,
                                         dSprayScale,
                                         horizScale=scale,
                                         vertScale=scale)
    hand_jointpath0 = hands[0].attachNewNode('handJoint0-path')
    hand_jointpath1 = hand_jointpath0.instanceTo(hands[1])
    bottleTrack = Sequence(
        Func(MovieUtil.showProp, bottle, hand_jointpath0),
        LerpScaleInterval(bottle,
                          dBottleScale,
                          bottle.getScale(),
                          startScale=MovieUtil.PNT3_NEARZERO),
        Wait(tSpray - dBottleScale))
    bottleTrack.append(sprayTrack)
    bottleTrack.append(Wait(dBottleHold))
    bottleTrack.append(
        LerpScaleInterval(bottle, dBottleScale, MovieUtil.PNT3_NEARZERO))
    bottleTrack.append(Func(hand_jointpath1.removeNode))
    bottleTrack.append(Func(hand_jointpath0.removeNode))
    bottleTrack.append(Func(MovieUtil.removeProp, bottle))
    tracks.append(bottleTrack)
    if hp > 0:
        tracks.append(
            __getSplashTrack(targetPoint, scale, tSpray + dSprayScale, battle))

    if (hp > 0 or delay <= 0) and suit:
        tracks.append(
            __getSuitTrack(suit,
                           tContact,
                           tSuitDodges,
                           hp,
                           hpbonus,
                           kbbonus,
                           'squirt-small-react',
                           died,
                           leftSuits,
                           rightSuits,
                           battle,
                           toon,
                           fShowStun,
                           revived=revived))

    return tracks
def doFanfare(delay, toon, panel):
    fanfareNode = toon.attachNewNode('fanfareNode')
    partyBall = fanfareNode.attachNewNode('partyBall')
    headparts = toon.getHeadParts()
    pos = headparts[2].getPos(fanfareNode)
    partyBallLeft = globalPropPool.getProp('partyBall')
    partyBallLeft.reparentTo(partyBall)
    partyBallLeft.setScale(0.80000000000000004)
    partyBallLeft.setH(90)
    partyBallLeft.setColorScale(1, 0, 0, 0)
    partyBallRight = globalPropPool.getProp('partyBall')
    partyBallRight.reparentTo(partyBall)
    partyBallRight.setScale(0.80000000000000004)
    partyBallRight.setH(-90)
    partyBallRight.setColorScale(1, 1, 0, 0)
    partyBall.setZ(pos.getZ() + 3.2000000000000002)
    ballShake1 = Sequence(Parallel(LerpHprInterval(partyBallLeft, duration = 0.20000000000000001, startHpr = Vec3(90, 0, 0), hpr = Vec3(90, 10, 0), blendType = 'easeInOut'), LerpHprInterval(partyBallRight, duration = 0.20000000000000001, startHpr = Vec3(-90, 0, 0), hpr = Vec3(-90, -10, 0), blendType = 'easeInOut')), Parallel(LerpHprInterval(partyBallLeft, duration = 0.20000000000000001, startHpr = Vec3(90, 10, 0), hpr = Vec3(90, -10, 0), blendType = 'easeInOut'), LerpHprInterval(partyBallRight, duration = 0.20000000000000001, startHpr = Vec3(-90, -10, 0), hpr = Vec3(-90, 10, 0), blendType = 'easeInOut')), Parallel(LerpHprInterval(partyBallLeft, duration = 0.20000000000000001, startHpr = Vec3(90, -10, 0), hpr = Vec3(90, 0, 0), blendType = 'easeInOut'), LerpHprInterval(partyBallRight, duration = 0.20000000000000001, startHpr = Vec3(-90, 10, 0), hpr = Vec3(-90, 0, 0), blendType = 'easeInOut')))
    ballShake2 = Sequence(Parallel(LerpHprInterval(partyBallLeft, duration = 0.20000000000000001, startHpr = Vec3(90, 0, 0), hpr = Vec3(90, -10, 0), blendType = 'easeInOut'), LerpHprInterval(partyBallRight, duration = 0.20000000000000001, startHpr = Vec3(-90, 0, 0), hpr = Vec3(-90, 10, 0), blendType = 'easeInOut')), Parallel(LerpHprInterval(partyBallLeft, duration = 0.20000000000000001, startHpr = Vec3(90, -10, 0), hpr = Vec3(90, 10, 0), blendType = 'easeInOut'), LerpHprInterval(partyBallRight, duration = 0.20000000000000001, startHpr = Vec3(-90, 10, 0), hpr = Vec3(-90, -10, 0), blendType = 'easeInOut')), Parallel(LerpHprInterval(partyBallLeft, duration = 0.20000000000000001, startHpr = Vec3(90, 10, 0), hpr = Vec3(90, 0, 0), blendType = 'easeInOut'), LerpHprInterval(partyBallRight, duration = 0.20000000000000001, startHpr = Vec3(-90, -10, 0), hpr = Vec3(-90, 0, 0), blendType = 'easeInOut')))
    openBall = Parallel(LerpHprInterval(partyBallLeft, duration = 0.20000000000000001, startHpr = Vec3(90, 0, 0), hpr = Vec3(90, 30, 0)), LerpHprInterval(partyBallRight, duration = 0.20000000000000001, startHpr = Vec3(-90, 0, 0), hpr = Vec3(-90, 30, 0)))
    confettiNode = fanfareNode.attachNewNode('confetti')
    confettiNode.setScale(3)
    confettiNode.setZ(pos.getZ() + 2.5)
    
    def longshake(models, num, duration):
        inShake = getScaleBlendIntervals(models, duration = duration, startScale = 0.23000000000000001, endScale = 0.20000000000000001, blendType = 'easeInOut')
        outShake = getScaleBlendIntervals(models, duration = duration, startScale = 0.20000000000000001, endScale = 0.23000000000000001, blendType = 'easeInOut')
        i = 1
        seq = Sequence()
        while i < num:
            if i % 2 == 0:
                seq.append(inShake)
            else:
                seq.append(outShake)
            i += 1
        return seq

    
    def getScaleBlendIntervals(props, duration, startScale, endScale, blendType):
        tracks = Parallel()
        for prop in props:
            tracks.append(LerpScaleInterval(prop, duration, endScale, startScale = startScale, blendType = blendType))
        
        return tracks

    trumpetNode = fanfareNode.attachNewNode('trumpetNode')
    trumpet1 = globalPropPool.getProp('bugle')
    trumpet2 = MovieUtil.copyProp(trumpet1)
    trumpet1.reparentTo(trumpetNode)
    trumpet1.setScale(0.20000000000000001)
    trumpet1.setPos(2, 2, 1)
    trumpet1.setHpr(120, 65, 0)
    trumpet2.reparentTo(trumpetNode)
    trumpet2.setScale(0.20000000000000001)
    trumpet2.setPos(-2, 2, 1)
    trumpet2.setHpr(-120, 65, 0)
    trumpetNode.setTransparency(1)
    trumpetNode.setColor(1, 1, 1, 0)
    trumpturn1 = LerpHprInterval(trumpet1, duration = 4, startHpr = Vec3(80, 15, 0), hpr = Vec3(150, 40, 0))
    trumpturn2 = LerpHprInterval(trumpet2, duration = 4, startHpr = Vec3(-80, 15, 0), hpr = Vec3(-150, 40, 0))
    trumpetTurn = Parallel(trumpturn1, trumpturn2)
    BattleParticles.loadParticles()
    confettiBlue = BattleParticles.createParticleEffect('Confetti')
    confettiBlue.reparentTo(confettiNode)
    blue_p0 = confettiBlue.getParticlesNamed('particles-1')
    blue_p0.renderer.getColorInterpolationManager().addConstant(0.0, 1.0, Vec4(0.0, 0.0, 1.0, 1.0), 1)
    confettiYellow = BattleParticles.createParticleEffect('Confetti')
    confettiYellow.reparentTo(confettiNode)
    yellow_p0 = confettiYellow.getParticlesNamed('particles-1')
    yellow_p0.renderer.getColorInterpolationManager().addConstant(0.0, 1.0, Vec4(1.0, 1.0, 0.0, 1.0), 1)
    confettiRed = BattleParticles.createParticleEffect('Confetti')
    confettiRed.reparentTo(confettiNode)
    red_p0 = confettiRed.getParticlesNamed('particles-1')
    red_p0.renderer.getColorInterpolationManager().addConstant(0.0, 1.0, Vec4(1.0, 0.0, 0.0, 1.0), 1)
    trumpetsAppear = LerpColorInterval(trumpetNode, 0.29999999999999999, startColor = Vec4(1, 1, 0, 0), color = Vec4(1, 1, 0, 1))
    trumpetsVanish = LerpColorInterval(trumpetNode, 0.29999999999999999, startColor = Vec4(1, 1, 0, 1), color = Vec4(1, 1, 0, 0))
    crabHorn = globalBattleSoundCache.getSound('King_Crab.mp3')
    drumroll = globalBattleSoundCache.getSound('SZ_MM_drumroll.mp3')
    fanfare = globalBattleSoundCache.getSound('SZ_MM_fanfare.mp3')
    crabHorn.setTime(1.5)
    partyBall.setTransparency(1)
    partyBall.setColorScale(1, 1, 1, 1)
    ballAppear = Parallel(LerpColorScaleInterval(partyBallLeft, 0.29999999999999999, startColorScale = Vec4(1, 0, 0, 0), colorScale = Vec4(1, 0, 0, 1)), LerpColorScaleInterval(partyBallRight, 0.29999999999999999, startColorScale = Vec4(1, 1, 0, 0), colorScale = Vec4(1, 1, 0, 1)))
    ballVanish = Parallel(LerpColorScaleInterval(partyBallLeft, 0.29999999999999999, startColorScale = Vec4(1, 0, 0, 1), colorScale = Vec4(1, 0, 0, 0)), LerpColorScaleInterval(partyBallRight, 0.29999999999999999, startColorScale = Vec4(1, 1, 0, 1), colorScale = Vec4(1, 1, 0, 0)))
    play = Parallel(SoundInterval(crabHorn, startTime = 1.5, duration = 4.0, node = toon), Sequence(Wait(0.25), longshake([
        trumpet1,
        trumpet2], 3, 0.20000000000000001), Wait(0.5), longshake([
        trumpet1,
        trumpet2], 3, 0.20000000000000001), Wait(0.5), longshake([
        trumpet1,
        trumpet2], 9, 0.10000000000000001), longshake([
        trumpet1,
        trumpet2], 3, 0.20000000000000001)))
    killParticles = Parallel(Func(blue_p0.setLitterSize, 0), Func(red_p0.setLitterSize, 0), Func(yellow_p0.setLitterSize, 0))
    p = Parallel(ParticleInterval(confettiBlue, confettiNode, worldRelative = 0, duration = 3, cleanup = True), ParticleInterval(confettiRed, confettiNode, worldRelative = 0, duration = 3, cleanup = True), ParticleInterval(confettiYellow, confettiNode, worldRelative = 0, duration = 3, cleanup = True))
    pOff = Parallel(Func(confettiBlue.remove), Func(confettiRed.remove), Func(confettiYellow.remove))
    partInterval = Parallel(p, Sequence(Wait(1.7), killParticles, Wait(1.3), pOff, Func(p.finish)), Sequence(Wait(3), Parallel(ballVanish)))
    seq1 = Parallel(Sequence(Wait(delay + 4.0999999999999996), SoundInterval(drumroll, node = toon), Wait(0.25), SoundInterval(fanfare, node = toon)), Sequence(Wait(delay), trumpetsAppear, Wait(3), ballAppear, Wait(0.5), ballShake1, Wait(0.10000000000000001), ballShake2, Wait(0.20000000000000001), Wait(0.10000000000000001), Parallel(openBall, partInterval), Func(fanfareNode.remove)))
    seq = Parallel(seq1, Sequence(Wait(delay), Parallel(trumpetTurn, Sequence(Wait(0.5), play)), Wait(0.5), trumpetsVanish))
    if panel != None:
        return (seq, panel)
    
    return (seq, None)
Example #60
0
def __doStormCloud(squirt, delay, fShowStun):
    toon = squirt['toon']
    level = squirt['level']
    hpbonus = squirt['hpbonus']
    target = squirt['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    battle = squirt['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    hitSuit = hp > 0
    scale = sprayScales[level]
    tButton = 0.0
    dButtonScale = 0.5
    dButtonHold = 3.0
    tContact = 2.8999999999999999
    tSpray = 1
    tSuitDodges = 1.8
    tracks = Parallel()
    soundTrack = __getSoundTrack(level, hitSuit, 2.2999999999999998, toon)
    soundTrack2 = __getSoundTrack(level, hitSuit, 4.5999999999999996, toon)
    tracks.append(soundTrack)
    tracks.append(soundTrack2)
    button = globalPropPool.getProp('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    hands = toon.getLeftHands()
    toonTrack = Sequence(Func(MovieUtil.showProps, buttons, hands),
                         Func(toon.headsUp, battle, suitPos),
                         ActorInterval(toon, 'pushbutton'),
                         Func(MovieUtil.removeProps, buttons),
                         Func(toon.loop, 'neutral'),
                         Func(toon.setHpr, battle, origHpr))
    tracks.append(toonTrack)
    cloud = globalPropPool.getProp('stormcloud')
    cloud2 = MovieUtil.copyProp(cloud)
    BattleParticles.loadParticles()
    trickleEffect = BattleParticles.createParticleEffect(
        file='trickleLiquidate')
    rainEffect = BattleParticles.createParticleEffect(file='liquidate')
    rainEffect2 = BattleParticles.createParticleEffect(file='liquidate')
    rainEffect3 = BattleParticles.createParticleEffect(file='liquidate')
    cloudHeight = suit.height + 3
    cloudPosPoint = Point3(0, 0, cloudHeight)
    scaleUpPoint = Point3(3, 3, 3)
    rainEffects = [rainEffect, rainEffect2, rainEffect3]
    rainDelay = 1
    effectDelay = 0.29999999999999999
    if hp > 0:
        cloudHold = 4.7000000000000002
    else:
        cloudHold = 1.7

    def getCloudTrack(cloud,
                      suit,
                      cloudPosPoint,
                      scaleUpPoint,
                      rainEffects,
                      rainDelay,
                      effectDelay,
                      cloudHold,
                      useEffect,
                      battle=battle,
                      trickleEffect=trickleEffect):
        track = Sequence(
            Func(MovieUtil.showProp, cloud, suit, cloudPosPoint),
            Func(cloud.pose, 'stormcloud', 0),
            LerpScaleInterval(cloud,
                              1.5,
                              scaleUpPoint,
                              startScale=MovieUtil.PNT3_NEARZERO),
            Wait(rainDelay))
        if useEffect == 1:
            ptrack = Parallel()
            delay = cloudHold * 0.25
            trickleDuration = cloudHold * 0.25
            trickleTrack = Sequence(
                Func(battle.movie.needRestoreParticleEffect, trickleEffect),
                ParticleInterval(trickleEffect,
                                 cloud,
                                 worldRelative=0,
                                 duration=trickleDuration,
                                 cleanup=True),
                Func(battle.movie.clearRestoreParticleEffect, trickleEffect))
            track.append(trickleTrack)
            for i in range(0, 3):
                dur = cloudHold - 2 * trickleDuration
                ptrack.append(
                    Sequence(
                        Func(battle.movie.needRestoreParticleEffect,
                             rainEffects[i]), Wait(delay),
                        ParticleInterval(rainEffects[i],
                                         cloud,
                                         worldRelative=0,
                                         duration=dur,
                                         cleanup=True),
                        Func(battle.movie.clearRestoreParticleEffect,
                             rainEffects[i])))
                delay += effectDelay

            ptrack.append(
                Sequence(
                    Wait(3 * effectDelay),
                    ActorInterval(cloud,
                                  'stormcloud',
                                  startTime=1,
                                  duration=cloudHold)))
            track.append(ptrack)
        else:
            track.append(
                ActorInterval(cloud,
                              'stormcloud',
                              startTime=1,
                              duration=cloudHold))
        track.append(LerpScaleInterval(cloud, 0.5, MovieUtil.PNT3_NEARZERO))
        track.append(Func(MovieUtil.removeProp, cloud))
        return track

    tracks.append(
        getCloudTrack(cloud,
                      suit,
                      cloudPosPoint,
                      scaleUpPoint,
                      rainEffects,
                      rainDelay,
                      effectDelay,
                      cloudHold,
                      useEffect=1))
    tracks.append(
        getCloudTrack(cloud2,
                      suit,
                      cloudPosPoint,
                      scaleUpPoint,
                      rainEffects,
                      rainDelay,
                      effectDelay,
                      cloudHold,
                      useEffect=0))
    if hp > 0 or delay <= 0:
        tracks.append(
            __getSuitTrack(suit,
                           tContact,
                           tSuitDodges,
                           hp,
                           hpbonus,
                           kbbonus,
                           'soak',
                           died,
                           leftSuits,
                           rightSuits,
                           battle,
                           toon,
                           fShowStun,
                           beforeStun=2.6000000000000001,
                           afterStun=2.2999999999999998,
                           revived=revived))

    return tracks