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
#!/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