123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- using CommonAI.Zone.Helper;
- using CommonLang;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using XmdsCommonSkill.Plugin.Interface;
- using XmdsCommonSkill.Plugin.Skills;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Pet20200515
- {
- /// <summary>
- /// 宠物装备被动:受击概率触发-》宠物获得护盾
- /// </summary>
- ///
- class Pet_80260 : PetEquipSkillBase
- {
- /// 技能ID.
- private static int ID = 80260;
- public override int SkillID { get { return ID; } }
- private static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.PET_EQUIPSKILL_HUDUN; //主人狂暴buff
- //最大生命,持续时间
- protected XmdsSkillValue mHuDun;
- //绑定法术
- LaunchSpell mBindSpell;
- //内部变量
- private int mUUID_1 = 0;
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
- XmdsBuff_Shield_AbsorbDamage buff = (XmdsBuff_Shield_AbsorbDamage)pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.SHIELD_AbsorbDamage);
- buff.AbsorbDamageSum = CUtils.CastInt(owner.MirrorProp.MaxHP * XmdsUnitProp.PER * mHuDun.GetValue(skillInfo.SkillLevel, 1));
- BuffTemplate bt = pack.mBuffTemplate;
- bt.IsHarmful = false;
- bt.LifeTimeMS = mHuDun.GetValue(skillInfo.SkillLevel, 2);
- pack.BindTemplateAndDispose();
- owner.RegistSendBuff(bt);
- mUUID_1 = owner.RegistOnHitDamage(OnHandleHitDamage, skillInfo, true);
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- var buff = unit.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_Shield_AbsorbDamage;
- buff.AbsorbDamageSum = CUtils.CastInt(unit.MirrorProp.MaxAttack * XmdsUnitProp.PER * mHuDun.GetValue(gs.SkillLevel, 1));
- var bt = unit.GetRegistBuff(Buff_ID);
- bt.LifeTimeMS = mHuDun.GetValue(gs.SkillLevel, 2);
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- owner.UnRegistOnHitDamage(mUUID_1);
- }
- private float OnHandleHitDamage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- {
- if (damage > 0 && base.IsTrigger(hitted, skill.SkillLevel))
- {
- hitted.mUnit.Parent.unitLaunchSpell(XmdsSkillType.none, hitted.mUnit, mBindSpell,
- hitted.mUnit.X, hitted.mUnit.Y, hitted.mUnit.ID);
- hitted.mUnit.AddBuff(Buff_ID);
- }
- return damage;
- }
- protected override void OnInitConfig(GameSkill skillInfo)
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(this.SkillID);
- XmdsSkillValue triggerInterval, triggerRate, bindEffectSpell;
- InitData(data, out triggerInterval, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out triggerRate, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- InitData(data, out mHuDun, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
- InitData(data, out bindEffectSpell, XmdsSkillData.XmdsSkillDataKey.ValueSet4);
- base.initEquipSkillBase(triggerInterval, triggerRate, skillInfo.SkillLevel);
- mBindSpell = ComSpellTemplate.Instance().GetSpellBySpellID(bindEffectSpell.GetValue());
- if (mBindSpell == null)
- {
- log.Error("Pet_80260找不到绑定特效法术ID:" + bindEffectSpell.GetValue());
- }
- }
- }
- }
|