1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/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
 
    if attacker.GetDictByKey("zhansha") and effect.GetEffectValue(2):
        # Õ¶É±²»´¥·¢µÄ±êÖ¾
        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