using CommonAI.Zone; using CommonAI.Zone.Formula; using CommonAI.Zone.Instance; using CommonLang; using System; using XmdsCommon.Plugin; using XmdsCommonServer.Plugin; using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator; using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills; namespace XmdsCommonSkill.Plugin.Buffs { /// ///BUFF:buff每秒触发,附近队友附加相应buff /// public class XmdsBuff_AddBuff : XmdsBuffBase { //增加buffID public int addBuffId = 0; //附近队友范围 public int addBuffRange = 5; public override int GetAbilityID() { return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.AddBuff; } public override void CopyTo(UnitBuff other) { var ret = other as XmdsBuff_AddBuff; ret.addBuffId = this.addBuffId; ret.addBuffRange = this.addBuffRange; base.CopyTo(other); } protected override void OnBindTemplate(ref BuffTemplate buffTemplate) { //DOT类技能首帧无效. buffTemplate.FirstTimeEnable = false; base.OnBindTemplate(ref buffTemplate); } protected override int OnBuffHit(XmdsVirtual hitter, XmdsVirtual attacker, CommonAI.Zone.Formula.AttackSource source, ref XmdsVirtual.AtkResult result) { //血量平分 //治疗自己和队友 using (var list = ListObjectPool.AllocAutoRelease()) { attacker.mUnit.Parent.getObjectsRoundRange( (obj, dx, dy, dr) => { var u = obj as InstanceUnit; //己方单位. if (attacker.IsAllies(u.Virtual as XmdsVirtual, false, true)) { return CMath.includeRoundPoint(dx, dy, dr, u.X, u.Y); } return false; }, attacker.mUnit.X, attacker.mUnit.Y, addBuffRange, list, attacker.mUnit.AoiStatus); //加血 & 加速 for (int i = 0; i < list.Count; i++) { list[i].AddBuff(this.addBuffId, attacker.mUnit); } } return base.OnBuffHit(hitter, attacker, source, ref result); ; } } }