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)