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 __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
Esempio 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']

    # 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
Esempio n. 5
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)
Esempio n. 6
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]
Esempio n. 7
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]
Esempio n. 8
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
Esempio n. 10
0
def __getSuitTrack(suit,
                   tContact,
                   tDodge,
                   hp,
                   hpbonus,
                   kbbonus,
                   anim,
                   died,
                   leftSuits,
                   rightSuits,
                   battle,
                   toon,
                   fShowStun,
                   beforeStun=0.5,
                   afterStun=1.8):
    if hp > 0:
        suitIvals = []
        sival = ActorInterval(suit, anim)
        sival = []
        if kbbonus > 0:
            suitPos, suitHpr = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animIvals = []
            animIvals.append(ActorInterval(suit, anim, duration=0.2))
            if suitType == 'a':
                animIvals.append(
                    ActorInterval(suit, 'slip-forward', startTime=2.43))
            else:
                if suitType == 'b':
                    animIvals.append(
                        ActorInterval(suit,
                                      'slip-forward',
                                      startTime=1.94,
                                      duration=1.03))
                else:
                    if suitType == 'c':
                        animIvals.append(
                            ActorInterval(suit, 'slip-forward',
                                          startTime=2.58))
            animIvals.append(Func(battle.unlureSuit, suit))
            animTrack = Track(animIvals)
            moveTrack = Track([
                WaitInterval(0.2),
                LerpPosInterval(suit, 0.6, pos=suitPos, other=battle)
            ])
            sival = MultiTrack([animTrack, moveTrack])
        else:
            if fShowStun == 1:
                sival = Parallel(
                    ActorInterval(suit, anim),
                    MovieUtil.createSuitStunInterval(suit, beforeStun,
                                                     afterStun))
            else:
                sival = ActorInterval(suit, anim)
        showDamage = FunctionInterval(suit.showLaffNumber,
                                      openEnded=0,
                                      extraArgs=[-hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar,
                                           extraArgs=[hp])
        suitIvals.append((tContact, showDamage))
        suitIvals.append(updateHealthBar)
        suitIvals.append(sival)
        bonusTrack = None
        bonusIvals = []
        if kbbonus > 0:
            bonusIvals.append((tContact + 0.75,
                               FunctionInterval(suit.showLaffNumber,
                                                openEnded=0,
                                                extraArgs=[-kbbonus, 2])))
        if hpbonus > 0:
            if kbbonus > 0:
                bonusIvals.append(
                    (0.75,
                     FunctionInterval(suit.showLaffNumber,
                                      openEnded=0,
                                      extraArgs=[-hpbonus, 1]), PREVIOUS_END))
            else:
                bonusIvals.append((tContact + 0.75,
                                   FunctionInterval(suit.showLaffNumber,
                                                    openEnded=0,
                                                    extraArgs=[-hpbonus, 1])))
        if len(bonusIvals) > 0:
            bonusTrack = Track(bonusIvals)
        if died != 0:
            suitIvals.append(MovieUtil.createSuitDeathTrack(
                suit, toon, battle))
        else:
            suitIvals.append(FunctionInterval(suit.loop,
                                              extraArgs=['neutral']))
        if bonusTrack == None:
            return Track(suitIvals)
        else:
            return MultiTrack([Track(suitIvals), bonusTrack])
    else:
        return MovieUtil.createSuitDodgeMultitrack(tDodge, suit, leftSuits,
                                                   rightSuits)
    return
Esempio n. 11
0
def __throwPie(throw, delay, hitCount):
    toon = throw['toon']
    hpbonus = throw['hpbonus']
    target = throw['target']
    suit = target['suit']
    hp = target['hp']
    kbbonus = target['kbbonus']
    sidestep = throw['sidestep']
    died = target['died']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    level = throw['level']
    battle = throw['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    notify.debug('toon: %s throws tart at suit: %d for hp: %d died: %d' % (toon.getName(), suit.doId, hp, died))
    pieName = pieNames[level]
    hitSuit = hp > 0
    pie = globalPropPool.getProp(pieName)
    pieType = globalPropPool.getPropType(pieName)
    pie2 = MovieUtil.copyProp(pie)
    pies = [pie, pie2]
    hands = toon.getRightHands()
    splatName = 'splat-' + pieName
    splat = globalPropPool.getProp(splatName)
    splatType = globalPropPool.getPropType(splatName)
    toonIvals = []
    toonFace = FunctionInterval(toon.headsUp, extraArgs=[battle, suitPos])
    toonIvals.append((delay, toonFace))
    toonIvals.append(ActorInterval(toon, 'throw'))
    toonIvals.append(FunctionInterval(toon.loop, extraArgs=['neutral']))
    toonIvals.append(FunctionInterval(toon.setHpr, extraArgs=[battle, origHpr]))
    toonTrack = Track(toonIvals)
    pieIntervals = []
    pieShow = FunctionInterval(MovieUtil.showProps, extraArgs=[pies, hands])
    pieAnim = FunctionInterval(__animProp, extraArgs=[pies, pieName, pieType])
    pieScale1 = LerpScaleInterval(pie, 1.0, pie.getScale(), startScale=MovieUtil.PNT3_NEARZERO)
    pieScale2 = LerpScaleInterval(pie2, 1.0, pie2.getScale(), startScale=MovieUtil.PNT3_NEARZERO)
    pieScale = MultiTrack([Track([pieScale1]), Track([pieScale2])])
    piePreflight = FunctionInterval(__propPreflight, extraArgs=[pies, suit, toon, battle])
    pieIntervals.append((delay, pieShow))
    pieIntervals.append(pieAnim)
    pieIntervals.append(pieScale)
    pieIntervals.append(FunctionInterval(battle.movie.needRestoreRenderProp, extraArgs=[pies[0]]))
    pieIntervals.append((delay + tPieLeavesHand, piePreflight))
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    if hitSuit:
        pieFly = LerpPosInterval(pie, tPieHitsSuit - tPieLeavesHand, pos=MovieUtil.avatarFacePoint(suit, other=battle), name=pieFlyTaskName, other=battle)
        pieHide = FunctionInterval(MovieUtil.removeProps, extraArgs=[pies])
        splatShow = FunctionInterval(__showProp, extraArgs=[splat, suit, Point3(0, 0, suit.getHeight())])
        splatBillboard = FunctionInterval(__billboardProp, extraArgs=[splat])
        splatAnim = ActorInterval(splat, splatName)
        splatHide = FunctionInterval(MovieUtil.removeProp, extraArgs=[splat])
        pieIntervals.append((delay + tPieLeavesHand, pieFly))
        pieIntervals.append(pieHide)
        pieIntervals.append(FunctionInterval(battle.movie.clearRenderProp, extraArgs=[pies[0]]))
        pieIntervals.append(splatShow)
        pieIntervals.append(splatBillboard)
        pieIntervals.append(splatAnim)
        pieIntervals.append(splatHide)
    else:
        missDict = {}
        if sidestep:
            suitPoint = MovieUtil.avatarFacePoint(suit, other=battle)
        else:
            suitPoint = __suitMissPoint(suit, other=battle)
        piePreMiss = FunctionInterval(__piePreMiss, extraArgs=[missDict, pie, suitPoint, battle])
        pieMiss = LerpFunctionInterval(__pieMissLerpCallback, extraArgs=[missDict], duration=(tPieHitsSuit - tPieLeavesHand) * ratioMissToHit)
        pieHide = FunctionInterval(MovieUtil.removeProps, extraArgs=[pies])
        pieIntervals.append((delay + tPieLeavesHand, piePreMiss))
        pieIntervals.append(pieMiss)
        pieIntervals.append(pieHide)
        pieIntervals.append(FunctionInterval(battle.movie.clearRenderProp, extraArgs=[pies[0]]))
    pieTrack = Track(pieIntervals)
    if hitSuit:
        suitIntervals = []
        showDamage = FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar, extraArgs=[hp])
        sival = []
        if kbbonus > 0:
            suitPos, suitHpr = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animIvals = []
            animIvals.append(ActorInterval(suit, 'pie-small-react', duration=0.2))
            if suitType == 'a':
                animIvals.append(ActorInterval(suit, 'slip-forward', startTime=2.43))
            else:
                if suitType == 'b':
                    animIvals.append(ActorInterval(suit, 'slip-forward', startTime=1.94, duration=1.03))
                else:
                    if suitType == 'c':
                        animIvals.append(ActorInterval(suit, 'slip-forward', startTime=2.58))
            animIvals.append(Func(battle.unlureSuit, suit))
            animTrack = Track(animIvals)
            moveTrack = Track([WaitInterval(0.2), LerpPosInterval(suit, 0.6, pos=suitPos, other=battle)])
            sival = MultiTrack([animTrack, moveTrack])
        else:
            if hitCount == 1:
                sival = Parallel(ActorInterval(suit, 'pie-small-react'), MovieUtil.createSuitStunInterval(suit, 0.3, 1.3))
            else:
                sival = ActorInterval(suit, 'pie-small-react')
        suitIntervals.append((delay + tPieHitsSuit, showDamage))
        suitIntervals.append(updateHealthBar)
        suitIntervals.append(sival)
        bonusTrack = None
        bonusIvals = []
        if kbbonus > 0:
            bonusIvals.append((delay + tPieHitsSuit + 0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-kbbonus, 2])))
        if hpbonus > 0:
            if kbbonus > 0:
                bonusIvals.append((0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hpbonus, 1]), PREVIOUS_END))
            else:
                bonusIvals.append((delay + tPieHitsSuit + 0.75, FunctionInterval(suit.showLaffNumber, openEnded=0, extraArgs=[-hpbonus, 1])))
        if len(bonusIvals) > 0:
            bonusTrack = Track(bonusIvals)
        if died != 0:
            suitIntervals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitIntervals.append(FunctionInterval(suit.loop, extraArgs=['neutral']))
        if bonusTrack == None:
            suitResponseTrack = Track(suitIntervals)
        else:
            suitResponseTrack = MultiTrack([Track(suitIntervals), bonusTrack])
    else:
        suitResponseTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
    if not hitSuit and delay > 0:
        return [toonTrack, soundTrack, pieTrack]
    else:
        return [
         toonTrack, soundTrack, pieTrack, suitResponseTrack]
    return
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]
def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased):
    toon = drop['toon']
    hpbonus = drop['hpbonus']
    target = drop['target']
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    battle = drop['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    majorObject = level >= 3
    button = globalPropPool.getProp('button')
    buttonType = globalPropPool.getPropType('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [button, button2]
    hands = toon.getLeftHands()
    object = globalPropPool.getProp(objName)
    objectType = globalPropPool.getPropType(objName)
    if objName == 'weight':
        object.setScale(object.getScale() * 0.75)
    elif objName == 'safe':
        object.setScale(object.getScale() * 0.84999999999999998)

    node = object.node()
    node.setBound(OmniBoundingVolume())
    node.setFinal(1)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    toonIntervals = []
    toonFace = FunctionInterval(toon.headsUp, extraArgs=[battle, suitPos])
    toonIntervals.append((delay, toonFace))
    toonIntervals.append(ActorInterval(toon, 'pushbutton'))
    toonIntervals.append(FunctionInterval(toon.loop, extraArgs=['neutral']))
    toonIntervals.append(
        FunctionInterval(toon.setHpr, extraArgs=[battle, origHpr]))
    toonTrack = Track(toonIntervals)
    buttonIntervals = []
    buttonShow = FunctionInterval(MovieUtil.showProps,
                                  extraArgs=[buttons, hands])
    buttonScaleUp = LerpScaleInterval(button,
                                      1.0,
                                      button.getScale(),
                                      startScale=Point3(0.01, 0.01, 0.01))
    buttonScaleDown = LerpScaleInterval(button,
                                        1.0,
                                        Point3(0.01, 0.01, 0.01),
                                        startScale=button.getScale())
    buttonHide = FunctionInterval(MovieUtil.removeProps, extraArgs=[buttons])
    buttonIntervals.append((delay, buttonShow))
    buttonIntervals.append(buttonScaleUp)
    buttonIntervals.append(WaitInterval(2.5))
    buttonIntervals.append(buttonScaleDown)
    buttonIntervals.append(buttonHide)
    buttonTrack = Track(buttonIntervals)
    objIntervals = []

    def posObject(object, suit, level, majorObject, miss, battle=battle):
        object.reparentTo(battle)
        if battle.isSuitLured(suit):
            (suitPos, suitHpr) = battle.getActorPosHpr(suit)
            object.setPos(suitPos)
            object.setHpr(suitHpr)
            if level >= 3:
                object.setY(object.getY() + 2)

        else:
            object.setPos(suit.getPos(battle))
            object.setHpr(suit.getHpr(battle))
            if miss and level >= 3:
                object.setY(object.getY(battle) + 5)

        if not majorObject:
            if not miss:
                shoulderHeight = shoulderHeights[suit.style.body] * suit.scale
                object.setZ(object.getPos(battle)[2] + shoulderHeight)

        object.setZ(object.getPos(battle)[2] + objZOffsets[level])

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

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

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

    def posShadow(dropShadow=dropShadow,
                  suit=suit,
                  battle=battle,
                  hp=hp,
                  level=level):
        dropShadow.reparentTo(battle)
        if battle.isSuitLured(suit):
            (suitPos, suitHpr) = battle.getActorPosHpr(suit)
            dropShadow.setPos(suitPos)
            dropShadow.setHpr(suitHpr)
            if level >= 3:
                dropShadow.setY(dropShadow.getY() + 2)

        else:
            dropShadow.setPos(suit.getPos(battle))
            dropShadow.setHpr(suit.getHpr(battle))
            if hp <= 0 and level >= 3:
                dropShadow.setY(dropShadow.getY(battle) + 5)

        dropShadow.setZ(dropShadow.getZ() + 0.5)

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

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

    if level >= 3:
        if alreadyTeased > 0:
            return [
                toonTrack, soundTrack, buttonTrack, objectTrack, shadowTrack
            ]
        else:
            suitTrack = Track([
                MovieUtil.createSuitTeaseMultiTrack(suit,
                                                    delay=delay +
                                                    tObjectAppears)
            ])
    else:
        suitTrack = MovieUtil.createSuitDodgeMultitrack(
            delay + tSuitDodges, suit, leftSuits, rightSuits)
    return [
        toonTrack, soundTrack, buttonTrack, objectTrack, shadowTrack, suitTrack
    ]
Esempio n. 14
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]
Esempio n. 15
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]
Esempio n. 16
0
def __getSuitTrack(
    suit,
    tContact,
    tDodge,
    hp,
    hpbonus,
    kbbonus,
    anim,
    died,
    leftSuits,
    rightSuits,
    battle,
    toon,
    fShowStun,
    beforeStun=0.5,
    afterStun=1.8,
):
    if hp > 0:
        suitIvals = []
        sival = ActorInterval(suit, anim)
        sival = []
        if kbbonus > 0:
            (suitPos, suitHpr) = battle.getActorPosHpr(suit)
            suitType = getSuitBodyType(suit.getStyleName())
            animIvals = []
            animIvals.append(ActorInterval(suit, anim, duration=0.20000000000000001))
            if suitType == "a":
                animIvals.append(ActorInterval(suit, "slip-forward", startTime=2.4300000000000002))
            elif suitType == "b":
                animIvals.append(ActorInterval(suit, "slip-forward", startTime=1.9399999999999999, duration=1.03))
            elif suitType == "c":
                animIvals.append(ActorInterval(suit, "slip-forward", startTime=2.5800000000000001))

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

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

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

        if died != 0:
            suitIvals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitIvals.append(FunctionInterval(suit.loop, extraArgs=["neutral"]))
        if bonusTrack == None:
            return Track(suitIvals)
        else:
            return MultiTrack([Track(suitIvals), bonusTrack])
    else:
        return MovieUtil.createSuitDodgeMultitrack(tDodge, suit, leftSuits, rightSuits)
Esempio n. 17
0
def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased):
    toon = drop['toon']
    hpbonus = drop['hpbonus']
    target = drop['target']
    suit = target['suit']
    hp = target['hp']
    hitSuit = hp > 0
    died = target['died']
    leftSuits = target['leftSuits']
    rightSuits = target['rightSuits']
    kbbonus = target['kbbonus']
    battle = drop['battle']
    suitPos = suit.getPos(battle)
    origHpr = toon.getHpr(battle)
    majorObject = level >= 3
    button = globalPropPool.getProp('button')
    buttonType = globalPropPool.getPropType('button')
    button2 = MovieUtil.copyProp(button)
    buttons = [
        button,
        button2]
    hands = toon.getLeftHands()
    object = globalPropPool.getProp(objName)
    objectType = globalPropPool.getPropType(objName)
    if objName == 'weight':
        object.setScale(object.getScale() * 0.75)
    elif objName == 'safe':
        object.setScale(object.getScale() * 0.84999999999999998)
    
    node = object.node()
    node.setBound(OmniBoundingVolume())
    node.setFinal(1)
    soundTrack = __getSoundTrack(level, hitSuit, toon)
    toonIntervals = []
    toonFace = FunctionInterval(toon.headsUp, extraArgs = [
        battle,
        suitPos])
    toonIntervals.append((delay, toonFace))
    toonIntervals.append(ActorInterval(toon, 'pushbutton'))
    toonIntervals.append(FunctionInterval(toon.loop, extraArgs = [
        'neutral']))
    toonIntervals.append(FunctionInterval(toon.setHpr, extraArgs = [
        battle,
        origHpr]))
    toonTrack = Track(toonIntervals)
    buttonIntervals = []
    buttonShow = FunctionInterval(MovieUtil.showProps, extraArgs = [
        buttons,
        hands])
    buttonScaleUp = LerpScaleInterval(button, 1.0, button.getScale(), startScale = Point3(0.01, 0.01, 0.01))
    buttonScaleDown = LerpScaleInterval(button, 1.0, Point3(0.01, 0.01, 0.01), startScale = button.getScale())
    buttonHide = FunctionInterval(MovieUtil.removeProps, extraArgs = [
        buttons])
    buttonIntervals.append((delay, buttonShow))
    buttonIntervals.append(buttonScaleUp)
    buttonIntervals.append(WaitInterval(2.5))
    buttonIntervals.append(buttonScaleDown)
    buttonIntervals.append(buttonHide)
    buttonTrack = Track(buttonIntervals)
    objIntervals = []
    
    def posObject(object, suit, level, majorObject, miss, battle = battle):
        object.reparentTo(battle)
        if battle.isSuitLured(suit):
            (suitPos, suitHpr) = battle.getActorPosHpr(suit)
            object.setPos(suitPos)
            object.setHpr(suitHpr)
            if level >= 3:
                object.setY(object.getY() + 2)
            
        else:
            object.setPos(suit.getPos(battle))
            object.setHpr(suit.getHpr(battle))
            if miss and level >= 3:
                object.setY(object.getY(battle) + 5)
            
        if not majorObject:
            if not miss:
                shoulderHeight = shoulderHeights[suit.style.body] * suit.scale
                object.setZ(object.getPos(battle)[2] + shoulderHeight)
            
        
        object.setZ(object.getPos(battle)[2] + objZOffsets[level])

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

        poseProp = FunctionInterval(poseProp, extraArgs = [
            object,
            objName,
            level])
        wait = WaitInterval(1.0)
        shrinkProp = LerpScaleInterval(object, dShrinkOnMiss, Point3(0.01, 0.01, 0.01), startScale = object.getScale())
        objIntervals.append(animProp)
        objIntervals.append(poseProp)
        objIntervals.append(wait)
        objIntervals.append(shrinkProp)
    objIntervals.append(FunctionInterval(MovieUtil.removeProp, extraArgs = [
        object]))
    objIntervals.append(FunctionInterval(battle.movie.clearRenderProp, extraArgs = [
        object]))
    objectTrack = Track(objIntervals)
    dropShadow = MovieUtil.copyProp(suit.getShadowJoints()[0])
    if level == 0:
        dropShadow.setScale(0.5)
    elif level <= 2:
        dropShadow.setScale(0.80000000000000004)
    elif level == 3:
        dropShadow.setScale(2.0)
    elif level == 4:
        dropShadow.setScale(2.2999999999999998)
    else:
        dropShadow.setScale(3.6000000000000001)
    
    def posShadow(dropShadow = dropShadow, suit = suit, battle = battle, hp = hp, level = level):
        dropShadow.reparentTo(battle)
        if battle.isSuitLured(suit):
            (suitPos, suitHpr) = battle.getActorPosHpr(suit)
            dropShadow.setPos(suitPos)
            dropShadow.setHpr(suitHpr)
            if level >= 3:
                dropShadow.setY(dropShadow.getY() + 2)
            
        else:
            dropShadow.setPos(suit.getPos(battle))
            dropShadow.setHpr(suit.getHpr(battle))
            if hp <= 0 and level >= 3:
                dropShadow.setY(dropShadow.getY(battle) + 5)
            
        dropShadow.setZ(dropShadow.getZ() + 0.5)

    shadowTrack = Track([
        WaitInterval(delay + tButtonPressed),
        FunctionInterval(battle.movie.needRestoreRenderProp, extraArgs = [
            dropShadow]),
        FunctionInterval(posShadow),
        LerpScaleInterval(dropShadow, tObjectAppears - tButtonPressed, dropShadow.getScale(), startScale = Point3(0.01, 0.01, 0.01)),
        WaitInterval(0.29999999999999999),
        FunctionInterval(MovieUtil.removeProp, extraArgs = [
            dropShadow]),
        FunctionInterval(battle.movie.clearRenderProp, extraArgs = [
            dropShadow])])
    if hp > 0:
        suitIntervals = []
        showDamage = FunctionInterval(suit.showLaffNumber, openEnded = 0, extraArgs = [
            -hp])
        updateHealthBar = FunctionInterval(suit.updateHealthBar, extraArgs = [
            hp])
        if majorObject:
            anim = 'flatten'
        else:
            anim = 'drop-react'
        suitReact = ActorInterval(suit, anim)
        suitIntervals.append((delay + tObjectAppears, showDamage))
        suitIntervals.append(updateHealthBar)
        suitIntervals.append(suitReact)
        bonusTrack = None
        if hpbonus > 0:
            bonusTrack = Track([
                (delay + tObjectAppears + 0.75, FunctionInterval(suit.showLaffNumber, openEnded = 0, extraArgs = [
                    -hpbonus,
                    1]))])
        
        if died != 0:
            suitIntervals.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
        else:
            suitIntervals.append(FunctionInterval(suit.loop, extraArgs = [
                'neutral']))
        if bonusTrack == None:
            suitTrack = Track(suitIntervals)
        else:
            suitTrack = MultiTrack([
                Track(suitIntervals),
                bonusTrack])
    elif kbbonus == 0:
        suitTrack = Track([
            (delay + tObjectAppears, FunctionInterval(MovieUtil.indicateMissed, extraArgs = [
                suit,
                0.59999999999999998])),
            FunctionInterval(suit.loop, extraArgs = [
                'neutral'])])
    elif alreadyDodged > 0:
        return [
            toonTrack,
            soundTrack,
            buttonTrack,
            objectTrack,
            shadowTrack]
    
    if level >= 3:
        if alreadyTeased > 0:
            return [
                toonTrack,
                soundTrack,
                buttonTrack,
                objectTrack,
                shadowTrack]
        else:
            suitTrack = Track([
                MovieUtil.createSuitTeaseMultiTrack(suit, delay = delay + tObjectAppears)])
    else:
        suitTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits)
    return [
        toonTrack,
        soundTrack,
        buttonTrack,
        objectTrack,
        shadowTrack,
        suitTrack]
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]
Esempio n. 19
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