Warrior_110260.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 System.Collections.Generic;
  9. using XmdsCommon.Plugin;
  10. using XmdsCommonServer.Plugin;
  11. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  12. using XmdsCommonServer.XLS.Data;
  13. using XmdsCommonSkill.Plugin.Buffs;
  14. using static CommonAI.Zone.SpellTemplate;
  15. using static XmdsCommonSkill.Plugin.Interface.ComSpellTemplate;
  16. namespace XmdsCommonSkill.Plugin.Skills.Warrior
  17. {
  18. /// <summary>
  19. /// 二技能: 2-6 (护盾值提升,护盾被打破或时间到了,会对周围产生基于生命百分比的伤害)
  20. /// </summary>
  21. public class Warrior_110260 : Warrior_110250
  22. {
  23. private static readonly int ID = 110260;
  24. //护盾buff在落地后,编辑器给玩家加buff
  25. protected static readonly int Buff_ID_HUDUN_6 = (int)XmdsBuffBase.XmdsBuffList.HUDUN_ZS_2_6;
  26. /// 获取技能ID.
  27. public override int SkillID { get { return ID; } }
  28. //盾破,造成基于生命的伤害
  29. public XmdsSkillValue mValueSet4;
  30. //护盾加成值
  31. public XmdsSkillValue mValueSet6;
  32. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  33. {
  34. base.OnInit(info, unit, ref template);
  35. //护盾
  36. XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID_HUDUN_6);
  37. var Buf = pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.SHIELD_AbsorbDamage) as XmdsBuff_Shield_AbsorbDamage;
  38. Buf.breakSpellID = XmdsSpellID.WARRIOR_2_6_DunBreak;
  39. int hudun = mValueSet3.GetValue(info.TalentSkillLevel2, 1) + mValueSet6.GetValue(info.TalentSkillLevel3);
  40. Buf.AbsorbDamageSum = CUtils.CastInt(unit.MirrorProp.MaxHP * XmdsUnitProp.PER * hudun);
  41. BuffTemplate bt = pack.mBuffTemplate;
  42. bt.IsHarmful = false;
  43. bt.LifeTimeMS = mValueSet3.GetValue(info.TalentSkillLevel2, 2); ;
  44. pack.BindTemplateAndDispose();
  45. unit.RegistSendBuff(bt);
  46. }
  47. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  48. {
  49. base.OnSkillDataChange(gs, unit);
  50. var buff = unit.GetRegisBuffVirtual(Buff_ID_HUDUN_6) as XmdsBuff_Shield_AbsorbDamage;
  51. int hudun = mValueSet3.GetValue(gs.TalentSkillLevel2, 1) + mValueSet6.GetValue(gs.TalentSkillLevel3);
  52. buff.AbsorbDamageSum = CUtils.CastInt(unit.MirrorProp.MaxHP * XmdsUnitProp.PER * hudun);
  53. var bt = unit.GetRegistBuff(Buff_ID_HUDUN_6);
  54. bt.LifeTimeMS = mValueSet3.GetValue(gs.TalentSkillLevel2, 2);
  55. }
  56. protected override void OnSkillDamagePerEvent(BattleParams param)
  57. {
  58. if (param.AtkProp.DamagePerID < 3)
  59. {
  60. base.OnSkillDamagePerEvent(param);
  61. }
  62. }
  63. protected override bool OnSkillFinalDamageModifyEvent(BattleParams param)
  64. {
  65. // 护盾破碎伤害
  66. if(param.AtkProp.DamagePerID == 3)
  67. {
  68. param.HitDamge = Math.Max(1, CUtils.CastInt(param.Attacker.MirrorProp.MaxHP *
  69. XmdsUnitProp.PER * mValueSet4.GetValue(param.GameSkill.TalentSkillLevel3)));
  70. return true;
  71. }
  72. return false;
  73. }
  74. protected override void OnInitConfig()
  75. {
  76. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  77. InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  78. InitData(data, out mValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
  79. InitData(data, out mValueSet3, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
  80. InitData(data, out mValueSet4, XmdsSkillData.XmdsSkillDataKey.ValueSet4);
  81. InitData(data, out mValueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
  82. InitData(data, out mValueSet6, XmdsSkillData.XmdsSkillDataKey.ValueSet6);
  83. //释放过程中免伤
  84. InitData(data, out mValueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8);
  85. }
  86. }
  87. }