コード例 #1
0
    def __placeMissInQuadrant(self, quadrant: Quadrant,
                              sectorCoordinates: Coordinates,
                              sectorType: SectorType):

        sector: Sector = quadrant.getSector(sectorCoordinates)

        sector.type = sectorType
コード例 #2
0
    def __updateQuadrant(self, quadrant: Quadrant, currentCoordinates: Coordinates, targetCoordinates: Coordinates) -> Quadrant:
        """

        Args:
            quadrant:           What we are updating
            currentCoordinates: Where we are
            targetCoordinates:  Where we are going

        Returns: The updated input quadrant
        """

        currentSector: Sector = quadrant.getSector(currentCoordinates)
        targetSector:  Sector = quadrant.getSector(targetCoordinates)

        currentSector.type = SectorType.EMPTY
        targetSector.type  = SectorType.ENTERPRISE
        targetSector.sprite = currentSector.sprite
        currentSector.sprite = cast(GamePiece, None)

        return quadrant
コード例 #3
0
    def _checkEnemyMoveIsValid(self, quadrant: Quadrant,
                               targetCoordinates: Coordinates) -> bool:

        targetSector: Sector = quadrant.getSector(targetCoordinates)
        if targetSector.type == SectorType.EMPTY:
            return True
        else:
            self._baseEnemyMediatorLogger.info(
                f'Commander cannot move to sector: {targetCoordinates} occupied by {targetSector.type}'
            )
            return False
コード例 #4
0
    def _enemyMovedUpdateQuadrant(self, quadrant: Quadrant, enemy: BaseEnemy,
                                  newSectorCoordinates: Coordinates,
                                  oldSectorCoordinates: Coordinates):
        """

        Args:
            quadrant:  Quadrant to modify
            enemy:     sprite to place in sector
            newSectorCoordinates:    old sector coordinates
            oldSectorCoordinates:    new sector coordinates

        """
        oldSector: Sector = quadrant.getSector(
            sectorCoordinates=oldSectorCoordinates)

        oldSector.type = SectorType.EMPTY
        oldSector.sprite = cast(GamePiece, None)

        newSector: Sector = quadrant.getSector(
            sectorCoordinates=newSectorCoordinates)

        newSector.type = SectorType.COMMANDER
        newSector.sprite = enemy
コード例 #5
0
    def __removeMissInQuadrant(self, quadrant: Quadrant,
                               sectorCoordinates: Coordinates):

        sector: Sector = quadrant.getSector(sectorCoordinates)

        sector.type = SectorType.EMPTY