using CommonAI.Zone.Helper; using CommonAI.Zone.Instance; using XmdsCommon.Message; using XmdsCommon.Plugin; using XmdsCommonServer.Plugin; using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills; namespace XmdsCommonSkill.Plugin.Buffs { //攻速 public class XmdsBuff_AttackSpeed : XmdsBuffBase { //改变的攻速. public int changeValue; //万分比 private int mHandleUUID = 0; private int mOpID = 0; public override int GetAbilityID() { return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.AttackSpeed; } public override void CopyTo(UnitBuff other) { var ret = other as XmdsBuff_AttackSpeed; ret.changeValue = this.changeValue; base.CopyTo(other); } protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state) { //注册监听. mHandleUUID = hitter.RegistLaunchSkillOver(OnLaunchSkillOver, null); XmdsVirtual.PropChangeOperation pco = hitter.CreatePropChangeOpertation(this); pco.Type = XmdsVirtual.UnitAttributeType.AttackSpeed; pco.Value = changeValue; pco.OpType = XmdsVirtual.PropChangeOperation.OperateType.Percent; mOpID = hitter.AddPropChangeOperation(pco); } private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState skill) { XmdsSkillProperties skillProp = skill.Data.Properties as XmdsSkillProperties; if ((skillProp != null && skillProp.SkillType == XmdsSkillType.normalAtk)) { if(BuffInvaildCheck()) { //int decreaseTime = skill.TotalCDTime * changeValue / 10000; //skill.SetDecreaseTotalTimeMS(decreaseTime); launcher.mUnit.removeBuff(this.BindBuffID); } } return 0; } protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace) { //取消监听. hitter.UnRegistLaunchSkillOver(mHandleUUID); hitter.RemovePropChangeOperation(mOpID); } } }