1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XmdsCommon.JSGModule.Interface;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using static CommonAI.Zone.Instance.InstanceUnit;
- namespace XmdsCommonSkill.Plugin.CardSkill
- {
- /// <summary>
- /// 获得最大生命值x%的护盾n秒,护盾存在时免控。根据玄武球数量2/3/4,护盾时间结束时未被打碎则随机生成1/2/3个四象球(按权重)(护盾被打碎不触发)
- /// </summary>
- public class CardSkill_1430000 : CardSkill_XuanWuBase
- {
- private static readonly int ID = 1430000;
- public override int SkillID { get { return ID; } }
- // 免控护盾
- public static readonly int CARD_XW_IGNORECTRL_HUDUN = (int)XmdsBuffBase.XmdsBuffList.CARD_XW_IGNORECTRL_HUDUN;
- //免控护盾时间,最大生命护盾系数
- protected static XmdsSkillValue s_ValueSet1;
- //护盾结束未碎产生N个球
- protected static XmdsSkillValue s_ValueSet2;
- //触发时,球数,等级
- private int mTriggerLv;
- private int mTriggerSameNums;
- protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
- {
- base.OnInit(info, unit, ref template);
- var pack1 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(CARD_XW_IGNORECTRL_HUDUN);
- var bt1 = pack1.mBuffTemplate;
- pack1.BindTemplateAndDispose();
- unit.RegistSendBuff(bt1);
- unit.RegistBuffEvent(OnRemoveBuffEvent, XmdsVirtual.BuffEventType.End, info);
- }
- public override void OnTriggerCardSkill(XmdsVirtual player, XmdsVirtual hitter, AttackSource source, CardSkillData skillData, int sameNums)
- {
- var bt = player.GetRegistBuff(CARD_XW_IGNORECTRL_HUDUN);
- bt.LifeTimeMS = s_ValueSet1.GetValue(skillData.skilLv, base.GetIndex2(1));
- var buff = player.GetRegisBuffVirtual(CARD_XW_IGNORECTRL_HUDUN) as XmdsBuff_Shield_AbsorbDamage;
- int huDunBase = (int)(player.MirrorProp.MaxHP * XmdsUnitProp.PER * s_ValueSet1.GetValue(skillData.skilLv, base.GetIndex2(2)));
- buff.AbsorbDamageSum = base.GetHuDunFinalValue(player, huDunBase);
-
- player.mUnit.AddBuff(CARD_XW_IGNORECTRL_HUDUN, player.mUnit);
- this.mTriggerLv = skillData.skilLv;
- this.mTriggerSameNums = sameNums;
- }
- private void OnRemoveBuffEvent(XmdsVirtual unit, BuffState buff, string result, GameSkill sk)
- {
- if(buff != null && buff.ID == CARD_XW_IGNORECTRL_HUDUN && !string.IsNullOrEmpty(result) && !BuffState.ENDResult_HuDunBreak.Equals(result))
- {
- for(int i = 0; i < this.mTriggerSameNums - 1; i++)
- {
- unit.CardModule.AddCard(s_ValueSet2.GetValue(this.mTriggerLv, 1), true);
- }
- }
- }
- protected override void OnInitSkillParam()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(this.SkillID);
- InitData(data, out s_ValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out s_ValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- }
- }
- }
|