12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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.RegistTryAddBuffEvent(OnTryAddBuffEvent, skillInfo, true);
- }
- 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.UnRegistTryAddBuffEvent(mUUID_2);
- owner.RemovePropChangeOperation(mOpID1);
- }
- }
- }
|