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

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

    tFeatherScaleUp = 0.5
    dFeatherScaleUp = 0.5
    dFeatherScaleDown = 0.5
    featherTrack = Parallel(
        MovieUtil.getActorIntervals(feathers, "feather"),
        Sequence(
            Wait(tFeatherScaleUp),
            Func(MovieUtil.showProps, feathers, hands),
            Func(scaleFeathers, feathers),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleUp, MovieUtil.PNT3_NEARZERO, feathers[0].getScale),
        ),
        Sequence(
            Wait(toon.getDuration("tickle") - dFeatherScaleDown),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleDown, None, MovieUtil.PNT3_NEARZERO),
        ),
    )
    tHeal = 3.0
    mtrack = Parallel(
        featherTrack,
        ActorInterval(toon, "tickle"),
        __getSoundTrack(level, 1, node=toon),
        Sequence(
            Wait(tHeal),
            Func(__healToon, target, hp, ineffective, hasInteractivePropHealBonus),
            ActorInterval(target, "cringe", startTime=20.0 / target.getFrameRate("cringe")),
        ),
    )
    track.append(mtrack)
    track.append(Func(MovieUtil.removeProps, feathers))
    track.append(__returnToBase(heal))
    track.append(Func(target.clearChat))
    return track
def __healJuggle(heal, hasInteractivePropHealBonus):
    npcId = 0
    if 'npcId' in heal:
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon is None:
            return
    else:
        toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    delay = 4.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = Func(
            __healToon,
            targetToon,
            hp,
            ineffective,
            hasInteractivePropHealBonus)
        if first == 1:
            targetTrack.append(Wait(delay))
            first = 0
        targetTrack.append(reactIval)

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

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

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

    tFeatherScaleUp = 0.5
    dFeatherScaleUp = 0.5
    dFeatherScaleDown = 0.5
    featherTrack = Parallel(
        MovieUtil.getActorIntervals(feathers, 'feather'),
        Sequence(
            Wait(tFeatherScaleUp), Func(MovieUtil.showProps, feathers, hands),
            Func(scaleFeathers, feathers),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleUp,
                                        MovieUtil.PNT3_NEARZERO,
                                        feathers[0].getScale)),
        Sequence(
            Wait(toon.getDuration('tickle') - dFeatherScaleDown),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleDown, None,
                                        MovieUtil.PNT3_NEARZERO)))
    tHeal = 3.0
    mtrack = Parallel(
        featherTrack, ActorInterval(toon, 'tickle'),
        __getSoundTrack(level, 1, node=toon),
        Sequence(
            Wait(tHeal),
            Func(__healToon, target, hp, ineffective,
                 hasInteractivePropHealBonus),
            ActorInterval(target,
                          'cringe',
                          startTime=20.0 / target.getFrameRate('cringe'))))
    track.append(mtrack)
    track.append(Func(MovieUtil.removeProps, feathers))
    track.append(__returnToBase(heal))
    track.append(Func(target.clearChat))
    return track
Example #4
0
def __healJuggle(heal):
    toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    ivals = __runToHealSpot(heal)
    delay = 4.0
    first = 1
    targetIvals = []
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = FunctionInterval(__healToon, extraArgs = [
            targetToon,
            hp,
            ineffective])
        if first == 1:
            targetIvals.append((delay, reactIval, PREVIOUS_END))
            first = 0
        else:
            targetIvals.append(reactIval)
    
    cube = globalPropPool.getProp('cubes')
    cube2 = MovieUtil.copyProp(cube)
    cubes = [
        cube,
        cube2]
    hips = [
        toon.getLOD(toon.getLODNames()[0]).find('**/joint-hips'),
        toon.getLOD(toon.getLODNames()[1]).find('**/joint-hips')]
    cubeIvals = [
        FunctionInterval(MovieUtil.showProps, extraArgs = [
            cubes,
            hips]),
        MovieUtil.getActorIntervals(cubes, 'cubes'),
        FunctionInterval(MovieUtil.removeProps, extraArgs = [
            cubes])]
    mtrack = MultiTrack([
        Track(cubeIvals),
        __getSoundTrack(level, 0.69999999999999996, duration = 7.7000000000000002, node = toon),
        Track([
            ActorInterval(toon, 'juggle')]),
        Track(targetIvals)])
    ivals.append(mtrack)
    ivals += __returnToBase(heal)
    for target in targets:
        targetToon = target['toon']
        ivals.append(FunctionInterval(targetToon.clearChat))
    
    return Track(ivals)
def __healJuggle(heal):
    toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    ivals = __runToHealSpot(heal)
    delay = 4.0
    first = 1
    targetIvals = []
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = FunctionInterval(__healToon,
                                     extraArgs=[targetToon, hp, ineffective])
        if first == 1:
            targetIvals.append((delay, reactIval, PREVIOUS_END))
            first = 0
        else:
            targetIvals.append(reactIval)

    cube = globalPropPool.getProp('cubes')
    cube2 = MovieUtil.copyProp(cube)
    cubes = [cube, cube2]
    hips = [
        toon.getLOD(toon.getLODNames()[0]).find('**/joint-hips'),
        toon.getLOD(toon.getLODNames()[1]).find('**/joint-hips')
    ]
    cubeIvals = [
        FunctionInterval(MovieUtil.showProps, extraArgs=[cubes, hips]),
        MovieUtil.getActorIntervals(cubes, 'cubes'),
        FunctionInterval(MovieUtil.removeProps, extraArgs=[cubes])
    ]
    mtrack = MultiTrack([
        Track(cubeIvals),
        __getSoundTrack(level,
                        0.69999999999999996,
                        duration=7.7000000000000002,
                        node=toon),
        Track([ActorInterval(toon, 'juggle')]),
        Track(targetIvals)
    ])
    ivals.append(mtrack)
    ivals += __returnToBase(heal)
    for target in targets:
        targetToon = target['toon']
        ivals.append(FunctionInterval(targetToon.clearChat))

    return Track(ivals)
Example #6
0
def __healJuggle(heal, hasInteractivePropHealBonus):
    """ __healJuggle(heal)
    """
    # Determine if this is an NPC heal
    #print("heal Juggle Anim")
    npcId = 0
    if (heal.has_key('npcId')):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if (toon == None):
            return None
    else:
        toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']

    # Make a 'sandwich' around the track specific interval
    if (npcId != 0):
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    delay = 4.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target['toon']
        #hp = min(targetToon.hp + target['hp'], targetToon.maxHp)
        hp = target['hp']
        reactIval = Func(__healToon, targetToon, hp, ineffective,
                         hasInteractivePropHealBonus)
        if (first == 1):
            targetTrack.append(Wait(delay))
            first = 0

        targetTrack.append(reactIval)

    cube = globalPropPool.getProp('cubes')
    cube2 = MovieUtil.copyProp(cube)
    cubes = [cube, cube2]
    hips = [
        toon.getLOD(toon.getLODNames()[0]).find("**/joint_hips"),
        toon.getLOD(toon.getLODNames()[1]).find("**/joint_hips"),
    ]
    cubeTrack = Sequence(
        Func(MovieUtil.showProps, cubes, hips),
        MovieUtil.getActorIntervals(cubes, 'cubes'),
        Func(MovieUtil.removeProps, cubes),
    )

    mtrack = Parallel(cubeTrack,
                      __getSoundTrack(level, 0.7, duration=7.7, node=toon),
                      ActorInterval(toon, 'juggle'), targetTrack)
    track.append(mtrack)
    if (npcId != 0):
        track.append(MovieNPCSOS.teleportOut(heal, toon))
    else:
        track.append(__returnToBase(heal))
    for target in targets:
        targetToon = target['toon']
        track.append(Func(targetToon.clearChat))
    return track
def __healTickle(heal):
    toon = heal['toon']
    target = heal['target']['toon']
    hp = heal['target']['hp']
    ineffective = heal['sidestep']
    level = heal['level']
    ivals = __runToHealSpot(heal)
    feather = globalPropPool.getProp('feather')
    feather2 = MovieUtil.copyProp(feather)
    feathers = [feather, feather2]
    hands = toon.getRightHands()

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

    tFeatherScaleUp = 0.5
    dFeatherScaleUp = 0.5
    dFeatherScaleDown = 0.5
    featherTrack = MultiTrack([
        MovieUtil.getActorIntervals(feathers, 'feather'),
        Track([
            WaitInterval(tFeatherScaleUp),
            FunctionInterval(MovieUtil.showProps, extraArgs=[feathers, hands]),
            FunctionInterval(scaleFeathers, extraArgs=[feathers]),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleUp,
                                        MovieUtil.PNT3_NEARZERO,
                                        feathers[0].getScale)
        ]),
        Track([
            WaitInterval(toon.getDuration('tickle') - dFeatherScaleDown),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleDown, None,
                                        MovieUtil.PNT3_NEARZERO)
        ])
    ])
    tHeal = 3.0
    mtrack = MultiTrack([
        featherTrack,
        Track([ActorInterval(toon, 'tickle')]),
        __getSoundTrack(level, 1, node=toon),
        Track([(tHeal,
                FunctionInterval(__healToon,
                                 extraArgs=[target, hp, ineffective])),
               ActorInterval(target,
                             'cringe',
                             startTime=20.0 / target.getFrameRate('cringe'))])
    ])
    ivals.append(mtrack)
    ivals.append(FunctionInterval(MovieUtil.removeProps, extraArgs=[feathers]))
    ivals += __returnToBase(heal)
    ivals.append(FunctionInterval(target.clearChat))
    return Track(ivals)
Example #8
0
def __healTickle(heal):
    toon = heal['toon']
    target = heal['target']['toon']
    hp = heal['target']['hp']
    ineffective = heal['sidestep']
    level = heal['level']
    ivals = __runToHealSpot(heal)
    feather = globalPropPool.getProp('feather')
    feather2 = MovieUtil.copyProp(feather)
    feathers = [
        feather,
        feather2]
    hands = toon.getRightHands()
    
    def scaleFeathers(feathers, toon = toon, target = target):
        toon.pose('tickle', 63)
        toon.update(0)
        hand = toon.getRightHands()[0]
        horizDistance = Vec3(hand.getPos(render) - target.getPos(render))
        horizDistance.setZ(0)
        distance = horizDistance.length()
        if target.style.torso[0] == 's':
            distance -= 0.5
        else:
            distance -= 0.29999999999999999
        featherLen = 2.3999999999999999
        scale = distance / featherLen * hand.getScale(render)[0]
        for feather in feathers:
            feather.setScale(scale)
        

    tFeatherScaleUp = 0.5
    dFeatherScaleUp = 0.5
    dFeatherScaleDown = 0.5
    featherTrack = MultiTrack([
        MovieUtil.getActorIntervals(feathers, 'feather'),
        Track([
            WaitInterval(tFeatherScaleUp),
            FunctionInterval(MovieUtil.showProps, extraArgs = [
                feathers,
                hands]),
            FunctionInterval(scaleFeathers, extraArgs = [
                feathers]),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleUp, MovieUtil.PNT3_NEARZERO, feathers[0].getScale)]),
        Track([
            WaitInterval(toon.getDuration('tickle') - dFeatherScaleDown),
            MovieUtil.getScaleIntervals(feathers, dFeatherScaleDown, None, MovieUtil.PNT3_NEARZERO)])])
    tHeal = 3.0
    mtrack = MultiTrack([
        featherTrack,
        Track([
            ActorInterval(toon, 'tickle')]),
        __getSoundTrack(level, 1, node = toon),
        Track([
            (tHeal, FunctionInterval(__healToon, extraArgs = [
                target,
                hp,
                ineffective])),
            ActorInterval(target, 'cringe', startTime = 20.0 / target.getFrameRate('cringe'))])])
    ivals.append(mtrack)
    ivals.append(FunctionInterval(MovieUtil.removeProps, extraArgs = [
        feathers]))
    ivals += __returnToBase(heal)
    ivals.append(FunctionInterval(target.clearChat))
    return Track(ivals)