123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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 XmdsCommonSkill.Plugin.Skills.Magic;
- using CommonLang;
- using CommonAI.Data;
- using System.Collections.Generic;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Magic
- {
- /// <summary>
- /// 岩石怪被动
- /// </summary>
- public class Other_100006 : XmdsPassiveSkillBase
- {
- /// 技能ID.
- public static readonly int ID = 100006;
- private static XmdsSkillValue valueSet;
- private int mNeedHitTimes = 0;
- private int mUUID_1 = 0;
- private int mUUID_2 = 0;
- private int mOpID1 = 0;
- //私有数据
- private int curHitTimes = 0;
- public override int SkillID { get { return ID; } }
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- mNeedHitTimes = valueSet.GetValue();
- XmdsVirtual.PropChangeOperation pco = owner.CreatePropChangeOpertation(null);
- pco.Type = XmdsVirtual.UnitAttributeType.SetMaxHP;
- pco.Value = mNeedHitTimes;
- mOpID1 = owner.AddPropChangeOperation(pco);
- //mUUID_1 = owner.RegistOnHitDamage(OnHandleHitDmage, skillInfo, true);
- mUUID_1 = owner.RegistAddOtherHPEvent(OnAddOtherHPEvnet, skillInfo);
- mUUID_1 = owner.RegistTryAddBuffEvent(OnTryAddBuffEvent, skillInfo, true);
- }
- public bool OnAddOtherHPEvnet(int hp, InstanceUnit sender, InstanceUnit hitter, AttackSource source, out int finalHP)
- {
- //加血跳过
- if (hp <= 0)
- {
- finalHP = hp;
- return true;
- }
- finalHP = hp;
- if (source != null && source.FromSkillType == XmdsSkillType.normalAtk)
- {
- curHitTimes++;
- //if(curHitTimes >= mNeedHitTimes)
- //{
- // hitted.mUnit.AddHP(-hitted.mUnit.MaxHP);
- //}
- finalHP = 1;
- return false;
- }
- (sender.Virtual as XmdsVirtual).SendBattleHintNumberB2C(0, XmdsVirtual.UnitHitEventState.Immunity, hitter.ID);
- finalHP = 0;
- return false;
- }
- // private float OnHandleHitDmage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- // ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- // {
- //isEndDispatch = true;
- // if (source.FromSkillType == XmdsSkillType.normalAtk)
- // {
- // curHitTimes++;
- // //if(curHitTimes >= mNeedHitTimes)
- // //{
- // // hitted.mUnit.AddHP(-hitted.mUnit.MaxHP);
- // //}
- // return 1;
- // }
- // attacker.SendBattleHintNumberB2C(0, XmdsVirtual.UnitHitEventState.Immunity, hitted.mUnit.ID);
- // return 0;
- // }
- private bool OnTryAddBuffEvent(ref BuffTemplate buff, XmdsVirtual attacker, XmdsVirtual hitter, GameSkill skill)
- {
- // 不允许加buff
- return false;
- }
- protected override void OnInitSkillParam()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- //owner.UnRegistOnHitDamage(mUUID_1);
- owner.UnRegistAddOtherHPEvent(mUUID_1);
- owner.UnRegistTryAddBuffEvent(mUUID_2);
- owner.RemovePropChangeOperation(mOpID1);
- }
- }
- }
|