Exemplo n.º 1
0
    def __placeMissInQuadrant(self, quadrant: Quadrant,
                              sectorCoordinates: Coordinates,
                              sectorType: SectorType):

        sector: Sector = quadrant.getSector(sectorCoordinates)

        sector.type = sectorType
    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
    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
    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
Exemplo n.º 5
0
    def __removeMissInQuadrant(self, quadrant: Quadrant,
                               sectorCoordinates: Coordinates):

        sector: Sector = quadrant.getSector(sectorCoordinates)

        sector.type = SectorType.EMPTY