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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: ×ÆÉÕ£¨Á÷ÅÉרÓ㬶îÍ⹫ʽ£©
# @author: Alee
# @date 2019-4-28 ÏÂÎç04:12:17
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
 
#µ¼Èë
import SkillCommon
import GameWorld
import ChConfig
import AttackCommon
import PlayerControl
import PassiveBuffEffMng
import GameObj
import BuffSkill
import SkillShell
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
#Âß¼­ÊµÏÖ
## ³ÖÐøÐÔBuff´¦Àí 
#  @param defender ³ÐÊÜÕß
#  @param curBuff µ±Ç°Buff
#  @param curEffect BuffЧ¹û
#  @param tick µ±Ç°Ê±¼ä
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def ProcessBuff(defender, curBuff, curEffect, processBuffTick, tick):
    if curBuff.GetValue2() == 0:
        return
    
    #µ¥´ÎÉ˺¦
    singleDecHP = curBuff.GetValue()
    buffOwner = SkillCommon.GetBuffOwner(curBuff)
    
    curBuffSkillID = curBuff.GetSkill().GetSkillTypeID()
    
    # SkillLostHPǰµ÷ÓàËÀÍö»òÕ߯äËûÇé¿ö»áÈ¡ÏûcurBuff
    curBuff.SetValue2(max(curBuff.GetValue2() - 1, 0))
    
    SkillCommon.SkillLostHP(defender, curBuffSkillID, buffOwner, singleDecHP, tick, hurtType=ChConfig.Def_HurtType_Burn)
    if buffOwner and GameObj.GetHP(buffOwner) > 0:
        # ´Ë´¦ÔÝÎÞ·¨Óñ»¶¯Ð§¹ûʵÏÖ
        buffManager = defender.GetProcessDeBuffState()
        burnToHPEffect, plusValue, skillID = BuffSkill.FindBuffEffectByOwnertID(buffManager, ChConfig.Def_Skill_Effect_BurnToAddHP, 
                                                                           buffOwner.GetID(), buffOwner.GetGameObjType())
        if burnToHPEffect:
            addHP = singleDecHP*burnToHPEffect.GetEffectValue(0)/ChConfig.Def_MaxRateValue
            SkillCommon.SkillAddHP(buffOwner, curBuffSkillID, addHP)
    return
 
 
def CalcBuffValue(attacker, defender, curSkill, changeBuffValueDict):
    curEffect = curSkill.GetEffect(0)
    skillPer = curEffect.GetEffectValue(0)
    skillPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_BurnPer)
    skillPer += PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_BurnPer)
    
    skillEnhance = curEffect.GetEffectValue(1) + PlayerControl.GetBurnValue(attacker)
    skillPer = skillPer*1.0/ChConfig.Def_MaxRateValue
    # ×ÆÉÕÌØÊ⹫ʽ
    hurtValue, hurtType = AttackCommon.CalcHurtHP(attacker, defender, curSkill, 
                            0, 0, GameWorld.GetGameWorld().GetTick(), ChConfig.Def_Skill_HappenState_HitOn, 
                            hurtFormulaKey="Burn", burnValue=skillEnhance, burnPer=skillPer)
    
    return [hurtValue]
 
 
# ´ÎÊý£¨ÅäºÏЧ¹ûID9999µÄ¼ä¸ô£©
def DoAddBuffOver(curObj, curBuff, curEffect, tick, buffOwner):
    if not buffOwner:
        return
    buffTick = SkillShell.GetProcessBuffTick(curBuff.GetSkill(), buffOwner)
    
    curBuff.SetValue2(curBuff.GetRemainTime()/buffTick)
    return
 
 
def OnBuffDisappear(defender, curSkill, curBuff, curEffect, tick):
    #ÒѾ­ËÀÍö²»´¥·¢
    if GameObj.GetHP(defender) <= 0:
        return
    
    count = curBuff.GetValue2()
    #ÎÞÊ£Óà
    if count > 0:
        SkillCommon.SkillLostHP(defender, curSkill.GetSkillTypeID(), SkillCommon.GetBuffOwner(curBuff), 
                                curBuff.GetValue()*count, tick, hurtType=ChConfig.Def_HurtType_Burn)
    
    if GameObj.GetHP(defender) <= 0:
        return
    
    # ÔÚ·ÀÓùÕßÉíÉÏͬʱȡÏûͬһ¸öÊÍ·ÅÕßµÄÏà¹Øbuff
    defender.SetDict(ChConfig.Def_PlayerKey_BurnOwnerID, curBuff.GetOwnerID())
    
    PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(defender, None, None, ChConfig.TriggerType_BurnDisappear)
    
    defender.SetDict(ChConfig.Def_PlayerKey_BurnOwnerID, 0)
    return