#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#
|
##@package
|
#
|
# @todo: ÎüÊÕ¶Ô·½ÊôÐÔ£¬ÓÐÄ¿±ê¼¼ÄÜ£¨41£©, ÔöÒæbuff
|
#
|
# @author: Alee
|
# @date 2019-3-15 ÏÂÎç04:05:05
|
# @version 1.0
|
#
|
# @note:
|
#
|
#---------------------------------------------------------------------
|
|
import ChConfig
|
import BaseAttack
|
import BuffSkill
|
import IPY_GameWorld
|
import EffGetSet
|
import GameWorld
|
import SkillCommon
|
|
|
def UseBuff(attacker, defender, curSkill, tick, tagRoundPosX, tagRoundPosY):
|
#def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):
|
if not defender:
|
return
|
|
atkObjType = attacker.GetGameObjType()
|
defObjType = defender.GetGameObjType()
|
|
attrIndexAllowList = [] # ´æÔÚNPC£¬½öÔÊÐí͵ȡµÄÊôÐÔÀàÐÍ
|
if atkObjType != IPY_GameWorld.gotPlayer or defObjType != IPY_GameWorld.gotPlayer:
|
attrIndexAllowList = [ChConfig.TYPE_Calc_AttrMaxHP, ChConfig.TYPE_Calc_AttrATKMin, ChConfig.TYPE_Calc_AttrATKMax,
|
ChConfig.TYPE_Calc_AttrDEF, ChConfig.TYPE_Calc_AttrAtkSpeed]
|
|
#GameWorld.DebugLog("͵ȡĿ±êÊôÐÔ: atkID=%s,defID=%s,attrIndexAllowList=%s" % (attacker.GetID(), defender.GetID(), attrIndexAllowList))
|
addBuffValueList = []
|
buff = SkillCommon.FindBuffByID(attacker, curSkill.GetSkillTypeID())[0]
|
if buff:
|
addBuffValueList = [buff.GetValue(), buff.GetValue1(), buff.GetValue2()]
|
#GameWorld.DebugLog("͵ȡĿ±êÊôÐÔ£¬ÒѾ´æÔÚbuff£¬Ö±½ÓÈ¡ÔÖµ! atkID=%s,defID=%s,addBuffValueList=%s,layer=%s"
|
# % (attacker.GetID(), defender.GetID(), addBuffValueList, buff.GetLayer()))
|
else:
|
# Ч¹ûID | ÊôÐÔÏÍò·ÖÂÊ
|
# ×î¶àÎüÊÕÄ¿±ê3ÖÖÊôÐÔ ´æÈëbuffvalue£¬¹Ì¶¨Ç°3¸öЧ¹û
|
# AÖµ-ÊôÐÔID BÖµ-ÎüÈ¡Íò·ÖÂÊ CÖµ-×î¸ß²»³¬¹ý×ÔÉíÊôÐÔÍò·ÖÂÊ£¬Åä0²»ÏÞÖÆ
|
for i in range(3):
|
effect = curSkill.GetEffect(i)
|
attrIndex = effect.GetEffectValue(0)
|
if not attrIndex:
|
continue
|
if attrIndexAllowList and attrIndex not in attrIndexAllowList:
|
continue
|
|
attrRate = effect.GetEffectValue(1)
|
tagValue = EffGetSet.GetValueByEffIndex(defender, attrIndex)
|
addValue = int(tagValue * attrRate / float(ChConfig.Def_MaxRateValue))
|
|
maxRate = effect.GetEffectValue(2)
|
curValue = EffGetSet.GetValueByEffIndex(attacker, attrIndex)
|
if maxRate:
|
maxValue = int(curValue * maxRate / float(ChConfig.Def_MaxRateValue))
|
addValue = min(addValue, maxValue)
|
|
addBuffValueList.append(addValue)
|
GameWorld.DebugLog("͵ȡĿ±êÊôÐÔ: atkID=%s,defID=%s,attrIndex=%s,attrRate=%s,addValue=%s,tagValue=%s,curValue=%s,maxRate=%s"
|
% (attacker.GetID(), defender.GetID(), attrIndex, attrRate, addValue, tagValue, curValue, maxRate))
|
|
buffType = SkillCommon.GetBuffType(curSkill)
|
return BuffSkill.DoAddBuff(attacker, buffType, curSkill, tick, addBuffValueList, attacker)
|
#´¦Àí¼¼ÄÜ´¥·¢ºÍ¹¥»÷³É¹¦Âß¼
|
#return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)
|