Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 def addNewBuff(self, targetId, buffId, executor, stack):
     '''添加新的buff
     '''
     newbuff = StateBuffer(buffId, holder=targetId,
                           executor=executor)  # Buff 状态
     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
                 buff.addStack()  # 相同的 buff 升级
     else:  # 不存在该 buff
         ntype = newbuff.getBuffType()
         state = 0
         for buff in self.StatePool[targetId]:
             tbuffId = buff.getID()
             tbufftype = buff.getBuffType()
             tstack = buff.getStack()
             if ntype == tbufftype:  # 同类型 buff
                 state = 1
                 if tstack > stack:  # 原来的比较高级,buff 在原来的基础上升级
                     buff.addStack()
                 else:  # 新的高级,buff 直接替换成新的
                     self.StatePool[targetId].remove(buff)
                     self.StatePool[targetId].append(newbuff)
         if not state:
             self.StatePool[targetId].append(newbuff)