XmdsBuff_RealDamage.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. 
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Formula;
  4. using CommonAI.Zone.Instance;
  5. using XmdsCommon.Plugin;
  6. using XmdsCommonServer.Plugin;
  7. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  8. namespace XmdsCommonSkill.Plugin.Buffs
  9. {
  10. /// <summary>
  11. /// Description: 诅咒,真实伤害
  12. /// </summary>
  13. public class XmdsBuff_RealDamage : XmdsBuffBase
  14. {
  15. //真实伤害比例
  16. public int realDamagePer = 0;
  17. private uint buffHitID = 0;
  18. private int UUID_1 = 0;
  19. public override int GetAbilityID()
  20. {
  21. return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.Curse_RealDamage;
  22. }
  23. public override void CopyTo(UnitBuff other)
  24. {
  25. var ret = other as XmdsBuff_RealDamage;
  26. ret.realDamagePer = this.realDamagePer;
  27. base.CopyTo(other);
  28. }
  29. protected override void OnBindTemplate(ref BuffTemplate buffTemplate)
  30. {
  31. //DOT类技能首帧无效.
  32. buffTemplate.FirstTimeEnable = false;
  33. base.OnBindTemplate(ref buffTemplate);
  34. }
  35. public override void BuffBegin(XmdsVirtual hitter, XmdsVirtual attacker, InstanceUnit.BuffState state)
  36. {
  37. buffHitID = hitter.mUnit.ID;
  38. UUID_1 = attacker.RegistGetSkillDamageInfo(OnGetSkillDamageInfo, null, true);
  39. }
  40. public override void BuffEnd(XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
  41. {
  42. hitter.UnRegistGetSkillDamageInfo(UUID_1);
  43. }
  44. //被打监听.
  45. protected virtual void OnGetSkillDamageInfo(XmdsVirtual attacker, XmdsVirtual hitter, ref AttackSource source, GameSkill gs)
  46. {
  47. if(hitter.mUnit.ID == this.buffHitID)
  48. {
  49. attacker.MirrorProp.IgnoreDefensePer = this.realDamagePer;
  50. }
  51. }
  52. protected override void OnDispose()
  53. {
  54. base.OnDispose();
  55. }
  56. }
  57. }