Monster_6061203.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. 
  2. using CommonAI.Zone;
  3. using CommonLang;
  4. using XmdsCommon.Plugin;
  5. using XmdsCommonServer.Plugin;
  6. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  7. using XmdsCommonServer.XLS.Data;
  8. namespace XmdsCommonSkill.Plugin.Skills.Monster
  9. {
  10. /// <summary>
  11. /// 疫病之王(亚巴顿) - 吸血: 在4秒内持续吸取当前目标的生命,对目标每0.4秒造成目标最大生命x%伤害.
  12. /// 并将这些伤害治疗自己,治疗量等于目标受到伤害的y倍.
  13. /// </summary>
  14. public class Monster_6061203 : XmdsSkillBase
  15. {
  16. public static int ID = 6061203;
  17. /// 伤害百分比.
  18. public static XmdsSkillValue DamageValue;
  19. /// 治疗百分比.
  20. public static XmdsSkillValue HealValue;
  21. /// 作用时间,在编辑器里配死,做成每秒进来1次,持续可打断型.
  22. public static int longTime = 5;
  23. public override int SkillID { get { return ID; } }
  24. private void OnUseFormluaTypeEvent(BattleParams param)
  25. {
  26. //自定义伤害计算.
  27. param.UseDamageType = CommonAI.Data.DamageType.Modify;
  28. }
  29. protected override void OnSkillLogicEvent(BattleParams param)
  30. {
  31. //强制为普攻.
  32. param.Source.OutClientState = (int)XmdsVirtual.UnitHitEventState.Normal;
  33. // 作用量.
  34. float t = (GetTargetFormulaValue(param.GameSkill.SkillLevel, DamageValue) * 1.0f) / XmdsDamageCalculator.PERER / longTime;
  35. int v = CUtils.CastInt(param.Hitter.mUnit.MaxHP * t);
  36. if (v > 0)
  37. {
  38. // 伤害.
  39. param.FinalSkillDamage = v;
  40. // 回复.
  41. v = CUtils.CastInt(v * (GetTargetFormulaValue(param.GameSkill.SkillLevel, HealValue) * 1.0f) / XmdsDamageCalculator.PERER);
  42. param.Attacker.AddHP(v, param.Attacker.mUnit, true);
  43. }
  44. }
  45. protected override void OnRegistEvent()
  46. {
  47. this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
  48. base.OnRegistEvent();
  49. }
  50. protected override void OnInitSkillParam()
  51. {
  52. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  53. InitData(data, out DamageValue, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  54. InitData(data, out HealValue, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
  55. }
  56. }
  57. }