hch
2019-03-15 d41a44a9fd316c021c4e85bde9cb0fab4c2e0be1
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
#!/usr/bin/python
# -*- coding: GBK -*-
 
##@package BuffProcess_1089
# °´±»¹¥»÷ÕßµÄ×î´óѪÁ¿°Ù·Ö±È¼õѪ
#
# @author Alee
# @date 2011-03-18 16:45
# @version 1.2
#
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
#
 
#µ¼Èë
import SkillCommon
import GameWorld
import ChConfig
import GameObj
import IPY_GameWorld
import PassiveBuffEffMng
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
#Âß¼­ÊµÏÖ
## ³ÖÐøÐÔBuff´¦Àí °´×î´óѪÁ¿°Ù·Ö±È¼õѪ
#  @param defender ³ÐÊÜÕß
#  @param curBuff µ±Ç°Buff
#  @param curEffect BuffЧ¹û
#  @param tick µ±Ç°Ê±¼ä
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def ProcessBuff(defender, curBuff, curEffect, processBuffTick, tick):
 
    #µ¥´ÎÉ˺¦
    singleDecHP = SkillCommon.GetProcessBuffChangeHp_Time(curBuff, processBuffTick, tick)
    
    #buffÓµÓÐÕß
    buffOwner = SkillCommon.GetBuffOwner(curBuff)
    
    curBuffSkillID = curBuff.GetSkill().GetSkillTypeID()
    
    SkillCommon.SkillLostHP(defender, curBuffSkillID, buffOwner, singleDecHP, tick, hurtType=ChConfig.Def_HurtType_Bleed)
    if curEffect.GetEffectValue(2) and buffOwner:
        SkillCommon.SkillAddHP(buffOwner, curBuffSkillID, singleDecHP)
 
    OnPassiveSkillByHurtCount(defender, curBuff, curEffect, buffOwner)
    return
 
 
def OnPassiveSkillByHurtCount(defender, curBuff, curEffect, buffOwner):
    if not buffOwner:
        return
    if buffOwner.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return
    # Ö´ÐдÎÊý¡£ µ±¼³Áé¶ÔÄ¿±êÔì³É3´ÎÉ˺¦Ê±£¬¿É½µµÍÄ¿±ê20%µÄ·ÀÓù
    curBuff.SetValue1(curBuff.GetValue1() + 1)
    tick = GameWorld.GetGameWorld().GetTick()
    
    defender.SetDict(ChConfig.Def_PlayerKey_BuffHurtCnt, curBuff.GetValue1())
    PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, defender, curBuff.GetSkill(), ChConfig.TriggerType_BuffHurtCnt, tick)
    defender.SetDict(ChConfig.Def_PlayerKey_BuffHurtCnt, 0)
    
    return
 
 
## ³ÖÐøÐÔBuffÏûʧ
#  @param defender ³ÐÊÜÕß
#  @param curSkill µ±Ç°¼¼ÄÜ
#  @param curBuff µ±Ç°Buff
#  @param tick µ±Ç°Ê±¼ä
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnBuffDisappear(defender, curSkill, curBuff, curEffect, tick):
    buffValue = curBuff.GetValue()
    
    #ÎÞÊ£Óà
    if buffValue <= 0:
        return
    
    #ÒѾ­ËÀÍö²»´¥·¢
    if GameObj.GetHP(defender) <= 0:
        return
    
    buffOwner = SkillCommon.GetBuffOwner(curBuff)
    
    SkillCommon.SkillLostHP(defender, curSkill.GetSkillTypeID(), buffOwner, buffValue, tick, hurtType=ChConfig.Def_HurtType_Bleed)
    
    # Ö´ÐдÎÊý
    OnPassiveSkillByHurtCount(defender, curBuff, curEffect, buffOwner)
    return
 
 
##³ÖÐøÉ˺¦Buff, ¸ù¾Ý¹¥»÷ÕßѪÁ¿¼ÆËã
# @param attacker ¹¥»÷ÕßʵÀý
# @param curSkill ¼¼ÄÜʵÀý
# @param curEffect µ±Ç°¼¼ÄÜЧ¹û1
# @return ×ÜÖµ
def CalcBuffValue(attacker, defender, curSkill, changeBuffValueDict):
    curEffect = curSkill.GetEffect(0)
    skillPer = curEffect.GetEffectValue(0)
    skillPer /= float(ChConfig.Def_MaxRateValue)
    #¼¼Äܸ½¼Ó
    skillEnhance = curEffect.GetEffectValue(1)
    
    return [int(GameObj.GetMaxHP(defender) * skillPer + skillEnhance)]