Exemple #1
0
def _target_monster(actor, max_range=None):
    """
    Returns a clicked monster inside FOV up to a range,
    or None if right-clicked.
    """
    while True:
        pos = interface.target_tile(actor, max_range)
        if pos is None:
            return None

        for obj in actor.current_map.objects:
            if (obj.x == pos.x and obj.y == pos.y and obj.fighter
                    and obj != actor):
                return obj
def _target_monster(actor, max_range=None):
    """
    Returns a clicked monster inside FOV up to a range,
    or None if right-clicked.
    """
    while True:
        pos = interface.target_tile(actor, max_range)
        if pos is None:
            return None

        for obj in actor.current_map.objects:
            if (obj.x == pos.x and obj.y == pos.y and obj.fighter and
                    obj != actor):
                return obj
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)
Exemple #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)