def next_level(player, portal): """ Advance to the next level (changing player.current_map). Heals the player 50%. Returns the Map of the new level. """ actions.heal(player.fighter, player.fighter.max_hp / 2) old_map = player.current_map generator = portal.generator need_stairs = generator(player, player.current_map.dungeon_level + 1) renderer.clear_console() renderer.update_camera(player) if need_stairs: stairs = Object(player.pos, '>', 'stairs up', libtcod.white, always_visible=True) stairs.destination = old_map stairs.dest_position = portal.pos player.current_map.objects.insert(0, stairs) player.current_map.portals.insert(0, stairs) return player.current_map
def cast_heal(player, amount=config.HEALING_POTION_AMOUNT): if player.fighter.hp == player.fighter.max_hp: log.add_message('Already at full health') return 'cancelled' log.add_message('You feel much better!') actions.heal(player.fighter, amount)
def cast_heal(actor): """ Heal the caster. """ if actor.fighter.hp == actor.fighter.max_hp: log.message('You are already at full health.', libtcod.red) return 'cancelled' log.message('Your wounds start to feel better!', libtcod.light_violet) actions.heal(actor.fighter, HEAL_AMOUNT)
def next_level(player, portal): """ Advance to the next level (changing player.current_map). Heals the player 50%. Returns the Map of the new level. """ log.message('You take a moment to rest, and recover your strength.', libtcod.light_violet) actions.heal(player.fighter, player.fighter.max_hp / 2) log.message('After a rare moment of peace, you descend deeper into the heart of the dungeon...', libtcod.red) old_map = player.current_map cartographer.make_map(player, player.current_map.dungeon_level + 1) renderer.clear_console() renderer.update_camera(player) # Create the up stairs at the current position. stairs = Object(player.pos, '>', 'stairs up', libtcod.white, always_visible=True) stairs.destination = old_map stairs.dest_position = portal.pos player.current_map.objects.insert(0, stairs) player.current_map.portals.insert(0, stairs) return player.current_map