hxp
2025-01-09 c5731326acc36a3cfc6870ddb51ce2cc86e2cdc5
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package Skill.GameBuffs.Buff_4012
#
# @todo:Ó°ÏìÍæ¼Ò״̬Ч¹û
# @author hxp
# @date 2015-3-4
# @version 1.0
#
# ÏêϸÃèÊö: Ó°ÏìÍæ¼Ò״̬Ч¹û
#
#---------------------------------------------------------------------
"""Version = 2015-3-4 20:00"""
 
import PlayerControl
import ChConfig
import PassiveBuffEffMng
import IPY_GameWorld
import GameObj
import GameWorld
import SkillCommon
 
## Ìí¼ÓBUFFºóµÄÂß¼­
#  @param None
#  @return None
def DoAddBuffOver(curObj, addBuff, curEffect, tick, buffOwner):
    stateType = curEffect.GetEffectValue(0)
    GameObj.SetPyPlayerState(curObj, stateType, 1)
    
    curObj.SetDict("CurPyPlayerState", stateType)
    PassiveBuffEffMng.OnPassiveSkillTrigger(curObj, None, None, ChConfig.TriggerType_BuffState, tick)
    
    buffOwner = SkillCommon.GetBuffOwner(addBuff)
    if buffOwner:
        PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, None, ChConfig.TriggerType_TagBuffState, tick)
    
    return
 
 
## BUFFÏûʧºó
#  @param None
#  @return None
def OnBuffDisappear(curObj, curSkill, curBuff, curEffect, tick):
 
    stateType = curEffect.GetEffectValue(0)
    if CanDelStateEffect(curObj, ChConfig.Def_Skill_Effect_BuffState, stateType):
        GameObj.SetPyPlayerState(curObj, stateType, 0)
        GameWorld.DebugLog("È¡ÏûÓ°ÏìÍæ¼Ò״̬Ч¹û---%s - %s"%(curObj.GetID(), stateType))
    return
    
    
def OnBuffDisappearEx(curObj, curSkill, curBuff, curEffect, tick):
 
    stateType = curEffect.GetEffectValue(0)
    if CanDelStateEffect(curObj, ChConfig.Def_Skill_Effect_BuffState, stateType):
        GameObj.SetPyPlayerState(curObj, stateType, 0)
        GameWorld.DebugLog("È¡ÏûÓ°ÏìÍæ¼Ò״̬Ч¹û---%s - %s"%(curObj.GetID(), stateType))
    return
    
 
# ´óÓÚµÈÓÚ2¸ö״̬ Ôò²»ÇåÀí״̬
def CanDelStateEffect(curObj, effectID, stateType):
    cnt = 0
    for buffType in xrange(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):
        if buffType in ChConfig.Def_BuffType_OnlyPlayer:
            continue
        
        buffTuple = SkillCommon.GetBuffManagerByBuffType(curObj, buffType)
        #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö
        if buffTuple == ():
            continue
    
        buffManager = buffTuple[0]
        
        for i in range(buffManager.GetEffectCount()):
            effect = buffManager.GetEffect(i)
            if not effect:
                continue
            if effect.GetEffectID() != effectID:
                continue
            
            if effect.GetEffectValue(0) == stateType:
                cnt += 1
            if cnt >= 2:
                return False
        
    return True