CardSkill_1430000.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.Formula;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using XmdsCommon.JSGModule.Interface;
  9. using XmdsCommon.Plugin;
  10. using XmdsCommonServer.Plugin;
  11. using XmdsCommonServer.XLS.Data;
  12. using XmdsCommonSkill.Plugin.Buffs;
  13. using static CommonAI.Zone.Instance.InstanceUnit;
  14. namespace XmdsCommonSkill.Plugin.CardSkill
  15. {
  16. /// <summary>
  17. /// 获得最大生命值x%的护盾n秒,护盾存在时免控。根据玄武球数量2/3/4,护盾时间结束时未被打碎则随机生成1/2/3个四象球(按权重)(护盾被打碎不触发)
  18. /// </summary>
  19. public class CardSkill_1430000 : CardSkill_XuanWuBase
  20. {
  21. private static readonly int ID = 1430000;
  22. public override int SkillID { get { return ID; } }
  23. // 免控护盾
  24. public static readonly int CARD_XW_IGNORECTRL_HUDUN = (int)XmdsBuffBase.XmdsBuffList.CARD_XW_IGNORECTRL_HUDUN;
  25. //免控护盾时间,最大生命护盾系数
  26. protected static XmdsSkillValue s_ValueSet1;
  27. //护盾结束未碎产生N个球
  28. protected static XmdsSkillValue s_ValueSet2;
  29. //触发时,球数,等级
  30. private int mTriggerLv;
  31. private int mTriggerSameNums;
  32. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  33. {
  34. base.OnInit(info, unit, ref template);
  35. var pack1 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(CARD_XW_IGNORECTRL_HUDUN);
  36. var bt1 = pack1.mBuffTemplate;
  37. pack1.BindTemplateAndDispose();
  38. unit.RegistSendBuff(bt1);
  39. unit.RegistBuffEvent(OnRemoveBuffEvent, XmdsVirtual.BuffEventType.End, info);
  40. }
  41. public override void OnTriggerCardSkill(XmdsVirtual player, XmdsVirtual hitter, AttackSource source, CardSkillData skillData, int sameNums)
  42. {
  43. var bt = player.GetRegistBuff(CARD_XW_IGNORECTRL_HUDUN);
  44. bt.LifeTimeMS = s_ValueSet1.GetValue(skillData.skilLv, base.GetIndex2(1));
  45. var buff = player.GetRegisBuffVirtual(CARD_XW_IGNORECTRL_HUDUN) as XmdsBuff_Shield_AbsorbDamage;
  46. int huDunBase = (int)(player.MirrorProp.MaxHP * XmdsUnitProp.PER * s_ValueSet1.GetValue(skillData.skilLv, base.GetIndex2(2)));
  47. buff.AbsorbDamageSum = base.GetHuDunFinalValue(player, huDunBase);
  48. player.mUnit.AddBuff(CARD_XW_IGNORECTRL_HUDUN, player.mUnit);
  49. this.mTriggerLv = skillData.skilLv;
  50. this.mTriggerSameNums = sameNums;
  51. }
  52. private void OnRemoveBuffEvent(XmdsVirtual unit, BuffState buff, string result, GameSkill sk)
  53. {
  54. if(buff != null && buff.ID == CARD_XW_IGNORECTRL_HUDUN && !string.IsNullOrEmpty(result) && !BuffState.ENDResult_HuDunBreak.Equals(result))
  55. {
  56. for(int i = 0; i < this.mTriggerSameNums - 1; i++)
  57. {
  58. unit.CardModule.AddCard(s_ValueSet2.GetValue(this.mTriggerLv, 1), true);
  59. }
  60. }
  61. }
  62. protected override void OnInitSkillParam()
  63. {
  64. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(this.SkillID);
  65. InitData(data, out s_ValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  66. InitData(data, out s_ValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
  67. }
  68. }
  69. }