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