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 __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 __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
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
Exemple #5
0
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
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
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 fShowStun == 1:
            sival = Parallel(Func(suit.loop, anim),
                             MovieUtil.zapCog(suit, beforeStun, afterStun))
        else:
            sival = ActorInterval(suit, anim)
        showDamage = Func(suit.showHpText,
                          -hp,
                          openEnded=0,
                          attackTrack=ZAP_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 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.createSuitZaplessMultiTrack(suit, 2.5)
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
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
Exemple #10
0
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target,
                      npcs):
    toon = drop['toon']
    if 'npc' in drop:
        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:
            node = suit.getGeomNode().getChild(0)
            suitFlatten = Sequence(
                Parallel(
                    LerpHprInterval(node,
                                    2,
                                    Vec3(0.0, 0.0, 0.0),
                                    blendType='easeInOut'),
                    LerpScaleInterval(node,
                                      2,
                                      VBase3(1, 0.05, 1),
                                      blendType='easeInOut')))
            gotHitSound = globalBattleSoundCache.getSound(
                'AA_drop_boat_cog.ogg')

            suitGettingHit.append(SoundInterval(gotHitSound, node=toon))
            suitGettingHit.append(suitFlatten)
            suitGettingHit.append(
                Sequence(
                    Wait(2.7),
                    LerpScaleInterval(node,
                                      2,
                                      VBase3(1, 1, 1),
                                      blendType='easeInOut')))
        suitTrack.append(suitGettingHit)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Sequence(
                Wait(delay + tObjectAppears + 0.75),
                Func(suit.showHpText, -hpbonus, 1, openEnded=0),
                Func(suit.updateHealthBar, hpbonus))
        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
Exemple #11
0
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']
    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)
    toonIvals = []
    toonFace = FunctionInterval(toon.headsUp, extraArgs=[battle, suitPos])
    toonIvals.append((delay, toonFace))
    toonIvals.append(ActorInterval(toon, 'throw'))
    toonIvals.append(FunctionInterval(toon.loop, extraArgs=['neutral']))
    toonIvals.append(FunctionInterval(toon.setHpr, extraArgs=[battle, origHpr]))
    toonTrack = Track(toonIvals)
    pieIntervals = []
    pieShow = FunctionInterval(MovieUtil.showProps, extraArgs=[pies, hands])
    pieAnim = FunctionInterval(__animProp, extraArgs=[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 = MultiTrack([Track([pieScale1]), Track([pieScale2])])
    piePreflight = FunctionInterval(__propPreflight, extraArgs=[pies, suit, toon, battle])
    pieIntervals.append((delay, pieShow))
    pieIntervals.append(pieAnim)
    pieIntervals.append(pieScale)
    pieIntervals.append(FunctionInterval(battle.movie.needRestoreRenderProp, extraArgs=[pies[0]]))
    pieIntervals.append((delay + tPieLeavesHand, piePreflight))
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    if hitSuit:
        pieFly = LerpPosInterval(pie, tPieHitsSuit - tPieLeavesHand, pos=MovieUtil.avatarFacePoint(suit, other=battle), name=pieFlyTaskName, other=battle)
        pieHide = FunctionInterval(MovieUtil.removeProps, extraArgs=[pies])
        splatShow = FunctionInterval(__showProp, extraArgs=[splat, suit, Point3(0, 0, suit.getHeight())])
        splatBillboard = FunctionInterval(__billboardProp, extraArgs=[splat])
        splatAnim = ActorInterval(splat, splatName)
        splatHide = FunctionInterval(MovieUtil.removeProp, extraArgs=[splat])
        pieIntervals.append((delay + tPieLeavesHand, pieFly))
        pieIntervals.append(pieHide)
        pieIntervals.append(FunctionInterval(battle.movie.clearRenderProp, extraArgs=[pies[0]]))
        pieIntervals.append(splatShow)
        pieIntervals.append(splatBillboard)
        pieIntervals.append(splatAnim)
        pieIntervals.append(splatHide)
    else:
        missDict = {}
        if sidestep:
            suitPoint = MovieUtil.avatarFacePoint(suit, other=battle)
        else:
            suitPoint = __suitMissPoint(suit, other=battle)
        piePreMiss = FunctionInterval(__piePreMiss, extraArgs=[missDict, pie, suitPoint, battle])
        pieMiss = LerpFunctionInterval(__pieMissLerpCallback, extraArgs=[missDict], duration=(tPieHitsSuit - tPieLeavesHand) * ratioMissToHit)
        pieHide = FunctionInterval(MovieUtil.removeProps, extraArgs=[pies])
        pieIntervals.append((delay + tPieLeavesHand, piePreMiss))
        pieIntervals.append(pieMiss)
        pieIntervals.append(pieHide)
        pieIntervals.append(FunctionInterval(battle.movie.clearRenderProp, extraArgs=[pies[0]]))
    pieTrack = Track(pieIntervals)
    if hitSuit:
        suitIntervals = []
        showDamage = FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar, extraArgs=[hp])
        sival = []
        if kbbonus > 0:
            suitPos, suitHpr = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animIvals = []
            animIvals.append(ActorInterval(suit, 'pie-small-react', duration=0.2))
            if suitType == 'a':
                animIvals.append(ActorInterval(suit, 'slip-forward', startTime=2.43))
            else:
                if suitType == 'b':
                    animIvals.append(ActorInterval(suit, 'slip-forward', startTime=1.94, duration=1.03))
                else:
                    if suitType == 'c':
                        animIvals.append(ActorInterval(suit, 'slip-forward', startTime=2.58))
            animIvals.append(Func(battle.unlureSuit, suit))
            animTrack = Track(animIvals)
            moveTrack = Track([WaitInterval(0.2), LerpPosInterval(suit, 0.6, pos=suitPos, other=battle)])
            sival = MultiTrack([animTrack, moveTrack])
        else:
            if hitCount == 1:
                sival = Parallel(ActorInterval(suit, 'pie-small-react'), MovieUtil.createSuitStunInterval(suit, 0.3, 1.3))
            else:
                sival = ActorInterval(suit, 'pie-small-react')
        suitIntervals.append((delay + tPieHitsSuit, showDamage))
        suitIntervals.append(updateHealthBar)
        suitIntervals.append(sival)
        bonusTrack = None
        bonusIvals = []
        if kbbonus > 0:
            bonusIvals.append((delay + tPieHitsSuit + 0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-kbbonus, 2])))
        if hpbonus > 0:
            if kbbonus > 0:
                bonusIvals.append((0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hpbonus, 1]), PREVIOUS_END))
            else:
                bonusIvals.append((delay + tPieHitsSuit + 0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hpbonus, 1])))
        if len(bonusIvals) > 0:
            bonusTrack = Track(bonusIvals)
        if died != 0:
            suitIntervals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitIntervals.append(FunctionInterval(suit.loop, extraArgs=['neutral']))
        if bonusTrack == None:
            suitResponseTrack = Track(suitIntervals)
        else:
            suitResponseTrack = MultiTrack([Track(suitIntervals), 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]
    return
Exemple #12
0
def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet=1):
    toon = lure['toon']
    battle = lure['battle']
    sidestep = lure['sidestep']
    targets = lure['target']
    tracks = Parallel()

    # Create a track for the toon
    tracks.append(Sequence(
        ActorInterval(toon, 'hold-magnet'),
        Func(toon.loop, 'neutral'),
        ))

    # Create a track for the magnet
    hands = toon.getLeftHands()
    magnet2 = MovieUtil.copyProp(magnet)
    magnets = [magnet, magnet2]
    magnetTrack = Sequence(
        Wait(0.7), # Wait before showing the magnet
        Func(MovieUtil.showProps, magnets,
             hands, pos, hpr, scale),
        Wait(6.3), # Wait while magnet is being used
        Func(MovieUtil.removeProps, magnets))
    tracks.append(magnetTrack)

    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        # See if lure succeeds
        if (sidestep == 0):
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            revived = target['revived']
            # See if suit animates to this particular lure (or another one that
            # also succeeds on the same suit)
            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 range(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))
                elif (died != 0):
                    suitTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))

                tracks.append(suitTrack)
                # Must lerp the suit during the magnet animation
                tracks.append(lerpSuit(suit, suitDelay+0.55+shakeTotalDuration,
                                       suitMoveDuration, reachPos, battle, trapProp))
        else: # If lure fails
            tracks.append(Sequence(Wait(3.7),
                                   Func(MovieUtil.indicateMissed, suit)))

    if (isSmallMagnet == 1): # using the small magnet
        tracks.append(getSoundTrack('TL_small_magnet.mp3', delay=0.7, node=toon))
    else:
        tracks.append(getSoundTrack('TL_large_magnet.mp3', delay=0.7, node=toon))

    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
    if pieName == 'wedding-cake':
        splatName = 'splat-birthday-cake'
    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)
        notify.warning('Current HP:' + str(hp))
        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, kbbonus))
        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]
Exemple #14
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.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 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.1,
                                  suitEndPos,
                                  startPos=suitStartPos,
                                  fluid=1)
            sDown = LerpPosInterval(suit,
                                    0.6,
                                    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)
Exemple #15
0
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),
        # Slowly lower dollar in front of the suit
        getSplicedLerpAnimsTrack(dollar, dollarName, 0.7, 2.0, startTime=3),
        # Quickly rip the dollar away before the suit has a change to grab it
        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), # Face toon
        ActorInterval(toon, 'battlecast'), # perform the casting animation
        Func(toon.loop, 'neutral'), # Face toon
        )
    
    tracks = Parallel(dollarTrack, poleTrack, toonTrack)
    # See if lure succeeds
    if (sidestep == 0):
        # See if suit animates to this particular lure (or another one that
        # also succeeds on the same suit)
        if (kbbonus == 1 or hp > 0):
            suitTrack = Sequence()
            opos, ohpr = battle.getActorPosHpr(suit)
            # The suit travels during the reach animation, so we must renew 
            # its position to where it ends up after reaching
            reachDist = MovieUtil.SUIT_LURE_DISTANCE
            reachPos = Point3(opos[0], opos[1]-reachDist, opos[2])
            suitTrack.append(Func(suit.loop, 'neutral'))
            # Wait before reaching for the dollar
            suitTrack.append(Wait(3.5))

            # Special case, if the suit is "big and tall" (type C and not
            # 'mm' or 'sc'), then the suit appears to travel more during the
            # reach animation (3.5 instead of 2.6).  Therefore, we must
            # actually push these suits back slightly as they move forward to
            # make sure they get to the correct spot but still look right
            # doing so
            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)# Reach for the dollar
                suitTrack.append(Parallel(moveTrack, reachTrack))
            else: # Otherwise just do the reach animation with no 
                  # artificial movement
                suitTrack.append(ActorInterval(suit, 'reach',
                        duration=reachAnimDuration)) # Reach for the dollar

            # Be sure to reparent the trapProp properly away from the
            # suit during movement and then back to the suit once
            # completed
            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: # If the lure fails
        tracks.append(Sequence(Wait(3.7),
                               Func(MovieUtil.indicateMissed, suit)))
    tracks.append(getSoundTrack('TL_fishing_pole.mp3', delay=0.5, node=toon))
        
    return tracks
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.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 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.1, suitEndPos, startPos=suitStartPos, fluid=1)
            sDown = LerpPosInterval(suit, 0.6, 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)
Exemple #17
0
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']
    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)

    dollarIvals = []
    dollarIvals.append(
        FunctionInterval(positionDollar, extraArgs=[dollar, suit]))
    dollarAnims = []
    dollarAnims.append(
        FunctionInterval(dollar.wrtReparentTo, extraArgs=[battle]))
    dollarAnims.append(ActorInterval(dollar, dollarName, duration=3))
    dollarAnims.extend(
        getSplicedLerpAnims(dollar, dollarName, 0.7, 2.0, startTime=3))
    dollarAnims.append(LerpPosInterval(dollar, 0.2, Point3(0, -10, 7)))
    dollarIvals.extend(dollarAnims)
    dollarIvals.append(
        FunctionInterval(MovieUtil.removeProp, extraArgs=[dollar]))
    dollarTrack = Track(dollarIvals)
    poleIvals = []
    poleIvals.append(
        FunctionInterval(MovieUtil.showProps, extraArgs=[poles, hands]))
    poleIvals.append(ActorInterval(pole, 'fishing-pole'))
    poleIvals.append(FunctionInterval(MovieUtil.removeProps,
                                      extraArgs=[poles]))
    poleTrack = Track(poleIvals)
    toonTrack = Track([
        FunctionInterval(toon.headsUp, extraArgs=[battle, targetPos]),
        ActorInterval(toon, 'cast'),
        FunctionInterval(toon.loop, extraArgs=['neutral'])
    ])
    tracks = [dollarTrack, poleTrack, toonTrack]
    if sidestep == 0:
        if kbbonus == 1 or hp > 0:
            suitIvals = []
            opos, ohpr = battle.getActorPosHpr(suit)
            reachDist = MovieUtil.SUIT_LURE_DISTANCE
            reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
            suitIvals.append(FunctionInterval(suit.loop,
                                              extraArgs=['neutral']))
            suitIvals.append(WaitInterval(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 = Track(
                    [ActorInterval(suit, 'reach', duration=reachAnimDuration)])
                suitIvals.append(MultiTrack([moveTrack, reachTrack]))
            else:
                suitIvals.append(
                    ActorInterval(suit, 'reach', duration=reachAnimDuration))
            if trapProp:
                suitIvals.append(
                    FunctionInterval(trapProp.wrtReparentTo,
                                     extraArgs=[battle]))
            suitIvals.append(
                FunctionInterval(suit.setPos, extraArgs=[battle, reachPos]))
            if trapProp:
                suitIvals.append(
                    FunctionInterval(trapProp.wrtReparentTo, extraArgs=[suit]))
                suit.battleTrapProp = trapProp
            suitIvals.append(FunctionInterval(suit.loop,
                                              extraArgs=['neutral']))
            suitIvals.append(
                FunctionInterval(battle.lureSuit, extraArgs=[suit]))
            if hp > 0:
                suitIvals.append(
                    __createSuitDamageTrack(battle, suit, hp, lure, trapProp))
            if died != 0:
                suitIvals.append(
                    MovieUtil.createSuitDeathTrack(suit, toon, battle))
            tracks.append(Track(suitIvals))
    else:
        tracks.append(
            Track([(3.7,
                    FunctionInterval(MovieUtil.indicateMissed,
                                     extraArgs=[suit]))]))
    tracks.append(getSoundTrack('TL_fishing_pole.mp3', delay=0.5, node=toon))
    return MultiTrack(tracks)
Exemple #18
0
def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet=1):
    toon = lure['toon']
    battle = lure['battle']
    sidestep = lure['sidestep']
    targets = lure['target']
    tracks = []
    tracks.append(
        Track([
            ActorInterval(toon, 'hold-magnet'),
            FunctionInterval(toon.loop, extraArgs=['neutral'])
        ]))
    hands = toon.getLeftHands()
    magnet2 = MovieUtil.copyProp(magnet)
    magnets = [magnet, magnet2]
    magnetIvals = []
    magnetIvals.append(WaitInterval(0.7))
    magnetIvals.append(
        FunctionInterval(MovieUtil.showProps,
                         extraArgs=[magnets, hands, pos, hpr, scale]))
    magnetIvals.append(WaitInterval(6.3))
    magnetIvals.append(
        FunctionInterval(MovieUtil.removeProps, extraArgs=[magnets]))
    tracks.append(Track(magnetIvals))
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            if kbbonus == 1 or hp > 0:
                suitDelay = 2.6
                suitMoveDuration = 0.8
                suitIvals = []
                opos, ohpr = battle.getActorPosHpr(suit)
                reachDist = MovieUtil.SUIT_LURE_DISTANCE
                reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
                numShakes = 3.0
                shakeTotalDuration = 0.8
                shakeDuration = shakeTotalDuration / numShakes
                suitAnims = []
                suitAnims.append(
                    FunctionInterval(suit.loop, extraArgs=['neutral']))
                suitAnims.append(WaitInterval(suitDelay))
                suitAnims.append(
                    ActorInterval(suit,
                                  'landing',
                                  startTime=2.37,
                                  endTime=1.82))
                for i in range(0, numShakes):
                    suitAnims.append(
                        ActorInterval(suit,
                                      'landing',
                                      startTime=1.82,
                                      endTime=1.16,
                                      duration=shakeDuration))

                suitAnims.append(
                    ActorInterval(suit, 'landing', startTime=1.16,
                                  endTime=0.7))
                suitAnims.append(
                    ActorInterval(suit, 'landing', startTime=0.7,
                                  duration=1.3))
                suitIvals.extend(suitAnims)
                suitIvals.append(
                    FunctionInterval(suit.loop, extraArgs=['neutral']))
                suitIvals.append(
                    FunctionInterval(battle.lureSuit, extraArgs=[suit]))
                if hp > 0:
                    suitIvals.append(
                        __createSuitDamageTrack(battle, suit, hp, lure,
                                                trapProp))
                if died != 0:
                    suitIvals.append(
                        MovieUtil.createSuitDeathTrack(suit, toon, battle))
                tracks.append(Track(suitIvals))
                tracks.append(
                    lerpSuit(suit, suitDelay + 0.55 + shakeTotalDuration,
                             suitMoveDuration, reachPos, battle, trapProp))
        else:
            tracks.append(
                Track([(3.7,
                        FunctionInterval(MovieUtil.indicateMissed,
                                         extraArgs=[suit]))]))

    if isSmallMagnet == 1:
        tracks.append(
            getSoundTrack('TL_small_magnet.mp3', delay=0.7, node=toon))
    else:
        tracks.append(
            getSoundTrack('TL_large_magnet.mp3', delay=0.7, node=toon))
    return MultiTrack(tracks)
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, '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))
            if died != 0:
                if not (trapProp.getName() == 'tnt' and suit.maxHP <= 42):
                    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
Exemple #20
0
def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased):
    toon = drop['toon']
    hpbonus = drop['hpbonus']
    target = drop['target']
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    battle = drop['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    majorObject = level >= 3
    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.84999999999999998)
    
    node = object.node()
    node.setBound(OmniBoundingVolume())
    node.setFinal(1)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    toonIntervals = []
    toonFace = FunctionInterval(toon.headsUp, extraArgs = [
        battle,
        suitPos])
    toonIntervals.append((delay, toonFace))
    toonIntervals.append(ActorInterval(toon, 'pushbutton'))
    toonIntervals.append(FunctionInterval(toon.loop, extraArgs = [
        'neutral']))
    toonIntervals.append(FunctionInterval(toon.setHpr, extraArgs = [
        battle,
        origHpr]))
    toonTrack = Track(toonIntervals)
    buttonIntervals = []
    buttonShow = FunctionInterval(MovieUtil.showProps, extraArgs = [
        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 = FunctionInterval(MovieUtil.removeProps, extraArgs = [
        buttons])
    buttonIntervals.append((delay, buttonShow))
    buttonIntervals.append(buttonScaleUp)
    buttonIntervals.append(WaitInterval(2.5))
    buttonIntervals.append(buttonScaleDown)
    buttonIntervals.append(buttonHide)
    buttonTrack = Track(buttonIntervals)
    objIntervals = []
    
    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])

    objIntervals.append(FunctionInterval(battle.movie.needRestoreRenderProp, extraArgs = [
        object]))
    objInit = FunctionInterval(posObject, extraArgs = [
        object,
        suit,
        level,
        majorObject,
        hp <= 0])
    objIntervals.append((delay + tObjectAppears, objInit))
    if hp > 0 and level == 1 or level == 2:
        animProp = ActorInterval(object, objName)
        trackObjAnimate = Track([
            animProp])
        shrinkProp = LerpScaleInterval(object, dShrink, Point3(0.01, 0.01, 0.01), startScale = object.getScale())
        trackObjShrink = Track([
            (animProp.getDuration() - dShrink, shrinkProp)])
        objAnimShrink = MultiTrack([
            trackObjAnimate,
            trackObjShrink])
        objIntervals.append(objAnimShrink)
    else:
        animProp = ActorInterval(object, objName, duration = landFrames[level] / 24.0)
        
        def poseProp(prop, animName, level):
            prop.pose(animName, landFrames[level])

        poseProp = FunctionInterval(poseProp, extraArgs = [
            object,
            objName,
            level])
        wait = WaitInterval(1.0)
        shrinkProp = LerpScaleInterval(object, dShrinkOnMiss, Point3(0.01, 0.01, 0.01), startScale = object.getScale())
        objIntervals.append(animProp)
        objIntervals.append(poseProp)
        objIntervals.append(wait)
        objIntervals.append(shrinkProp)
    objIntervals.append(FunctionInterval(MovieUtil.removeProp, extraArgs = [
        object]))
    objIntervals.append(FunctionInterval(battle.movie.clearRenderProp, extraArgs = [
        object]))
    objectTrack = Track(objIntervals)
    dropShadow = MovieUtil.copyProp(suit.getShadowJoints()[0])
    if level == 0:
        dropShadow.setScale(0.5)
    elif level <= 2:
        dropShadow.setScale(0.80000000000000004)
    elif level == 3:
        dropShadow.setScale(2.0)
    elif level == 4:
        dropShadow.setScale(2.2999999999999998)
    else:
        dropShadow.setScale(3.6000000000000001)
    
    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 = Track([
        WaitInterval(delay + tButtonPressed),
        FunctionInterval(battle.movie.needRestoreRenderProp, extraArgs = [
            dropShadow]),
        FunctionInterval(posShadow),
        LerpScaleInterval(dropShadow, tObjectAppears - tButtonPressed, dropShadow.getScale(), startScale = Point3(0.01, 0.01, 0.01)),
        WaitInterval(0.29999999999999999),
        FunctionInterval(MovieUtil.removeProp, extraArgs = [
            dropShadow]),
        FunctionInterval(battle.movie.clearRenderProp, extraArgs = [
            dropShadow])])
    if hp > 0:
        suitIntervals = []
        showDamage = FunctionInterval(suit.showLaffNumber, openEnded = 0, extraArgs = [
            -hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar, extraArgs = [
            hp])
        if majorObject:
            anim = 'flatten'
        else:
            anim = 'drop-react'
        suitReact = ActorInterval(suit, anim)
        suitIntervals.append((delay + tObjectAppears, showDamage))
        suitIntervals.append(updateHealthBar)
        suitIntervals.append(suitReact)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Track([
                (delay + tObjectAppears + 0.75, FunctionInterval(suit.showLaffNumber, openEnded = 0, extraArgs = [
                    -hpbonus,
                    1]))])
        
        if died != 0:
            suitIntervals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitIntervals.append(FunctionInterval(suit.loop, extraArgs = [
                'neutral']))
        if bonusTrack == None:
            suitTrack = Track(suitIntervals)
        else:
            suitTrack = MultiTrack([
                Track(suitIntervals),
                bonusTrack])
    elif kbbonus == 0:
        suitTrack = Track([
            (delay + tObjectAppears, FunctionInterval(MovieUtil.indicateMissed, extraArgs = [
                suit,
                0.59999999999999998])),
            FunctionInterval(suit.loop, extraArgs = [
                'neutral'])])
    elif alreadyDodged > 0:
        return [
            toonTrack,
            soundTrack,
            buttonTrack,
            objectTrack,
            shadowTrack]
    
    if level >= 3:
        if alreadyTeased > 0:
            return [
                toonTrack,
                soundTrack,
                buttonTrack,
                objectTrack,
                shadowTrack]
        else:
            suitTrack = Track([
                MovieUtil.createSuitTeaseMultiTrack(suit, delay = delay + tObjectAppears)])
    else:
        suitTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
    return [
        toonTrack,
        soundTrack,
        buttonTrack,
        objectTrack,
        shadowTrack,
        suitTrack]
Exemple #21
0
def __createHypnoGogglesMultiTrack(lure, npcs=[]):
    toon = lure['toon']
    if 'npc' in lure:
        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)
    hasAppendedImmune = 0
    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, 'lured'))
                suitTrack.append(Wait(suitDelay))
                LureRoundsTrack = Func(suit.showHpText,
                                       AvLureRounds[5],
                                       openEnded=0,
                                       attackTrack=LURE_TRACK)
                if hasAppendedImmune == 0:
                    for immuneSuit in battle.activeSuits:
                        if immuneSuit.getImmuneStatus() == 1:
                            ImmuneLureText = Func(immuneSuit.showHpText,
                                                  number=-1)
                            suitTrack.append(ImmuneLureText)
                            hasAppendedImmune = 1
                            print('hasAppendedImmune: %s' % hasAppendedImmune)
                suitTrack.append(LureRoundsTrack)
                suitTrack.append(
                    ActorInterval(suit, 'hypnotized', duration=3.1))
                suitTrack.append(Func(suit.setPos, battle, reachPos))
                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 suit.isVirtual and died != 0:
                    suitTrack.append(
                        MovieUtil.createVirtualDeathTrack(suit, toon, battle))
                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
Exemple #22
0
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.30)
    hpr = Point3(-96.55, 36.14, -170.59)
    scale = Point3(1.5, 1.5, 1.5)
    hands = toon.getLeftHands()

    gogglesTrack = Sequence(
        Wait(0.6), # Wait a bit to appear
        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)
    
    #print "hypno!!!!"
    #print targets

    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        # See if lure succeeds
        if (sidestep == 0):
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            revived = target['revived']
            # See if suit animates to this particular lure (or another one that
            # also succeeds on the same suit)
            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'))
                # Wait before being hypnotized
                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)
                # Must lerp the suit during the hypnotize animation
                tracks.append(lerpSuit(suit, suitDelay+1.7, 0.7, reachPos,
                                        battle, trapProp))
        else: # If lure fails
            tracks.append(Sequence(Wait(2.3),
                                   Func(MovieUtil.indicateMissed, suit, 1.1)))
    tracks.append(getSoundTrack('TL_hypnotize.mp3', delay=0.5, node=toon))
    

    return tracks
Exemple #23
0
def __getSuitTrack(suit,
                   tContact,
                   tDodge,
                   hp,
                   hpbonus,
                   kbbonus,
                   anim,
                   died,
                   leftSuits,
                   rightSuits,
                   battle,
                   toon,
                   fShowStun,
                   beforeStun=0.5,
                   afterStun=1.8):
    if hp > 0:
        suitIvals = []
        sival = ActorInterval(suit, anim)
        sival = []
        if kbbonus > 0:
            suitPos, suitHpr = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animIvals = []
            animIvals.append(ActorInterval(suit, anim, duration=0.2))
            if suitType == 'a':
                animIvals.append(
                    ActorInterval(suit, 'slip-forward', startTime=2.43))
            else:
                if suitType == 'b':
                    animIvals.append(
                        ActorInterval(suit,
                                      'slip-forward',
                                      startTime=1.94,
                                      duration=1.03))
                else:
                    if suitType == 'c':
                        animIvals.append(
                            ActorInterval(suit, 'slip-forward',
                                          startTime=2.58))
            animIvals.append(Func(battle.unlureSuit, suit))
            animTrack = Track(animIvals)
            moveTrack = Track([
                WaitInterval(0.2),
                LerpPosInterval(suit, 0.6, pos=suitPos, other=battle)
            ])
            sival = MultiTrack([animTrack, moveTrack])
        else:
            if fShowStun == 1:
                sival = Parallel(
                    ActorInterval(suit, anim),
                    MovieUtil.createSuitStunInterval(suit, beforeStun,
                                                     afterStun))
            else:
                sival = ActorInterval(suit, anim)
        showDamage = FunctionInterval(suit.showLaffNumber,
                                      openEnded=0,
                                      extraArgs=[-hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar,
                                           extraArgs=[hp])
        suitIvals.append((tContact, showDamage))
        suitIvals.append(updateHealthBar)
        suitIvals.append(sival)
        bonusTrack = None
        bonusIvals = []
        if kbbonus > 0:
            bonusIvals.append((tContact + 0.75,
                               FunctionInterval(suit.showLaffNumber,
                                                openEnded=0,
                                                extraArgs=[-kbbonus, 2])))
        if hpbonus > 0:
            if kbbonus > 0:
                bonusIvals.append(
                    (0.75,
                     FunctionInterval(suit.showLaffNumber,
                                      openEnded=0,
                                      extraArgs=[-hpbonus, 1]), PREVIOUS_END))
            else:
                bonusIvals.append((tContact + 0.75,
                                   FunctionInterval(suit.showLaffNumber,
                                                    openEnded=0,
                                                    extraArgs=[-hpbonus, 1])))
        if len(bonusIvals) > 0:
            bonusTrack = Track(bonusIvals)
        if died != 0:
            suitIvals.append(MovieUtil.createSuitDeathTrack(
                suit, toon, battle))
        else:
            suitIvals.append(FunctionInterval(suit.loop,
                                              extraArgs=['neutral']))
        if bonusTrack == None:
            return Track(suitIvals)
        else:
            return MultiTrack([Track(suitIvals), bonusTrack])
    else:
        return MovieUtil.createSuitDodgeMultitrack(tDodge, suit, leftSuits,
                                                   rightSuits)
    return
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs):
    toon = drop['toon']
    if 'npc' in drop:
        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:
            node = suit.getGeomNode().getChild(0)
            suitFlatten = Sequence(
                Parallel(
                    LerpHprInterval(node, 2, Vec3(0.0, 0.0, 0.0), blendType='easeInOut'),
                    LerpScaleInterval(node, 2, VBase3(1, 0.05, 1), blendType='easeInOut')
                )
            )
            gotHitSound = globalBattleSoundCache.getSound('AA_drop_boat_cog.ogg')

            suitGettingHit.append(SoundInterval(gotHitSound, node=toon))
            suitGettingHit.append(suitFlatten)
            suitGettingHit.append(Sequence(
                Wait(2.7), LerpScaleInterval(node, 2, VBase3(1, 1, 1), blendType='easeInOut'))
            )
        suitTrack.append(suitGettingHit)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Sequence(Wait(delay + tObjectAppears + 0.75), Func(suit.showHpText, -hpbonus, 1, openEnded=0), Func(suit.updateHealthBar, hpbonus))
        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
Exemple #25
0
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, '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:
                    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
Exemple #26
0
def __getSuitTrack(
    suit,
    tContact,
    tDodge,
    hp,
    hpbonus,
    kbbonus,
    anim,
    died,
    leftSuits,
    rightSuits,
    battle,
    toon,
    fShowStun,
    beforeStun=0.5,
    afterStun=1.8,
):
    if hp > 0:
        suitIvals = []
        sival = ActorInterval(suit, anim)
        sival = []
        if kbbonus > 0:
            (suitPos, suitHpr) = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animIvals = []
            animIvals.append(ActorInterval(suit, anim, duration=0.20000000000000001))
            if suitType == "a":
                animIvals.append(ActorInterval(suit, "slip-forward", startTime=2.4300000000000002))
            elif suitType == "b":
                animIvals.append(ActorInterval(suit, "slip-forward", startTime=1.9399999999999999, duration=1.03))
            elif suitType == "c":
                animIvals.append(ActorInterval(suit, "slip-forward", startTime=2.5800000000000001))

            animIvals.append(Func(battle.unlureSuit, suit))
            animTrack = Track(animIvals)
            moveTrack = Track(
                [
                    WaitInterval(0.20000000000000001),
                    LerpPosInterval(suit, 0.59999999999999998, pos=suitPos, other=battle),
                ]
            )
            sival = MultiTrack([animTrack, moveTrack])
        elif fShowStun == 1:
            sival = Parallel(ActorInterval(suit, anim), MovieUtil.createSuitStunInterval(suit, beforeStun, afterStun))
        else:
            sival = ActorInterval(suit, anim)
        showDamage = FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar, extraArgs=[hp])
        suitIvals.append((tContact, showDamage))
        suitIvals.append(updateHealthBar)
        suitIvals.append(sival)
        bonusTrack = None
        bonusIvals = []
        if kbbonus > 0:
            bonusIvals.append(
                (tContact + 0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-kbbonus, 2]))
            )

        if hpbonus > 0:
            if kbbonus > 0:
                bonusIvals.append(
                    (0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hpbonus, 1]), PREVIOUS_END)
                )
            else:
                bonusIvals.append(
                    (tContact + 0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hpbonus, 1]))
                )

        if len(bonusIvals) > 0:
            bonusTrack = Track(bonusIvals)

        if died != 0:
            suitIvals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitIvals.append(FunctionInterval(suit.loop, extraArgs=["neutral"]))
        if bonusTrack == None:
            return Track(suitIvals)
        else:
            return MultiTrack([Track(suitIvals), bonusTrack])
    else:
        return MovieUtil.createSuitDodgeMultitrack(tDodge, suit, leftSuits, rightSuits)
Exemple #27
0
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))
            if hpbonus > 0:
                bonusTrack.append(Wait(0.75))
                bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0, attackTrack=THROW_TRACK))
            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]
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, '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 + 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
Exemple #29
0
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
    if pieName == 'wedding-cake':
        splatName = 'splat-birthday-cake'
    splat = globalPropPool.getProp(splatName)
    splatType = globalPropPool.getPropType(splatName)

    # make the toon throw the pie
    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))

    # take the pie from the toon and make it fly
    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:
        # make the pie fly up to the suit's face and disappear
        pieFly = LerpPosInterval(pie,
                                 tPieHitsSuit - tPieLeavesHand,
                                 pos=MovieUtil.avatarFacePoint(suit,
                                                               other=battle),
                                 name=pieFlyTaskName,
                                 other=battle)
        pieHide = Func(MovieUtil.removeProps, pies)
        # play the splat animation
        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:
        # the suit is going to dodge, or we missed
        # make the pie fly past the suit's face, and shrink to nothing
        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)
        # If the suit gets knocked back, animate it
        # No stun animation shown here
        sival = []  # Suit interval of its animation
        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))
            # Be sure to unlure the suit so it doesn't walk back (already knocked back)
            animTrack.append(Func(battle.unlureSuit, suit))

            moveTrack = Sequence(
                Wait(0.2),
                LerpPosInterval(suit, 0.6, pos=suitPos, other=battle),
            )
            sival = Parallel(animTrack, moveTrack)
        else:
            if (hitCount == 1):
                sival = Parallel(
                    ActorInterval(suit, 'pie-small-react'),
                    MovieUtil.createSuitStunInterval(suit, 0.3, 1.3),
                )
            else:
                sival = ActorInterval(suit, 'pie-small-react')
            #sival = ActorInterval(suit, 'pie-small-react')
        suitResponseTrack.append(Wait(delay + tPieHitsSuit))
        suitResponseTrack.append(showDamage)
        suitResponseTrack.append(updateHealthBar)
        suitResponseTrack.append(sival)
        # Make a bonus track for any hp bonus
        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))
        if (hpbonus > 0):
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(
                Func(suit.showHpText,
                     -hpbonus,
                     1,
                     openEnded=0,
                     attackTrack=THROW_TRACK))

        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:
        # suit dodges
        # other suits may need to dodge as well
        suitResponseTrack = MovieUtil.createSuitDodgeMultitrack(
            delay + tSuitDodges, suit, leftSuits, rightSuits)

    # Since it's possible for there to be simultaneous throws, we only
    # want the suit to dodge one time at most.  Thus if the suit is
    # not hit (dodges) and that dodge is not from the first dodge
    # (which has delay=0) then we don't add another suit reaction.
    # Otherwise, we add the suit track as normal

    if (not hitSuit and delay > 0):
        return [toonTrack, soundTrack, pieTrack]
    else:
        return [toonTrack, soundTrack, pieTrack, suitResponseTrack]
Exemple #30
0
def __createHypnoGogglesMultiTrack(lure):
    toon = lure['toon']
    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(97.65, 46.18, -97.25)
    scale = Point3(1.5, 1.5, 1.5)
    hands = toon.getLeftHands()
    gogglesIvals = []
    gogglesIvals.append(WaitInterval(0.6))
    gogglesIvals.append(
        FunctionInterval(MovieUtil.showProps,
                         extraArgs=[bothGoggles, hands, pos, hpr, scale]))
    gogglesIvals.append(ActorInterval(goggles, 'hypno-goggles', duration=2.2))
    gogglesIvals.append(
        FunctionInterval(MovieUtil.removeProps, extraArgs=[bothGoggles]))
    gogglesTrack = Track(gogglesIvals)
    toonTrack = Track([
        ActorInterval(toon, 'hypnotize'),
        FunctionInterval(toon.loop, extraArgs=['neutral'])
    ])
    tracks = [gogglesTrack, toonTrack]
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            if kbbonus == 1 or hp > 0:
                suitIvals = []
                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])
                suitIvals.append(
                    FunctionInterval(suit.loop, extraArgs=['neutral']))
                suitIvals.append(WaitInterval(suitDelay))
                suitIvals.append(
                    ActorInterval(suit, 'hypnotized', duration=3.1))
                suitIvals.append(
                    FunctionInterval(suit.setPos, extraArgs=[battle,
                                                             reachPos]))
                suitIvals.append(
                    FunctionInterval(suit.loop, extraArgs=['neutral']))
                suitIvals.append(
                    FunctionInterval(battle.lureSuit, extraArgs=[suit]))
                if hp > 0:
                    suitIvals.append(
                        __createSuitDamageTrack(battle, suit, hp, lure,
                                                trapProp))
                if died != 0:
                    suitIvals.append(
                        MovieUtil.createSuitDeathTrack(suit, toon, battle))
                tracks.append(Track(suitIvals))
                tracks.append(
                    lerpSuit(suit, suitDelay + 1.7, 0.7, reachPos, battle,
                             trapProp))
        else:
            tracks.append(
                Track([(2.3,
                        FunctionInterval(MovieUtil.indicateMissed,
                                         extraArgs=[suit, 1.1]))]))

    tracks.append(getSoundTrack('TL_hypnotize.mp3', delay=0.5, node=toon))
    return MultiTrack(tracks)
Exemple #31
0
def __throwGroupPie(throw, delay, groupHitDict):
    """
    TODO this can be made to __throwGroupPie and wedding cake stuff is called in a diff function
    """
    toon = throw['toon']
    battle = throw['battle']
    level = throw['level']
    sidestep = throw['sidestep']
    hpbonus = throw['hpbonus']
    numTargets = len(throw['target'])

    avgSuitPos = calcAvgSuitPos(throw)

    # make the toon throw the wedding cake
    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))

    # take the pie from the toon and make it fly
    suits = []
    for i in range(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,
    )

    #create the pie flight interval
    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 range(numTargets):
        target = throw['target'][i]
        hitSuit = (target['hp'] > 0)
        if hitSuit:
            didThrowHitAnyone = True
    soundTrack = __getSoundTrack(level, didThrowHitAnyone, toon)

    groupSuitResponseTrack = Parallel()
    #handle the suit response
    for i in range(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)
            # If the suit gets knocked back, animate it
            # No stun animation shown here
            sival = []  # Suit interval of its animation
            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))
                # Be sure to unlure the suit so it doesn't walk back (already knocked back)
                animTrack.append(Func(battle.unlureSuit, suit))

                moveTrack = Sequence(
                    Wait(0.2),
                    LerpPosInterval(suit, 0.6, pos=suitPos, other=battle),
                )
                sival = Parallel(animTrack, moveTrack)
            else:
                if (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')
                #sival = ActorInterval(suit, 'pie-small-react')
            singleSuitResponseTrack.append(Wait(delay + tPieHitsSuit))
            singleSuitResponseTrack.append(showDamage)
            singleSuitResponseTrack.append(updateHealthBar)
            singleSuitResponseTrack.append(sival)

            # Make a bonus track for any hp bonus
            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))
            if (hpbonus > 0):
                bonusTrack.append(Wait(0.75))
                bonusTrack.append(
                    Func(suit.showHpText,
                         -hpbonus,
                         1,
                         openEnded=0,
                         attackTrack=THROW_TRACK))

            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:
            #if none of the group throws hit at all, we can do a dodge
            groupHitValues = groupHitDict.values()
            if groupHitValues.count(0) == len(groupHitValues):
                singleSuitResponseTrack = MovieUtil.createSuitDodgeMultitrack(
                    delay + tSuitDodges, suit, leftSuits, rightSuits)
            else:
                #because all the group pies fire at the same time, do not dodge at all
                #in case one toon hits and another toon misses
                singleSuitResponseTrack = Sequence(
                    Wait(tPieHitsSuit - 0.1),
                    Func(MovieUtil.indicateMissed, suit, 1.0))

        groupSuitResponseTrack.append(singleSuitResponseTrack)

    return [toonTrack, pieTrack, soundTrack, groupSuitResponseTrack]
Exemple #32
0
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, '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))
            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
def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased):
    toon = drop['toon']
    hpbonus = drop['hpbonus']
    target = drop['target']
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    battle = drop['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    majorObject = level >= 3
    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.84999999999999998)

    node = object.node()
    node.setBound(OmniBoundingVolume())
    node.setFinal(1)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    toonIntervals = []
    toonFace = FunctionInterval(toon.headsUp, extraArgs=[battle, suitPos])
    toonIntervals.append((delay, toonFace))
    toonIntervals.append(ActorInterval(toon, 'pushbutton'))
    toonIntervals.append(FunctionInterval(toon.loop, extraArgs=['neutral']))
    toonIntervals.append(
        FunctionInterval(toon.setHpr, extraArgs=[battle, origHpr]))
    toonTrack = Track(toonIntervals)
    buttonIntervals = []
    buttonShow = FunctionInterval(MovieUtil.showProps,
                                  extraArgs=[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 = FunctionInterval(MovieUtil.removeProps, extraArgs=[buttons])
    buttonIntervals.append((delay, buttonShow))
    buttonIntervals.append(buttonScaleUp)
    buttonIntervals.append(WaitInterval(2.5))
    buttonIntervals.append(buttonScaleDown)
    buttonIntervals.append(buttonHide)
    buttonTrack = Track(buttonIntervals)
    objIntervals = []

    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])

    objIntervals.append(
        FunctionInterval(battle.movie.needRestoreRenderProp,
                         extraArgs=[object]))
    objInit = FunctionInterval(
        posObject, extraArgs=[object, suit, level, majorObject, hp <= 0])
    objIntervals.append((delay + tObjectAppears, objInit))
    if hp > 0 and level == 1 or level == 2:
        animProp = ActorInterval(object, objName)
        trackObjAnimate = Track([animProp])
        shrinkProp = LerpScaleInterval(object,
                                       dShrink,
                                       Point3(0.01, 0.01, 0.01),
                                       startScale=object.getScale())
        trackObjShrink = Track([(animProp.getDuration() - dShrink, shrinkProp)
                                ])
        objAnimShrink = MultiTrack([trackObjAnimate, trackObjShrink])
        objIntervals.append(objAnimShrink)
    else:
        animProp = ActorInterval(object,
                                 objName,
                                 duration=landFrames[level] / 24.0)

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

        poseProp = FunctionInterval(poseProp,
                                    extraArgs=[object, objName, level])
        wait = WaitInterval(1.0)
        shrinkProp = LerpScaleInterval(object,
                                       dShrinkOnMiss,
                                       Point3(0.01, 0.01, 0.01),
                                       startScale=object.getScale())
        objIntervals.append(animProp)
        objIntervals.append(poseProp)
        objIntervals.append(wait)
        objIntervals.append(shrinkProp)
    objIntervals.append(
        FunctionInterval(MovieUtil.removeProp, extraArgs=[object]))
    objIntervals.append(
        FunctionInterval(battle.movie.clearRenderProp, extraArgs=[object]))
    objectTrack = Track(objIntervals)
    dropShadow = MovieUtil.copyProp(suit.getShadowJoints()[0])
    if level == 0:
        dropShadow.setScale(0.5)
    elif level <= 2:
        dropShadow.setScale(0.80000000000000004)
    elif level == 3:
        dropShadow.setScale(2.0)
    elif level == 4:
        dropShadow.setScale(2.2999999999999998)
    else:
        dropShadow.setScale(3.6000000000000001)

    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 = Track([
        WaitInterval(delay + tButtonPressed),
        FunctionInterval(battle.movie.needRestoreRenderProp,
                         extraArgs=[dropShadow]),
        FunctionInterval(posShadow),
        LerpScaleInterval(dropShadow,
                          tObjectAppears - tButtonPressed,
                          dropShadow.getScale(),
                          startScale=Point3(0.01, 0.01, 0.01)),
        WaitInterval(0.29999999999999999),
        FunctionInterval(MovieUtil.removeProp, extraArgs=[dropShadow]),
        FunctionInterval(battle.movie.clearRenderProp, extraArgs=[dropShadow])
    ])
    if hp > 0:
        suitIntervals = []
        showDamage = FunctionInterval(suit.showLaffNumber,
                                      openEnded=0,
                                      extraArgs=[-hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar,
                                           extraArgs=[hp])
        if majorObject:
            anim = 'flatten'
        else:
            anim = 'drop-react'
        suitReact = ActorInterval(suit, anim)
        suitIntervals.append((delay + tObjectAppears, showDamage))
        suitIntervals.append(updateHealthBar)
        suitIntervals.append(suitReact)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Track([(delay + tObjectAppears + 0.75,
                                 FunctionInterval(suit.showLaffNumber,
                                                  openEnded=0,
                                                  extraArgs=[-hpbonus, 1]))])

        if died != 0:
            suitIntervals.append(
                MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitIntervals.append(
                FunctionInterval(suit.loop, extraArgs=['neutral']))
        if bonusTrack == None:
            suitTrack = Track(suitIntervals)
        else:
            suitTrack = MultiTrack([Track(suitIntervals), bonusTrack])
    elif kbbonus == 0:
        suitTrack = Track([
            (delay + tObjectAppears,
             FunctionInterval(MovieUtil.indicateMissed,
                              extraArgs=[suit, 0.59999999999999998])),
            FunctionInterval(suit.loop, extraArgs=['neutral'])
        ])
    elif alreadyDodged > 0:
        return [toonTrack, soundTrack, buttonTrack, objectTrack, shadowTrack]

    if level >= 3:
        if alreadyTeased > 0:
            return [
                toonTrack, soundTrack, buttonTrack, objectTrack, shadowTrack
            ]
        else:
            suitTrack = Track([
                MovieUtil.createSuitTeaseMultiTrack(suit,
                                                    delay=delay +
                                                    tObjectAppears)
            ])
    else:
        suitTrack = MovieUtil.createSuitDodgeMultitrack(
            delay + tSuitDodges, suit, leftSuits, rightSuits)
    return [
        toonTrack, soundTrack, buttonTrack, objectTrack, shadowTrack, suitTrack
    ]
Exemple #34
0
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
    if pieName == 'wedding-cake':
        splatName = 'splat-birthday-cake'
    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))
        if hpbonus > 0:
            bonusTrack.append(Wait(0.75))
            bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0, attackTrack=THROW_TRACK))
        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]
Exemple #35
0
def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet = 1):
    toon = lure['toon']
    battle = lure['battle']
    sidestep = lure['sidestep']
    targets = lure['target']
    tracks = []
    tracks.append(Track([
        ActorInterval(toon, 'hold-magnet'),
        FunctionInterval(toon.loop, extraArgs = [
            'neutral'])]))
    hands = toon.getLeftHands()
    magnet2 = MovieUtil.copyProp(magnet)
    magnets = [
        magnet,
        magnet2]
    magnetIvals = []
    magnetIvals.append(WaitInterval(0.69999999999999996))
    magnetIvals.append(FunctionInterval(MovieUtil.showProps, extraArgs = [
        magnets,
        hands,
        pos,
        hpr,
        scale]))
    magnetIvals.append(WaitInterval(6.2999999999999998))
    magnetIvals.append(FunctionInterval(MovieUtil.removeProps, extraArgs = [
        magnets]))
    tracks.append(Track(magnetIvals))
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            if kbbonus == 1 or hp > 0:
                suitDelay = 2.6000000000000001
                suitMoveDuration = 0.80000000000000004
                suitIvals = []
                (opos, ohpr) = battle.getActorPosHpr(suit)
                reachDist = MovieUtil.SUIT_LURE_DISTANCE
                reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
                numShakes = 3.0
                shakeTotalDuration = 0.80000000000000004
                shakeDuration = shakeTotalDuration / numShakes
                suitAnims = []
                suitAnims.append(FunctionInterval(suit.loop, extraArgs = [
                    'neutral']))
                suitAnims.append(WaitInterval(suitDelay))
                suitAnims.append(ActorInterval(suit, 'landing', startTime = 2.3700000000000001, endTime = 1.8200000000000001))
                for i in range(0, numShakes):
                    suitAnims.append(ActorInterval(suit, 'landing', startTime = 1.8200000000000001, endTime = 1.1599999999999999, duration = shakeDuration))
                
                suitAnims.append(ActorInterval(suit, 'landing', startTime = 1.1599999999999999, endTime = 0.69999999999999996))
                suitAnims.append(ActorInterval(suit, 'landing', startTime = 0.69999999999999996, duration = 1.3))
                suitIvals.extend(suitAnims)
                suitIvals.append(FunctionInterval(suit.loop, extraArgs = [
                    'neutral']))
                suitIvals.append(FunctionInterval(battle.lureSuit, extraArgs = [
                    suit]))
                if hp > 0:
                    suitIvals.append(__createSuitDamageTrack(battle, suit, hp, lure, trapProp))
                
                if died != 0:
                    suitIvals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
                
                tracks.append(Track(suitIvals))
                tracks.append(lerpSuit(suit, suitDelay + 0.55000000000000004 + shakeTotalDuration, suitMoveDuration, reachPos, battle, trapProp))
            
        else:
            tracks.append(Track([
                (3.7000000000000002, FunctionInterval(MovieUtil.indicateMissed, extraArgs = [
                    suit]))]))
    
    if isSmallMagnet == 1:
        tracks.append(getSoundTrack('TL_small_magnet.mp3', delay = 0.69999999999999996, node = toon))
    else:
        tracks.append(getSoundTrack('TL_large_magnet.mp3', delay = 0.69999999999999996, node = toon))
    return MultiTrack(tracks)
Exemple #36
0
def __doSoundsLevel(sounds, delay, hitCount):
    lastSoundThatHit = None
    totalDamage = 0
    for sound in sounds:
        for target in sound['target']:
            if target['hp'] > 0:
                lastSoundThatHit = sound
                totalDamage += target['hp']
                break

    tracks = []
    for sound in sounds:
        toon = sound['toon']
        level = sound['level']
        targets = sound['target']
        hpbonus = sound['hpbonus']
        megaphone = globalPropPool.getProp('megaphone')
        megaphone2 = MovieUtil.copyProp(megaphone)
        megaphones = [megaphone, megaphone2]
        hands = toon.getRightHands()
        megaphoneIntervals = []
        megaphoneShow = FunctionInterval(MovieUtil.showProps,
                                         extraArgs=[megaphones, hands])
        megaphoneGrow = LerpScaleInterval(megaphone,
                                          dMegaphoneGrow,
                                          megaphone.getScale(),
                                          startScale=Point3(0.01, 0.01, 0.01))
        megaphoneShrink = LerpScaleInterval(megaphone, dMegaphoneShrink,
                                            Point3(0.01, 0.01, 0.01),
                                            megaphone.getScale())
        megaphoneHide = FunctionInterval(MovieUtil.removeProps,
                                         extraArgs=[megaphones])
        megaphoneIntervals.append((delay, megaphoneShow))
        megaphoneIntervals.append(megaphoneGrow)
        megaphoneIntervals.append((delay + tMegaphoneShrink, megaphoneShrink))
        megaphoneIntervals.append(megaphoneHide)
        tracks.append(Track(megaphoneIntervals))
        toonIntervals = []
        toonSound = ActorInterval(toon, 'sound')
        toonIntervals.append((delay, toonSound))
        toonIntervals.append(FunctionInterval(toon.loop,
                                              extraArgs=['neutral']))
        tracks.append(Track(toonIntervals))
        soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
        if soundEffect:
            soundIntervals = []
            playSound = SoundInterval(soundEffect, node=toon)
            soundIntervals.append((delay + tSound, playSound))
            tracks.append(Track(soundIntervals))
        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']
                suitIntervals = []
                showDamage = FunctionInterval(suit.showLaffNumber,
                                              openEnded=0,
                                              extraArgs=[-totalDamage])
                updateHealthBar = FunctionInterval(suit.updateHealthBar,
                                                   extraArgs=[totalDamage])
                suitIntervals.append((delay + tSuitReact, showDamage))
                suitIntervals.append(updateHealthBar)
                if hitCount == 1:
                    suitIntervals.append(
                        Parallel(
                            ActorInterval(suit, 'squirt-small-react'),
                            MovieUtil.createSuitStunInterval(suit, 0.5, 1.8)))
                else:
                    suitIntervals.append(
                        ActorInterval(suit, 'squirt-small-react'))
                if kbbonus == 0:
                    suitIntervals.append(
                        __createSuitResetPosTrack(suit, battle))
                    suitIntervals.append(Func(battle.unlureSuit, suit))
                bonusTrack = None
                if hpbonus > 0:
                    bonusTrack = Track([
                        (delay + tSuitReact + 0.75,
                         FunctionInterval(suit.showLaffNumber,
                                          openEnded=0,
                                          extraArgs=[-hpbonus, 1]))
                    ])
                if died != 0:
                    suitIntervals.append(
                        MovieUtil.createSuitDeathTrack(suit, toon, battle))
                else:
                    suitIntervals.append(
                        FunctionInterval(suit.loop, extraArgs=['neutral']))
                if bonusTrack == None:
                    tracks.append(Track(suitIntervals))
                else:
                    tracks.append(
                        MultiTrack([Track(suitIntervals), bonusTrack]))
            else:
                if totalDamage <= 0:
                    tracks.append(
                        Track([(2.9,
                                FunctionInterval(MovieUtil.indicateMissed,
                                                 extraArgs=[suit, 1.0]))]))

    return tracks
    return
Exemple #37
0
def __createHypnoGogglesMultiTrack(lure):
    toon = lure['toon']
    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(97.650000000000006, 46.18, -97.25)
    scale = Point3(1.5, 1.5, 1.5)
    hands = toon.getLeftHands()
    gogglesIvals = []
    gogglesIvals.append(WaitInterval(0.59999999999999998))
    gogglesIvals.append(FunctionInterval(MovieUtil.showProps, extraArgs = [
        bothGoggles,
        hands,
        pos,
        hpr,
        scale]))
    gogglesIvals.append(ActorInterval(goggles, 'hypno-goggles', duration = 2.2000000000000002))
    gogglesIvals.append(FunctionInterval(MovieUtil.removeProps, extraArgs = [
        bothGoggles]))
    gogglesTrack = Track(gogglesIvals)
    toonTrack = Track([
        ActorInterval(toon, 'hypnotize'),
        FunctionInterval(toon.loop, extraArgs = [
            'neutral'])])
    tracks = [
        gogglesTrack,
        toonTrack]
    for target in targets:
        suit = target['suit']
        trapProp = suit.battleTrapProp
        if sidestep == 0:
            hp = target['hp']
            kbbonus = target['kbbonus']
            died = target['died']
            if kbbonus == 1 or hp > 0:
                suitIvals = []
                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])
                suitIvals.append(FunctionInterval(suit.loop, extraArgs = [
                    'neutral']))
                suitIvals.append(WaitInterval(suitDelay))
                suitIvals.append(ActorInterval(suit, 'hypnotized', duration = 3.1000000000000001))
                suitIvals.append(FunctionInterval(suit.setPos, extraArgs = [
                    battle,
                    reachPos]))
                suitIvals.append(FunctionInterval(suit.loop, extraArgs = [
                    'neutral']))
                suitIvals.append(FunctionInterval(battle.lureSuit, extraArgs = [
                    suit]))
                if hp > 0:
                    suitIvals.append(__createSuitDamageTrack(battle, suit, hp, lure, trapProp))
                
                if died != 0:
                    suitIvals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
                
                tracks.append(Track(suitIvals))
                tracks.append(lerpSuit(suit, suitDelay + 1.7, 0.69999999999999996, reachPos, battle, trapProp))
            
        else:
            tracks.append(Track([
                (2.2999999999999998, FunctionInterval(MovieUtil.indicateMissed, extraArgs = [
                    suit,
                    1.1000000000000001]))]))
    
    tracks.append(getSoundTrack('TL_hypnotize.mp3', delay = 0.5, node = toon))
    return MultiTrack(tracks)
Exemple #38
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']

    # 4 options for a suit in a drop attack:
    #  1) It takes damage and reacts (hp > 0)
    #  2) It is lured, thus drop misses so suit does nothing (kbbonus == 0).  This is
    #     detected using a hack in the kbbonus.  There is no actual kickback bonus involved
    #     for drops, but if this kbbonus value is set to 0 instead of -1 (in the battle
    #     calculator), then we've specified that the suit is lured
    #  3) The suit dodges and is reacting to the first drop to dodge, detected when the
    #     variable alreadyDodged == 0
    #  4) The suit would dodge but is already dodging first drop, detected when the
    #     variable alreadyDodged == 1
    if (hp > 0):
        # Suit takes damage (for each drop that hits)
        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)
        # Create a bonus track if there is an hp bonus
        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):
        # If suit is lured, doesn't need to dodge and certainly won't get hit
        suitTrack = Sequence(
            Wait(delay + tObjectAppears),
            Func(MovieUtil.indicateMissed, suit, 0.6),
            Func(suit.loop, 'neutral'),
        )
    else:
        # Conditions regarding dodging:
        #    1) The suit will dodge only once with multiple drops in the same attack,
        #       so we only dodge if we haven't already (alreadyDodged==0)
        #    2) The suit will not NEED to dodge if attacked by a larger drop (which fall
        #       behind the suit on a miss rather than having the suit dodge
        # Special conditions:
        #    1) If there's a large drop followed by a small one at some point, we can allow
        #       the suit to start teasing and then dogde, this looks fine
        #    2) If there's a small drop followed by a large drop at some point, we don't allow
        #       the suit to tease, doesn't look right
        # other suits may need to dodge as well

        # First check if suit started dodging, if so, do not add any another reaction
        if (alreadyDodged > 0):
            return None  #Parallel(toonTrack, soundTrack, buttonTrack, objectTrack, shadowTrack)

        # Check for large drops
        if (level >=
                3):  # the larger drops, suit doesn't dodge, but teases instead
            # But if we've already started to tease, don't tease more than once
            if (alreadyTeased > 0):
                return None  #Parallel(toonTrack, soundTrack, buttonTrack, objectTrack, shadowTrack)
            else:
                suitTrack = MovieUtil.createSuitTeaseMultiTrack(suit,
                                                                delay=delay +
                                                                tObjectAppears)

        else:  # small drop, so dodge
            suitTrack = MovieUtil.createSuitDodgeMultitrack(
                delay + tSuitDodges, suit, leftSuits, rightSuits)

    return suitTrack
Exemple #39
0
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']
    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)

    dollarIvals = []
    dollarIvals.append(FunctionInterval(positionDollar, extraArgs = [
        dollar,
        suit]))
    dollarAnims = []
    dollarAnims.append(FunctionInterval(dollar.wrtReparentTo, extraArgs = [
        battle]))
    dollarAnims.append(ActorInterval(dollar, dollarName, duration = 3))
    dollarAnims.extend(getSplicedLerpAnims(dollar, dollarName, 0.69999999999999996, 2.0, startTime = 3))
    dollarAnims.append(LerpPosInterval(dollar, 0.20000000000000001, Point3(0, -10, 7)))
    dollarIvals.extend(dollarAnims)
    dollarIvals.append(FunctionInterval(MovieUtil.removeProp, extraArgs = [
        dollar]))
    dollarTrack = Track(dollarIvals)
    poleIvals = []
    poleIvals.append(FunctionInterval(MovieUtil.showProps, extraArgs = [
        poles,
        hands]))
    poleIvals.append(ActorInterval(pole, 'fishing-pole'))
    poleIvals.append(FunctionInterval(MovieUtil.removeProps, extraArgs = [
        poles]))
    poleTrack = Track(poleIvals)
    toonTrack = Track([
        FunctionInterval(toon.headsUp, extraArgs = [
            battle,
            targetPos]),
        ActorInterval(toon, 'cast'),
        FunctionInterval(toon.loop, extraArgs = [
            'neutral'])])
    tracks = [
        dollarTrack,
        poleTrack,
        toonTrack]
    if sidestep == 0:
        if kbbonus == 1 or hp > 0:
            suitIvals = []
            (opos, ohpr) = battle.getActorPosHpr(suit)
            reachDist = MovieUtil.SUIT_LURE_DISTANCE
            reachPos = Point3(opos[0], opos[1] - reachDist, opos[2])
            suitIvals.append(FunctionInterval(suit.loop, extraArgs = [
                'neutral']))
            suitIvals.append(WaitInterval(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 = Track([
                    ActorInterval(suit, 'reach', duration = reachAnimDuration)])
                suitIvals.append(MultiTrack([
                    moveTrack,
                    reachTrack]))
            else:
                suitIvals.append(ActorInterval(suit, 'reach', duration = reachAnimDuration))
            if trapProp:
                suitIvals.append(FunctionInterval(trapProp.wrtReparentTo, extraArgs = [
                    battle]))
            
            suitIvals.append(FunctionInterval(suit.setPos, extraArgs = [
                battle,
                reachPos]))
            if trapProp:
                suitIvals.append(FunctionInterval(trapProp.wrtReparentTo, extraArgs = [
                    suit]))
                suit.battleTrapProp = trapProp
            
            suitIvals.append(FunctionInterval(suit.loop, extraArgs = [
                'neutral']))
            suitIvals.append(FunctionInterval(battle.lureSuit, extraArgs = [
                suit]))
            if hp > 0:
                suitIvals.append(__createSuitDamageTrack(battle, suit, hp, lure, trapProp))
            
            if died != 0:
                suitIvals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
            
            tracks.append(Track(suitIvals))
        
    else:
        tracks.append(Track([
            (3.7000000000000002, FunctionInterval(MovieUtil.indicateMissed, extraArgs = [
                suit]))]))
    tracks.append(getSoundTrack('TL_fishing_pole.mp3', delay = 0.5, node = toon))
    return MultiTrack(tracks)
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 range(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 range(numTargets):
        target = throw['target'][i]
        hitSuit = target['hp'] > 0
        if hitSuit:
            didThrowHitAnyone = True

    soundTrack = __getSoundTrack(level, didThrowHitAnyone, toon)
    groupSuitResponseTrack = Parallel()
    for i in range(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, kbbonus))
            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]
Exemple #41
0
def __throwPie(throw, delay, hitCount, showCannon = 1):
    #print ("__throwPie %s" % (showCannon))

    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)

    #pie = globalPropPool.getProp(pieName)
    #pieType = globalPropPool.getPropType(pieName)
    #pie2 = MovieUtil.copyProp(pie)
    #pies = [pie, pie2]
    #hands = toon.getRightHands()

    #splatName = 'splat-' + pieName
    #if pieName == 'wedding-cake':
    #    splatName = 'splat-birthday-cake'
    #splat = globalPropPool.getProp(splatName)
    #splatType = globalPropPool.getPropType(splatName)
    
    
    button = globalPropPool.getProp('button')
    buttonType = globalPropPool.getPropType('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    hands = toon.getLeftHands()
    

    # make the toon throw the pie
    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)
        # If the suit gets knocked back, animate it
        # No stun animation shown here
        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.20)
        
        #import pdb; pdb.set_trace()
        
        #print "Fire anim suit name: %s" % (suit.dna.name)
        suitScale = 0.90
        import math
        suitScale = 0.9 - (math.sqrt(suitLevel) * 0.10)
        #if suit.dna.name == 'bf':
        #    suitScale = 0.80
        #elif suit.dna.name == 'cr':
        #    suitScale = 0.75
        sival = [] # Suit interval of its animation
        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(.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.50, Point3(0,-deep,0.0), blendType='easeIn'),
                                                             ),
                                                         ),
                                             ),
                                    Wait(2.5),
                                    
                                    Parallel(
                                        playSoundBomb,
                                        playSoundFly,
                                        Sequence( 
                                            Func(smoke.show),
                                            Parallel(LerpScaleInterval(smoke, .5, 3),
                                            LerpColorScaleInterval(smoke, .5, Vec4(2,2,2,0))),
                                            Func(smoke.hide),
                                        ),
                                        Sequence( 
                                            Func(kapow.show),
                                            ActorInterval(kapow, 'kapow'),
                                            Func(kapow.hide),
                                        ),
                                        LerpPosInterval(suit, 3.00, 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
            #sival = ActorInterval(suit, 'pie-small-react')
        suitResponseTrack.append(Wait(delay + tPieHitsSuit))
        suitResponseTrack.append(showDamage)
        suitResponseTrack.append(updateHealthBar)
        suitResponseTrack.append(sival)
        # Make a bonus track for any hp bonus
        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))
            
        if 0:
            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)
    
      
    
        # Since it's possible for there to be simultaneous throws, we only
        # want the suit to dodge one time at most.  Thus if the suit is
        # not hit (dodges) and that dodge is not from the first dodge
        # (which has delay=0) then we don't add another suit reaction.
        # Otherwise, we add the suit track as normal
    

    return [toonTrack, soundTrack, buttonTrack, suitResponseTrack]