示例#1
0
def define_dummy():
    with collect_records() as c:
        ActorPrefab('dehydrated_dummy',
                    name='Dummy',
                    skinPalette='pOrange',
                    armorPalette='pOrange',
                    unarmoredPalette='pOrange',
                    clothPalette='pOrange',
                    playerCanOpenInv=True,
                    unkillable=True,
                    hostile=False,
                    faction='player',
                    actorTypeID=ActorType(
                        'dehydrated_dummy',
                        cloneFrom='dummy',
                        reactions=[
                            ActorTypeReaction(
                                element=['dispel', 'combatStart'],
                                spawnItem='dehydrated_dummy_placeable',
                                action=Action('dispel_dehydrated_dummy',
                                              av_affecters=[
                                                  AvAffecter(
                                                      actorValue='removeActor',
                                                      magnitude=1)
                                              ])),
                        ]))

        item = ItemType(
            'dehydrated_dummy_placeable',
            name='Dehydrated Dummy',
            description='Place it on the ground and add water.',
            sprite=26,
            pR='pOrange',
            itemCategory='tool',
            weight=1,
            volume=10,
            value=1000,
            reactions=[
                ItemReaction(element='water',
                             newID='X',
                             action=Action(
                                 'spawn_dummy',
                                 special='cantUseInCombat',
                                 av_affecters=[
                                     AvAffecter(actorValue='summonActor',
                                                magnitude='dehydrated_dummy',
                                                chance=100,
                                                duration=Duration.permanent()),
                                 ]))
            ])

        add_dialog(item)
        return c
示例#2
0
def callout_action(collection, sayings):
    av_affecters = []
    for say in sayings:
        av_affecters.append(
            AvAffecter(actorValue='trigger',
                       magnitude=GlobalTrigger(generate_id('trigger_say_'), [
                           GlobalTriggerEffect('damageNumber', strings=[say])
                       ]).collect(collection),
                       useSeparateChanceRoll=True,
                       chance=100 / len(sayings)))

    action = Action(generate_id('callout_'), av_affecters=av_affecters)
    collection.append(action)
    return action
示例#3
0
def lightning_trigger():
    return Action(
        'elecTriggerAttack',
        name='Lightning Trigger',
        casterAnimation='spellcast',
        casterAnimationDependsOnWeaponHand=True,
        aoe=ActionAOE(cloneFrom='adjacent',
                      arc=True,
                      airborne=True,
                      maxRangeBonus='sa:stoneSavant * 2'),
        av_affecters=[
            AvAffecter(actorValue='HP',
                       magnitude='d:elecDmgWpnPower(0) - sa:stoneSavant * 2',
                       chance='d:elecAcc',
                       element=['magic', 'lightning'],
                       FXOnTile=['lightningStrike_mild', 'shortBolt', 'spark'])
        ])
示例#4
0
def evil_boat():
    action = Action(
        'toyboat_explosion',
        name='Toy Boat',
        casterAnimation='use',
        FXOnTarget=['medShakeHoriz', 'strike'],
        aoe=ActionAOE(shape=2,
                      needsLOE=True,
                      minRange=1,
                      maxRange=10,
                      occupyAll=True,
                      fReq='m:incapped'),
        av_affecters=[
            AvAffecter(actorValue='removeActor',
                       harmful=False,
                       magnitude=1,
                       element=['explode', 'smash', 'heavySmash'],
                       FXOnTile=[
                           'sfx_classicExplosion', 'medExplosion',
                           'ThudShotBigger'
                       ]),
            AvAffecter(actorValue='summonItem',
                       magnitude='loot_bone_junk',
                       FXOnTile='terrain',
                       aoe=AvAffecterAOE(cloneFrom='adjacentAndSelf')),
            AvAffecter(actorValue='push',
                       useCasterAsOriginForDirectionalEffects=False,
                       magnitude=3,
                       chance=100,
                       FXOnTile='smallShockwave_instant_moving',
                       aoe=AvAffecterAOE(cloneFrom='adjacent+1',
                                         arc=True,
                                         airborne=True,
                                         coneAngle=360))
        ])
    boat = ItemType('toyboat', cloneFrom='toyboat', action=action.id)
    return Collection(action, boat)
示例#5
0
def define_ambush(crops):
    Action('reset_crop_harvest_ambush',
           av_affecters=[
               AvAffecter(actorValue='trigger',
                          magnitude=GlobalTrigger('toggle_crop_harvest_ambush_on',
                                                  [
                                                      GlobalTriggerEffect('setGlobalVar',
                                                                          strings=['crop_harvest_ambush'],
                                                                          floats=[0])
                                                  ]))
           ])

    munch_crop = Action('munch_crop_attack',
           name='Munch',
           applyWeaponBuffs=True,
           chargeTime=25,
           AIRatingBonus=100,
           casterAnimation='s_simpleAttack',
           special=['requiresCharging', 'cancelChargingOnMove'],
           aoe=ActionAOE(cloneFrom='adjacent'),
           av_affecters=[
               AvAffecter(actorValue='HP',
                          magnitude='d:fistDmg * 1.2',
                          chance='d:fistAcc',
                          weaponAvAffecter=True,
                          element=['melee', 'fakeElec'],
                          FXOnTile=['pop', 'smash'],)
           ])

    monsters = [
        ActorPrefab(f'crop_{monster}',
                    hostile=True,
                    faction='player',
                    combatTeam='crop_monster',
                    aiScript='idle',
                    actorTypeID=ActorType(f'crop_{monster}',
                                          cloneFrom=monster,
                                          innateActions=munch_crop))
        for monster in ['spide', 'cattle']
    ]

    for monster in monsters:
        ActorTypeDetectAoE(monster.id,
                           cloneFrom='detect',
                           coneAngle=360,
                           maxRange=10)

    spawn_chance = [f'9 * gIs0:crop_harvest_ambush']
    for crop_mature, crop_result in crops:
        spawn_chance.append(f'0.1 * gIs0:crop_harvest_ambush * itemsZone:{crop_mature}')
        spawn_chance.append(f'0.1 * gIs0:crop_harvest_ambush * itemsZone:{crop_result}')
    FormulaGlobal('crop_harvest_ambush_chance', ' + '.join(spawn_chance))

    spawn_chances = {}
    for i, monster in enumerate(monsters):
        spawn_chances[monster.id] = f'd:crop_harvest_ambush_chance * gIs{i}:crop_harvest_ambush_monster'

    affecters = [
        AvAffecter(actorValue='trigger',
                   chance='100 * gIs0:crop_harvest_ambush',
                   magnitude=GlobalTrigger('crop_harvest_ambush_random_monster',
                                           [
                                               GlobalTriggerEffect('setGlobalVar_math',
                                                                   strings=['crop_harvest_ambush_monster',
                                                                            'm:rand(4)'])
                                           ]))
    ]
    for monster in monsters:
        affecters.append(AvAffecter(actorValue='summonActor',
                                    magnitude=monster,
                                    useSeparateChanceRoll=True,
                                    chance=spawn_chances[monster.id],
                                    aoe=AvAffecterAOE(cloneFrom='land_search',
                                                      minRange=2,
                                                      maxRange=6)))

    affecters.append(AvAffecter(actorValue='trigger',
                                chance='100 * gIs0:crop_harvest_ambush',
                                magnitude=GlobalTrigger('crop_harvest_ambush',
                                                        [
                                                            GlobalTriggerEffect('setGlobalVar',
                                                                                strings=['crop_harvest_ambush'],
                                                                                floats=[1]),
                                                            GlobalTriggerEffect('cancelIfEnemiesNotPresent',
                                                                                floats=[0]),
                                                            GlobalTriggerEffect('setGlobalVar_math',
                                                                                strings=[
                                                                                    'num_crop_harvest_ambushes',
                                                                                    'g:num_crop_harvest_ambushes + 1'
                                                                                ]),
                                                            GlobalTriggerEffect('enterCombat',
                                                                                floats=[9999999])
                                                        ])))
    Action('activate_crop_harvest_ambush',
           av_affecters=affecters)
示例#6
0
def define_hoe():
    with collect_records() as c:
        iron = ItemType('hoe_iron',
                        name='Iron Hoe',
                        texture='rcfox_farming_tools',
                        sprite=2,
                        pR='pIron',
                        pB='pIronHilt',
                        itemCategory='weapon',
                        element='spear',
                        special=['cannotBeSheathed', 'sprite2xHeight'],
                        weight=2,
                        volume=5,
                        value=25,
                        power=2,
                        action=Action(
                            'hoe_attack',
                            casterAnimation='spear',
                            casterAnimationDependsOnWeaponHand=True,
                            FXChangesWithWeaponHand=True,
                            FXOnTarget='stab',
                            special='cantUseInCombat',
                            aoe=ActionAOE(shape=2,
                                          needsLoS=True,
                                          needsLoE=True,
                                          airborne=True,
                                          minRange=1,
                                          maxRange=2,
                                          maxRangeBonus='w:power - 1',
                                          bypassAll=False,
                                          occupyAll=False),
                            av_affecters=[
                                AvAffecter(aoe=AvAffecterAOE(
                                    aoeCasterAsOrigin=True,
                                    shape=2,
                                    minRange=1,
                                    maxRange=0,
                                    maxRangeBonus=0,
                                    maxRangeAddDistanceFromCaster=True,
                                    coneAngle=1),
                                           actorValue='HP',
                                           magnitude='d:spearDmg',
                                           chance='d:spearAcc',
                                           element=['dig']),
                            ]))
        wood = ItemType('hoe_wood',
                        cloneFrom='hoe_iron',
                        name='Wooden Hoe',
                        pR='pWood',
                        pB='pWoodDark',
                        power=1)
        steel = ItemType('hoe_steel',
                         cloneFrom='hoe_iron',
                         name='Steel Hoe',
                         pR='pSteel',
                         pB='pSteelHilt',
                         power=3)
        mythril = ItemType('hoe_mythril',
                           cloneFrom='hoe_iron',
                           name='Mythril Hoe',
                           pR='pMythril',
                           pB='pMythrilHilt',
                           power=4)

        kit = ItemType(
            'craft_hoe',
            cloneFrom='craft_sword',
            name='Hoe Crafting Kit',
            texture='rcfox_farming_tools',
            sprite=12,
            description='Combine this with raw material to create a hoe.')
        kit.recipe('woodPlank', wood, reverse_with=FURNACE_IDS)
        kit.recipe('iron_chunk', iron, reverse_with=FURNACE_IDS)
        kit.recipe('steel_bar', steel, reverse_with=FURNACE_IDS)
        kit.recipe('mythril_chunk', mythril, reverse_with=FURNACE_IDS)

        return c
示例#7
0
def define_watering_can():
    affecter_aoe = AvAffecterAOE(shape=3,
                                 aoeCasterAsOrigin=True,
                                 coneAngle=92,
                                 minRange=1,
                                 maxRange=0,
                                 maxRangeBonus=0,
                                 maxRangeAddDistanceFromCaster=True)
    with collect_records() as c:
        iron = ItemType(
            'watering_can_iron',
            name='Iron Watering Can',
            texture='rcfox_farming_tools',
            sprite=0,
            spriteWhenHeld=1,
            pR='pIron',
            pB='pIronHilt',
            itemCategory='weapon',
            element='water',
            harmful=False,
            special='cannotBeSheathed',
            weight=2,
            volume=5,
            value=25,
            power=2,
            action=Action(
                'watering_can_use',
                casterAnimation='use',
                casterAnimationDependsOnWeaponHand=True,
                special='cantUseInCombat',
                aoe=ActionAOE(
                    shape=2,
                    needsLoS=False,
                    needsLoE=True,
                    airborne=True,
                    arc=True,
                    minRange=0,
                    maxRange=0,
                    maxRangeBonus='w:power + cIsGreaterThan:skill_Ice:6'),
                av_affecters=[
                    AvAffecter(aoe=affecter_aoe,
                               harmful=False,
                               actorValue='wet',
                               magnitude=1,
                               duration=150,
                               chance='d:iceAcc',
                               element='water'),
                    AvAffecter(aoe=affecter_aoe,
                               harmful=False,
                               actorValue='summonItem',
                               magnitude='puddle',
                               duration=1,
                               chance=100),
                ]))
        wood = ItemType('watering_can_wood',
                        cloneFrom='watering_can_iron',
                        name='Wooden Watering Can',
                        pR='pWood',
                        pB='pWoodDark',
                        power=1)
        steel = ItemType('watering_can_steel',
                         cloneFrom='watering_can_iron',
                         name='Steel Watering Can',
                         pR='pSteel',
                         pB='pSteelHilt',
                         power=3)
        mythril = ItemType('watering_can_mythril',
                           cloneFrom='watering_can_iron',
                           name='Mythril Watering Can',
                           pR='pMythril',
                           pB='pMythrilHilt',
                           power=4)

        kit = ItemType(
            'craft_watering_can',
            cloneFrom='craft_sword',
            name='Watering Can Crafting Kit',
            texture='rcfox_farming_tools',
            sprite=6,
            description=
            'Combine this with raw material to create a watering can.')
        kit.recipe('woodPlank', wood, reverse_with=FURNACE_IDS)
        kit.recipe('iron_chunk', iron, reverse_with=FURNACE_IDS)
        kit.recipe('steel_bar', steel, reverse_with=FURNACE_IDS)
        kit.recipe('mythril_chunk', mythril, reverse_with=FURNACE_IDS)

        return c
示例#8
0
def define_scythe():
    with collect_records() as c:
        iron = ItemType('scythe_iron',
                        name='Iron Scythe',
                        texture='rcfox_farming_tools',
                        sprite=3,
                        pR='pIron',
                        pB='pIronHilt',
                        itemCategory='weapon',
                        element='spear',
                        special=['cannotBeSheathed', 'sprite2xHeight'],
                        weight=2,
                        volume=5,
                        value=25,
                        power=2,
                        action=Action('scythe_attack',
                                      casterAnimation='broadswing',
                                      casterAnimationDependsOnWeaponHand=True,
                                      FXChangesWithWeaponHand=True,
                                      FXOnTarget='swipe',
                                      special='cantUseInCombat',
                                      aoe=ActionAOE(cloneFrom='adjacent'),
                                      av_affecters=[
                                          AvAffecter(aoe=AvAffecterAOE(
                                              aoeCasterAsOrigin=True,
                                              maxRange=1.5,
                                              coneAngle=90,
                                              maxRangeBonus='w:power - 1'),
                                                     actorValue='HP',
                                                     magnitude='d:spearDmg',
                                                     chance='d:spearAcc',
                                                     element=['slash']),
                                      ]))
        wood = ItemType('scythe_wood',
                        cloneFrom='scythe_iron',
                        name='Wooden Scythe',
                        pR='pWood',
                        pB='pWoodDark',
                        power=1)
        steel = ItemType('scythe_steel',
                         cloneFrom='scythe_iron',
                         name='Steel Scythe',
                         pR='pSteel',
                         pB='pSteelHilt',
                         power=3)
        mythril = ItemType('scythe_mythril',
                           cloneFrom='scythe_iron',
                           name='Mythril Scythe',
                           pR='pMythril',
                           pB='pMythrilHilt',
                           power=4)

        kit = ItemType(
            'craft_scythe',
            cloneFrom='craft_sword',
            name='Scythe Crafting Kit',
            texture='rcfox_farming_tools',
            sprite=7,
            description='Combine this with raw material to create a scythe.')
        kit.recipe('woodPlank', wood, reverse_with=FURNACE_IDS)
        kit.recipe('iron_chunk', iron, reverse_with=FURNACE_IDS)
        kit.recipe('steel_bar', steel, reverse_with=FURNACE_IDS)
        kit.recipe('mythril_chunk', mythril, reverse_with=FURNACE_IDS)

        return c