12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using CommonAI.Zone.Instance;
- 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.Skills;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Pet20200515
- {
- /// <summary>
- /// 宠物装备被动:死亡有几率触发 -》 给主人加血buff
- /// </summary>
- ///
- class Pet_80290 : PetEquipSkillBase
- {
- /// 技能ID.
- private static int ID = 80290;
- public override int SkillID { get { return ID; } }
- private static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.PET_EQUIPSKILL_ADDHP; //主人狂暴buff
- //加血参数:比例,时间
- protected XmdsSkillValue mAddHPValue;
- private int mSkillLv;
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- var pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
- var buff = pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.AddHP) as XmdsBuff_AddHP;
- buff.ChangeValue = CUtils.CastInt(owner.MirrorProp.MaxAttack * XmdsUnitProp.PER * mAddHPValue.GetValue(skillInfo.SkillLevel, 1));
- var bt = pack.mBuffTemplate;
- bt.LifeTimeMS = mAddHPValue.GetValue(skillInfo.SkillLevel, 2);
- bt.IsHarmful = true;
- pack.BindTemplateAndDispose();
- owner.RegistSendBuff(bt);
- this.mSkillLv = skillInfo.SkillLevel;
- owner.mUnit.OnDead += OnPetDead;
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- var buff = unit.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_AddHP;
- buff.ChangeValue = CUtils.CastInt(unit.MirrorProp.MaxAttack * XmdsUnitProp.PER * mAddHPValue.GetValueExt(gs.SkillLevel, 1));
- var bt = unit.GetRegistBuff(Buff_ID);
- bt.LifeTimeMS = mAddHPValue.GetValue(gs.SkillLevel, 2);
- this.mSkillLv = gs.SkillLevel;
- }
- private void OnPetDead(InstanceUnit unit, InstanceUnit attacker)
- {
- if (base.IsTrigger((XmdsVirtual)unit.Virtual, this.mSkillLv))
- {
- //主人添加buff
- InstancePet pet = unit as InstancePet;
- if (pet != null && pet.Master != null)
- {
- pet.Master.AddBuff(Buff_ID, unit);
- }
- }
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- owner.mUnit.OnDead -= OnPetDead;
- }
- protected override void OnInitConfig(GameSkill skillInfo)
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(this.SkillID);
- XmdsSkillValue triggerInterval, triggerRate;
- InitData(data, out triggerInterval, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out triggerRate, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- InitData(data, out mAddHPValue, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
- base.initEquipSkillBase(triggerInterval, triggerRate, skillInfo.SkillLevel);
- }
- }
- }
|