123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- 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;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Magic
- {
- /// <summary>
- /// 灵宝套装被动: 次攻击时有X%的概率触发,使玩家的当前面板的攻击伤害提高Y%,持续时间Z秒,技能冷却时间S秒
- /// </summary>
- public class Other_100200_ZhiBao : XmdsPassiveSkillBase
- {
- /// 技能ID.
- public static readonly int ID = 100200;
- public static readonly int DAMAGE_INDEX = 10;
- private static XmdsSkillValue mValueSet1; // 触发概率
- private static XmdsSkillValue mValueSet2; // 伤害百分比
- private static XmdsSkillValue mValueSet3; // buff持续时间
- private static XmdsSkillValue mValueSet4; // 冷却时间
- //本次触发时间
- private long mNextTirggerTime = 0;
- //buff有效截止时间
- private long mBuffValidEndTime = 0;
- //当前技能等级
- private byte mSkillLevel = 0;
- public override int SkillID { get { return ID; } }
- private int mUUID_1;
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- mUUID_1 = owner.RegistOnHitOther(OnHandleHitOther, skillInfo, true);
- this.mSkillLevel = (byte)skillInfo.SkillLevel;
- mNextTirggerTime = CommonLang.CUtils.localTimeMS + mValueSet4.GetValue(this.mSkillLevel);
- }
- private float OnHandleHitOther(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- {
- if (source == null || source.FromBuff != null)
- {
- return damage;
- }
- if (mNextTirggerTime < CommonLang.CUtils.localTimeMS && attacker.mUnit.RandomN.Next(0, 10000) < mValueSet1.GetValue(skill.SkillLevel))
- {
- mNextTirggerTime = CommonLang.CUtils.localTimeMS + mValueSet4.GetValue(skill.SkillLevel);
- mBuffValidEndTime = CommonLang.CUtils.localTimeMS + mValueSet3.GetValue(skill.SkillLevel);
- }
- return damage;
- }
- protected override void OnInitOver(XmdsVirtual unit, GameSkill info)
- {
- //AbstractSkill baseSkill = unit.SkillHelper.GetPlayerSkillById(unit.SkillHelper.GetBaseSkillID());
- //if(baseSkill == null)
- //{
- // log.Error("Other_100200_ZhiBao找不到单位基础技能:" + unit.mUnit.PlayerUUID);
- // return;
- //}
- //// 借用一下这个接口,懒得写新的了
- //baseSkill.InitOver(unit, info);
- unit.ReInitOverBaseSkill(info);
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- this.mSkillLevel = (byte)gs.SkillLevel;
- }
- //Value1: 技能伤害,Value2: 技能是否触发, Value3: 释放了特殊技能
- public override int GetSkillValue(AbstractSkillType type)
- {
- if(type == AbstractSkillType.Value1)
- {
- return mValueSet2.GetValue(this.mSkillLevel);
- }
- else if(type == AbstractSkillType.Value2)
- {
- return CommonLang.CUtils.localTimeMS < mBuffValidEndTime ? 1 : 0;
- }
- else if (type == AbstractSkillType.Value3)
- {
- this.mBuffValidEndTime = 0;
- }else if(type == AbstractSkillType.Value4)
- {
- return mValueSet2.GetValueExt(this.mSkillLevel);
- }
- return 0;
- }
- protected override void OnInitSkillParam()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out mValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- InitData(data, out mValueSet3, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
- InitData(data, out mValueSet4, XmdsSkillData.XmdsSkillDataKey.ValueSet4);
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- owner.UnRegistOnHitOther(mUUID_1);
- AbstractSkill baseSkill = owner.SkillHelper.GetPlayerSkillById(owner.SkillHelper.GetBaseSkillID());
- if (baseSkill == null)
- {
- //log.Error("Other_100200_ZhiBao找不到单位基础技能:" + owner.mUnit.PlayerUUID);
- return;
- }
- // 借用一下这个接口,懒得写新的了
- baseSkill.DoSkillDispose(this.SkillID);
- }
- }
- }
|