using CommonAI.Zone.Instance; using CommonAI.Zone.Formula; using System; using System.Collections.Generic; using System.Linq; using System.Text; using XmdsCommon.Plugin; using XmdsCommonServer.Plugin; using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills; using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator; using CommonAI.Zone; using XmdsCommonSkill.Plugin.Interface; using static XmdsCommonSkill.Plugin.Interface.ComSpellTemplate; using CommonAI.Data; using CommonAI.Zone.Helper; namespace XmdsCommonSkill.Plugin.Buffs { /// /// 技能击中创建新法术 /// public class XmdsBuff_HitCreateSpell : XmdsBuffBase { public XmdsSpellID spellID = 0; //创建的法术ID public int skillID = 0; //释放的技能ID private int mHandleUUID = 0; public override int GetAbilityID() { return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.Hit_CreateSpell; } public override void CopyTo(UnitBuff other) { var ret = other as XmdsBuff_HitCreateSpell; ret.spellID = this.spellID; ret.skillID = this.skillID; base.CopyTo(other); } protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state) { GameSkill gameSkill = null; if (skillID != 0) { gameSkill = new GameSkill(skillID); } //注册监听. mHandleUUID = hitter.RegistOnHitOther(OnHandleHitOther, gameSkill); } private float OnHandleHitOther(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source, ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch) { //if(this.skillID == 0 || (this.skillID == sk.SkillID)) { CommonAI.Zone.LaunchSpell ls = new CommonAI.Zone.LaunchSpell(); // //播放声音特效. attacker.mUnit.Parent.unitLaunchSpell(XmdsSkillType.none, hitted.mUnit, ComSpellTemplate.Instance().GetSpellByID(this.spellID), hitted.mUnit.X, hitted.mUnit.Y, hitted.mUnit.ID); attacker.mUnit.removeBuff(this.BindBuffID); } return damage; } protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace) { //取消监听. hitter.UnRegistOnHitOther(mHandleUUID); } protected override void OnDispose() { base.OnDispose(); } } }