1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- 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_IgnorCtrlToSpeedDown : XmdsBuffBase
- {
- //免疫硬控,并转换成减速50%
- public int speedChange = -5000;
- private static int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.SPEED_DOWN;
- private int uuid_ignoreCtrl = 0;
- public override int GetAbilityID()
- {
- return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.IgnorCtrl_To_SpeedDown;
- }
- public override void CopyTo(UnitBuff other)
- {
- var ret = other as XmdsBuff_IgnorCtrlToSpeedDown;
- ret.speedChange = this.speedChange;
- base.CopyTo(other);
- }
- protected override void OnBuffBegin(XmdsVirtual hitter, XmdsVirtual attacker, InstanceUnit.BuffState state)
- {
- //注册免控
- uuid_ignoreCtrl = hitter.RegistTryAddBuffEvent(OnTryAddBuffEvent, null);
- }
- protected override void OnBuffEnd(XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
- {
- hitter.UnRegistTryAddBuffEvent(uuid_ignoreCtrl);
- }
- private bool OnTryAddBuffEvent(ref BuffTemplate buff, XmdsVirtual attacker, XmdsVirtual hitter, GameSkill skill)
- {
- // Buff没有生效
- if(XmdsInstanceUtils.IsControlBuff(buff))
- {
- hitter.SendBattleHintNumberB2C(0, XmdsVirtual.UnitHitEventState.Immunity);
- //每次生效自动检查.
- XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
- XmdsBuff_MoveSpeedDown buffAdd = (XmdsBuff_MoveSpeedDown)pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.MoveSpeedDown);
- buffAdd.ChangePercent = this.speedChange;
- BuffTemplate bt = pack.mBuffTemplate;
- bt.IsHarmful = true;
- bt.LifeTimeMS = buff.LifeTimeMS;
- pack.BindTemplateAndDispose();
- hitter.RegistSendBuff(bt);
- hitter.mUnit.AddBuff(Buff_ID, hitter.mUnit);
- return false;
- }
- return true;
- }
- }
- }
|