Warrior_110400.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.Formula;
  3. using CommonAI.Zone.Helper;
  4. using CommonAI.Zone.Instance;
  5. using CommonLang;
  6. using XmdsCommon.Plugin;
  7. using XmdsCommonServer.Plugin;
  8. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  9. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  10. using XmdsCommonServer.XLS.Data;
  11. using XmdsCommonSkill.Plugin.Buffs;
  12. using XmdsCommonSkill.Plugin.PassiveSkills.Warrior;
  13. namespace XmdsCommonSkill.Plugin.Skills.Warrior
  14. {
  15. /// <summary>
  16. /// 四技能 4 : 基类
  17. /// 踩踏地面咆哮,获得气动山河buff 对范围怪物仇恨值增加N并上加仇恨最高队友N倍的仇恨值,队友在持续期间不增加怪物仇恨值【结束挂 需要在底层加应用层东西,建议去掉】(对玩家为嘲讽T秒)
  18. /// ,受到来自拉到仇恨的怪物和玩家平A伤害减半,技能不减伤害减免n%(PVP为受到被嘲讽玩家的普攻伤害减半)整体伤害减免n%(上版本已加过)。
  19. /// 对范围敌人造成自身当前生命值最大生命值n%伤害,两个荒原血统、嗜血神力被动直接刷新并满层,嗜血神力天赋,在buff持续时间内每n秒增长x点怒气。仇恨效果持续5秒(圆半径4-5)
  20. /// </summary>
  21. public class Warrior_110400 : XmdsSkillBase
  22. {
  23. private static readonly int ID = 110400;
  24. private static readonly int Buff_Mocking = (int)XmdsBuffBase.XmdsBuffList.ZS_CAOFENG;
  25. private static readonly int Buff_4_4 = (int)XmdsBuffBase.XmdsBuffList.ZS_4_ADD_TALENT;
  26. public override int SkillID { get { return ID; } }
  27. //普攻减伤
  28. protected XmdsSkillValue mDamageReduce;
  29. //生命百分比伤害
  30. protected XmdsSkillValue mValueSet1;
  31. // 嘲讽配置
  32. protected XmdsSkillValue mValueSet5;
  33. //技能效果时间
  34. protected XmdsSkillValue mValueSet6;
  35. //嘲讽期间,增加怒气
  36. protected XmdsSkillValue mValueSet8;
  37. // 被动
  38. public Warrior_110600 playerPassive;
  39. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  40. {
  41. // 嘲讽注册
  42. var pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_Mocking);
  43. var buff = (XmdsBuff_Mocking)pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.Mocking);
  44. buff.damageReduce = mDamageReduce.GetValue(info.SkillLevel) + GetSkillValue(AbstractSkillType.Value1);
  45. var bt = pack.mBuffTemplate;
  46. bt.IsHarmful = true;
  47. bt.LifeTimeMS = mValueSet5.GetValue(info.SkillLevel, 1);
  48. pack.BindTemplateAndDispose();
  49. unit.RegistSendBuff(bt);
  50. //气动山河buff
  51. var pack2 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_4_4);
  52. var buff2 = (XmdsBuff_AddTalent)pack2.GetXmdsBuff(0);
  53. buff2.hitAddTalentValue = mValueSet8.GetValue(info.SkillLevel);
  54. var bt2 = pack2.mBuffTemplate;
  55. bt2.IsHarmful = true;
  56. bt2.LifeTimeMS = this.GetBuffTime(null, info);
  57. pack2.BindTemplateAndDispose();
  58. unit.RegistSendBuff(bt2);
  59. unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
  60. }
  61. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  62. {
  63. base.OnSkillDataChange(gs, unit);
  64. var buff = unit.GetRegisBuffVirtual(Buff_Mocking) as XmdsBuff_Mocking;
  65. buff.damageReduce = mDamageReduce.GetValue(gs.SkillLevel) + GetSkillValue(AbstractSkillType.Value1);
  66. var bt2 = unit.GetRegistBuff(Buff_4_4);
  67. bt2.LifeTimeMS = this.GetBuffTime(null, gs);
  68. var buff2 = unit.GetRegisBuffVirtual(Buff_4_4) as XmdsBuff_AddTalent;
  69. buff2.hitAddTalentValue = mValueSet8.GetValue(gs.SkillLevel);
  70. }
  71. private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState skill)
  72. {
  73. //直接刷新两个buff,并到满层
  74. launcher.mUnit.AddBuff(Warrior_110601.GetTalentBufID(), launcher.mUnit, 0, false, true);
  75. launcher.mUnit.AddBuff(Buff_4_4, launcher.mUnit);
  76. // 重置嗜血神力
  77. if(playerPassive == null)
  78. {
  79. playerPassive = (Warrior_110600)launcher.SkillHelper.GetPlayerSkillByIdExt(Warrior_110600.ID);
  80. }
  81. if(playerPassive != null)
  82. {
  83. playerPassive.ResetTriggerTime();
  84. }
  85. return 0;
  86. }
  87. protected override bool OnSkillFinalDamageModifyEvent(BattleParams param)
  88. {
  89. // 相当于把生命系数转换成攻击值去算攻击力
  90. param.HitDamge = GetHitDamage(param);
  91. return true;
  92. }
  93. protected int GetHitDamage(BattleParams param)
  94. {
  95. int baseDamge = mValueSet1.GetValue(param.GameSkill.SkillLevel);
  96. int hpValue = CUtils.CastInt(param.Attacker.mUnit.CurrentHP * XmdsUnitProp.PER * mValueSet1.GetValueExt(param.GameSkill.SkillLevel));
  97. return baseDamge + XmdsDamageCalculator.GetDamage(hpValue, param.Attacker, param.Hitter, param.Source);
  98. }
  99. protected override void OnSkillLogicEvent(BattleParams param)
  100. {
  101. BuffTemplate bt = param.Attacker.GetRegistBuff(Buff_Mocking);
  102. bt.LifeTimeMS = GetBuffTime(param.Hitter, param.GameSkill);
  103. param.Hitter.mUnit.AddBuff(Buff_Mocking, param.Attacker.mUnit);
  104. }
  105. protected int GetBuffTime(XmdsVirtual hitter, GameSkill skill)
  106. {
  107. if (hitter != null && hitter is XmdsVirtual_Player)
  108. {
  109. return mValueSet5.GetValue(skill.SkillLevel, 1);
  110. }
  111. return mValueSet5.GetValue(skill.SkillLevel, 2);
  112. }
  113. protected override void OnInitConfig()
  114. {
  115. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  116. InitData(data, out mDamageReduce, XmdsSkillData.XmdsSkillDataKey.DmgRate);
  117. InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  118. // 扩展配置
  119. InitData(data, out mValueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
  120. InitData(data, out mValueSet6, XmdsSkillData.XmdsSkillDataKey.ValueSet6);
  121. InitData(data, out mValueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8);
  122. }
  123. }
  124. }