Remedy_510100.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using CommonAI.Data;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Formula;
  4. using CommonAI.Zone.Helper;
  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.XLS.Data;
  12. /// <summary>
  13. /// 治疗【1】技能 1 基类
  14. /// 向一个方向丢出巨大的幻化扇子,到达最大距离时原地旋转2S,伤害分为2个部分,
  15. /// 飞行过程,旋转,造成伤害自身恢复损失生命值的n%(7-8)
  16. /// </summary>
  17. ///
  18. namespace XmdsCommonSkill.Plugin.Skills.Remedy
  19. {
  20. public class Remedy_510100 : RemedySkillBase
  21. {
  22. private static readonly int ID = 510100;
  23. public override int SkillID { get { return ID; } }
  24. // 伤害倍数:固定值_百分比
  25. protected XmdsSkillValue valueSet1;
  26. //扩展配置
  27. protected XmdsSkillValue valueSet5; //基础治疗值, 最大治疗次数
  28. //当前总治疗次数
  29. protected int mBaseHealTimes;
  30. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  31. {
  32. base.OnInit(info, unit, ref template);
  33. unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
  34. this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
  35. }
  36. protected virtual void OnUseFormluaTypeEvent(BattleParams param)
  37. {
  38. param.UseDamageType = base.AutoGetDamageType(param, CommonAI.Data.DamageType.None);
  39. }
  40. protected virtual int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState state)
  41. {
  42. info.mHitUnits.Clear();
  43. this.mBaseHealTimes = 0;
  44. return 0;
  45. }
  46. protected bool GetDamagePer(BattleParams param)
  47. {
  48. int hitNums = param.GameSkill.mHitUnits.Get(param.Hitter.mUnit.ID);
  49. param.SkillDamageAdd = valueSet1.GetValue(param.GameSkill.SkillLevel);
  50. param.SkillDamagePer = valueSet1.GetValueExt(param.GameSkill.SkillLevel);
  51. param.GameSkill.mHitUnits.Put(param.Hitter.mUnit.ID, hitNums + 1);
  52. return hitNums <= 0;
  53. }
  54. /** 自疗恢复已损失生命百分百 */
  55. protected virtual float GetHealValue(BattleParams param)
  56. {
  57. return valueSet5.GetValue(param.GameSkill.SkillLevel, 1);
  58. }
  59. protected override void OnSkillDamagePerEvent(BattleParams param)
  60. {
  61. bool firstHit = GetDamagePer(param);
  62. if (mBaseHealTimes >= valueSet5.GetValue(param.GameSkill.SkillLevel, 2))
  63. {
  64. return;
  65. }
  66. if (param.Attacker.mUnit.CurrentHP < param.Attacker.mUnit.MaxHP && firstHit)
  67. {
  68. int addHP = CUtils.CastInt((param.Attacker.mUnit.MaxHP - param.Attacker.mUnit.CurrentHP)
  69. * XmdsUnitProp.PER * GetHealValue(param));
  70. param.Attacker.AddHP(Math.Max(1, addHP), param.Attacker.mUnit);
  71. mBaseHealTimes++;
  72. }
  73. }
  74. protected override void OnInitConfig()
  75. {
  76. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  77. base.InitBaseConfig(data);
  78. InitData(data, out valueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  79. //扩展配置
  80. InitData(data, out valueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
  81. }
  82. }
  83. }