hch
2019-05-09 bc915a9b717eccef3c8d825f9af79a7596394ac7
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/Buff_4012.py
@@ -47,14 +47,42 @@
def OnBuffDisappear(curObj, curSkill, curBuff, curEffect, tick):
    stateType = curEffect.GetEffectValue(0)
    GameObj.SetPyPlayerState(curObj, stateType, 0)
    if CanDelStateEffect(curObj, ChConfig.Def_Skill_Effect_BuffState, stateType):
        GameObj.SetPyPlayerState(curObj, stateType, 0)
        GameWorld.DebugLog("取消影响玩家状态效果---%s - %s"%(curObj.GetID(), stateType))
    return
    
    
def OnBuffDisappearEx(curObj, curSkill, curBuff, curEffect, tick):
    stateType = curEffect.GetEffectValue(0)
    GameObj.SetPyPlayerState(curObj, stateType, 0)
    if CanDelStateEffect(curObj, ChConfig.Def_Skill_Effect_BuffState, stateType):
        GameObj.SetPyPlayerState(curObj, stateType, 0)
        GameWorld.DebugLog("取消影响玩家状态效果---%s - %s"%(curObj.GetID(), stateType))
    return
    
# 大于等于2个状态 则不清理状态
def CanDelStateEffect(curObj, effectID, stateType):
    cnt = 0
    for buffType in xrange(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):
        buffTuple = SkillCommon.GetBuffManagerByBuffType(curObj, buffType)
        #通过类型获取目标的buff管理器为空,则跳出
        if buffTuple == ():
            continue
        buffManager = buffTuple[0]
        for i in range(buffManager.GetEffectCount()):
            effect = buffManager.GetEffect(i)
            if not effect:
                continue
            if effect.GetEffectID() != effectID:
                continue
            if effect.GetEffectValue(0) == stateType:
                cnt += 1
            if cnt >= 2:
                return False
    return True