Ejemplo n.º 1
0
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs):
    toon = drop['toon']
    if drop.has_key('npc'):
        toon = drop['npc']
    
    battle = drop['battle']
    majorObject = level >= 3
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    revived = target['revived']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    hpbonus = drop['hpbonus']
    if hp > 0:
        suitTrack = Sequence()
        showDamage = Func(suit.showHpText, -hp, openEnded = 0)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        if majorObject:
            anim = 'flatten'
        else:
            anim = 'drop-react'
        suitReact = ActorInterval(suit, anim)
        suitTrack.append(Wait(delay + tObjectAppears))
        suitTrack.append(showDamage)
        suitTrack.append(updateHealthBar)
        suitGettingHit = Parallel(suitReact)
        if level == UBER_GAG_LEVEL_INDEX:
            gotHitSound = globalBattleSoundCache.getSound('AA_drop_boat_cog.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
Ejemplo n.º 4
0
def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs):
    toon = drop["toon"]
    if drop.has_key("npc"):
        toon = drop["npc"]
    battle = drop["battle"]
    majorObject = level >= 3
    suit = target["suit"]
    hp = target["hp"]
    hitSuit = hp > 0
    died = target["died"]
    revived = target["revived"]
    leftSuits = target["leftSuits"]
    rightSuits = target["rightSuits"]
    kbbonus = target["kbbonus"]
    hpbonus = drop["hpbonus"]
    if hp > 0:
        suitTrack = Sequence()
        showDamage = Func(suit.showHpText, -hp, openEnded=0)
        updateHealthBar = Func(suit.updateHealthBar, hp)
        if majorObject:
            anim = "flatten"
        else:
            anim = "drop-react"
        suitReact = ActorInterval(suit, anim)
        suitTrack.append(Wait(delay + tObjectAppears))
        suitTrack.append(showDamage)
        suitTrack.append(updateHealthBar)
        suitGettingHit = Parallel(suitReact)
        if level == UBER_GAG_LEVEL_INDEX:
            gotHitSound = globalBattleSoundCache.getSound("AA_drop_boat_cog.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
Ejemplo n.º 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
Ejemplo n.º 6
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
Ejemplo n.º 7
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 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
Ejemplo n.º 9
0
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
Ejemplo n.º 10
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
Ejemplo n.º 11
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 __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
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
Ejemplo n.º 14
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
Ejemplo n.º 15
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)
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
Ejemplo n.º 17
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
Ejemplo n.º 18
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
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]
Ejemplo n.º 20
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)
Ejemplo n.º 21
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]
Ejemplo n.º 22
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
Ejemplo n.º 23
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
Ejemplo n.º 24
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]
Ejemplo n.º 25
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]
Ejemplo n.º 26
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
Ejemplo n.º 27
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]
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]
Ejemplo n.º 29
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]