private void StartDelayedCast(object creature)
        {
            var Params = (List <object>)creature;

            Unit   _unit   = Params[0] as Unit;
            ushort Ability = (ushort)Params[1];

            // This is used by random ability cast
            if (_unit != null && !_unit.IsDead)
            {
                _unit.AbtInterface.StartCast(_unit, Ability, 1);

                if (!(_unit is Pet))
                {
                    _unit.MvtInterface.StopMove();
                    AbilityInfo AbiInfo = AbilityMgr.GetAbilityInfo(Ability);
                    if (!AbiInfo.CanCastWhileMoving)
                    {
                        _unit.EvtInterface.AddEvent(DelayedChase, AbiInfo.CastTime + 100, 1);
                    }
                    else
                    {
                        Chase(_unit.CbtInterface.GetCurrentTarget(), true);
                    }
                }
            }
        }
        /// <summary>Performs the initial modifications to the volatile ability properties.</summary>
        private byte ModifyInitials()
        {
            if (!_pendingInfo.ConstantInfo.IgnoreOwnModifiers)
            {
                List <AbilityModifier> myModifiers = AbilityMgr.GetAbilityPreCastModifiers(_pendingInfo.Entry);
                if (myModifiers != null)
                {
                    foreach (AbilityModifier modifier in myModifiers)
                    {
                        byte result = modifier.ModifyAbility(_caster, _pendingInfo);

                        if (result > 0)
                        {
                            return(result);
                        }
                    }
                }
            }

            // Morales and items should not run through general handlers
            if (_pendingInfo.SpecialCost < 0 || _pendingInfo.ConstantInfo.Origin == AbilityOrigin.AO_ITEM)
            {
                return(0);
            }

            if (_caster is Player)
            {
                ((Player)_caster).TacInterface.ModifyInitials(_pendingInfo);
            }
            _caster.StsInterface.ModifyAbilityVolatiles(_pendingInfo);
            return(0);
        }
예제 #3
0
 public void UpdateAbilities()
 {
     if (HasPlayer())
     {
         Abilities = AbilityMgr.GetCareerAbility(GetPlayer()._Info.CareerLine, GetPlayer().Level);
     }
 }
예제 #4
0
        public void UpdateAbilities()
        {
            if (HasPlayer())
            {
                List <Ability_Info> Ab = AbilityMgr.GetCareerAbility(GetPlayer()._Info.CareerLine);
                if (Ab != null)
                {
                    //Log.Info("Abilities", "Selected :" + Ab.Count);

                    foreach (Ability_Info Info in Ab)
                    {
                        if (IsValidAbility(Info))
                        {
                            byte LastLevel = 0;
                            foreach (Ability_Stats Stat in Info.Stats)
                            {
                                if (Stat.Level <= GetPlayer().Level&& Stat.Level > LastLevel)
                                {
                                    LastLevel = Stat.Level;

                                    if (!Abilities.ContainsKey(Stat.Entry))
                                    {
                                        Abilities.Add(Stat.Entry, Stat);
                                    }
                                    else
                                    {
                                        Abilities[Stat.Entry] = Stat;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        private void ExecuteCommand(string cmd, byte stat, int value)
        {
            switch (cmd)
            {
            case "ModifyStat":
                _player.StsInterface.SetRenownStat((Stats)stat, (ushort)value);
                break;

            case "ModifyEvasion":
                _player.StsInterface.SetRenownStat(Stats.Evade, (ushort)value);
                _player.StsInterface.SetRenownStat(Stats.Disrupt, (ushort)value);
                break;

            case "IncreaseAPPool":
                _player.MaxActionPoints = (ushort)(_player.MaxActionPoints + value);
                break;

            case "AddAbility":
                _activeAbilities.Add((ushort)value);
                _player.AbtInterface.GrantAbility((ushort)value);
                break;

            case "AddBuff":
                BuffInfo buffInfo = AbilityMgr.GetBuffInfo((ushort)value);
                if (buffInfo == null)
                {
                    _player.SendClientMessage("The requested ability is not implemented.");
                }
                else
                {
                    _player.BuffInterface.QueueBuff(new BuffQueueInfo(_player, _player.EffectiveLevel, buffInfo));
                }
                break;
            }
        }
        public bool StartCastAtPos(Unit instigator, ushort abilityID, Point3D worldPos, ushort zoneId, byte castSequence)
        {
            if (PreventCasting)
            {
                if (_Owner is Player)
                {
                    Player owner = _Owner as Player;
                    owner?.SendClientMessage("A developer has disabled all abilities.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                }
                return(false);
            }

            // Allow only interruption of channeled skills of a different ID to the skill being used
            if (IsCasting() && (!_abilityProcessor.IsChannelling || _abilityProcessor.AbInfo.Entry == abilityID))
            {
                return(false);
            }

            AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(abilityID);

            if (abInfo == null || (abInfo.ConstantInfo.Origin != AbilityOrigin.AO_ITEM && !IsValidAbility(abInfo)))
            {
                return(false);
            }
            try
            {
                if (AbilityMgr.HasCommandsFor(abilityID) || abInfo.ConstantInfo.ChannelID != 0)
                {
                    if (_abilityProcessor == null)
                    {
                        _abilityProcessor = new AbilityProcessor(_unitOwner, this);
                    }

                    abInfo.Instigator = instigator;

                    if (!_abilityProcessor.HasInfo())
                    {
                        _abilityProcessor.StartAbilityAtPos(abInfo, castSequence, worldPos, zoneId);
                    }
                    return(true);
                }
                if (_Owner is Player)
                {
                    var owner = _Owner as Player;
                    owner?.SendClientMessage(abilityID + " " + AbilityMgr.GetAbilityNameFor(abilityID) + " has no implementation.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                }
                return(false);
            }

            catch (Exception e)
            {
                if (_Owner is Player)
                {
                    var owner = _Owner as Player;
                    owner?.SendClientMessage(abilityID + " " + AbilityMgr.GetAbilityNameFor(abilityID) + " threw an unhandled " + e.GetType().Name + " from " + e.TargetSite + ".");
                }
                return(false);
            }
        }
        public void GrantAbility(ushort abilityEntry)
        {
            _abilities.Add(AbilityMgr.GetAbilityInfo(abilityEntry));
            _abilitySet.Add(abilityEntry);

            SendAbilityLevels();

            ResendCooldown(abilityEntry);
        }
        private bool AllowCast()
        {
            AbilityResult myResult = AbilityResult.ABILITYRESULT_OK;

            if (AbInfo.Target != null)
            {
                if (AbInfo.Target.IsDead && !AbInfo.ConstantInfo.AffectsDead)
                {
                    myResult = AbilityResult.ABILITYRESULT_ILLEGALTARGET_DEAD;
                }
                else if (!AbInfo.Target.IsDead && AbInfo.ConstantInfo.AffectsDead)
                {
                    myResult = AbilityResult.ABILITYRESULT_ILLEGALTARGET_NOT_DEAD_ALLY;
                }

                else if (AbInfo.Target != _caster)
                {
                    if (AbInfo.ConstantInfo.CastAngle != 0 && _caster.IsMoving && !_caster.IsObjectInFront(AbInfo.Target, AbInfo.ConstantInfo.CastAngle))
                    {
                        myResult = AbilityResult.ABILITYRESULT_OUT_OF_ARC;
                    }

                    // Explicit LOS check for move-cast abilities
                    if (AbInfo.CastTime > 0 && AbInfo.CanCastWhileMoving && AbInfo.Target != null && !_caster.LOSHit(AbInfo.Target))
                    {
                        myResult = AbilityResult.ABILITYRESULT_NOT_VISIBLE;
                    }
                }
            }

            if (myResult != AbilityResult.ABILITYRESULT_OK)
            {
                CancelCast((ushort)myResult);
                return(false);
            }

            if (myResult == AbilityResult.ABILITYRESULT_OK && _caster.ItmInterface != null)
            {
                myResult = _caster.ItmInterface.WeaponCheck(AbInfo.ConstantInfo.WeaponNeeded);
            }

            if (AbInfo.ApCost > 0 && _caster is Player && !_caster.ConsumeActionPoints(AbInfo.ApCost))
            {
                myResult = AbilityResult.ABILITYRESULT_AP;
            }

            if (myResult != AbilityResult.ABILITYRESULT_OK)
            {
                CancelCast((ushort)myResult);
                return(false);
            }

            AbilityMgr.GetCommandsFor(_caster, AbInfo);

            return(true);
        }
예제 #9
0
        public bool ApplyIronSkin(Object npc = null, object instigator = null)
        {
            Unit     u = Obj as Unit;
            BuffInfo b = AbilityMgr.GetBuffInfo(5262); // This is Iron Skin buff - Squig Commando

            b.Duration = 30;
            u.BuffInterface.QueueBuff(new BuffQueueInfo(u, u.Level, b));

            return(true);
        }
예제 #10
0
        public void ApplyTerrorToEveryoneInRadius()
        {
            Unit u = Obj as Unit;

            foreach (Player player in Obj.PlayersInRange)
            {
                BuffInfo b = AbilityMgr.GetBuffInfo(5968, u, player); // This is Terror buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(u, 40, b));
            }
        }
예제 #11
0
        protected override void SetDeath(Unit killer)
        {
            Health = 0;

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_DEATH, 12);

            Out.WriteUInt16(Oid);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteUInt16(killer.IsPet() ? killer.GetPet().Owner.Oid : killer.Oid);
            Out.Fill(0, 6);
            DispatchPacket(Out, true);

            AbtInterface.Cancel(true);
            ScrInterface.OnDie(this);
            BuffInterface.RemoveBuffsOnDeath();

            EvtInterface.Notify(EventName.OnDie, this, killer);

            Pet    pet      = killer as Pet;
            Player credited = (pet != null) ? pet.Owner : (killer as Player);

            if (credited != null)
            {
                HandleDeathRewards(credited);
            }

            ClearTrackedDamage();

            _buildState = EConstructionState.Destroying;

            foreach (Player plr in _interactors)
            {
                plr.Palisade = null;
            }

            _interactors.Clear();

            foreach (NewBuff buff in _interactionBuffs)
            {
                buff.BuffHasExpired = true;
            }

            _interactionBuffs.Clear();

            GroundTarget gt = new GroundTarget(_constructor, new Point3D(WorldPosition), GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt, Zone.ZoneId);

            gt.BuffInterface.QueueBuff(new BuffQueueInfo(_constructor, 40, AbilityMgr.GetBuffInfo(23762)));

            gt.SetExpiry(TCPManager.GetTimeStampMS() + 5000);
        }
예제 #12
0
        public bool ApplyTerror(Object npc = null, object instigator = null)
        {
            Unit u = Obj as Unit;

            foreach (Player player in Obj.PlayersInRange)
            {
                BuffInfo b = AbilityMgr.GetBuffInfo(5968, u, player); // This is Terror buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(u, 40, b));
            }

            return(true);
        }
        private bool AllowCastAtPos()
        {
            if (AbInfo.ApCost > 0 && !_caster.ConsumeActionPoints(AbInfo.ApCost))
            {
                CancelCast(0);
                return(false);
            }

            AbilityMgr.GetCommandsFor(_caster, AbInfo);

            return(true);
        }
예제 #14
0
        public void Hotswap(NewBuff oldBuff, ushort newBuffEntry)
        {
            BuffInfo newInfo = AbilityMgr.GetBuffInfo(newBuffEntry);

            NewBuff buff = new NewBuff();

            buff.Initialize(oldBuff.Caster, (Unit)_Owner, oldBuff.BuffId, 40, newInfo.MaxStack, newInfo, this);

            _pendingBuffs[_pendingBuffs.IndexOf(oldBuff)] = buff;
            _buffs[_buffs.IndexOf(oldBuff)] = buff;

            buff.StartBuff();
        }
        /// <summary>
        /// Takes old level and new level to handle .modify level
        /// </summary>
        /// <param name="oldLevel"></param>
        /// <param name="newLevel"></param>
        public void OnPlayerLeveled(byte oldLevel, byte newLevel)
        {
            List <AbilityInfo> newAbilities = AbilityMgr.GetAvailableCareerAbilities(((Player)_unitOwner).Info.CareerLine, oldLevel + 1, newLevel);

            _abilities.AddRange(newAbilities);

            foreach (AbilityInfo ab in newAbilities)
            {
                _abilitySet.Add(ab.Entry);
            }

            SendMasteryPointsUpdate();
            SendAbilityLevels();
        }
        public void DisablePlayer()
        {
            Creature creature = Obj as Creature;

            if (creature != null)
            {
                if (creature.PlayersInRange.Count > 0)
                {
                    bool   haveTarget     = false;
                    int    playersInRange = creature.PlayersInRange.Count();
                    Player player;
                    while (!haveTarget)
                    {
                        int    rndmPlr = random.Next(1, playersInRange + 1);
                        Object obj     = creature.PlayersInRange.ElementAt(rndmPlr - 1);
                        player = obj as Player;
                        if (player != null && !player.IsDead)
                        {
                            haveTarget = true;
                            creature.MvtInterface.TurnTo(player);
                            creature.MvtInterface.Follow(player, 5, 50);
                            creature.AiInterface.CurrentBrain.AddHatred(player, true, 5000);

                            creature.Say("*** Zapping " + player.Name + " ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

                            BuffInfo b = AbilityMgr.GetBuffInfo(5240, creature, player); // Disable
                            creature.BuffInterface.QueueBuff(new BuffQueueInfo(creature, creature.Level, b));

                            player.PlayEffect(1390);

                            var prms = new List <object>()
                            {
                                player, 165
                            };
                            PlayAnimation(prms);

                            prms = new List <object>()
                            {
                                player, 0
                            };
                            player.EvtInterface.AddEvent(PlayAnimation, 595 * 100, 1, prms);

                            break;
                        }
                    }
                }
            }
        }
예제 #17
0
        public void DelayedBuff(object prms)
        {
            var Params = (List <object>)prms;

            Creature c      = (Creature)Params[0];
            ushort   BuffId = (ushort)Params[1];
            string   Text   = (string)Params[2];

            BuffInfo b = AbilityMgr.GetBuffInfo(BuffId, c, c);

            c.BuffInterface.QueueBuff(new BuffQueueInfo(c, c.Level, b));

            if (!String.IsNullOrEmpty(Text))
            {
                c.Say(Text, SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
        }
        /// <summary>Regular root command. Will fail if the target is Immovable.</summary>
        public virtual bool TryRoot(NewBuff hostBuff)
        {
            if (IsImmovable)
            {
                return(false);
            }
            lock (MovementCCLock)
            {
                if (IsImmovable)
                {
                    return(false);
                }
                IsImmovable = true;
            }

            BuffInterface.QueueBuff(new BuffQueueInfo(this, EffectiveLevel, AbilityMgr.GetBuffInfo((ushort)GameBuffs.Immovable)));
            StsInterface.AddVelocityModifier(hostBuff, 0);
            return(true);
        }
        protected void BuffAtCombatStart()
        {
            if (_unit.AbtInterface.NPCAbilities == null)
            {
                return;
            }

            foreach (NPCAbility ability in _unit.AbtInterface.NPCAbilities)
            {
                // If ability is set to Active = 0 it will not be played
                if (ability.Active == 0 || ability.ActivateOnCombatStart == 0)
                {
                    continue;
                }

                //_unit.AbtInterface.StartCast(_unit, ability.Entry, 1);
                BuffInfo b = AbilityMgr.GetBuffInfo(ability.Entry, _unit, _unit); // This should cast buff on self
                _unit.BuffInterface.QueueBuff(new BuffQueueInfo(_unit, _unit.Level, b));
            }
        }
        public override void Update(long tick)
        {
            if (tick <= _rezTime)
            {
                return;
            }

            _slayerChoppa.RezUnit(_slayerChoppa.Realm == Realms.REALMS_REALM_ORDER ? (ushort)1489 : (ushort)1795, 25, true);

            AbilityDamageInfo damageThisPass = AbilityMgr.GetExtraDamageFor(_slayerChoppa.Realm == Realms.REALMS_REALM_ORDER ? (ushort)1489 : (ushort)1795, 0, 0);

            List <Object> objects;

            lock (_slayerChoppa.PlayersInRange)
                objects = new List <Object>(_slayerChoppa.ObjectsInRange);

            int count = 0;

            foreach (Object obj in objects)
            {
                Unit unit = obj as Unit;
                if (unit == null || unit == _slayerChoppa)
                {
                    continue;
                }

                if (unit.ObjectWithinRadiusFeet(_slayerChoppa, 40) && CombatInterface.CanAttack(_slayerChoppa, unit) && _slayerChoppa.LOSHit(unit))
                {
                    CombatManager.InflictDamage(damageThisPass.Clone(), _slayerChoppa.AbtInterface.GetMasteryLevelFor(3), _slayerChoppa, unit);
                }

                ++count;

                if (count == 9)
                {
                    break;
                }
            }

            Dispose();
        }
        public override bool Load()
        {
            if (_playerOwner != null)
            {
                InitializeCareerMastery();
                LoadCareerAbilities();
                RefreshBonusMasteryPoints();

                _abilityProcessor = new AbilityProcessor(_unitOwner, this);
            }

            Creature creature = _Owner as Creature;

            if (creature != null && !(_Owner is Pet))
            {
                NPCAbilities = AbilityMgr.GetCreatureAbilities(creature.Spawn.Proto.Entry);
            }

            _Owner.EvtInterface.AddEventNotify(EventName.OnMove, OnPlayerMoved);

            return(base.Load());
        }
예제 #22
0
파일: Ability.cs 프로젝트: wardev1/WarEmu-1
        public Ability(AbilityInterface Interface, Ability Parent, Ability_Stats Info, Unit Caster, bool IsBuff, string OverrideHandler = "")
        {
            this.Parent    = Parent;
            this.Info      = Info;
            this.Caster    = Caster;
            this.Interface = Interface;
            if (OverrideHandler == "")
            {
                this.Handler = AbilityMgr.GetAbilityHandler(Info.Entry, Info.Info.HandlerName);
            }
            else
            {
                this.Handler = AbilityMgr.GetAbilityHandler(0, OverrideHandler);
            }

            this.IsBuff = IsBuff;

            if (Handler != null)
            {
                Handler.InitAbility(this);
            }
        }
        public void BreakEgg()
        {
            GameObject go = Obj as GameObject;

            go.PlayEffect(2185);

            go.Say("*** Terrible stench of rotten wyvern eggs fills the cave... ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);

            Creature OlGreenwingz = null;

            foreach (Object o in Obj.ObjectsInRange)
            {
                Creature c = o as Creature;
                if (c != null && c.Entry == 2000900)
                {
                    OlGreenwingz = c;
                }
            }

            if (OlGreenwingz != null)
            {
                foreach (Player player in Obj.PlayersInRange.ToList())
                {
                    if (player != null && !player.IsDead && !player.IsInvulnerable && go.GetDistanceToObject(player) < 31)
                    {
                        BuffInfo b = AbilityMgr.GetBuffInfo(20356, OlGreenwingz, player); // Bad Gaz
                        player.BuffInterface.QueueBuff(new BuffQueueInfo(OlGreenwingz, OlGreenwingz.Level, b));

                        b = AbilityMgr.GetBuffInfo(1927, OlGreenwingz, player); // Sticky Feetz
                        player.BuffInterface.QueueBuff(new BuffQueueInfo(OlGreenwingz, OlGreenwingz.Level, b));
                    }
                }
            }

            go.AbtInterface.StartCast(go, 1927, 1);

            Obj.EvtInterface.AddEvent(Obj.Destroy, 1000, 1);
        }
        private void LoadCareerAbilities()
        {
            _abilities = AbilityMgr.GetAvailableCareerAbilities(_playerOwner.Info.CareerLine, 0, _playerOwner.Level);

            foreach (AbilityInfo ab in _abilities)
            {
                _abilitySet.Add(ab.Entry);
            }

            List <AbilityInfo> masteryAbilities = AbilityMgr.GetMasteryAbilities(_playerOwner.Info.CareerLine);

            foreach (AbilityInfo ab in masteryAbilities)
            {
                byte entry = (byte)((ab.ConstantInfo.PointCost - 1) / 2 - 1);
                _masteryAbilities[ab.ConstantInfo.MasteryTree - 1, entry] = ab;

                if (_activeSkillsInTree[ab.ConstantInfo.MasteryTree - 1, entry] == 1)
                {
                    _abilities.Add(ab);
                    _abilitySet.Add(ab.Entry);
                }
            }
        }
        private void InvokeChannelBuff()
        {
            byte desiredLevel = _channelInfo.Level;

            if (_channelInfo.BoostLevel > 0 && _caster != _target)
            {
                desiredLevel = _channelInfo.BoostLevel;

                    #if DEBUG
                ((Player)_caster).SendClientMessage("Boost debug: Casting with level " + desiredLevel + " on target " + _target.Name);
                    #endif
            }

            BuffInfo buffInfo = AbilityMgr.GetBuffInfo(_channelInfo.Entry, _host, _target);
            if (!string.IsNullOrEmpty(buffInfo.AuraPropagation))
            {
                _target.BuffInterface.QueueBuff(new BuffQueueInfo(_caster, desiredLevel, buffInfo, BuffEffectInvoker.CreateAura, ChannelInitialization));
            }
            else
            {
                _target.BuffInterface.QueueBuff(new BuffQueueInfo(_caster, desiredLevel, buffInfo, ChannelInitialization));
            }
        }
예제 #26
0
        private void HandleUser(Player player)
        {
            if (_interactors.Contains(player))
            {
                _interactors.Remove(player);

                for (int i = 0; i < _interactionBuffs.Count; ++i)
                {
                    if (_interactionBuffs[i].Target == player)
                    {
                        _interactionBuffs[i].BuffHasExpired = true;
                        _interactionBuffs.RemoveAt(i);
                        --i;
                    }
                }

                player.SendClientMessage("You are no longer in cover behind the " + _info.Name + ".");
                player.Palisade = null;
            }

            else
            {
                _interactors.Add(player);

                player.Palisade = this;

                // Range increase buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(this, 1, AbilityMgr.GetBuffInfo(10356), RegisterUserBuff));

                // Cast time reduction buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(this, 1, AbilityMgr.GetBuffInfo(10936), RegisterUserBuff));

                player.SendClientMessage("You are in in cover behind the " + _info.Name + ".\nWhile in cover, you may not move, but your range is extended, your cast times are reduced, and the palisade will intercept direct attacks aimed at you.");

                player.EvtInterface.AddEventNotify(EventName.OnDie, EventRemovePlayer);
            }
        }
        /// <summary>Performs the final modifications to the ability commands.</summary>
        private bool ModifyFinals()
        {
            if (!AbInfo.ConstantInfo.IgnoreOwnModifiers)
            {
                List <AbilityModifier> myModifiers = AbilityMgr.GetAbilityModifiers(AbInfo.Entry);
                if (myModifiers != null)
                {
                    foreach (var modifier in myModifiers)
                    {
                        var result = modifier.ModifyAbility(_caster, AbInfo);

                        if (result > 0)
                        {
                            if (result > 1)
                            {
                                _abInterface.SetCooldown(AbInfo.ConstantInfo.CooldownEntry != 0 ? AbInfo.ConstantInfo.CooldownEntry : AbInfo.Entry, AbInfo.Cooldown * 1000);
                                _abInterface.SetGlobalCooldown();
                            }

                            return(false);
                        }
                    }
                }
            }

            // Morales and items should not run through general handlers
            if (AbInfo.SpecialCost < 0 || AbInfo.ConstantInfo.Origin == AbilityOrigin.AO_ITEM)
            {
                return(true);
            }

            var player = _caster as Player;

            player?.TacInterface.ModifyFinals(AbInfo);
            return(true);
        }
예제 #28
0
        protected override void PropagateGroup()
        {
            if (_groupPendingTargetList.Count > 0)
            {
                List <NewBuff> locList = new List <NewBuff>();
                lock (_groupPendingTargetList)
                {
                    locList.AddRange(_groupPendingTargetList);
                    _groupPendingTargetList.Clear();
                }

                foreach (var buff in locList)
                {
                    _groupTargetList.Add(buff.Target, buff);
                }
            }

            Group myGroup = _myPlayer.PriorityGroup;

            if (myGroup != null)
            {
                foreach (var member in myGroup.GetUnitList(_myPlayer))
                {
                    if (member == Caster)
                    {
                        continue;
                    }

                    if (member.IsInCastRange(Caster, MAX_GROUP_RADIUS))
                    {
                        if (_groupTargetList.ContainsKey(member))
                        {
                            if (_groupTargetList[member].BuffHasExpired) // Group member already has this buff and it's still active, so sustain it
                            {
                                _groupTargetList.Remove(member);
                            }
                            continue;
                        }

                        if (Duration == 0)
                        {
                            member.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry), BuffEffectInvoker.CreateOygBuff, RegisterOYG));
                        }
                        else
                        {
                            BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry);
                            BI.Duration = (ushort)(RemainingTimeMs * 0.001f);
                            member.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, BI, RegisterGroupBuff));
                        }
                    }

                    else
                    {
                        if (_groupTargetList.ContainsKey(member))
                        {
                            // Group member out of range - finish the buff and remove them
                            if (!_groupTargetList[member].BuffHasExpired)
                            {
                                _groupTargetList[member].BuffHasExpired = true;
                            }
                            _groupTargetList.Remove(member);
                        }
                    }
                }
            }

            List <Unit> gtlKeys = _groupTargetList.Keys.ToList();

            foreach (var guy in gtlKeys)
            {
                if (myGroup == null || !myGroup.HasUnit(guy))
                {
                    _groupTargetList[guy].BuffHasExpired = true;
                    _groupTargetList.Remove(guy);
                }
            }
        }
예제 #29
0
 public override bool Load()
 {
     // Queues Hatred Master, used for giving hatred when hit and hitting foes.
     myPlayer?.BuffInterface.QueueBuff(new BuffQueueInfo(myPlayer, myPlayer.EffectiveLevel, AbilityMgr.GetBuffInfo(_masterID)));
     return(true);
 }
예제 #30
0
 public Ability(Ability_Info Info, Object Caster)
 {
     this.Info   = Info;
     this.Caster = Caster;
     Handler     = AbilityMgr.GetAbilityHandler(Info.AbilityType);
 }