Ejemplo n.º 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)
Ejemplo n.º 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'
Ejemplo n.º 3
0
def dragonweed_pull(actor, target, context):
    if target.fighter.hp > 0:
        ui.message(
            "The dragonweed's stem lashes out at %s!" % syntax.name(target),
            libtcod.dark_green)
        result = combat.attack_ex(actor.fighter,
                                  target,
                                  0,
                                  accuracy_modifier=1.5,
                                  damage_multiplier=0.75,
                                  verb=('pull', 'pulls'))
        if result == 'hit' and target.fighter is not None:
            if 'displacement' in target.fighter.immunities:
                if fov.player_can_see(target.x, target.y):
                    ui.message(
                        '%s %s.' % (syntax.name(target).capitalize(),
                                    syntax.conjugate(target is player.instance,
                                                     ('resist', 'resists'))),
                        libtcod.gray)
                return 'success'
            beam = main.beam(actor.x, actor.y, target.x, target.y)
            pull_to = beam[max(len(beam) - 3, 0)]
            target.set_position(pull_to[0], pull_to[1])
            if main.roll_dice('1d10') <= 5:
                target.fighter.apply_status_effect(
                    effects.immobilized(duration=2), context['save_dc'], actor)
Ejemplo n.º 4
0
def shackles_of_the_dead(actor, target, context):
    for t in target:
        t.fighter.apply_status_effect(
            effects.immobilized(
                duration=context['duration'] +
                (actor.fighter.spell_power(elements=['death']) / 5)),
            context['save_dc'] + actor.fighter.spell_power(elements=['death']),
            actor)
Ejemplo n.º 5
0
def zombie_on_hit(attacker, target, damage):
    if target.fighter is None:
        return
    if libtcod.random_get_int(0, 0, 100) < 20:
        ui.message(
            '%s grabs %s! %s cannot move!' %
            (syntax.name(attacker).capitalize(), syntax.name(target),
             syntax.pronoun(target).capitalize()), libtcod.yellow)
        target.fighter.apply_status_effect(effects.immobilized(3))
Ejemplo n.º 6
0
def avalanche(actor, target, context):
    for l in target:
        for obj in main.current_map.fighters:
            if obj.x == l[0] and obj.y == l[1]:
                combat.attack_magical(actor.fighter, obj, 'ability_avalanche')
                if obj.fighter is not None:
                    obj.fighter.apply_status_effect(effects.immobilized(),
                                                    context['save_dc'], actor)
        if libtcod.random_get_int(0, 0, 3) > 0:
            tile = main.current_map.tiles[l[0]][l[1]]
            if tile.is_floor and tile.tile_type != 'snow drift' and tile.tile_type != 'ice':
                tile.tile_type = 'snow drift'
                main.changed_tiles.append(l)
            if tile.is_water:
                tile.tile_type = 'ice'
                main.changed_tiles.append(l)
Ejemplo n.º 7
0
def throw_net(actor, target, context):
    if actor is player.instance:
        ui.message('Yo implement this', libtcod.red)
        return 'failure'

    dist = actor.distance_to(target)
    if dist > context['range']:
        return 'cancelled'

    ui.message(
        '%s %s a net at %s.' %
        (syntax.name(actor).capitalize(),
         syntax.conjugate(actor is player.instance,
                          ('throw', 'throws')), syntax.name(target)),
        libtcod.gold)
    ui.render_projectile((actor.x, actor.y), (target.x, target.y),
                         libtcod.gold,
                         character='#')
    target.fighter.apply_status_effect(
        effects.immobilized(duration=context['duration']),
        context['save_dc'],
        source_fighter=actor)

    return 'success'
Ejemplo n.º 8
0
def immobilize_attack(actor, target, damage):
    if target.fighter is not None and main.roll_dice('1d10') <= 5:
        target.fighter.apply_status_effect(effects.immobilized(duration=2))