Remedy_510400.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using CommonAI.Data;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Helper;
  4. using CommonAI.Zone.Instance;
  5. using CommonLang;
  6. using System;
  7. using XmdsCommon.Plugin;
  8. using XmdsCommonServer.Plugin;
  9. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  10. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  11. using XmdsCommonServer.XLS.Data;
  12. using XmdsCommonSkill.Plugin.Buffs;
  13. using XmdsCommonSkill.Plugin.PassiveSkills.Remedy;
  14. using static CommonAI.Zone.Instance.InstanceUnit;
  15. namespace XmdsCommonSkill.Plugin.Skills.Remedy
  16. {
  17. /// <summary>
  18. /// 治疗, 四技能 4 : 基类
  19. /// 向一个指定区域的中心抛出绿色的水灵,水灵打到小区域回血,冒出向四周4个方向蔓延的藤曼(类似婕拉和大树大招的结合),
  20. /// 造成伤害并禁锢1.5s(可攻击可释放非位移技能,不能移动) 编辑器
  21. /// 伤害帧备注:1:藤蔓伤害; 2:强化1治疗; 3:特殊挂毒区域
  22. /// </summary>
  23. public class Remedy_510400 : RemedySkillBase
  24. {
  25. private static readonly int ID = 510400;
  26. protected static readonly int Buff_JINGU = (int)XmdsBuffBase.XmdsBuffList.REMEDY_4_JINGU;
  27. /// 伤害倍数, 回血 : 固定值_百分比
  28. protected XmdsSkillValue valueSet;
  29. //扩展配置
  30. protected XmdsSkillValue valueSet5;
  31. //毒爆范围,毒爆基础伤害,毒爆百分比伤害[1:10,10,500]
  32. //protected XmdsSkillValue valueSet8;
  33. //毒爆伤害,等级:层数伤害百分比
  34. protected XmdsSkillValue valueSet8;
  35. public override int SkillID { get { return ID; } }
  36. protected override void OnSkillDamagePerEvent(BattleParams param)
  37. {
  38. param.SkillDamageAdd = valueSet.GetValue(param.GameSkill.SkillLevel);
  39. param.SkillDamagePer = valueSet.GetValueExt(param.GameSkill.SkillLevel);
  40. }
  41. protected override bool OnSkillFinalDamageModifyEvent(BattleParams param)
  42. {
  43. if (param.GameSkill.mHitUnits.ContainsKey(param.Hitter.mUnit.ID))
  44. {
  45. return true;
  46. }
  47. param.GameSkill.mHitUnits.Put(param.Hitter.mUnit.ID, 1);
  48. var playerCache = param.Attacker.GetPlayerCache() as PlayerCache_Remedy;
  49. if(playerCache == null)
  50. {
  51. //职业技能给怪物用了
  52. if (param.Attacker.mUnit.IsPlayer)
  53. {
  54. log.Error("Remedy_510400玩家缓存信息异常:" + param.Attacker.mUnit.PlayerUUID);
  55. }
  56. return false;
  57. }
  58. //攻击到了,检测毒爆
  59. BuffState buffState = param.Hitter.mUnit.GetBuffByIDAndSender(Remedy_510601.Buff_POISON, param.Attacker.mUnit.ID);
  60. if (buffState != null)
  61. {
  62. int finalLayer = buffState.OverlayLevel + 1 + this.GetSkillValue(AbstractSkillType.Value1);
  63. //伤害百分比
  64. int atkPer = finalLayer * valueSet8.GetValue(param.GameSkill.SkillLevel, finalLayer);
  65. int attackTemp = (int)(param.Attacker.MirrorProp.GetFinalAttack(param.Hitter.mUnit.IsMonster) / XmdsDamageCalculator.PERER * atkPer);
  66. //基础伤害
  67. int calcDmg = XmdsDamageCalculator.GetDamage(attackTemp, param.Attacker, param.Hitter, null);
  68. //最终强化伤害
  69. int strongEffect = (playerCache.mPoisonBreakDmgAdd + (finalLayer >= buffState.Data.MaxOverlay ? playerCache.mPoisonBreakFullDmgAdd : 0));
  70. int finalDmg = CUtils.CastInt(calcDmg * (1.0f + strongEffect / XmdsDamageCalculator.PERER));
  71. param.Hitter.AddHP(-finalDmg, param.Attacker.mUnit, DamageSource.RemedyPoison);
  72. param.Hitter.mUnit.removeBuffBySender(Remedy_510601.Buff_POISON, param.Attacker.mUnit.ID);
  73. int breakBuffID = this.GetSkillValue(AbstractSkillType.Value3);
  74. if (breakBuffID > 0)
  75. {
  76. BuffState buff = param.Hitter.mUnit.AddBuff(breakBuffID, param.Attacker.mUnit, 0, false, false, false, 0, finalLayer);
  77. if(buff != null)
  78. {
  79. buff.SetLayerLevel((byte)(Math.Min(this.GetSkillValue(AbstractSkillType.Value2), finalLayer)));
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  86. {
  87. base.OnInit(info, unit, ref template);
  88. //禁锢buf
  89. XmdsBuffPack pack2 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_JINGU);
  90. BuffTemplate bt2 = pack2.mBuffTemplate;
  91. bt2.IsHarmful = true;
  92. bt2.LifeTimeMS = valueSet5.GetValue(info.SkillLevel);
  93. pack2.BindTemplateAndDispose();
  94. unit.RegistSendBuff(bt2);
  95. this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
  96. unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
  97. }
  98. protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
  99. {
  100. base.OnSkillDataChange(gs, unit);
  101. var bt = unit.GetRegistBuff(Buff_JINGU);
  102. bt.LifeTimeMS = valueSet5.GetValue(gs.SkillLevel);
  103. }
  104. protected virtual int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState skill)
  105. {
  106. //执行毒爆检测(改成攻击到触发)
  107. //var playerCache = launcher.GetPlayerCache() as PlayerCache_Remedy;
  108. //if(playerCache == null)
  109. //{
  110. // //职业技能给怪物用了
  111. // if(launcher.mUnit.IsPlayer)
  112. // {
  113. // log.Error("Remedy_510400玩家缓存信息异常:" + launcher.mUnit.PlayerUUID);
  114. // }
  115. //}
  116. //else
  117. //{
  118. // playerCache.TriggerPoisonEffect(valueSet8.GetValue(info.SkillLevel, 2), valueSet8.GetValue(info.SkillLevel, 3),
  119. // valueSet8.GetValue(info.SkillLevel, 1),
  120. // this.GetSkillValue(AbstractSkillType.Value1),
  121. // this.GetSkillValue(AbstractSkillType.Value3),
  122. // this.GetSkillValue(AbstractSkillType.Value2));
  123. //}
  124. info.mHitUnits.Clear();
  125. return 0;
  126. }
  127. protected void OnUseFormluaTypeEvent(BattleParams param)
  128. {
  129. if (param.AtkProp.DamagePerID == 2)
  130. {
  131. param.UseDamageType = base.AutoGetDamageType(param);
  132. }
  133. else
  134. {
  135. param.UseDamageType = CommonAI.Data.DamageType.Damage;
  136. }
  137. }
  138. protected override void OnSkillLogicEvent(BattleParams param)
  139. {
  140. if (param.AtkProp.DamagePerID == 1)//藤蔓
  141. {
  142. param.Hitter.mUnit.AddBuff(Buff_JINGU, param.Attacker.mUnit);
  143. }
  144. }
  145. protected override void OnInitConfig()
  146. {
  147. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  148. base.InitBaseConfig(data);
  149. InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  150. //扩展配置
  151. InitData(data, out valueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
  152. InitData(data, out valueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8);
  153. }
  154. }
  155. }