def end_turn_pressed(self): """ This is called when the end turn button is pressed. Advances to the next turn. """ # Check if the turn can actually end for unit in base_unit.BaseUnit.active_units: if unit.team == self.cur_team and not unit.can_turn_end(): # Make sure the game mode is changed back to Select self.change_mode(Modes.Select) # If not, switch to that unit self.sel_unit = unit return # reset game mode self.change_mode(Modes.Select) # unselect unit self.sel_unit = None # Reset the turn states of all units for unit in base_unit.BaseUnit.active_units: # This is the current team's unit, so call its turn end function if unit.team == self.cur_team and not unit.turn_ended(): # The unit died! Add its death effect if unit.die_effect: self._effects.add(unit.die_effect(unit.rect.topleft)) # advance turn self.current_turn += 1
def end_turn_pressed(self): """ This is called when the end turn button is pressed. Advances to the next turn. """ # Check if the turn can actually end for unit in base_unit.BaseUnit.active_units: if unit.team == self.cur_team and not unit.can_turn_end(): # Make sure the game mode is changed back to Select self.change_mode(Modes.Select) # If not, switch to that unit self.sel_unit = unit return # reset game mode self.change_mode(Modes.Select) # unselect unit self.sel_unit = None # builds a new footman. for unit in base_unit.BaseUnit.active_units: if unit.type == 'Factory': # searches the units still alive for a factory. new_unit = factory.Factory.build_footman(unit) # goes through the original function to create footman. if (new_unit != None): self.update_unit_rect(new_unit) # Reset the turn states of all units for unit in base_unit.BaseUnit.active_units: # This is the current team's unit, so call its turn end function if unit.team == self.cur_team and not unit.turn_ended(): # The unit died! Add its death effect if unit.die_effect: self._effects.add(unit.die_effect(unit.rect.topleft)) # advance turn self.current_turn += 1