Exemplo n.º 1
0
def cast_lightning(player):
    monster = _closest_monster(player, config.LIGHTNING_RANGE)
    if monster is None:
        log.add_message('No enemy in range', config.COLOR_ERROR_MESSAGE)
        return 'cancelled'

    log.add_message('Lightning strikes ' + monster.name + ' for ' + str(config.LIGHTNING_DAMAGE) + ' damage',
                    config.COLOR_MAGIC_MESSAGE)
    actions.inflict_damage(player, monster.fighter, config.LIGHTNING_DAMAGE)
Exemplo n.º 2
0
def cast_lightning(actor):
    """
    Find closest enemy (inside a maximum range) and damage it.
    """
    monster = _closest_monster(actor, LIGHTNING_RANGE)
    if monster is None:
        log.message('No enemy is close enough to strike.', libtcod.red)
        return 'cancelled'

    log.message('A lighting bolt strikes the ' + monster.name +
                ' with a loud thunder! The damage is ' +
                str(LIGHTNING_DAMAGE) + ' hit points.', libtcod.light_blue)
    actions.inflict_damage(actor, monster.fighter, LIGHTNING_DAMAGE)
Exemplo n.º 3
0
def cast_lightning(actor):
    """
    Find closest enemy (inside a maximum range) and damage it.
    """
    monster = _closest_monster(actor, LIGHTNING_RANGE)
    if monster is None:
        log.message('No enemy is close enough to strike.', libtcod.red)
        return 'cancelled'

    log.message(
        'A lighting bolt strikes the ' + monster.name +
        ' with a loud thunder! The damage is ' + str(LIGHTNING_DAMAGE) +
        ' hit points.', libtcod.light_blue)
    actions.inflict_damage(actor, monster.fighter, LIGHTNING_DAMAGE)
Exemplo n.º 4
0
def cast_fireball(actor):
    log.message('Left-click a target tile for the fireball, '
                'or right-click to cancel.', libtcod.light_cyan)
    pos = interface.target_tile(actor)
    if pos is None:
        return 'cancelled'
    log.message('The fireball explodes, burning everything within ' +
                str(FIREBALL_RADIUS) + ' tiles!', libtcod.orange)

    for obj in actor.current_map.objects:
        if obj.distance(pos) <= FIREBALL_RADIUS and obj.fighter:
            log.message('The ' + obj.name + ' gets burned for ' +
                        str(FIREBALL_DAMAGE) + ' hit points.',
                        libtcod.orange)
            actions.inflict_damage(actor, obj.fighter, FIREBALL_DAMAGE)
Exemplo n.º 5
0
def cast_fireball(actor):
    log.message(
        'Left-click a target tile for the fireball, '
        'or right-click to cancel.', libtcod.light_cyan)
    pos = interface.target_tile(actor)
    if pos is None:
        return 'cancelled'
    log.message(
        'The fireball explodes, burning everything within ' +
        str(FIREBALL_RADIUS) + ' tiles!', libtcod.orange)

    for obj in actor.current_map.objects:
        if obj.distance(pos) <= FIREBALL_RADIUS and obj.fighter:
            log.message(
                'The ' + obj.name + ' gets burned for ' +
                str(FIREBALL_DAMAGE) + ' hit points.', libtcod.orange)
            actions.inflict_damage(actor, obj.fighter, FIREBALL_DAMAGE)