| | |
| | | import BaseAttack
|
| | | import BuffSkill
|
| | | import IPY_GameWorld
|
| | | import SkillCommon
|
| | | import EffGetSet
|
| | | import GameWorld
|
| | | import SkillCommon
|
| | |
|
| | |
|
| | | def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):
|
| | | def UseBuff(attacker, defender, curSkill, tick, tagRoundPosX, tagRoundPosY):
|
| | | #def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):
|
| | | if not defender:
|
| | | return
|
| | | if defender.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | 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 = []
|
| | | # 效果ID | 属性项,万分率
|
| | | # 最多吸收目标3种属性 存入buffvalue
|
| | | # 最多吸收目标3种属性 存入buffvalue,固定前3个效果
|
| | | # A值-属性ID B值-吸取万分率 C值-最高不超过自身属性万分率,配0不限制
|
| | | for i in range(3):
|
| | | attrIndex = curSkill.GetEffect(i).GetEffectValue(0)
|
| | | effect = curSkill.GetEffect(i)
|
| | | attrIndex = effect.GetEffectValue(0)
|
| | | if not attrIndex:
|
| | | break
|
| | | curValue = EffGetSet.GetValueByEffIndex(defender, attrIndex)
|
| | | curValue = int(curValue * curSkill.GetEffect(i).GetEffectValue(1) / ChConfig.Def_MaxRateValue)
|
| | | continue
|
| | | if attrIndexAllowList and attrIndex not in attrIndexAllowList:
|
| | | continue
|
| | |
|
| | | addBuffValueList.append(curValue)
|
| | | 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)
|
| | | BuffSkill.DoAddBuff(attacker, buffType, curSkill, tick, addBuffValueList, attacker)
|
| | |
|
| | | return True
|
| | | #处理技能触发和攻击成功逻辑
|
| | | return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)
|
| | | #return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)
|