#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#
|
# @todo:
|
#
|
# @author: Alee
|
# @date 2017-12-7 ÏÂÎç05:18:11
|
# @version 1.0
|
#
|
# @note: ³ÖÐø¶¾É˺¦£¬ÕæÊµ¼ÆËã
|
#
|
#---------------------------------------------------------------------
|
#µ¼Èë
|
import SkillCommon
|
import GameWorld
|
import ChConfig
|
import GameObj
|
import AttackCommon
|
import SkillShell
|
import PassiveBuffEffMng
|
import BaseAttack
|
import BuffSkill
|
#---------------------------------------------------------------------
|
#È«¾Ö±äÁ¿
|
#---------------------------------------------------------------------
|
|
#---------------------------------------------------------------------
|
#Â߼ʵÏÖ
|
## ³ÖÐøÐÔ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
|
|
layer = max(curBuff.GetLayer(), 1)
|
#µ¥´ÎÉ˺¦, ¶¾Óв㼶µÄÇé¿ö
|
singleDecHP = curBuff.GetValue()*layer
|
hurtPer = FindBuffPer(defender, curBuff) # ÕÒµ½ÁíÍâÒ»¸öbuff¶ÔÖж¾µÄÉ˺¦¼Ó³É
|
|
singleDecHP = int((hurtPer + ChConfig.Def_MaxRateValue)*1.0/ChConfig.Def_MaxRateValue*singleDecHP)
|
#GameWorld.DebugLog("1033---------%s-%s-%s-%s"%(curBuff.GetValue(), layer, hurtPer, singleDecHP ) )
|
#buffÓµÓÐÕß
|
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_Bleed)
|
|
return
|
|
|
##³ÖÐøÉ˺¦Buff, ¸ù¾Ý¹¥»÷ÕßÉ˺¦¼ÆËã
|
# @param attacker ¹¥»÷ÕßʵÀý
|
# @param curSkill ¼¼ÄÜʵÀý
|
# @param curEffect µ±Ç°¼¼ÄÜЧ¹û1
|
# @return ×ÜÖµ
|
def CalcBuffValue(attacker, defender, curSkill, changeBuffValueDict):
|
curEffect = curSkill.GetEffect(0)
|
skillPer = curEffect.GetEffectValue(0)/float(ChConfig.Def_MaxRateValue)
|
skillEnhance = curEffect.GetEffectValue(1)
|
|
# ¿Í»§¶Ë±íÏÖÆ®×ÖΪÁ÷Ѫ£¬ÎÞÐè֪ͨÆäËûÉËѪÀàÐÍ
|
hurtValue, hurtType = AttackCommon.CalcHurtHP(attacker, defender, curSkill,
|
skillEnhance, skillPer, GameWorld.GetGameWorld().GetTick(),
|
ChConfig.Def_Skill_HappenState_HitOn)
|
addTime = PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(attacker, None, curSkill, ChConfig.TriggerType_BuffTime)
|
buffTick = SkillShell.GetProcessBuffTick(curSkill, attacker)
|
|
# µ¥´ÎÉ˺¦Öµ£¬É˺¦ÀàÐÍ£¬´ÎÊý£¨ÅäºÏЧ¹ûID9999µÄ¼ä¸ô£©
|
return [hurtValue, hurtType, int(addTime/buffTick + curEffect.GetEffectValue(2))]
|
|
|
# ÏûʧǰÈçÓÐδִÐдÎÊýÔò²¹ÉÏ
|
# @param defender ³ÐÊÜÕß
|
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_Bleed)
|
#ÒѾËÀÍö²»´¥·¢
|
if GameObj.GetHP(defender) <= 0:
|
return
|
|
BuffBoom(defender, curSkill, curBuff, tick)
|
return
|
|
# buff±¬Õ¨£¬É˺¦ËãÊÍ·ÅbuffÕߣ¬Í¨Öª¿Í»§¶Ë±íÏÖΪÖÐBUFFÕß,ĿǰֻÄÜ´¦ÀíÒ»ÖÖ±¬Õ¨
|
def BuffBoom(defender, curSkill, curBuff, tick):
|
#buffÓµÓÐÕß
|
attacker = SkillCommon.GetBuffOwner(curBuff)
|
if not attacker:
|
return
|
|
skills = PassiveBuffEffMng.GetPassiveSkillByTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_BuffBoom)
|
|
if not skills:
|
return
|
|
boomSkill = skills[0]
|
curEffect = curSkill.GetEffect(0)
|
skillPer = curEffect.GetEffectValue(0)/float(ChConfig.Def_MaxRateValue)
|
skillEnhance = curEffect.GetEffectValue(1)
|
|
BaseAttack.AttackAreaDefenderNotify(attacker, defender, defender.GetPosX(), defender.GetPosY(), boomSkill,
|
skillPer, skillEnhance, tick)
|
|
return
|
|
|
|
# ÕÒµ½¶ÔÓ¦¼Ó³ÉÉ˺¦µÄ¶¾
|
def FindBuffPer(curObj, curBuff):
|
ownerID = curBuff.GetOwnerID()
|
ownerType = curBuff.GetOwnerType()
|
|
if not ownerType:
|
return 0
|
|
buffManager = curObj.GetDeBuffState()
|
curEffect, plusValue, skillID = BuffSkill.FindBuffEffectByOwnertID(buffManager, ChConfig.Def_Skill_Effect_ProBloodPer, ownerID, ownerType)
|
if not curEffect:
|
return 0
|
|
# buffÏàͬ¹éÊôÕßµÄÖ¸¶¨buff²ÅÓÐÉ˺¦¼Ó³É
|
for i in range(buffManager.GetBuffCount()):
|
findBuff = buffManager.GetBuff(i)
|
if findBuff.GetBuffID() != skillID:
|
continue
|
if findBuff.GetOwnerID() != ownerID:
|
continue
|
|
if curEffect.GetEffectValue(1) == curBuff.GetBuffID():
|
return curEffect.GetEffectValue(0)
|
|
return 0
|
|
|
|