XmdsBuff_AddHPByLossHP.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. 
  2. using CommonAI.Data;
  3. using CommonAI.Zone;
  4. using CommonAI.Zone.Formula;
  5. using CommonAI.Zone.Instance;
  6. using CommonLang;
  7. using System;
  8. using XmdsCommon.Plugin;
  9. using XmdsCommonServer.Plugin;
  10. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  11. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  12. namespace XmdsCommonSkill.Plugin.Buffs
  13. {
  14. // 根据已损失生命值增加血量
  15. public class XmdsBuff_AddHPByLossHP : XmdsBuffBase
  16. {
  17. public int ChangeValue = 0;
  18. public override int GetAbilityID()
  19. {
  20. return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.AddHPByLossHP;
  21. }
  22. public override void CopyTo(UnitBuff other)
  23. {
  24. var ret = other as XmdsBuff_AddHPByLossHP;
  25. ret.ChangeValue = ChangeValue;
  26. base.CopyTo(other);
  27. }
  28. protected override void OnBindTemplate(ref BuffTemplate buffTemplate)
  29. {
  30. //DOT类技能首帧无效.
  31. base.OnBindTemplate(ref buffTemplate);
  32. }
  33. public override void BuffUpdate(XmdsVirtual unit, InstanceUnit.BuffState state)
  34. {
  35. //为自己加血.
  36. int addHP = CUtils.CastInt((unit.mUnit.MaxHP - unit.mUnit.CurrentHP) * XmdsUnitProp.PER * ChangeValue);
  37. if(addHP > 0)
  38. {
  39. unit.mUnit.AddHP(addHP, unit.mUnit);
  40. }
  41. }
  42. public override void BuffBegin(XmdsVirtual hitter, XmdsVirtual attacker, InstanceUnit.BuffState state)
  43. {
  44. }
  45. public override void BuffEnd(XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
  46. {
  47. }
  48. protected override void OnDispose()
  49. {
  50. base.OnDispose();
  51. }
  52. }
  53. }