Remedy_510200.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using CommonAI.Zone.Helper;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Instance;
  4. using XmdsCommon.Plugin;
  5. using XmdsCommonServer.Plugin;
  6. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  7. using XmdsCommonServer.XLS.Data;
  8. using XmdsCommonSkill.Plugin.Buffs;
  9. using XmdsCommonSkill.Plugin.PassiveSkills.Remedy;
  10. using System.Diagnostics;
  11. using CommonLang;
  12. namespace XmdsCommonSkill.Plugin.Skills.Remedy
  13. {
  14. /// <summary>
  15. /// 治疗 二技能: 2 基类
  16. /// 向X码范围内的友方(包括自己)释放一个绿色的风精灵,精灵飞到队友身上,持续恢复奶妈攻击力的百分之X血量
  17. /// (值不是动态变化的,在释放那一刻已经结算好,只有重伤效果可以即刻影响)
  18. /// 回血机制通过法术触发伤害实现
  19. /// </summary>
  20. public class Remedy_510200 : RemedySkillBase
  21. {
  22. private static readonly int ID = 510200;
  23. public override int SkillID { get { return ID; } }
  24. //回血buff
  25. private static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.REMEDY_2_0_ADDHP;
  26. //回血持续时间
  27. protected XmdsSkillValue buffTime;
  28. // 回血系数 : 固定值_百分比
  29. protected XmdsSkillValue valueSet;
  30. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  31. {
  32. base.OnInit(info, unit, ref template);
  33. //// Buff修改
  34. var pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
  35. var buff = pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.AddHP) as XmdsBuff_AddHP;
  36. buff.ChangeValue = 0;// CUtils.CastInt(unit.MirrorProp.MaxAttack * XmdsUnitProp.PER * valueSet.GetValue(info.SkillLevel, 1));
  37. var bt = pack.mBuffTemplate;
  38. bt.LifeTimeMS = buffTime.GetValue(info.SkillLevel);
  39. bt.IsHarmful = true;
  40. pack.BindTemplateAndDispose();
  41. unit.RegistSendBuff(bt);
  42. unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
  43. this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
  44. }
  45. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  46. {
  47. var bt = unit.GetRegistBuff(Buff_ID);
  48. bt.LifeTimeMS = buffTime.GetValue(gs.SkillLevel);
  49. }
  50. protected virtual void OnUseFormluaTypeEvent(BattleParams param)
  51. {
  52. if (param.Attacker.IsAllies(param.Hitter, true, true))
  53. {
  54. //友军无伤害,只加buff
  55. param.UseDamageType = CommonAI.Data.DamageType.None;
  56. }
  57. else
  58. {
  59. param.UseDamageType = CommonAI.Data.DamageType.Damage;
  60. }
  61. }
  62. private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState state)
  63. {
  64. info.mHitUnits.Clear();
  65. return 0;
  66. }
  67. protected override void OnSkillDamagePerEvent(BattleParams param)
  68. {
  69. param.SkillDamageAdd = valueSet.GetValue(param.GameSkill.SkillLevel, 2);
  70. param.SkillDamagePer = valueSet.GetValueExt(param.GameSkill.SkillLevel, 2);
  71. }
  72. protected void AddHpBuff(BattleParams param)
  73. {
  74. var buff = param.Attacker.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_AddHP;
  75. int changePer = CUtils.CastInt(param.Attacker.MirrorProp.MaxAttack * XmdsUnitProp.PER * valueSet.GetValueExt(param.GameSkill.SkillLevel, 1));
  76. buff.ChangeValue = valueSet.GetValue(param.GameSkill.SkillLevel, 1) + changePer;
  77. param.Hitter.mUnit.AddBuff(Buff_ID, param.Attacker.mUnit);
  78. param.GameSkill.mHitUnits.Put(param.Hitter.mUnit.ID, 1);
  79. }
  80. protected override void OnSkillLogicEvent(BattleParams param)
  81. {
  82. if (param.Attacker.IsAllies(param.Hitter, true, true) && !param.GameSkill.mHitUnits.ContainsKey(param.Hitter.mUnit.ID))
  83. {
  84. AddHpBuff(param);
  85. }
  86. }
  87. protected override void OnInitConfig()
  88. {
  89. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  90. base.InitBaseConfig(data);
  91. InitData(data, out buffTime, XmdsSkillData.XmdsSkillDataKey.DmgRate);
  92. InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  93. }
  94. }
  95. }