XmdsBuff_RemedyPoison.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using CommonAI.Data;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Instance;
  4. using CommonLang;
  5. using XmdsCommon.Plugin;
  6. using XmdsCommonServer.Plugin;
  7. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  8. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  9. namespace XmdsCommonSkill.Plugin.Buffs
  10. {
  11. //治疗的毒,单独扩展
  12. public class XmdsBuff_RemedyPoison : XmdsBuffBase
  13. {
  14. /// <summary>
  15. /// 基础伤害系数
  16. /// </summary>
  17. public int mBaseDmg = 0;
  18. public int mBaseDmgPer;
  19. //流血加深系数
  20. public int mDeeperDmg = 0;
  21. public int mDeeperDmgPer = 0;
  22. //buff挂的那一刻决定buff的伤害值
  23. private int mFinalBaseDmg;
  24. private int mFinalDeeperDmg;
  25. public override int GetAbilityID()
  26. {
  27. return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.RemedyPoison;
  28. }
  29. public override void CopyTo(UnitBuff other)
  30. {
  31. var ret = other as XmdsBuff_RemedyPoison;
  32. ret.mBaseDmg = this.mBaseDmg;
  33. ret.mBaseDmgPer = this.mBaseDmgPer;
  34. ret.mDeeperDmg = this.mDeeperDmg;
  35. ret.mDeeperDmgPer = this.mDeeperDmgPer;
  36. base.CopyTo(other);
  37. }
  38. protected override void OnBindTemplate(ref BuffTemplate buffTemplate)
  39. {
  40. //DOT类技能首帧无效.
  41. base.OnBindTemplate(ref buffTemplate);
  42. }
  43. protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state)
  44. {
  45. //计算buff伤害
  46. int finalAttack = attacker.MirrorProp.GetFinalAttack(hitter.mUnit.IsMonster);
  47. int attackTemp = (int)(finalAttack / XmdsDamageCalculator.PERER * mBaseDmgPer);
  48. this.mFinalBaseDmg = System.Math.Max(1, mBaseDmg + XmdsDamageCalculator.GetDamage(attackTemp, attacker, hitter, null));
  49. attackTemp = (int)(finalAttack / XmdsDamageCalculator.PERER * mDeeperDmgPer);
  50. this.mFinalDeeperDmg = System.Math.Max(1, mDeeperDmg + XmdsDamageCalculator.GetDamage(attackTemp, attacker, hitter, null));
  51. }
  52. protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
  53. {
  54. }
  55. public override void BuffUpdate(XmdsVirtual unit, InstanceUnit.BuffState state)
  56. {
  57. //为自己加血.
  58. int reduceHP = mFinalBaseDmg + mFinalDeeperDmg * state.OverlayLevel;
  59. unit.AddHP(-reduceHP, state.Sender, DamageSource.RemedyPoison);
  60. }
  61. protected override void OnDispose()
  62. {
  63. base.OnDispose();
  64. }
  65. }
  66. }