Esempio n. 1
0
	def expand(self):
		oldsize = self.size
		self.size = sizeofunit[self.expandInto]
		offsetx,offsety = getGridCenter(self.offsetx,self.offsety)
		offsetx += modify[self.expandInto][0]
		offsety += modify[self.expandInto][1]
		container = self.container.getTopContainer()
		if container.available(self,offsetx,offsety):
			self.startAnimation("expand_%d"%(self.player))
		self.size = oldsize
Esempio n. 2
0
	def step(self,map,characters):
		super(Vehicle,self).step(map,characters)
		if self.animation == "expand_%d"%(self.player) and self.end:
			oldsize = self.size
			self.size = sizeofunit[self.expandInto]
			offsetx,offsety = getGridCenter(self.offsetx,self.offsety)
			offsetx += modify[self.expandInto][0]
			offsety += modify[self.expandInto][1]
			if characters.unitSet.available(self,offsetx,offsety):
				self.replace = self.expandInto
			else:
				self.size = oldsize
Esempio n. 3
0
 def step(self):
     unitlist = []
     for unit in self.unitSet:
         unitlist.append(unit)
     for unit in unitlist:
         unit.step(self.map,self)
         if hasattr(unit,"replace") and unit.replace != None:
             name = unit.replace
             newunit = classmap[name](unit.player)
             newunit.HP = unit.HP
             newunit.fullHP = unit.fullHP
             if isinstance(newunit,Building):
                 offsetx,offsety = getGridCenter(unit.offsetx,unit.offsety)
             offsetx += modify[name][0]
             offsety += modify[name][1]
             self.removeUnit(unit)
             if not self.addUnit(newunit,offsetx,offsety):
                 self.addUnit(unit)