Boss_90104.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using CommonAI.Zone.Helper;
  2. using CommonAI.Zone.Instance;
  3. using XmdsCommonServer.Plugin;
  4. using XmdsCommonServer.XLS.Data;
  5. using XmdsCommonSkill.Plugin.Buffs;
  6. using System;
  7. using static CommonAI.Zone.Instance.InstanceUnit;
  8. using XmdsCommon.Plugin;
  9. using CommonAI.Zone;
  10. using XmdsCommonServer.Plugin.Units;
  11. using CommonAI.Zone.Formula;
  12. using XmdsCommonSkill.Plugin.Skills;
  13. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  14. using CommonAI.Data;
  15. using CommonLang;
  16. namespace XmdsCommonSkill.Plugin.PassiveSkills.Remedy
  17. {
  18. /// <summary>
  19. /// boss通用被动 - 尖刺(反弹受到伤害的百分之N)
  20. /// </summary>
  21. class Boss_90104 : XmdsPassiveSkillBase
  22. {
  23. public static int ID = 90104;
  24. //private static XmdsSkillValue valueSet;
  25. private static float damageReturn = 0;
  26. private int mUUID_1 = 0;
  27. public override int SkillID {get{return ID;}}
  28. protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
  29. {
  30. mUUID_1 = owner.RegistOnHitDamage(OnHandleHitDmage, skillInfo, true);
  31. }
  32. //单位被攻击时,判断是否符合条件触发BUFF效果.
  33. private float OnHandleHitDmage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  34. ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  35. {
  36. int reduce = Math.Max(1, CUtils.CastInt(damage * damageReturn));
  37. //自己给自己回血
  38. attacker.AddHP(-reduce, hitted.mUnit);
  39. return damage;
  40. }
  41. protected override void OnInitSkillParam()
  42. {
  43. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  44. XmdsSkillValue valueSet;
  45. InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.DmgRate);
  46. damageReturn = valueSet.GetValue() * XmdsUnitProp.PER;
  47. }
  48. protected override void OnDispose(XmdsVirtual owner)
  49. {
  50. owner.UnRegistOnHitDamage(mUUID_1);
  51. }
  52. }
  53. }