def cast_lightning(min, max):
    """ |  **Spells and Effects: Lightning**
            |  Cast a lightning and deal a random amount of Lethal damage inside the given *min* and *max* boundaries.
            |  The target is the closest mob inside a radius of 5 fields.
    """
    from utils import closest_mob
    from render import message

    mob = closest_mob(5)
    if mob is None:
        message('No enemy is close enough to strike.', libtcod.red)
        return 'cancelled'
    damage = libtcod.random_get_int(0, min, max)
    message(
        'A lighting bolt strikes the ' + mob.name + '! The damage is ' +
        str(damage) + ' Lethal HL.', libtcod.light_blue)
    mob.fighter.take_damage(damage)
def cast_confusion(min, max):
    """ |  **Spells and Effects: Confusion**
            |  Apply a 'confusion' status to the closes mob within 5 fields.
            |  A confused enemy moves into a random direction every time it takes a turn.
            |  Also, it doesn't react to ai_blocked tiles, so it can fall down a hole.
    """
    from utils import closest_mob
    from render import message

    mob = closest_mob(5)
    if mob is None:
        message('No enemy is close enough to target.', libtcod.red)
        return 'cancelled'

    message(
        'A violet smoke appears around the ' + mob.name + '! It\'s confused.',
        libtcod.violet)
    mob.ai.applyStatus('confusion', libtcod.random_get_int(0, min, max))