123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using CommonAI.Zone.Helper;
- using CommonAI.Zone.Instance;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using System;
- using static CommonAI.Zone.Instance.InstanceUnit;
- using XmdsCommon.Plugin;
- using CommonAI.Zone;
- using XmdsCommonServer.Plugin.Units;
- using CommonAI.Zone.Formula;
- using XmdsCommonSkill.Plugin.Skills;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using CommonAI.Data;
- using CommonLang;
- using XmdsCommonSkill.Plugin.PassiveSkills.Pet20200515;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Remedy
- {
- /// <summary>
- /// NewPet - 防2(受击时,有N%的几率提高防御值N+N%(当前防御值),持续N秒。冷却时间N秒。)
- /// </summary>
- class Pet_80009 : PetPassiveBase
- {
- public static readonly int ID = 80009;
- public static int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.NEWPET_DEFENCEUP;
- private static XmdsSkillValue triggerRate; // 触发几率
- private static XmdsSkillValue triggerRateExt; // 命格增加几率
- private static XmdsSkillValue triggerInterval; // 触发间隔
- private static XmdsSkillValue defenceChange; // 防御改变:固定值+百分百
- private static XmdsSkillValue buffTime; // Buff时间
- // 内部数据
- private int mUUID_1 = 0;
- private long mNextTriggerTime = 0;
- public override int SkillID { get { return ID; } }
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
- XmdsBuff_PropChange buff = (XmdsBuff_PropChange)pack.GetXmdsBuff(0);
- buff.CurentChangeType = XmdsVirtual.UnitAttributeType.Defence;
- buff.CurrentValue = defenceChange.GetValue(skillInfo.SkillLevel); // 基础防御提升
- buff.IsPercent = false;
- XmdsBuff_PropChange buff1 = (XmdsBuff_PropChange)pack.GetXmdsBuff(1);
- buff1.CurentChangeType = XmdsVirtual.UnitAttributeType.Defence;
- buff1.CurrentValue = defenceChange.GetValueExt(skillInfo.SkillLevel); // 防御提升比例
- buff1.IsPercent = true;
- BuffTemplate bt = pack.mBuffTemplate;
- bt.IsHarmful = true;
- bt.LifeTimeMS = buffTime.GetValue(skillInfo.SkillLevel);
- pack.BindTemplateAndDispose();
- owner.RegistSendBuff(bt);
- this.mNextTriggerTime = CommonLang.CUtils.localTimeMS + triggerInterval.GetValue();
- //mUUID_1 = owner.RegistOnHitDamage(OnHandleHitDamage, skillInfo, true);
- mUUID_1 = owner.RegistShareMasterDmgEvent(OnShareMasterDmgEvent, skillInfo);
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- var buff1 = unit.GetRegisBuffVirtual(Buff_ID, 0) as XmdsBuff_PropChange;
- buff1.CurrentValue = defenceChange.GetValue(gs.SkillLevel);
- var buff2 = unit.GetRegisBuffVirtual(Buff_ID, 1) as XmdsBuff_PropChange;
- buff2.CurrentValue = defenceChange.GetValueExt(gs.SkillLevel);
- var bt = unit.GetRegistBuff(Buff_ID);
- bt.LifeTimeMS = buffTime.GetValue(gs.SkillLevel);
- }
- private int OnShareMasterDmgEvent(int hp, InstanceUnit sender, InstanceUnit unit, GameSkill skill, ref bool isEndDispatch)
- {
- XmdsVirtual virUnit = unit.Virtual as XmdsVirtual;
- UnitFateType fateType = virUnit.GetUnitFateType();
- if (fateType != UnitFateType.None && hp > 0 && this.mNextTriggerTime < CommonLang.CUtils.localTimeMS &&
- IsTrigger(virUnit, triggerRate, triggerRateExt, skill, fateType))
- {
- virUnit.mUnit.AddBuff(Buff_ID, virUnit.mUnit);
- this.mNextTriggerTime = CommonLang.CUtils.localTimeMS + triggerInterval.GetValue();
- base.NotifyTriggerAblity(virUnit.mUnit, this.SkillID);
- }
- return hp;
- }
- //private float OnHandleHitDamage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- //ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- //{
- // UnitFateType fateType = hitted.GetUnitFateType();
- // if (fateType != UnitFateType.None && damageType == DamageType.Damage &&
- // this.mNextTriggerTime < CommonLang.CUtils.localTimeMS &&
- // IsTrigger(hitted, triggerRate, triggerRateExt, skill, fateType))
- // {
- // hitted.mUnit.AddBuff(Buff_ID, hitted.mUnit);
- // this.mNextTriggerTime = CommonLang.CUtils.localTimeMS + triggerInterval.GetValue();
- // base.NotifyTriggerAblity(hitted.mUnit, this.SkillID);
- // }
- // return damage;
- //}
- protected override void OnInitSkillParam()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- InitData(data, out triggerRate, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out triggerRateExt, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- InitData(data, out triggerInterval, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
- InitData(data, out defenceChange, XmdsSkillData.XmdsSkillDataKey.ValueSet4);
- InitData(data, out buffTime, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- //owner.UnRegistOnHitDamage(mUUID_1);
- owner.UnRegistShareMasterDmgEvent(mUUID_1);
- }
- }
- }
|