Пример #1
0
 def run(self):
     """ Run the controller """
     self.previousController = TheGameEngine.controller
     self.application.addWidget(self.window)
     self.application.setCurrentWidget(self.window)
     TheGameEngine.start(self.window, self)
     self.window.grabKeyboard()
Пример #2
0
 def run(self):
     """ Run the controller """
     self.previousController = TheGameEngine.controller
     self.application.addWidget(self.window)
     self.application.setCurrentWidget(self.window)
     TheGameEngine.start(self.window, self)
     self.window.grabKeyboard()
Пример #3
0
    def move(self, rowMovement, columnMovement):
        """ Move the drone """
        self.row += rowMovement
        self.column += columnMovement
        self.moveRating.move()

        square = self.minefield.getSquare(self.row, self.column)
        square.onMove(self)
        TheGameEngine.updateUI()
Пример #4
0
 def move(self, rowMovement, columnMovement):
     """ Move the drone """
     self.row += rowMovement
     self.column += columnMovement
     self.moveRating.move()
     
     square = self.minefield.getSquare(self.row, self.column)
     square.onMove(self)
     TheGameEngine.updateUI()
Пример #5
0
    def tryToAttack(self, drone):
        """ Try to have the worm attack the drone """
        if not self.attacking:
            self.attacking = self.droneInSquare(drone)

        if self.attacking:
            if (self.attackTick % self.cyclesToAttack) == 0:
                self.attack(drone)
                self.attacking = False
            self.attackTick %= self.cyclesToAttack
            self.attackTick += 1
            TheGameEngine.updateUI()
Пример #6
0
 def tryToAttack(self, drone):
     """ Try to have the worm attack the drone """
     if not self.attacking:
         self.attacking = self.droneInSquare(drone)
     
     if self.attacking:
         if (self.attackTick % self.cyclesToAttack) == 0:
             self.attack(drone)
             self.attacking = False
         self.attackTick %= self.cyclesToAttack
         self.attackTick += 1
         TheGameEngine.updateUI()
Пример #7
0
 def move(self, minefield):
     """ Move the worm in the minefield """
     adjacentSquares = minefield.getAdjacentSquares(self.gridSquare)
     
     while True:
         if len(adjacentSquares) == 0:
             break
         square = choice(adjacentSquares)
         if square.hasGroundDefense() or square.column == 0:
             adjacentSquares.remove(square) # Can't move to a square that already has ground content or is in the safe zone
         else:
             self.gridSquare.setGroundDefense(None)
             square.setGroundDefense(self)
             self.gridSquare = square
             TheGameEngine.updateUI()
             break
Пример #8
0
    def move(self, minefield):
        """ Move the worm in the minefield """
        adjacentSquares = minefield.getAdjacentSquares(self.gridSquare)

        while True:
            if len(adjacentSquares) == 0:
                break
            square = choice(adjacentSquares)
            if square.hasGroundDefense() or square.column == 0:
                adjacentSquares.remove(
                    square
                )  # Can't move to a square that already has ground content or is in the safe zone
            else:
                self.gridSquare.setGroundDefense(None)
                square.setGroundDefense(self)
                self.gridSquare = square
                TheGameEngine.updateUI()
                break
Пример #9
0
 def run(self):
     """ Run the controller """
     self.application.addWidget(self.window)
     self.application.setCurrentWidget(self.window)
     TheGameEngine.start(self.window, self)
Пример #10
0
 def defuse(self):
     """ Defuse the current cell """
     self.powerRating.usePower(DEFUSE_POWER)
     self.minefield.defuse(self.row, self.column, self)
     TheGameEngine.updateUI()
Пример #11
0
 def performEMP(self):
     """ Performan EMP Blast """
     self.powerRating.usePower(EMP_POWER)
     self.minefield.performEMP(self.row, self.column, self)
     TheGameEngine.updateUI()
Пример #12
0
 def defuseCarefully(self):
     """ Carfeully defuse a Fragile mine """
     self.powerRating.usePower(CAREFUL_DEFUSE_POWER)
     self.minefield.defuseCarefully(self.row, self.column, self)
     TheGameEngine.updateUI()
Пример #13
0
 def defuse(self):
     """ Defuse the current cell """
     self.powerRating.usePower(DEFUSE_POWER)
     self.minefield.defuse(self.row, self.column, self)
     TheGameEngine.updateUI()
Пример #14
0
 def scan(self):
     """ Scan the current cell """
     self.powerRating.usePower(SCAN_POWER)
     self.minefield.scan(self.row, self.column, self)
     TheGameEngine.updateUI()
Пример #15
0
 def scan(self):
     """ Scan the current cell """
     self.powerRating.usePower(SCAN_POWER)
     self.minefield.scan(self.row, self.column, self)
     TheGameEngine.updateUI()
Пример #16
0
 def defuseCarefully(self):
     """ Carfeully defuse a Fragile mine """
     self.powerRating.usePower(CAREFUL_DEFUSE_POWER)
     self.minefield.defuseCarefully(self.row, self.column, self)
     TheGameEngine.updateUI()
Пример #17
0
 def performEMP(self):
     """ Performan EMP Blast """
     self.powerRating.usePower(EMP_POWER)
     self.minefield.performEMP(self.row, self.column, self)
     TheGameEngine.updateUI()