Remedy_510601.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. using CommonAI.Zone.Helper;
  2. using CommonAI.Zone.Instance;
  3. using XmdsCommonServer.Plugin;
  4. using XmdsCommonServer.XLS.Data;
  5. using XmdsCommonSkill.Plugin.Buffs;
  6. using System;
  7. using static CommonAI.Zone.Instance.InstanceUnit;
  8. using XmdsCommon.Plugin;
  9. using CommonAI.Zone;
  10. using XmdsCommonServer.Plugin.Units;
  11. using CommonAI.Zone.Formula;
  12. using XmdsCommonSkill.Plugin.Skills;
  13. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  14. using XmdsCommonSkill.Plugin.Skills.Remedy;
  15. using XmdsCommonSkill.Plugin.Skills.Magic;
  16. using CommonAI.Data;
  17. using CommonLang;
  18. using CommonAI.ZoneServer.JSGModule;
  19. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  20. namespace XmdsCommonSkill.Plugin.PassiveSkills.Remedy
  21. {
  22. /// <summary>
  23. /// 治疗被动
  24. /// 灵桓蝶舞:普攻(几率为n1%)或者特定技能技能(按数值要求:每个技能几率单配)
  25. /// 造成的每段伤害,会给目标施加n层毒伤,每层伤害为每T秒对目标造成施法单位攻击力的n3%伤害,持续T2秒,每次都会叠加层数,
  26. /// 并刷新存在CD,最多叠加n2层,当CD时间到了,全部层数一起消失。并且不同施法目标对同一个目标施加这个效果独立计算。
  27. /// </summary>
  28. class Remedy_510601 : XmdsPassiveSkillBase
  29. {
  30. /// 技能ID.
  31. public static readonly int ID = 510601;
  32. public override int SkillID { get { return ID; } }
  33. public static readonly int Buff_POISON = (int)XmdsBuffBase.XmdsBuffList.REMEDY_POISON; // 毒buff
  34. //毒伤buff时间,基础效果固伤_百分比系数,每层毒提供效果固伤_百分比系数
  35. private static XmdsSkillValue mValueSet1;
  36. //私有数据
  37. private PlayerCache_Remedy mPlayerCache;
  38. private int mUUID_1 = 0;
  39. protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
  40. {
  41. int skillLv = skillInfo.GetPassiveLevel();
  42. mPlayerCache = XmdsPlayerCache.PlayerTalnetInit(XmdsUnitPro.Priest, owner.mUnit, mValueSet1.GetValue(skillLv, 1), null) as PlayerCache_Remedy;
  43. owner.SetPlayerCache(mPlayerCache);
  44. // Buff1修改
  45. var pack1 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_POISON);
  46. var buff1 = pack1.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.RemedyPoison) as XmdsBuff_RemedyPoison;
  47. buff1.mBaseDmg = mValueSet1.GetValue(skillLv, 2);
  48. buff1.mBaseDmgPer = mValueSet1.GetValue(skillLv, 3);
  49. buff1.mDeeperDmg = mValueSet1.GetValue(skillLv, 4);
  50. buff1.mDeeperDmgPer = mValueSet1.GetValue(skillLv, 5);
  51. var bt1 = pack1.mBuffTemplate;
  52. bt1.LifeTimeMS = mValueSet1.GetValue(skillLv, 1);
  53. bt1.IsHarmful = false;
  54. pack1.BindTemplateAndDispose();
  55. owner.RegistSendBuff(bt1);
  56. mUUID_1 = owner.RegistOnHitOther(OnHitOther, skillInfo, true);
  57. }
  58. protected virtual float OnHitOther(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  59. ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  60. {
  61. if (damage <= 0 || attacker.mUnit.IsMonster || source.FromSkillType == XmdsSkillType.cardSkill)//治疗
  62. {
  63. return damage;
  64. }
  65. if(mPlayerCache == null)
  66. {
  67. log.Error("Remedy_510601找不到玩家天赋缓存:" + attacker.mUnit.PlayerUUID);
  68. return damage;
  69. }
  70. if(source.Attack == null || source.Attack.Properties == null)
  71. {
  72. log.Error("Remedy_510601解析伤害技能异常1:"+ attacker.mUnit.PlayerUUID + ", " + attacker.mUnit.Parent.GetSceneID());
  73. return damage;
  74. }
  75. XmdsAttackProperties prop = (source.Attack.Properties as XmdsAttackProperties);
  76. //来自编辑器自行配置的攻击,调过叠毒检测
  77. if(prop.SkillTemplateID == XmdsBattleSkill.DefaultSkillScriptID)
  78. {
  79. return damage;
  80. }
  81. IntIntData poisonRate = mPlayerCache.GePoisonRateInfo(prop.SkillTemplateID);
  82. if(poisonRate == null)
  83. {
  84. log.Error("Remedy_510601解析伤害技能异常2:" + attacker.mUnit.PlayerUUID + ", " + prop.SkillTemplateID +
  85. ", " + attacker.mUnit.Parent.GetSceneID() + ", " + JSGModule.GetAttackSourceDes(source));
  86. return damage;
  87. }
  88. //挂毒buff
  89. if(poisonRate.value1 > 0 && poisonRate.value2 > 0 && attacker.mUnit.RandomN.Next(GlobalData.RATE_BASE) < (poisonRate.value1 + mPlayerCache.GetRateAddition()))
  90. {
  91. hitted.mUnit.AddBuff(Buff_POISON, attacker.mUnit, 0, false, false, false, 0, poisonRate.value2);
  92. mPlayerCache.RecordPoisonPlayer(hitted);
  93. }
  94. return damage;
  95. }
  96. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  97. {
  98. int skillLv = gs.GetPassiveLevel();
  99. var bt = unit.GetRegistBuff(Buff_POISON);
  100. bt.LifeTimeMS = mValueSet1.GetValue(skillLv, 1);
  101. var buff = unit.GetRegisBuffVirtual(Buff_POISON) as XmdsBuff_RemedyPoison;
  102. buff.mBaseDmg = mValueSet1.GetValue(skillLv, 2);
  103. buff.mBaseDmgPer = mValueSet1.GetValue(skillLv, 3);
  104. buff.mDeeperDmg = mValueSet1.GetValue(skillLv, 4);
  105. buff.mDeeperDmgPer = mValueSet1.GetValue(skillLv, 5);
  106. mPlayerCache.RefreshConfig(mValueSet1.GetValue(skillLv, 1));
  107. }
  108. protected override void OnDispose(XmdsVirtual owner)
  109. {
  110. owner.UnRegistOnHitOther(mUUID_1);
  111. XmdsPlayerCache.PlayerTalnetDestory(owner.mUnit);
  112. }
  113. protected override void OnInitSkillParam()
  114. {
  115. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  116. InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  117. }
  118. }
  119. /*
  120. * //2021.07.25 13.55这个被动已经完全替换成新效果了
  121. /// <summary>
  122. /// 治疗被动
  123. //表格配置: 下次普攻加成 1:1000;2:2000;3:3000;4:4000 移速提升,时间 1:2000,2000;2:2500,2000;3:3000,2000;4:4000,2000
  124. /// 灵桓蝶舞:释放三次技能下次普攻附带攻击力系数的增益,自身移速增加n% S秒
  125. /// </summary>
  126. class Remedy_510601 : XmdsPassiveSkillBase
  127. {
  128. /// 技能ID.
  129. public static int ID = 510601;
  130. private static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.NORMAL_ATTACK_STRENGTH; // 下次普攻强化
  131. //攻击提升
  132. private static XmdsSkillValue mValueSet1;
  133. //速度提升值
  134. private static XmdsSkillValue mValueSet2;
  135. private int mSkillLaunchTimes = 0;
  136. private int mNormalAtkDmgAdd = 0;
  137. private int mUUID_1 = 0;
  138. private int mUUID_2 = 0;
  139. /// 获取技能ID.
  140. public override int SkillID {get{return ID;}}
  141. protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
  142. {
  143. // Buff1修改
  144. var pack1 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
  145. var buff1 = pack1.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.MoveSpeedUp) as XmdsBuff_MoveSpeedUp;
  146. buff1.ChangePercent = mValueSet2.GetValue(skillInfo.GetPassiveLevel(), 1);
  147. var bt1 = pack1.mBuffTemplate;
  148. bt1.LifeTimeMS = mValueSet2.GetValue(skillInfo.GetPassiveLevel(), 2);
  149. bt1.IsHarmful = false;
  150. pack1.BindTemplateAndDispose();
  151. owner.RegistSendBuff(bt1);
  152. //收到攻击监听注册
  153. mUUID_1 = owner.RegistLaunchSkillOver(OnLaunchSkillOver, skillInfo, true);
  154. mUUID_2 = owner.RegistOnHitOther(OnHandleHitOther, skillInfo, true);
  155. }
  156. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  157. {
  158. var buff = unit.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_MoveSpeedUp;
  159. buff.ChangePercent = mValueSet2.GetValue(gs.GetPassiveLevel(), 1);
  160. var bt = unit.GetRegistBuff(Buff_ID);
  161. bt.LifeTimeMS = mValueSet2.GetValue(gs.GetPassiveLevel(), 2);
  162. }
  163. private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher,
  164. CommonAI.Zone.Instance.InstanceUnit.SkillState skill)
  165. {
  166. if (skill.GetSkillType() == XmdsSkillType.active)
  167. {
  168. if (++this.mSkillLaunchTimes >= 3)
  169. {
  170. launcher.mUnit.AddBuff(Buff_ID);
  171. mNormalAtkDmgAdd = 2;
  172. this.mSkillLaunchTimes = 0;
  173. }
  174. }
  175. else if(skill.GetSkillType() == XmdsSkillType.normalAtk)
  176. {
  177. mNormalAtkDmgAdd--;
  178. }
  179. return 0;
  180. }
  181. //单位受击
  182. private float OnHandleHitOther(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  183. ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  184. {
  185. if(source.FromSkillType == XmdsSkillType.normalAtk && mNormalAtkDmgAdd > 0)
  186. {
  187. damage += Math.Max(1, CUtils.CastInt(damage * XmdsUnitProp.PER * mValueSet1.GetValue(skill.GetPassiveLevel())));
  188. }
  189. return damage;
  190. }
  191. protected override void OnDispose(XmdsVirtual owner)
  192. {
  193. owner.UnRegistLaunchSkillOver(mUUID_1);
  194. owner.UnRegistOnHitOther(mUUID_2);
  195. }
  196. protected override void OnInitSkillParam()
  197. {
  198. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  199. InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  200. InitData(data, out mValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
  201. }
  202. }
  203. */
  204. }