XmdsBuff_Damage.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.Instance;
  3. using CommonLang;
  4. using XmdsCommon.Plugin;
  5. using XmdsCommonServer.Plugin;
  6. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  7. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  8. namespace XmdsCommonSkill.Plugin.Buffs
  9. {
  10. public class XmdsBuff_Damage : XmdsBuffBase
  11. {
  12. /// <summary>
  13. ///攻击值
  14. /// </summary>
  15. public int mDamageValue = 0; // 伤害固定值
  16. public int mDamagePer = 0; // 伤害百分比
  17. public override int GetAbilityID()
  18. {
  19. return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.Damage;
  20. }
  21. public override void CopyTo(UnitBuff other)
  22. {
  23. var ret = other as XmdsBuff_Damage;
  24. ret.mDamageValue = this.mDamageValue;
  25. ret.mDamagePer = this.mDamagePer;
  26. base.CopyTo(other);
  27. }
  28. protected override void OnBindTemplate(ref BuffTemplate buffTemplate)
  29. {
  30. //DOT类技能首帧无效.
  31. base.OnBindTemplate(ref buffTemplate);
  32. }
  33. protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state)
  34. {
  35. }
  36. protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
  37. {
  38. }
  39. protected override int OnBuffHit(XmdsVirtual hitter, XmdsVirtual attacker, CommonAI.Zone.Formula.AttackSource source, ref XmdsVirtual.AtkResult result)
  40. {
  41. if (this.mDamageValue != 0 || this.mDamagePer != 0)
  42. {
  43. return GetFinalDamage(attacker, hitter, source);
  44. }
  45. return base.OnBuffHit(hitter, attacker, source, ref result);
  46. }
  47. private int GetFinalDamage(XmdsVirtual attacker, XmdsVirtual hitter, CommonAI.Zone.Formula.AttackSource source)
  48. {
  49. int finalDamage = this.mDamageValue;
  50. if (this.mDamagePer > 0)
  51. {
  52. float attackFinal = attacker.MirrorProp.GetFinalAttack(hitter.mUnit.IsMonster) * XmdsUnitProp.PER * this.mDamagePer;
  53. finalDamage += XmdsDamageCalculator.GetDamage((int)attackFinal, attacker, hitter, null);
  54. }
  55. return finalDamage;
  56. }
  57. }
  58. }