Exemplo n.º 1
0
    def __init__(self, coordinates: Coordinates):
        """
            Initialize a quadrant
        """
        from pytrek.engine.GameEngine import GameEngine  # Avoid recursion

        self.logger: Logger = getLogger(__name__)
        self._coordinates: Coordinates = coordinates
        self._sectors: QuadrantGrid = QuadrantGrid([])

        self._intelligence: Intelligence = Intelligence()
        self._gameEngine: GameEngine = GameEngine()
        self._gameSettings: GameSettings = GameSettings()

        self._klingonCount: int = 0
        self._commanderCount: int = 0
        self._superCommanderCount: int = 0
        self._hasStarBase: bool = False
        self._hasPlanet: bool = False
        self._hasSuperNova: bool = False
        self._scanned: bool = False

        self._klingons: Enemies = Enemies([])
        self._commanders: Enemies = Enemies([])
        self._superCommanders: Enemies = Enemies([])

        self._planet: Planet = cast(Planet, None)
        self._starBase: StarBase = cast(StarBase, None)

        self._enterprise: Enterprise = cast(Enterprise, None)
        self._enterpriseCoordinates: Coordinates = cast(Coordinates, None)
        self._starBaseCoordinates: Coordinates = cast(Coordinates, None)

        self._createQuadrant()
Exemplo n.º 2
0
    def init(self, *args, **kwds):

        self.logger: Logger = getLogger(__name__)

        self._gameEngine: GameEngine = GameEngine()
        self._gameState: GameState = GameState()
        self._gameSettings: GameSettings = GameSettings()
        self._computer: Computer = Computer()
        self._intelligence: Intelligence = Intelligence()

        self._ktm: KlingonTorpedoMediator = KlingonTorpedoMediator()
        self._ctm: CommanderTorpedoMediator = CommanderTorpedoMediator()
        self._ptm: EnterpriseTorpedoMediator = EnterpriseTorpedoMediator()
        self._stm: SuperCommanderTorpedoMediator = SuperCommanderTorpedoMediator(
        )

        self._km: KlingonMediator = KlingonMediator()
        self._cm: CommanderMediator = CommanderMediator()
        self._scm: SuperCommanderMediator = SuperCommanderMediator()

        self._epm: EnterprisePhaserMediator = EnterprisePhaserMediator()

        self._messageConsole: MessageConsole = MessageConsole()
        self._soundMachine: SoundMachine = SoundMachine()

        self._playerList: SpriteList = SpriteList()
        self._klingonList: SpriteList = SpriteList()
        self._commanderList: SpriteList = SpriteList()
        self._superCommanderList: SpriteList = SpriteList()
Exemplo n.º 3
0
    def _setupGame(cls):
        """
        Assumes the game setting location has been set

        Since the game mechanics are run by singletons set them up once
        at the start of this test class.  Then each instance test will just
        use the pre-initialized singletons

        The initializaton code copied from PyTrekView
        TODO: perhaps should go in a utility class so it is always current

        """
        TestBase.resetSingletons()

        TestEventEngine.clsLogMessageConsole = LogMessageConsole()
        TestEventEngine.clsGameSettings = GameSettings(
        )  # Be able to read the preferences file
        TestEventEngine.clsIntelligence = Intelligence()

        TestEventEngine.clsGameState = GameState(
        )  # Set up the game parameters which uses the above
        TestEventEngine.clsGameState.currentQuadrantCoordinates = TestEventEngine.clsIntelligence.generateQuadrantCoordinates(
        )

        TestEventEngine.clsGameEngine = GameEngine(
        )  # Then the engine needs to be initialized

        TestEventEngine.clsEventEngine = EventEngine(
            TestEventEngine.clsLogMessageConsole)
        TestEventEngine.clsDevices = Devices()
        TestEventEngine.clsGalaxy = Galaxy()
Exemplo n.º 4
0
    def __init__(self):

        super().__init__()
        self.logger: Logger = getLogger(__name__)

        self._gameSettings: GameSettings = GameSettings()
        self._gameState: GameState = GameState()
        self._gameEngine: GameEngine = GameEngine()
        self._intelligence: Intelligence = Intelligence()
        self._computer: Computer = Computer()
        self._galaxy: Galaxy = Galaxy()
        self._devices: Devices = Devices()

        self._messageConsole: SchedulerTestMessageConsole = SchedulerTestMessageConsole(
        )
        self._eventEngine: EventEngine = EventEngine(self._messageConsole)
        self._quadrantMediator: QuadrantMediator = QuadrantMediator()

        self._quadrant: Quadrant = self._galaxy.currentQuadrant

        self._gameState.currentQuadrantCoordinates = self._galaxy.currentQuadrant.coordinates

        enterprise: Enterprise = self._gameState.enterprise

        self._quadrantMediator.enterQuadrant(quadrant=self._quadrant,
                                             enterprise=enterprise)

        self._createInitialEvents()
Exemplo n.º 5
0
    def _setupGame(cls):
        """
        Assumes the game setting location has been set

        Since the game mechanics are run by singletons set them up once
        at the start of this test class.  Then each instance test will just
        use the pre-initialized singletons

        The initializaton code copied from PyTrekView
        TODO: perhaps should go in a utility class so it is always current

        """
        TestBase.resetSingletons()

        TestFutureEventHandlers.clsGameSettings = GameSettings(
        )  # Be able to read the preferences file
        TestFutureEventHandlers.clsGameState = GameState(
        )  # Set up the game parameters which uses the above
        TestFutureEventHandlers.clsGameEngine = GameEngine(
        )  # Then the engine needs to be initialized
        TestFutureEventHandlers.clsIntelligence = Intelligence()
        TestFutureEventHandlers.clsComputer = Computer()
        TestFutureEventHandlers.clsGalaxy = Galaxy()
        TestFutureEventHandlers.clsEventEngine = EventEngine(
            LogMessageConsole())
        TestFutureEventHandlers.clsQuadrantMediator = QuadrantMediator()
        TestFutureEventHandlers.clsGalaxyMediator = GalaxyMediator(
        )  # This essentially finishes initializing most of the game
Exemplo n.º 6
0
    def setup(self):
        """
        Set up the game here. Call this function to restart the game.
        """

        fqFileName: str = LocateResources.getResourcesPath(
            resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME,
            bareFileName='QuadrantBackground.png')
        self.background = load_texture(fqFileName)

        self._gameSettings = GameSettings()
        self._gameState = GameState()
        self._gameEngine = GameEngine()
        self._intelligence = Intelligence()
        self._computer = Computer()
        self._galaxy = Galaxy()

        self._quadrantMediator = QuadrantMediator()

        self._enterprise: Enterprise = self._gameState.enterprise

        self._quadrant: Quadrant = self._galaxy.currentQuadrant

        self._quadrant.klingonCount = 0
        self._quadrant.commanderCount = 0
        self._quadrant.superCommanderCount = 0

        currentSectorCoordinates: Coordinates = self._intelligence.generateSectorCoordinates(
        )

        self._gameState.currentQuadrantCoordinates = self._galaxy.currentQuadrant.coordinates
        self._gameState.currentSectorCoordinates = currentSectorCoordinates

        self._quadrantMediator.enterQuadrant(quadrant=self._quadrant,
                                             enterprise=self._enterprise)

        self._enterpriseMediator: EnterpriseMediator = EnterpriseMediator(
            view=self, warpTravelCallback=self._noOp)

        self._statusConsole = StatusConsole(gameView=self)
        self._messageConsole = MessageConsole()

        self._makeEnemySpriteLists()

        self._makeGamePiecePalette()
        self.logger.info(f'Setup Complete')
Exemplo n.º 7
0
    def __init__(self, messageConsole: AbstractMessageConsole):

        self.logger: Logger = getLogger(__name__)

        self._intelligence: Intelligence = Intelligence()
        self._gameState: GameState = GameState()
        self._galaxy: Galaxy = Galaxy()

        self._messageConsole: AbstractMessageConsole = messageConsole
        self._futureEventHandlers: FutureEventHandlers = FutureEventHandlers(
            self._messageConsole)
Exemplo n.º 8
0
    def __init__(self, messageConsole: AbstractMessageConsole):

        self.logger: Logger = getLogger(__name__)
        self._gameState: GameState = GameState()
        self._galaxy: Galaxy = Galaxy()
        self._intelligence: Intelligence = Intelligence()
        self._galaxyMediator: GalaxyMediator = GalaxyMediator()
        self._quadrantMediator: QuadrantMediator = QuadrantMediator()

        self._messageConsole: AbstractMessageConsole = messageConsole

        self.logger.debug(f'FutureEventHandlers.__init__ - {self._gameState=}')
Exemplo n.º 9
0
    def __init__(self):

        self._missesMediatorLogger: Logger = getLogger(__name__)

        super().__init__()

        self._gameState: GameState = GameState()
        self._gameEngine: GameEngine = GameEngine()
        self._intelligence: Intelligence = Intelligence()
        self._gameSettings: GameSettings = GameSettings()

        self._messageConsole: MessageConsole = MessageConsole()
Exemplo n.º 10
0
    def setUp(self):
        self.logger: Logger = TestIntelligence.clsLogger

        self._gameEngine: GameEngine = GameEngine()
        self._gameSettings: GameSettings = GameSettings()
        self._gameState: GameState = GameState()
        self.smarty: Intelligence = Intelligence()

        self._savePlayerType: PlayerType = self._gameSettings.playerType
        self._saveGameType: GameType = self._gameSettings.gameType

        self._powerTestPlayerType: PlayerType = cast(PlayerType, None)
Exemplo n.º 11
0
    def init(self, *args, **kwds):

        self.logger: Logger = getLogger(__name__)

        self._gameSettings: GameSettings = GameSettings()
        self._gameState: GameState = GameState()
        self._intelligence: Intelligence = Intelligence()
        self._computer: Computer = Computer()
        self._devices: Devices = Devices()
        # self._eventEngine:  EventEngine  = EventEngine()

        self._accumulatedDelta: float = 0.0
        self._gameClock: float = 0.0

        self.logger.info(f'GameEngine initialized')
Exemplo n.º 12
0
    def init(self):

        self.logger:  Logger       = getLogger(__name__)
        gameSettings: GameSettings = GameSettings()
        intelligence: Intelligence = Intelligence()
        playerType:   PlayerType   = gameSettings.playerType
        gameType:     GameType     = gameSettings.gameType

        self._playerType: PlayerType  = playerType
        self._gameType:     GameType  = gameType
        self._energy:       float     = gameSettings.initialEnergyLevel
        self._shieldEnergy: float     = gameSettings.initialShieldEnergy
        self._torpedoCount: int       = gameSettings.initialTorpedoCount
        self._starDate:     float     = intelligence.generateInitialStarDate()
        self._inTime:       float     = intelligence.generateInitialGameTime()
        self._opTime:       float     = 0.0

        self._remainingGameTime:   float = intelligence.generateInitialGameTime()
        self._remainingKlingons:   int   = intelligence.generateInitialKlingonCount(gameType=gameType, playerType=playerType)
        self._remainingCommanders: int   = intelligence.generateInitialCommanderCount(playerType=playerType, generatedKlingons=self._remainingKlingons)

        self._starBaseCount: int = intelligence.generateInitialStarBaseCount()
        self._planetCount:   int = intelligence.generateInitialPlanetCount()

        # Adjust total Klingon counts by # of commanders
        self._remainingKlingons = self._remainingKlingons - self._remainingCommanders

        # Novice and Fair players do not get Super Commanders
        if playerType != PlayerType.Novice and playerType != PlayerType.Fair:
            self._remainingSuperCommanders = intelligence.generateInitialSuperCommanderCount(playerType=playerType, numberOfKlingons=self._remainingKlingons)
            # Adjust total Klingons by # of super commanders
            self._remainingKlingons = self._remainingKlingons - self._remainingSuperCommanders
        else:
            self._remainingSuperCommanders = 0

        self._shipCondition:             ShipCondition  = ShipCondition.Green
        self.currentQuadrantCoordinates: Coordinates    = cast(Coordinates, None)
        self.currentSectorCoordinates:   Coordinates    = cast(Coordinates, None)

        self._enterprise: Enterprise = Enterprise()

        self.gameActive:    bool = True

        self.logger.info(f'Game State singleton initialized')
Exemplo n.º 13
0
    def setup(self):

        SettingsCommon.determineSettingsLocation()

        # self._backgroundSprite: QuadrantBackground = QuadrantBackground()

        fqFileName: str = LocateResources.getResourcesPath(resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME,
                                                           bareFileName='QuadrantBackground.png')
        self.background = load_texture(fqFileName)
        # Create the 'physics engine'
        # self.physicsEngine = PhysicsEngineSimple(self._enterprise, self._hardSpriteList)

        # These singletons are initialized for the first time
        self._gameSettings = GameSettings()     # Be able to read the preferences file
        self._gameState    = GameState()        # Set up the game parameters which uses the above
        self._gameEngine   = GameEngine()       # Then the engine needs to be initialized
        self._intelligence = Intelligence()
        self._computer     = Computer()
        self._galaxy       = Galaxy()           # This essentially finishes initializing most of the game

        self._messageConsole: MessageConsole = MessageConsole()
        self._eventEngine:    EventEngine    = EventEngine(self._messageConsole)

        self._statusConsole:  StatusConsole = StatusConsole(gameView=self)       # UI elements
        self._soundMachine:   SoundMachine = SoundMachine()

        self._enterprise: Enterprise = self._gameState.enterprise

        # Important mediators
        self._enterpriseMediator: EnterpriseMediator = EnterpriseMediator(view=self, warpTravelCallback=self._enterpriseHasWarped)
        self._quadrantMediator:   QuadrantMediator   = QuadrantMediator()
        self._galaxyMediator:     GalaxyMediator     = GalaxyMediator()

        self._quadrant: Quadrant = self._galaxy.currentQuadrant

        self._gameState.currentQuadrantCoordinates = self._galaxy.currentQuadrant.coordinates

        # And finally the rest of the UI elements
        self._quadrantMediator.enterQuadrant(quadrant=self._quadrant, enterprise=self._enterprise)

        self.logger.info(f'{self._enterprise=}')
        self.logger.info(f'{self._quadrant=}')
        self.logger.info(f'Setup Complete')
Exemplo n.º 14
0
    def init(self, *args, **kwds):
        """"""
        self._gameEngine:   GameEngine    = GameEngine()
        self._intelligence: Intelligence  = Intelligence()
        self._gameState:    GameState     = GameState()
        self._gameSettings: GameSettings  = GameSettings()

        self.logger: Logger = getLogger(__name__)

        self._currentQuadrant: Quadrant   = cast(Quadrant, None)
        self.quadrants:        GalaxyGrid = GalaxyGrid([])  # 2D array aka python list

        self._createGalaxy()

        self._addEnemies()

        self._placeStarBasesInGalaxy()
        self._placePlanetsInGalaxy()
        self._setInitialQuadrant()

        self.logger.info(f'Galaxy singleton initialized')
Exemplo n.º 15
0
    def init(self, *args, **kwds):
        """
        Accepts the following keyword arguments:
        * view The arcade view for the long range scan
        * graphicCenterX  The background center X position
        * graphicCenterY  The background center Y position
        Args:
            *args:
            **kwds:

        """

        self.logger: Logger = getLogger(__name__)

        self._intelligence: Intelligence = Intelligence()
        self._computer: Computer = Computer()
        self._galaxy: Galaxy = Galaxy()

        self.view: View = cast(View, None)
        self.graphicCenterX: float = 0
        self.graphicCenterY: float = 0

        self._setKeywordParameters(**kwds)
Exemplo n.º 16
0
    def init(self, *args, **kwargs):
        """

        Args:
            *args:  Arg 0 is the message console
            **kwargs:

        Returns:

        """

        self.logger: Logger = getLogger(__name__)

        self._intelligence: Intelligence = Intelligence()
        self._gameState: GameState = GameState()
        self._gameSettings: GameSettings = GameSettings()
        self._devices: Devices = Devices()

        self._eventMap: EventMap = cast(EventMap, None)
        self._setupEventMap()

        self._messageConsole: MessageConsole = args[0]
        self._eventCreator: EventCreator = EventCreator(self._messageConsole)

        self.logger.debug(
            f"{self._gameState.inTime=} eventMap: {self.__repr__()}")

        # TODO Put in debug option that allows selectively scheduling these
        self._scheduleRecurringEvents(
            eventType=FutureEventType.COMMANDER_ATTACKS_BASE)
        self._scheduleRecurringEvents(eventType=FutureEventType.TRACTOR_BEAM)
        self._scheduleRecurringEvents(eventType=FutureEventType.SUPER_NOVA)

        # I do not know what a Number is tell mypy so
        schedule(function_pointer=self._doEventChecking,
                 interval=EventEngine.EVENT_CHECK_INTERVAL)  # type: ignore
Exemplo n.º 17
0
 def init(self):
     self.logger: Logger = getLogger(__name__)
     self._intelligence: Intelligence = Intelligence()
Exemplo n.º 18
0
class TestShooting(View):
    """
    Main application class.
    """

    MADE_UP_PRETTY_MAIN_NAME: str = "Test Shooter"

    PALETTE_KLINGON_ID: str = 'paletteKlingon'
    PALETTE_COMMANDER_ID: str = 'paletteCommander'
    PALETTE_SUPER_COMMANDER_ID: str = 'paletteSuperCommander'

    def __init__(self):

        super().__init__()

        self.logger: Logger = getLogger(TestShooting.MADE_UP_PRETTY_MAIN_NAME)

        set_background_color(color.WHITE)

        self.background: Texture = cast(Texture, None)
        self._enterprise: Enterprise = cast(Enterprise, None)

        self._galaxy: Galaxy = cast(Galaxy, None)
        self._quadrant: Quadrant = cast(Quadrant, None)

        self._quadrantMediator: QuadrantMediator = cast(QuadrantMediator, None)
        self._statusConsole: StatusConsole = cast(StatusConsole, None)
        self._messageConsole: MessageConsole = cast(MessageConsole, None)

        self._gameState: GameState = cast(GameState, None)
        self._gameSettings: GameSettings = cast(GameSettings, None)
        self._gameEngine: GameEngine = cast(GameEngine, None)

        self._intelligence: Intelligence = cast(Intelligence, None)
        self._computer: Computer = cast(Computer, None)

        self._sprites: SpriteList = SpriteList()
        self._staticSprites: SpriteList = SpriteList()

        self._selectedGamePiece: GamePiece = cast(GamePiece, None)

    def setup(self):
        """
        Set up the game here. Call this function to restart the game.
        """

        fqFileName: str = LocateResources.getResourcesPath(
            resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME,
            bareFileName='QuadrantBackground.png')
        self.background = load_texture(fqFileName)

        self._gameSettings = GameSettings()
        self._gameState = GameState()
        self._gameEngine = GameEngine()
        self._intelligence = Intelligence()
        self._computer = Computer()
        self._galaxy = Galaxy()

        self._quadrantMediator = QuadrantMediator()

        self._enterprise: Enterprise = self._gameState.enterprise

        self._quadrant: Quadrant = self._galaxy.currentQuadrant

        self._quadrant.klingonCount = 0
        self._quadrant.commanderCount = 0
        self._quadrant.superCommanderCount = 0

        currentSectorCoordinates: Coordinates = self._intelligence.generateSectorCoordinates(
        )

        self._gameState.currentQuadrantCoordinates = self._galaxy.currentQuadrant.coordinates
        self._gameState.currentSectorCoordinates = currentSectorCoordinates

        self._quadrantMediator.enterQuadrant(quadrant=self._quadrant,
                                             enterprise=self._enterprise)

        self._enterpriseMediator: EnterpriseMediator = EnterpriseMediator(
            view=self, warpTravelCallback=self._noOp)

        self._statusConsole = StatusConsole(gameView=self)
        self._messageConsole = MessageConsole()

        self._makeEnemySpriteLists()

        self._makeGamePiecePalette()
        self.logger.info(f'Setup Complete')

    def on_draw(self):
        """
        Render the screen.
        """
        start_render()
        # Draw the background texture
        draw_lrwh_rectangle_textured(bottom_left_x=1,
                                     bottom_left_y=CONSOLE_HEIGHT,
                                     width=SCREEN_WIDTH,
                                     height=QUADRANT_GRID_HEIGHT,
                                     texture=self.background)

        self._quadrantMediator.draw(quadrant=self._quadrant)
        self._statusConsole.draw()
        self._messageConsole.draw()

        self._staticSprites.draw()

    def on_update(self, delta_time):
        """
        All the logic to move, and the game logic goes here.
        Normally, you'll call update() on the sprite lists that
        need it.
        """
        self._quadrantMediator.update(quadrant=self._quadrant)
        self._enterpriseMediator.update(quadrant=self._quadrant)

    def on_key_release(self, releasedKey: int, key_modifiers: int):
        """
        Called whenever the user lets off a previously pressed key.
        """
        if releasedKey == arcadeKey.Q:
            import os
            # noinspection PyUnresolvedReferences
            # noinspection PyProtectedMember
            os._exit(0)
        elif releasedKey == arcadeKey.A:
            self.setup()
        elif releasedKey == arcadeKey.K:
            self._fireKlingonTorpedo()
        elif releasedKey == arcadeKey.C:
            self._fireCommanderTorpedo()
        elif releasedKey == arcadeKey.S:
            self._fireSuperCommanderTorpedo()
        elif releasedKey == arcadeKey.P:
            self._firePhasers()

    def on_mouse_release(self, x: float, y: float, button: int,
                         keyModifiers: int):
        """
        Called when the user presses a mouse button.
        """
        self.logger.info(f'{button=} {keyModifiers=}')
        if button == MOUSE_BUTTON_LEFT and keyModifiers == arcadeKey.MOD_CTRL:
            # Try klingons first
            clickedEnemies: List[Sprite] = get_sprites_at_point(
                point=(x, y), sprite_list=self._quadrantMediator.klingonList)

            # The Commanders
            if len(clickedEnemies) == 0:
                clickedEnemies = get_sprites_at_point(
                    point=(x, y),
                    sprite_list=self._quadrantMediator.commanderList)

            # Must be Super Commanders
            if len(clickedEnemies) == 0:
                clickedEnemies = get_sprites_at_point(
                    point=(x, y),
                    sprite_list=self._quadrantMediator.superCommanderList)

            for enemy in clickedEnemies:
                print(f'Delete {enemy}')
                enemy.remove_from_sprite_lists()
        elif button == MOUSE_BUTTON_LEFT:

            if self._selectedGamePiece is None:
                clickedPaletteSprites: List[Sprite] = get_sprites_at_point(
                    point=(x, y), sprite_list=self._staticSprites)

                for paletteSprite in clickedPaletteSprites:
                    paletteSprite.color = color.BLACK
                    self._selectedGamePiece = paletteSprite
            else:
                # A palette sprite is selected
                self._placeSpriteOnBoard(x=x, y=y)

                self.logger.info(f'Clear selected Sprite')
                self._selectedGamePiece.color = color.WHITE
                self._selectedGamePiece = cast(GamePiece, None)

        arcadePoint: ArcadePoint = ArcadePoint(x=x, y=y)
        self._quadrantMediator.handleMousePress(quadrant=self._quadrant,
                                                arcadePoint=arcadePoint,
                                                button=button,
                                                keyModifiers=keyModifiers)

    def _placeSpriteOnBoard(self, x: float, y: float):

        enemy: BaseEnemy = cast(BaseEnemy, self._selectedGamePiece)

        if enemy.id == TestShooting.PALETTE_KLINGON_ID:
            klingon: Klingon = self._quadrant.addKlingon()
            added: bool = self._addEnemyToTestGrid(enemy=klingon, x=x, y=y)
            if added is True:
                self._quadrantMediator.klingonList.append(klingon)
        elif enemy.id == TestShooting.PALETTE_COMMANDER_ID:
            commander: Commander = self._quadrant.addCommander()
            added = self._addEnemyToTestGrid(enemy=commander, x=x, y=y)
            if added is True:
                self._quadrantMediator.commanderList.append(commander)

        elif enemy.id == TestShooting.PALETTE_SUPER_COMMANDER_ID:
            superCommander: SuperCommander = self._quadrant.addSuperCommander()
            added = self._addEnemyToTestGrid(enemy=superCommander, x=x, y=y)
            if added is True:
                self._quadrantMediator.superCommanderList.append(
                    superCommander)

    def _fireKlingonTorpedo(self):
        """
        We are testing so we'll access protected methods
        """
        # noinspection PyProtectedMember
        ktm: KlingonTorpedoMediator = self._quadrantMediator._ktm
        self.__fireEnemyTorpedo(
            torpedoMediator=ktm,
            enemySprites=self._quadrantMediator.klingonList,
            rotationAngle=Klingon.ROTATION_ANGLE)

    def _fireCommanderTorpedo(self):
        """
        We are testing so we'll access protected methods
        """
        # noinspection PyProtectedMember
        ctm: CommanderTorpedoMediator = self._quadrantMediator._ctm
        self.__fireEnemyTorpedo(
            torpedoMediator=ctm,
            enemySprites=self._quadrantMediator.commanderList,
            rotationAngle=Commander.ROTATION_ANGLE)

    def _fireSuperCommanderTorpedo(self):
        """
        We are testing so we'll access protected methods
        """
        # noinspection PyProtectedMember
        stm: SuperCommanderTorpedoMediator = self._quadrantMediator._stm
        self.__fireEnemyTorpedo(
            torpedoMediator=stm,
            enemySprites=self._quadrantMediator.superCommanderList,
            rotationAngle=SuperCommander.ROTATION_ANGLE)

    def _firePhasers(self):

        # noinspection PyProtectedMember
        epm: EnterprisePhaserMediator = self._quadrantMediator._epm

        epm.firePhasers(quadrant=self._quadrant)

    # noinspection PyUnusedLocal
    def _noOp(self, warpSpeed: float, destinationCoordinates: Coordinates):
        self.logger.warning(f'******** How did we warp? *************')

    def __fireEnemyTorpedo(self,
                           torpedoMediator: BaseTorpedoMediator,
                           enemySprites: SpriteList,
                           rotationAngle: int = 0):

        for sprite in enemySprites:
            enemy: Enemy = cast(Enemy, sprite)
            # noinspection PyProtectedMember
            torpedoMediator._pointAtEnterprise(enemy=enemy,
                                               enterprise=self._enterprise,
                                               rotationAngle=rotationAngle)
            # noinspection PyProtectedMember
            torpedoMediator._fireTorpedo(enemy=enemy,
                                         enterprise=self._enterprise)

    def _makeEnemySpriteLists(self):
        """
        Place enemies in the appropriate sprite lists
        """
        self.__makeKlingonSpriteList()
        self.__makeCommanderSpriteList()
        self.__makeSuperCommanderSpriteList()

    def _makeGamePiecePalette(self):
        """
        These are the static icons that can be dragged on screen

        """
        bogusCoordinates: Coordinates = Coordinates(-1, -1)
        paletteKlingon: Klingon = Klingon(coordinates=bogusCoordinates)
        paletteKlingon.id = TestShooting.PALETTE_KLINGON_ID
        paletteKlingon.center_x = 32
        paletteKlingon.center_y = 150

        paletteCommander: Commander = Commander(coordinates=bogusCoordinates,
                                                moveInterval=-1)
        paletteCommander.id = TestShooting.PALETTE_COMMANDER_ID
        paletteCommander.center_x = paletteKlingon.center_x + 64
        paletteCommander.center_y = 150

        paletteSuperCommander: SuperCommander = SuperCommander(
            coordinates=bogusCoordinates, moveInterval=-1)
        paletteSuperCommander.id = TestShooting.PALETTE_SUPER_COMMANDER_ID
        paletteSuperCommander.center_x = paletteCommander.center_x + 64
        paletteSuperCommander.center_y = 150

        self._staticSprites.append(paletteKlingon)
        self._staticSprites.append(paletteCommander)
        self._staticSprites.append(paletteSuperCommander)

    def _addEnemyToTestGrid(
        self,
        enemy: BaseEnemy,
        x: float,
        y: float,
    ) -> bool:

        added: bool = True
        gameCoordinates: Coordinates = self._computer.computeCoordinates(x=x,
                                                                         y=y)
        if gameCoordinates.valid() is True:
            # Recompute a 'centered' arcade point
            arcadePoint: ArcadePoint = GamePiece.gamePositionToScreenPosition(
                gameCoordinates)

            enemy.gameCoordinates = gameCoordinates
            enemy.center_x = arcadePoint.x
            enemy.center_y = arcadePoint.y
        else:
            added = False

        return added

    def __makeCommanderSpriteList(self):
        if self._quadrant.commanderCount > 0:
            self._gameState.shipCondition = ShipCondition.Red
            commanderSprites: SpriteList = SpriteList()
            for commander in self._quadrant.commanders:
                commanderSprites.append(commander)

            self._quadrantMediator.commanderList = commanderSprites
        else:
            self._quadrantMediator.commanderList = SpriteList()

    def __makeSuperCommanderSpriteList(self):
        if self._quadrant.superCommanderCount > 0:
            self._gameState.shipCondition = ShipCondition.Red
            superCommanderSprites: SpriteList = SpriteList()
            for superCommander in self._quadrant.superCommanders:
                superCommanderSprites.append(superCommander)

            self._quadrantMediator.superCommanderList = superCommanderSprites
        else:
            self._quadrantMediator.superCommanderList = SpriteList()

    def __makeKlingonSpriteList(self):
        if self._quadrant.klingonCount > 0:
            self._gameState.shipCondition = ShipCondition.Red
            klingonSprites: SpriteList = SpriteList()
            for klingon in self._quadrant.klingons:
                klingonSprites.append(klingon)

            self._quadrantMediator.klingonList = klingonSprites
        else:
            self._quadrantMediator.klingonList = SpriteList()

    def __doEnemyDebugActions(self):

        if self._gameSettings.debugAddKlingons is True:
            numKlingons: int = self._gameSettings.debugKlingonCount
            for x in range(numKlingons):
                self._quadrant.addKlingon()

            self._gameState.remainingKlingons += numKlingons

        if self._gameSettings.debugAddCommanders is True:
            nCommanders: int = self._gameSettings.debugCommanderCount
            for x in range(nCommanders):
                self._quadrant.addCommander()

            self._gameState.remainingCommanders += nCommanders

        if self._gameSettings.debugAddSuperCommanders:
            nSuperCommanders: int = self._gameSettings.debugSuperCommanderCount
            for x in range(nSuperCommanders):
                self._quadrant.addSuperCommander()
            self._gameState.remainingSuperCommanders += nSuperCommanders