예제 #1
0
def wild_growth(actor, target, context):
    import mapgen
    terrain = main.current_map.tiles[target.x][target.y].tile_type
    if target.fighter and target.fighter.has_status('immobilized'):
        return 'cancelled'
    if terrain == 'grass floor':
        if target.fighter:
            if target is player.instance or fov.player_can_see(
                    target.x, target.y):
                ui.message('The grass sprouts a tangle of grasping vines!',
                           libtcod.lime)
            duration = main.roll_dice(context['root_duration'])
            immobilized = target.fighter.apply_status_effect(
                effects.immobilized(duration=duration), dc=context['save_dc'])
            if immobilized:
                target.fighter.apply_status_effect(effects.StatusEffect(
                    'wild growth',
                    time_limit=duration,
                    color=libtcod.lime,
                    on_tick=wild_growth_tick,
                    message='You are gripped by writhing vines!',
                    description='This unit will take damage every turn',
                    cleanseable=True),
                                                   dc=None)
    else:
        if target is player.instance or fov.player_can_see(target.x, target.y):
            ui.message('Grass springs from the %s...' % terrain, libtcod.lime)
        grass = mapgen.create_terrain_patch((target.x, target.y),
                                            'grass floor',
                                            min_patch=4,
                                            max_patch=12,
                                            overwrite=False)
        for tile in grass:
            main.changed_tiles.append(tile)
예제 #2
0
def strangleweeds(actor, target, context):
    hit = False
    for f in main.get_fighters_in_burst(
            actor.x, actor.y, context['range'], actor,
            lambda o: o.fighter.team != actor.fighter.team):
        tile = main.current_map.tiles[f.x][f.y]
        if tile.tile_type == 'grass floor':
            if actor is player.instance or fov.player_can_see(f.x, f.y):
                ui.message(
                    'Writhing vines grip %s and hold %s in place!' %
                    (syntax.name(f), syntax.pronoun(f)),
                    spells.essence_colors['life'])
            f.fighter.apply_status_effect(
                effects.immobilized(duration=context['duration']))
            f.fighter.apply_status_effect(
                effects.StatusEffect(
                    'strangleweeds',
                    time_limit=context['duration'],
                    color=libtcod.lime,
                    on_tick=strangleweed_on_tick,
                    message='The strangleweeds crush you!',
                    description='This unit will take damage every turn',
                    cleanseable=True))
            hit = True
    if hit:
        return 'success'
    else:
        if actor is player.instance:
            ui.message("You can't see any susceptible targets.", libtcod.gray)
        return 'cancelled'
예제 #3
0
def confuse(actor, target, context):
    import consts
    if target.fighter.apply_status_effect(
            effects.StatusEffect(
                'confusion',
                consts.CONFUSE_NUM_TURNS,
                color=libtcod.pink,
            )):
        ui.message(
            '%s %s confused!' % (syntax.name(target).capitalize(),
                                 syntax.conjugate(target is player.instance,
                                                  ('are', 'is'))),
            libtcod.light_blue)
예제 #4
0
def summon_equipment(actor, item):
    if actor is player.instance and len(
            player.instance.fighter.inventory) >= 26:
        ui.message('You are carrying too many items to summon another.')
        return 'didnt-take-turn'

    summoned_equipment = main.create_item(item, material='', quality='')
    if summoned_equipment is None:
        return

    expire_ticker = main.Ticker(15, summon_equipment_on_tick)
    equipped_item = None
    expire_ticker.old_left = None
    if summoned_equipment.equipment.slot == 'both hands':
        equipped_item = main.get_equipped_in_slot(actor.fighter.inventory,
                                                  'right hand')
        expire_ticker.old_left = main.get_equipped_in_slot(
            actor.fighter.inventory, 'left hand')
    elif summoned_equipment.equipment.slot == 'floating shield':
        #can't stack two shields
        equipped_item = actor.fighter.get_equipped_shield()
    else:
        equipped_item = main.get_equipped_in_slot(
            actor.fighter.inventory, summoned_equipment.equipment.slot)
    expire_ticker.old_equipment = equipped_item

    if equipped_item is not None:
        equipped_item.dequip()
    summoned_equipment.item.pick_up(actor, True)
    expire_ticker.equipment = summoned_equipment
    effect = effects.StatusEffect('summoned equipment',
                                  expire_ticker.max_ticks + 1,
                                  summoned_equipment.color)
    actor.fighter.apply_status_effect(effect)
    expire_ticker.effect = effect
    expire_ticker.owner = actor
    main.current_map.tickers.append(expire_ticker)

    if actor is player.instance:
        ui.message("A {} appears!".format(summoned_equipment.name),
                   libtcod.white)

    return 'success'
예제 #5
0
def waterbreathing():
    player.instance.fighter.apply_status_effect(
        effects.StatusEffect('waterbreathing', 31, libtcod.light_azure))
예제 #6
0
def on_hit_sting(attacker, target, damage):
    if target.fighter is None:
        return
    target.fighter.apply_status_effect(effects.StatusEffect(
        'stung', 3, libtcod.flame),
                                       dc=8)