| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Skill.GameBuffs.Buff_4012  | 
| #  | 
| # @todo:Ó°ÏìÍæ¼Ò״̬Ч¹û  | 
| # @author hxp  | 
| # @date 2015-3-4  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: Ó°ÏìÍæ¼Ò״̬Ч¹û  | 
| #  | 
| #---------------------------------------------------------------------  | 
| """Version = 2015-3-4 20:00"""  | 
|   | 
| import PlayerControl  | 
| import ChConfig  | 
| import PassiveBuffEffMng  | 
| import IPY_GameWorld  | 
| import GameObj  | 
| import GameWorld  | 
| import SkillCommon  | 
|   | 
| ## Ìí¼ÓBUFFºóµÄÂß¼  | 
| #  @param None  | 
| #  @return None  | 
| def DoAddBuffOver(curObj, addBuff, curEffect, tick, buffOwner):  | 
|     stateType = curEffect.GetEffectValue(0)  | 
|     GameObj.SetPyPlayerState(curObj, stateType, 1)  | 
|       | 
|     curObj.SetDict("CurPyPlayerState", stateType)  | 
|     PassiveBuffEffMng.OnPassiveSkillTrigger(curObj, None, None, ChConfig.TriggerType_BuffState, tick)  | 
|       | 
|     buffOwner = SkillCommon.GetBuffOwner(addBuff)  | 
|     if buffOwner:  | 
|         PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, None, ChConfig.TriggerType_BuffState, tick)  | 
|       | 
|     return  | 
|   | 
|   | 
| ## BUFFÏûʧºó  | 
| #  @param None  | 
| #  @return None  | 
| def OnBuffDisappear(curObj, curSkill, curBuff, curEffect, tick):  | 
|   | 
|     stateType = curEffect.GetEffectValue(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)  | 
|     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):  | 
|         if buffType in ChConfig.Def_BuffType_OnlyPlayer:  | 
|             continue  | 
|           | 
|         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  |