def addNewBuff(self, targetId, buffId, executor, stack):
     '''添加新的buff
     '''
     newbuff = StateBuffer(buffId, holder=targetId, executor=executor)
     newbuff.setStack(stack)
     buffIdlist = [buff.getID() for buff in self.StatePool[targetId]]
     if buffId in buffIdlist:  #存在同样的buff时
         for buff in self.StatePool[targetId]:
             tbuffId = buff.getID()
             if buffId == tbuffId:
                 buff.addStack()
     else:
         ntype = newbuff.getBuffType()
         state = 0
         for buff in self.StatePool[targetId]:
             tbuffId = buff.getID()
             tbufftype = buff.getBuffType()
             tstack = buff.getStack()
             if ntype == tbufftype:
                 state = 1
                 if tstack > stack:
                     buff.addStack()
                 else:
                     self.StatePool[targetId].remove(buff)
                     self.StatePool[targetId].append(newbuff)
         if not state:
             self.StatePool[targetId].append(newbuff)
 def addNewBuff(self,targetId,buffId,executor,stack):
     '''添加新的buff
     '''
     newbuff = StateBuffer(buffId, holder = targetId, executor = executor)
     newbuff.setStack(stack)
     buffIdlist = [buff.getID() for buff in self.StatePool[targetId]]
     if buffId in buffIdlist:#存在同样的buff时
         for buff in self.StatePool[targetId]:
             tbuffId = buff.getID()
             if buffId == tbuffId:
                 buff.addStack()
     else:
         ntype = newbuff.getBuffType()
         state = 0
         for buff in self.StatePool[targetId]:
             tbuffId = buff.getID()
             tbufftype = buff.getBuffType()
             tstack = buff.getStack()
             if ntype == tbufftype:
                 state = 1
                 if tstack>stack:
                     buff.addStack()
                 else:
                     self.StatePool[targetId].remove(buff)
                     self.StatePool[targetId].append(newbuff)
         if not state:
             self.StatePool[targetId].append(newbuff)
예제 #3
0
 def putBuff(self,target,buffId):
     '''给指定的目标添加一个buff
     @param target: int 目标的id
     @param buffId: int buff的ID
     '''
     buff = StateBuffer(buffId)
     if not self.StatePool.has_key(target):
         self.StatePool[target] = []
     self.replaceBuff(target, buff)
     self.seizeBuffSpace(target, buff)
     actor = self.owner.fighters[target]
     #print "【%s】获得BUF[%s]"%(actor['chaName'],buff.getName())
     self.StatePool[target].append(buff)
     actor = self.owner.fighters[target]
     exec(buff.getEffectFormula())