| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| # @todo: ±ôËÀʱ´¥·¢¼¼ÄÜ  | 
| #  | 
| # @author: Alee  | 
| # @date 2018-1-9 ÏÂÎç09:39:37  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #  | 
| #---------------------------------------------------------------------  | 
|   | 
| import ChConfig  | 
| import GameWorld  | 
| import GameObj  | 
| import SkillCommon  | 
| import IPY_GameWorld  | 
|   | 
| def CheckCanHappen(attacker, defender, effect, curSkill):  | 
|     if attacker.GetPlayerAction() == IPY_GameWorld.paDie:  | 
|         # µ±Ç°ÒѾ±»´¦ÀíΪËÀÍö£¬ÄÇô¾Í²»´¥·¢  | 
|         return False  | 
|   | 
|     zhanshaState = attacker.GetDictByKey(ChConfig.Def_PlayerKey_Zhansha)  | 
|       | 
|     if zhanshaState:  | 
|         # °´Î»Åжϣ¬1ΪնɱÇé¿öÏ£¬´Ë¼¼Äܲ»¿É±»´¥·¢£¬2ΪÖÕ¼«Õ¶É±²»´¥·¢£¬3ΪÈκÎնɱ¶¼²»´¥·¢  | 
|         if (effect.GetEffectValue(2) & pow(2, zhanshaState-1)) != 0:  | 
|             return False  | 
|       | 
|       | 
|     result = GameWorld.CanHappen(effect.GetEffectValue(0))  | 
|     if result:  | 
|         GameObj.SetHP(attacker, 1) # ÎªÁ˱ÜÃâÉúÃüΪ0ʱ£¬ÆÁ±Î¹ý¶àÂß¼  | 
|         # Ìáǰ´¥·¢CD£¬ ²»È»Íâ²ãÎÞ·¨´¥·¢¼¼Äܵϰ¾Í²»½øÈëCD£¬ ÈçºÍƽģʽ  | 
|         if curSkill.GetCoolDownTime():  | 
|             SkillCommon.SetSkillRemainTime(curSkill, 0, GameWorld.GetGameWorld().GetTick(), attacker)  | 
|         return True  | 
|           | 
|     if effect.GetEffectValue(1):  | 
|         #²»ËÀѪÁ¿1£¬µ«²»´¥·¢¼¼ÄÜ  | 
|         if GameWorld.CanHappen(effect.GetEffectValue(1)):  | 
|             GameObj.SetHP(attacker, 1)  | 
|             # Ìáǰ´¥·¢CD£¬ ²»È»Íâ²ãÎÞ·¨´¥·¢¼¼Äܵϰ¾Í²»½øÈëCD£¬ ÈçºÍƽģʽ  | 
|             if curSkill.GetCoolDownTime():  | 
|                 SkillCommon.SetSkillRemainTime(curSkill, 0, GameWorld.GetGameWorld().GetTick(), attacker)  | 
|             return False  | 
|   | 
|     return False  |