Warrior_110340.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.Helper;
  3. using CommonAI.Zone.Instance;
  4. using System;
  5. using XmdsCommon.Plugin;
  6. using XmdsCommonServer.Plugin;
  7. using XmdsCommonServer.XLS.Data;
  8. using XmdsCommonSkill.Plugin.Buffs;
  9. namespace XmdsCommonSkill.Plugin.Skills.Warrior
  10. {
  11. /// <summary>
  12. /// 三技能 3- 4(根据命中人数提高自身防御,x秒(每层n%,上限5))
  13. /// </summary>
  14. public class Warrior_110340 : Warrior_110300
  15. {
  16. private static readonly int ID = 110340;
  17. //命中多人,提升防御
  18. protected XmdsSkillValue mValueSet2;
  19. //本次释放技能命中人数
  20. private int mHitUintsLayer = 0;
  21. private static readonly int Buff_DefenceUp = (int)XmdsBuffBase.XmdsBuffList.ZS_DEFENCEUP_3_4;
  22. public override int SkillID { get { return ID; } }
  23. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  24. {
  25. base.OnInit(info, unit, ref template);
  26. XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_DefenceUp);
  27. var buff = pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.PropChange) as XmdsBuff_PropChange;
  28. buff.CurentChangeType = XmdsVirtual.UnitAttributeType.Defence;
  29. buff.IsPercent = true;
  30. buff.CurrentValue = mValueSet2.GetValue(info.TalentSkillLevel1, 1);
  31. BuffTemplate bt = pack.mBuffTemplate;
  32. bt.IsHarmful = false;
  33. bt.LifeTimeMS = mValueSet2.GetValue(info.TalentSkillLevel1, 2);
  34. pack.BindTemplateAndDispose();
  35. unit.RegistSendBuff(bt);
  36. unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
  37. }
  38. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  39. {
  40. base.OnSkillDataChange(gs, unit);
  41. var buff = unit.GetRegisBuffVirtual(Buff_DefenceUp) as XmdsBuff_PropChange;
  42. buff.CurrentValue = mValueSet2.GetValue(gs.TalentSkillLevel1, 1);
  43. var bt = unit.GetRegistBuff(Buff_DefenceUp);
  44. bt.LifeTimeMS = mValueSet2.GetValue(gs.TalentSkillLevel1, 2);
  45. }
  46. private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState state)
  47. {
  48. this.mHitUintsLayer = 0;
  49. info.mHitUnits.Clear();
  50. return 0;
  51. }
  52. protected override void OnSkillDamagePerEvent(BattleParams param)
  53. {
  54. base.OnSkillDamagePerEvent(param);
  55. param.GameSkill.mHitUnits.Put(param.Hitter.mUnit.ID, 1);
  56. int layers = GetBufEffect(param.GameSkill.mHitUnits.Count);
  57. if (this.mHitUintsLayer != layers)
  58. {
  59. this.mHitUintsLayer = layers;
  60. param.Attacker.mUnit.AddBuff(Buff_DefenceUp);
  61. }
  62. }
  63. protected override void OnInitConfig()
  64. {
  65. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  66. InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  67. InitData(data, out mValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
  68. // 基础-减速数值
  69. InitData(data, out mValueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
  70. //蓄力技能规则
  71. InitData(data, out mValueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8);
  72. }
  73. }
  74. }