12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Instance;
- using CommonLang;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
- namespace XmdsCommonSkill.Plugin.Buffs
- {
- //治疗的毒,单独扩展
- public class XmdsBuff_RemedyPoison : XmdsBuffBase
- {
- /// <summary>
- /// 基础伤害系数
- /// </summary>
- public int mBaseDmg = 0;
- public int mBaseDmgPer;
- //流血加深系数
- public int mDeeperDmg = 0;
- public int mDeeperDmgPer = 0;
- //buff挂的那一刻决定buff的伤害值
- private int mFinalBaseDmg;
- private int mFinalDeeperDmg;
- public override int GetAbilityID()
- {
- return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.RemedyPoison;
- }
- public override void CopyTo(UnitBuff other)
- {
- var ret = other as XmdsBuff_RemedyPoison;
- ret.mBaseDmg = this.mBaseDmg;
- ret.mBaseDmgPer = this.mBaseDmgPer;
- ret.mDeeperDmg = this.mDeeperDmg;
- ret.mDeeperDmgPer = this.mDeeperDmgPer;
- base.CopyTo(other);
- }
- protected override void OnBindTemplate(ref BuffTemplate buffTemplate)
- {
- //DOT类技能首帧无效.
- base.OnBindTemplate(ref buffTemplate);
- }
- protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state)
- {
- //计算buff伤害
- int finalAttack = attacker.MirrorProp.GetFinalAttack(hitter.mUnit.IsMonster);
- int attackTemp = (int)(finalAttack / XmdsDamageCalculator.PERER * mBaseDmgPer);
- this.mFinalBaseDmg = System.Math.Max(1, mBaseDmg + XmdsDamageCalculator.GetDamage(attackTemp, attacker, hitter, null));
- attackTemp = (int)(finalAttack / XmdsDamageCalculator.PERER * mDeeperDmgPer);
- this.mFinalDeeperDmg = System.Math.Max(1, mDeeperDmg + XmdsDamageCalculator.GetDamage(attackTemp, attacker, hitter, null));
- }
- protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
- {
- }
- public override void BuffUpdate(XmdsVirtual unit, InstanceUnit.BuffState state)
- {
- //为自己加血.
- int reduceHP = mFinalBaseDmg + mFinalDeeperDmg * state.OverlayLevel;
- unit.AddHP(-reduceHP, state.Sender, DamageSource.RemedyPoison);
- }
- protected override void OnDispose()
- {
- base.OnDispose();
- }
- }
- }
|