| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| # @todo: ¼õÉÙÖ¸¶¨¼¼ÄܵÄCD£¬Èç¹ûÓдÎÊý¿ØÖÆ ÐèÒª×ö³É²ã¼¶buff -----  ÀལÈз籩¼¼ÄÜʹÓà  | 
| #        µÚÈý¸öЧ¹ûֵĬÈÏΪ0£¬Ã¿´Î¶¼¼õÉÙCD Ôò²»ÐèÒªÅäÖóÉbuff£» ÅäÖÃÊý×ÖÔòÐèÒªºÍbuff²ã¼¶´îÅäÀ´¿ØÖÆ´ÎÊý  | 
| #  | 
| # @author: Alee  | 
| # @date 2018-1-9 ÏÂÎç09:39:37  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #  | 
| #---------------------------------------------------------------------  | 
|   | 
| import ChConfig  | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import SkillCommon  | 
| import BuffSkill  | 
|   | 
| def CheckCanHappen(attacker, defender, effect, curSkill):  | 
|     if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:  | 
|         return False  | 
|       | 
|     if effect.GetEffectValue(2):  | 
|         skillID = curSkill.GetSkillID()  | 
|         if SkillCommon.IsBuff(curSkill):  | 
|             buffType = SkillCommon.GetBuffType(curSkill)  | 
|             buffTuple = SkillCommon.GetBuffManagerByBuffType(attacker, buffType)  | 
|             if buffTuple == ():  | 
|                 return False  | 
|               | 
|             buffManager = buffTuple[0]  | 
|             findBuff = buffManager.FindBuff(skillID)  | 
|             if findBuff and findBuff.GetLayer() >= effect.GetEffectValue(2):  | 
|                 # ³¬¹ý²»ÔÙ¼õCD  | 
|                 return False  | 
|   | 
|     return True  | 
|   | 
| def GetValue(attacker, defender, effect):  | 
|     # ´Ë´¦´¦Àí¼õÉÙCDÂß¼  | 
|     skillID = effect.GetEffectValue(0)  | 
|   | 
|     curSkill = attacker.GetSkillManager().FindSkillBySkillID(skillID)  | 
|     coolDownTime = curSkill.GetCoolDownTime()  | 
|     remainTime = curSkill.GetRemainTime()  | 
|     remainTime = int(max(remainTime - coolDownTime*1.0*effect.GetEffectValue(1)/ChConfig.Def_MaxRateValue, 0))  | 
|   | 
|     curSkill.SetRemainTime(remainTime)  | 
|     curSkill.SetLastUseTick(GameWorld.GetGameWorld().GetTick())  | 
|     curSkill.Sync_Skill()  | 
|     return 0  |