1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using CommonAI.Zone.Instance;
- using CommonAI.Zone.Formula;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using CommonAI.Data;
- namespace XmdsCommonSkill.Plugin.Buffs
- {
- /// <summary>
- /// 烙印标记,发送者对其伤害提高
- /// </summary>
- public class XmdsBuff_Brand_2 : XmdsBuffBase
- {
- /// <summary>
- /// BUFF效果,正值为扣血,负值为抵伤.
- /// </summary>
- public int BuffValue;
- private int mHandleUUID = 0;
- //发送者id
- private uint mSenderID = 0;
- public override int GetAbilityID()
- {
- return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.Brand_2;
- }
- public override void CopyTo(UnitBuff other)
- {
- var ret = other as XmdsBuff_Brand_2;
- ret.BuffValue = this.BuffValue;
- base.CopyTo(other);
- }
- protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state)
- {
- //注册监听.
- mHandleUUID = hitter.RegistOnHitDamage(OnHandleHitDmage, null);
- mSenderID = attacker.mUnit.ID;
- }
- protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
- {
- //取消监听.
- hitter.UnRegistOnHitDamage(mHandleUUID);
- }
- //单位被攻击时,判断是否符合条件触发BUFF效果.
- private float OnHandleHitDmage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- {
- if(mSenderID == attacker.mUnit.ID)
- {
- damage = damage * XmdsUnitProp.PER * (XmdsDamageCalculator.PERER + this.BuffValue);
- }
- return damage;
- }
- protected override void OnDispose()
- {
- base.OnDispose();
- }
- }
- }
|