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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: buffÖб»±ê¼ÇµÄ¹¥»÷Õß¹¥»÷±ê¼Ç·½¼õ²ã
#
# @author: Alee
# @date 2019-4-27 ÏÂÎç04:04:41
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
 
import ChConfig
import GameWorld
import SkillCommon
import BuffSkill
import SkillShell
import IPY_GameWorld
 
def CheckCanHappen(attacker, defender, passiveEffect, skillID, **skillkwargs):
    if not defender:
        return
    
    useSkill = skillkwargs.get("useSkill", None)
    if not useSkill:
        return False
    # Ö÷¶¯Ðͼ¼ÄܲÅÓÐЧ
    if useSkill.GetFuncType() not in [ChConfig.Def_SkillFuncType_FbSkill,
                                      ChConfig.Def_SkillFuncType_NormalAttack]:
        return False
        
    curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
    if not curSkill:
        return False
    
    buffType = SkillCommon.GetBuffType(curSkill)
    buffTuple = SkillCommon.GetBuffManagerByBuffType(attacker, buffType)
    #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö
    if buffTuple == ():
        return False
    
    buffManager = buffTuple[0]
    buff = buffManager.FindBuff(curSkill.GetSkillTypeID())
    if not buff:
        return False
 
    if buff.GetLayer() <= 0:
        return False
    
    if buff.GetOwnerID() != defender.GetID():
        return False
    
    BuffSkill.SetBuffLayer(attacker, buff, buff.GetLayer()-1, skillTypeID=curSkill.GetSkillTypeID())
    
    return True