Ejemplo n.º 1
0
    def respawn_player(self, player: PlayerState) -> None:
        # discard current action
        msg = f"Respawning player '{player.name_str()}'."
        self.logger.info(msg)
        player.add_history(self.game_tick, msg)
        player.killed = False
        player.reset_position()

        # check if it kill another player
        poor_player = self.will_kill_player(player)
        if poor_player is not None:
            self.kill_player_by(poor_player, player)
Ejemplo n.º 2
0
    def test_reset_position(self):
        game_map = GameMap(5)
        pos = Position(1, 1)
        ps = PlayerState(id=1,
                         name="dummy",
                         game_map=game_map,
                         position=pos,
                         direction=Direction(Direction.DOWN))
        ps.direction = Direction(Direction.LEFT)
        ps.reset_position()

        self.assertEqual(ps.direction, Direction(Direction.DOWN))
Ejemplo n.º 3
0
 def kill_player(self, poor_player: PlayerState) -> None:
     self.game_map.clear_tile_owned_by(poor_player.id)
     poor_player.reset_position()
     poor_player.killed = True
     poor_player.stats.set_stat(PlayerStats.CONQUERED, 0)