Warrior_110300.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using CommonAI.Data;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Helper;
  4. using CommonAI.Zone.Instance;
  5. using XmdsCommon.Plugin;
  6. using XmdsCommonServer.Plugin;
  7. using XmdsCommonServer.XLS.Data;
  8. using XmdsCommonSkill.Plugin.Buffs;
  9. using XmdsCommonSkill.Plugin.Interface;
  10. namespace XmdsCommonSkill.Plugin.Skills.Warrior
  11. {
  12. /// <summary>
  13. /// 三技能 : 3 基类
  14. /// 消耗n点怒气值,怒气不足不能放 (前置添加了一个蓄力动作)n秒读条施法, 蓄力T秒双手持剑由怀中向地面戳击,向指定方向释放出一道熔岩爆裂
  15. /// (线性伤害,一条直线上所有敌人同时受到伤害,并减速n%,T秒)(类似DOTA牛的沟壑)(长方形9*3.5)
  16. /// 蓄力期间妖兽免伤提升x%,并且是霸体状态 伤害和击打距离随蓄力时长递增,满蓄可以整个区域小击飞及额外妖兽伤害加成n%(蓄力打的逻辑和5技能类似,可以提前点击释放)
  17. /// (特效等会有变化,并且特效指示器可否做成随着时间往前蔓延式的)【蓄力生成法术弄成蔓延式的,对应特效也要配合(指示器+伤害法术特效),满蓄的击飞逻辑放在满蓄时间对应的序列时间点上。】
  18. /// </summary>
  19. public class Warrior_110300 : XmdsSkillBase
  20. {
  21. private static readonly int ID = 110300;
  22. public override int SkillID { get { return ID; } }
  23. protected static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.ZS_SPEEDDOWN_3;
  24. //释放动作期间免伤
  25. protected static readonly int Buff_INGORE_DAMAGE = (int)XmdsBuffBase.XmdsBuffList.ZS_INGOREDMG_3;
  26. /// 伤害倍数:固定值_百分比(满蓄力伤害)
  27. protected XmdsSkillValue mValueSet1;
  28. // 基础-减速数值,减速时间,免伤比例,免伤时间
  29. protected XmdsSkillValue mValueSet5;
  30. //蓄力N毫秒以上即满蓄,满蓄法术ID, 满蓄妖兽伤害提升
  31. protected XmdsSkillValue mValueSet8;
  32. //技能释放时间
  33. protected long mSkillLaunchTime;
  34. //蓄力伤害 - 根据蓄力时间/总蓄力伤害
  35. protected int mSpecialDamge;
  36. //是否满蓄
  37. protected bool mIsFullStorage;
  38. //技能等级
  39. protected int mSkillLv;
  40. protected override void OnSkillDamagePerEvent(BattleParams param)
  41. {
  42. param.SkillDamageAdd = mValueSet1.GetValue(param.GameSkill.SkillLevel);
  43. param.SkillDamagePer = mSpecialDamge;
  44. // 满蓄后额外的一段伤害
  45. if(param.Hitter.mUnit.IsMonster && mIsFullStorage)
  46. {
  47. param.SkillDamagePer += mValueSet8.GetValue(this.mSkillLv, 3);
  48. }
  49. }
  50. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  51. {
  52. //注册减速
  53. XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
  54. var buff = pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.MoveSpeedDown) as XmdsBuff_MoveSpeedDown;
  55. buff.ChangePercent = -this.GetBaseSpeedDownValue(info);
  56. BuffTemplate bt = pack.mBuffTemplate;
  57. bt.LifeTimeMS = this.GetBaseSpeedDownTime(info);
  58. bt.IsHarmful = true;
  59. pack.BindTemplateAndDispose();
  60. unit.RegistSendBuff(bt);
  61. //注册免伤buff
  62. XmdsBuffPack pack2 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_INGORE_DAMAGE);
  63. XmdsBuff_PropChange buff2 = (XmdsBuff_PropChange)pack2.GetXmdsBuff(0);
  64. buff2.CurentChangeType = XmdsVirtual.UnitAttributeType.AllDmgReduce;
  65. buff2.CurrentValue = mValueSet5.GetValue(info.SkillLevel, 3); // 免伤比例
  66. buff2.IsPercent = true;
  67. BuffTemplate bt2 = pack2.mBuffTemplate;
  68. bt2.IsHarmful = true;
  69. bt2.LifeTimeMS = mValueSet5.GetValue(info.SkillLevel, 4);
  70. pack2.BindTemplateAndDispose();
  71. unit.RegistSendBuff(bt2);
  72. //注册增加法术的监听
  73. unit.RegistTrySendSpellEvent(OnTrySendSpell, info);
  74. unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
  75. this.mSkillLv = info.SkillLevel;
  76. }
  77. //获取基础减速效果-减速值
  78. public virtual int GetBaseSpeedDownValue(GameSkill info)
  79. {
  80. return mValueSet5.GetValue(info.SkillLevel, 1);
  81. }
  82. //获取基础减速效果-减速时间
  83. public virtual int GetBaseSpeedDownTime(GameSkill info)
  84. {
  85. return mValueSet5.GetValue(info.SkillLevel, 2);
  86. }
  87. // 增加释放法术的监听
  88. private void OnTrySendSpell(GameSkill skill, XmdsVirtual launcher, LaunchSpell launch, ref SpellTemplate spell, ref JSGCreateSpellData createData, ref float startX, ref float startY)
  89. {
  90. //满蓄击飞
  91. if(skill.SkillID == spell.ID && this.mIsFullStorage)
  92. {
  93. LaunchSpell launchSpll = ComSpellTemplate.Instance().GetCardSpell(mValueSet8.GetValue(this.mSkillLv, 2));
  94. launcher.mUnit.Parent.unitLaunchSpell(XmdsSkillType.active, launcher.mUnit, launchSpll, launcher.mUnit.X, launcher.mUnit.Y);
  95. }
  96. }
  97. //蓄力变化式技能【法术基础时间,法术最大时间,蓄力最大时间,蓄力时间转法术时间系数,满蓄伤害提升,满蓄妖兽伤害提升】
  98. private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState skill)
  99. {
  100. //特殊的延展式攻击的法术时间
  101. if (skill.ActionIndex <= 0)
  102. {
  103. this.mSkillLaunchTime = CommonLang.CUtils.localTimeMS;
  104. this.mSpecialDamge = mValueSet1.GetValueExt(this.mSkillLv);
  105. this.mIsFullStorage = true;
  106. launcher.mUnit.AddBuff(Buff_INGORE_DAMAGE);
  107. }
  108. else
  109. {
  110. //蓄力时间
  111. int storageTime = (int)(CommonLang.CUtils.localTimeMS - this.mSkillLaunchTime);
  112. float stroagePrecent = (float)storageTime / mValueSet8.GetValue(this.mSkillLv, 1);
  113. this.mIsFullStorage = stroagePrecent >= 1.0f;
  114. this.mSpecialDamge = (int)(mValueSet1.GetValueExt(this.mSkillLv) * (System.Math.Min(1.0f, stroagePrecent)));
  115. launcher.mUnit.removeBuff(Buff_INGORE_DAMAGE);
  116. }
  117. return 0;
  118. }
  119. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  120. {
  121. base.OnSkillDataChange(gs, unit);
  122. this.mSkillLv = gs.SkillLevel;
  123. //减速
  124. var buff1 = unit.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_MoveSpeedDown;
  125. buff1.ChangePercent = GetBaseSpeedDownValue(gs);
  126. var bt1 = unit.GetRegistBuff(Buff_ID);
  127. bt1.LifeTimeMS = GetBaseSpeedDownTime(gs);
  128. //免伤
  129. var buff2 = unit.GetRegisBuffVirtual(Buff_INGORE_DAMAGE) as XmdsBuff_PropChange;
  130. buff2.CurrentValue = mValueSet5.GetValue(gs.SkillLevel, 3);
  131. var bt2 = unit.GetRegistBuff(Buff_INGORE_DAMAGE);
  132. bt2.LifeTimeMS = mValueSet5.GetValue(gs.SkillLevel, 4);
  133. }
  134. protected override void OnSkillLogicEvent(BattleParams param)
  135. {
  136. base.OnSkillLogicEvent(param);
  137. if(param.Attacker.mUnit != param.Hitter.mUnit)
  138. {
  139. param.Hitter.mUnit.AddBuff(Buff_ID, param.Attacker.mUnit);
  140. }
  141. }
  142. protected override void OnInitConfig()
  143. {
  144. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  145. InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  146. // 基础-减速数值
  147. InitData(data, out mValueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
  148. //蓄力技能规则
  149. InitData(data, out mValueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8);
  150. }
  151. protected int GetBufEffect(int nCount)
  152. {
  153. if (nCount >= 5)
  154. {
  155. return 3;
  156. }
  157. else if (nCount >= 3)
  158. {
  159. return 2;
  160. }
  161. else if (nCount > 0)
  162. {
  163. return 1;
  164. }
  165. return 0;
  166. }
  167. }
  168. }