def new_game(): """ Starts a new game, with a default player on level 1 of the dungeon. Returns the player object. """ # Must initialize the log before we do anything that might emit a message. log.init() fighter_component = Fighter(hp=100, defense=1, power=2, xp=0, death_function=player_death) player = Object(algebra.Location(0, 0), '@', 'player', libtcod.white, blocks=True, fighter=fighter_component) player.inventory = [] player.level = 1 player.game_state = 'playing' # True if there's a (hostile) fighter in FOV player.endangered = False obj = miscellany.dagger() player.inventory.append(obj) actions.equip(player, obj.equipment, False) obj.always_visible = True cartographer.make_map(player, 1) renderer.clear_console() renderer.update_camera(player) log.message('Welcome stranger! Prepare to perish in the Tombs of the Ancient Kings.', libtcod.red) log.message('Press ? or F1 for help.') return player
def _new_equipment(player, obj): _new_item(player, obj) actions.equip(player, obj.equipment, False)
def _new_equipment(actor, obj): _new_item(actor, obj) actions.equip(actor, obj.equipment, False)