示例#1
0
    def impulse(self, newCoordinates: Coordinates, quadrant: Quadrant,
                enterprise: Enterprise):
        """

        Args:
            newCoordinates: The new sector coordinates
            quadrant:       The current quadrant travel was in
            enterprise:     The enterprise sprite
        """

        travelDistance: float = self._computer.computeQuadrantDistance(
            self._gameState.currentSectorCoordinates, newCoordinates)
        quadrant.placeEnterprise(enterprise, newCoordinates)

        self._gameState.currentSectorCoordinates = newCoordinates

        self.updateTimeAfterImpulseTravel(travelDistance=travelDistance)

        if self._gameState.energy < self._gameSettings.minimumImpulseEnergy:
            neededEnergyForImpulseMove = self._gameState.energy
        else:
            neededEnergyForImpulseMove = self.computeEnergyForQuadrantTravel(
                travelDistance=travelDistance)

        self._gameState.energy = self._gameState.energy - neededEnergyForImpulseMove
        self._gameState.opTime = travelDistance / 0.095
示例#2
0
    def enterQuadrant(self, quadrant: Quadrant, enterprise):

        currentSectorCoordinates: Coordinates = self._intelligence.generateSectorCoordinates(
        )

        if self._gameSettings.debugManualPlaceShipInQuadrant is True:
            currentSectorCoordinates = self._gameSettings.manualSectorCoordinates

        playerList: SpriteList = SpriteList()
        playerList.append(enterprise)

        self._gameState.currentSectorCoordinates = currentSectorCoordinates
        quadrant.placeEnterprise(enterprise, currentSectorCoordinates)

        self.playerList = playerList
        # Don't do this until we have set up the current quadrant
        self._makeEnemySpriteLists(quadrant=quadrant)
        self._doDebugActions(quadrant=quadrant)