def choose_species(self, ev): """ Process a 'choose species' event. """ if ev[0] != ss_event.CHOOSE_SPECIES: return False new_flow = BackgroundSelection(self.state, self.ui_spawner, self.name, ev[1]) raise flow.ChangeFlow(new_flow, None)
def choose_background(self, ev): """ Process a 'background chosen' event. """ if ev[0] != bs_event.CHOOSE_BACKGROUND: return False new_flow = PlayerCreator(self.state, self.ui_spawner, self.name, self.species, ev[1]) raise flow.ChangeFlow(new_flow, FINAL_ENTRY_POINT)
def abort(self, ev): """ Process an 'abort char creation' event. """ if ev[0] != bs_event.ABORT_BACKGROUND: return False import sw.stage.main_menu as mm new_flow = mm.MainMenu(self.state, self.ui_spawner) raise flow.ChangeFlow(new_flow, None)
def quit(self, ev): """ Process a 'quit' event. """ if ev[0] != event.QUIT: return False import sw.stage.quit as quit_stage new_flow = quit_stage.Quit(self.ui_spawner) raise flow.ChangeFlow(new_flow, quit_stage.ENTRY_POINT)
def new_game(self, ev): """ Process a 'new game' event. """ if ev[0] != event.NEW_GAME: return False import sw.stage.char_creation as char_stage new_flow = char_stage.NameInput(self.state, self.ui_spawner) raise flow.ChangeFlow(new_flow, None)
def view_item(self, ev): """ Handle 'view item' event. """ if ev[0] != event.EXAMINE_ITEM: return False import sw.stage.item_view as iv item = ev[1] new_flow = iv.ItemView(self.state, self.ui_spawner, item) raise flow.ChangeFlow(new_flow, iv.FROM_INVENTORY)
def generate_world(self): """ Generate a world and then transfer control to the main game flow. """ import sw.stage.main_overworld as mo self.state.world = world.world_from_scratch(self.state.data) new_flow = mo.MainOverworld(self.state, self.ui_spawner) raise flow.ChangeFlow(new_flow, mo.FROM_WORLDGEN)
def quit_to_equipment(self, ev): """ Quit the item view back to equipment screen. """ if ev[0] != event.QUIT_TO_INVENTORY: return False import sw.stage.equipment as equ new_flow = equ.Equipment(self.state, self.ui_spawner) raise flow.ChangeFlow(new_flow, None)
def quit_to_inventory(self, ev): """ Quit the item view back to inventory. """ if ev[0] != event.QUIT_TO_INVENTORY: return False import sw.stage.inventory as inv new_flow = inv.Inventory(self.state, self.ui_spawner) raise flow.ChangeFlow(new_flow, None)
def create_player(self): """ Create the player character and transfer control to the world creator. """ import sw.stage.world_generation as worldgen player = player_from_scratch(self.name, self.species, self.background) self.state.player = player new_flow = worldgen.WorldGeneration(self.state, self.ui_spawner) raise flow.ChangeFlow(new_flow, worldgen.ENTRY_POINT)
def descend(self, ev): """ Handle 'descend' command. """ if ev[0] != event.DESCEND: return False import sw.stage.main_dungeon as md header = self.state.current_overworld_header() area = header.load_or_generate_area() new_flow = md.MainDungeon(self.state, self.ui_spawner) raise flow.ChangeFlow(new_flow, md.FROM_OVERWORLD, area)
def back(self, ev): """ Process 'return to species selection' event. """ if ev[0] != bs_event.BACK_TO_SPECIES: return False new_flow = SpeciesSelection(self.state, self.ui_spawner, self.name) raise flow.ChangeFlow(new_flow, None)
def enter_name(self, ev): """ Process a 'name entered' event. """ if ev[0] != cnp_event.NAME_ENTERED: return False new_flow = SpeciesSelection(self.state, self.ui_spawner, ev[1]) raise flow.ChangeFlow(new_flow, None)