123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using CommonAI.Zone;
- using CommonAI.Zone.Instance;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.Units;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
- namespace XmdsCommonSkill.Plugin.Buffs
- {
- public class XmdsBuff_SpeedUpAndIngoreCtr : XmdsBuffBase
- {
- /// <summary>
- /// 传负值减速度,传正值加速度.
- /// </summary>
- public int ChangePercent = 0;
- private int mOpID = 0;
- private int uuid = 0;
- public override int GetAbilityID()
- {
- return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.SpeedUpAndIngoreCtrl;
- }
- public override void CopyTo(UnitBuff other)
- {
- var ret = other as XmdsBuff_SpeedUpAndIngoreCtr;
- ret.ChangePercent = this.ChangePercent;
- base.CopyTo(other);
- }
- protected override void OnBuffBegin(XmdsVirtual hitter, XmdsVirtual attacker, InstanceUnit.BuffState state)
- {
- //float v = ChangePercent / XmdsDamageCalculator.PERER;
- //float cv = (hitter.mProp.ServerData.Prop.MoveSpeed * v);
- //移动速度变更.
- //hitter.AddMoveSpeed(cv);
- XmdsVirtual.PropChangeOperation pco = hitter.CreatePropChangeOpertation(this);
- pco.Type = XmdsVirtual.UnitAttributeType.MoveSpeed;
- pco.Value = ChangePercent;
- pco.OpType = XmdsVirtual.PropChangeOperation.OperateType.Percent;
- mOpID = hitter.AddPropChangeOperation(pco);
- XmdsVirtual.FormatLog("BuffBegin : 单位【{0}】,移动速度变更{1}", hitter.mProp.ServerData.BaseInfo.name, ChangePercent);
- uuid = hitter.RegistTryAddBuffEvent(OnTryAddBuffEvent, null);
- XmdsVirtual.FormatLog("BuffBegin : 单位【{0}】进入免控状态.", hitter.mProp.ServerData.BaseInfo.name);
- }
- protected override void OnBuffEnd(XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
- {
- //移动速度变更.
- //hitter.AddMoveSpeed(-cv);
- hitter.RemovePropChangeOperation(mOpID);
- XmdsVirtual.FormatLog("BuffEnd : 单位【{0}】,移动速度变更{1}", hitter.mProp.ServerData.BaseInfo.name, ChangePercent);
- hitter.UnRegistTryAddBuffEvent(uuid);
- XmdsVirtual.FormatLog("BuffEnd : 单位【{0}】脱离免控状态", hitter.mProp.ServerData.BaseInfo.name);
- }
- private bool OnTryAddBuffEvent(ref BuffTemplate buff, XmdsVirtual attacker, XmdsVirtual hitter, GameSkill skill)
- {
- if (!IsInvaild() && XmdsInstanceUtils.IsControlBuff(buff))
- {
- hitter.SendBattleHintNumberB2C(0, XmdsVirtual.UnitHitEventState.Immunity);
- //每次生效自动检查.
- if (BuffInvaildCheck())
- {
- hitter.mUnit.removeBuff(BindBuffID);
- }
- return false;
- }
- return true;
- }
- }
- }
|