Beispiel #1
0
 def addCrystal(self, color):
     assert color.isBasic
     if self.crystals[color] < 3:
         self.match.stack.push(stack.Call(self._addCrystal, color),
                               stack.Call(self._removeCrystal, color))
     else:
         self.addToken(color)
Beispiel #2
0
 def setTerrainCost(self, terrain, cost):
     """Set the movement cost of the given terrain to *cost*. If *cost* is None, the terrain will not
     be passable."""
     self.match.stack.push(
         stack.Call(self._setTerrainCost, terrain, cost),
         stack.Call(self._setTerrainCost, terrain,
                    self.terrainCosts.get(terrain)))
Beispiel #3
0
 def add(self, id, title, method):
     if id in (action.id for action in self._list):
         return
     i = 0
     while i < len(self._list) and self._list[i].title < title:
         i += 1
     action = Action(id, title, method)
     self.match.stack.push(stack.Call(self._insert, i, action),
                           stack.Call(self._remove, action))
Beispiel #4
0
 def removeSite(self, site):
     self.match.stack.push(stack.Call(self._removeSite, site),
                           stack.Call(self._addSite, site))
Beispiel #5
0
 def setOwner(self, site, player):
     if site.owner != player:
         self.match.stack.push(stack.Call(self._setOwner, site, player),
                               stack.Call(self._setOwner, site, site.owner))
Beispiel #6
0
 def setEnemies(self, site, enemies):
     self.match.stack.push(stack.Call(self._setEnemies, site, enemies),
                           stack.Call(self._setEnemies, site, site.enemies))
Beispiel #7
0
 def movePerson(self, person, coords):
     assert person in self.persons
     self.match.stack.push(
         stack.Call(self._movePerson, person, coords),
         stack.Call(self._movePerson, person, self.persons[person]))
Beispiel #8
0
 def removePerson(self, person):
     assert person in self.persons
     self.match.stack.push(
         stack.Call(self._removePerson, person),
         stack.Call(self._addPerson, person, self.persons[person]))
Beispiel #9
0
 def addPerson(self, person, coords):
     assert person not in self.persons
     self.match.stack.push(stack.Call(self._addPerson, person, coords),
                           stack.Call(self._removePerson, person))
Beispiel #10
0
 def remove(self, effect):
     self.match.stack.push(stack.Call(self._remove, effect),
                           stack.Call(self._add, effect))
Beispiel #11
0
 def clear(self):
     self.match.stack.push(stack.Call(self._setActions, []),
                           stack.Call(self._setActions, self._list))
Beispiel #12
0
 def remove(self, actionId):
     for index, action in enumerate(self._list):
         if action.id == actionId:
             self.match.stack.push(stack.Call(self._remove, action),
                                   stack.Call(self._insert, index, action))
             break
Beispiel #13
0
 def removeCrystal(self, color):
     assert color.isBasic and self.crystals[color] > 0
     self.match.stack.push(stack.Call(self._removeCrystal, color),
                           stack.Call(self._addCrystal, color))
Beispiel #14
0
 def setState(self, state):
     assert isinstance(state, State)
     if state != self.state:
         self.stack.push(stack.Call(self._setState, state),
                         stack.Call(self._setState, self.state))
         self.updateActions()