public void ReloadTactics()
        {
            List <ushort> tacList          = new List <ushort>();
            bool          sendTacticUpdate = false;

            if (_myPlayer._Value.Tactic1 != 0 && !tacList.Contains(_myPlayer._Value.Tactic1))
            {
                tacList.Add(_myPlayer._Value.Tactic1);
            }
            if (_myPlayer._Value.Tactic2 != 0 && !tacList.Contains(_myPlayer._Value.Tactic2))
            {
                tacList.Add(_myPlayer._Value.Tactic2);
            }
            if (_myPlayer._Value.Tactic3 != 0 && !tacList.Contains(_myPlayer._Value.Tactic3))
            {
                tacList.Add(_myPlayer._Value.Tactic3);
            }
            if (_myPlayer._Value.Tactic4 != 0 && !tacList.Contains(_myPlayer._Value.Tactic4))
            {
                tacList.Add(_myPlayer._Value.Tactic4);
            }

            int maxAllowedTactics = _myPlayer.AdjustedLevel / 10;

            while (tacList.Count > maxAllowedTactics)
            {
                tacList.RemoveAt(tacList.Count - 1);
                sendTacticUpdate = true;
            }

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

                if (_modifyingTactics.Contains(buff.Entry))
                {
                    _modifyingTactics.Remove(buff.Entry);

                    List <ushort> toRemove = new List <ushort>();

                    if (AbilityMgr.HasPreCastModifiers(buff.Entry))
                    {
                        foreach (AbilityModifier mod in AbilityMgr.GetAbilityPreCastModifiers(buff.Entry))
                        {
                            if (mod.Affecting == 0)
                            {
                                _generalPreCastModifiers.RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else if (mod.Affecting <= 3)
                            {
                                _speclinePreCastModifiers[(byte)(mod.Affecting - 1)].RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else
                            {
                                toRemove.Add(mod.Affecting);
                            }
                        }

                        foreach (ushort rem in toRemove)
                        {
                            _abilityPreCastModifiers[rem].RemoveAll(fmod => fmod.Source == buff.Entry);
                        }

                        toRemove.Clear();
                    }

                    if (AbilityMgr.HasModifiers(buff.Entry))
                    {
                        foreach (AbilityModifier mod in AbilityMgr.GetAbilityModifiers(buff.Entry))
                        {
                            if (mod.Affecting == 0)
                            {
                                _generalModifiers.RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else if (mod.Affecting <= 3)
                            {
                                _speclineModifiers[(byte)(mod.Affecting - 1)].RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else
                            {
                                toRemove.Add(mod.Affecting);
                            }
                        }

                        foreach (ushort rem in toRemove)
                        {
                            _abilityModifiers[rem].RemoveAll(fmod => fmod.Source == buff.Entry);
                        }

                        toRemove.Clear();
                    }

                    if (AbilityMgr.HasBuffModifiers(buff.Entry))
                    {
                        foreach (AbilityModifier mod in AbilityMgr.GetBuffModifiers(buff.Entry))
                        {
                            if (mod.Affecting == 0)
                            {
                                _generalBuffModifiers.RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else if (mod.Affecting <= 3)
                            {
                                _speclineBuffModifiers[(byte)(mod.Affecting - 1)].RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else
                            {
                                toRemove.Add(mod.Affecting);
                            }
                        }

                        foreach (ushort rem in toRemove)
                        {
                            _buffModifiers[rem].RemoveAll(fmod => fmod.Source == buff.Entry);
                        }
                    }
                }

                _activeTactics.Remove(buff.Entry);
            }

            _activeBuffs.Clear();

            foreach (ushort id in tacList)
            {
                if (id == 0 || _activeTactics.Contains(id))
                {
                    continue;
                }
                BuffInfo b = AbilityMgr.GetBuffInfo(id);

                if (b == null)
                {
                    _myPlayer.SendClientMessage("Nonexistent tactic: " + id + " " + AbilityMgr.GetAbilityNameFor(id));
                    continue;
                }

                if (!_myPlayer.AbtInterface.IsValidTactic(id))
                {
                    _myPlayer.SendClientMessage("Invalid tactic: " + id + " " + AbilityMgr.GetAbilityNameFor(id));
                    sendTacticUpdate = true;
                    continue;
                }

                if (!string.IsNullOrEmpty(b.AuraPropagation))
                {
                    _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(_myPlayer, _myPlayer.AbtInterface.GetMasteryLevelFor(AbilityMgr.GetMasteryTreeFor(b.Entry)), b, BuffEffectInvoker.CreateAura, RegisterTacticBuff));
                }
                else
                {
                    _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(_myPlayer, _myPlayer.AbtInterface.GetMasteryLevelFor(AbilityMgr.GetMasteryTreeFor(b.Entry)), b, RegisterTacticBuff));
                }
                _activeTactics.Add(id);
            }

            // Update the saved list for the server
            for (int i = 0; i < 4; ++i)
            {
                _myPlayer._Value.SetTactic((byte)(i + 1), i < _activeTactics.Count ? _activeTactics[i] : (ushort)0);
            }

            if (sendTacticUpdate)
            {
                SendTactics();
            }
        }
        public override void ExperimentalModeModifyBuff(BuffInfo buffInfo, Unit target)
        {
            switch (buffInfo.Entry)
            {
            // Prayer of Absolution
            case 8242:
                if (target != myPlayer)
                {
                    return;
                }

                // Reduces armor by 50% and converts Strength to Willpower
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1));
                // Adds 8 RF/sec
                buffInfo.Interval = 1000;
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                myPlayer.AbtInterface.SetCooldown(8249, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(8243, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 3;
                break;

            // Covenant of Tenacity
            case 9563:
                if (target != myPlayer)
                {
                    return;
                }

                // Reduces armor by 50% and converts Strength to Willpower
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1));
                // Adds 8 SE/sec
                buffInfo.Interval = 1000;
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                myPlayer.AbtInterface.SetCooldown(9559, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(9567, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 3;

                break;

            // Prayer of Devotion
            case 8249:
                if (target != myPlayer)
                {
                    return;
                }

                // Gain Willpower when striking a target
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                myPlayer.AbtInterface.SetCooldown(8242, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(8243, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                // AoE detaunt
                CurrentStance = 2;
                break;

            // Covenant of Vitality
            case 9567:
                if (target != myPlayer)
                {
                    return;
                }
                // Gain Willpower when striking a target
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 3));
                myPlayer.AbtInterface.SetCooldown(9559, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(9563, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                // AoE detaunt
                CurrentStance = 2;
                break;

            // Prayer of Righteousness
            case 8243:
                if (target != myPlayer)
                {
                    return;
                }

                // Procs on the caster also increase speed by 20%
                buffInfo.AppendBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1), 0);
                // Damage of Path of Wrath skills increased by 1% for every 10 RF
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 3));
                myPlayer.AbtInterface.SetCooldown(8249, DPS_SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(8242, DPS_SWITCH_CD_MS);
                // Neutralize Fury
                if (myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 1;
                break;

            // Covenant of Celerity
            case 9559:
                if (target != myPlayer)
                {
                    return;
                }

                //Damage of Path of Torture skills increased by 1 % for every 10 SE
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 3));
                myPlayer.AbtInterface.SetCooldown(9563, DPS_SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(9567, DPS_SWITCH_CD_MS);
                // Neutralize SE
                if (myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 1;
                break;

            case 8244:     // Divine Assault
            case 9554:     // Rend Soul
                if (_currentStance == 2)
                {
                    foreach (BuffCommandInfo command in buffInfo.CommandInfo)
                    {
                        for (BuffCommandInfo cmd = command; cmd != null; cmd = cmd.NextCommand)
                        {
                            // Is undefendable, to compensate deals half damage but heals for 75% more
                            if (cmd.CommandName == "StealLife")
                            {
                                cmd.PrimaryValue = (int)(cmd.PrimaryValue * 1.75f);
                            }
                            else if (cmd.DamageInfo != null)
                            {
                                cmd.DamageInfo.Undefendable  = true;
                                cmd.DamageInfo.ResultFromRaw = true;
                            }
                        }
                    }
                }
                break;

            case 8270:     // Absence of Faith becomes 50% with DPS on
                if (_currentStance == 1)
                {
                    buffInfo.CommandInfo[0].SecondaryValue = -50;
                }
                break;
                // WP/DoK DoTs (easier than using modifier system)

                /*case 3054:
                 * case 3055:
                 * case 3737:
                 * case 3757:
                 * case 8271:
                 * case 8295:
                 * case 9575:
                 *  if (_currentStance == 1)
                 *  {
                 *      foreach (BuffCommandInfo cmd in buffInfo.CommandInfo)
                 *      {
                 *          for (BuffCommandInfo command = cmd; command != null; command = command.NextCommand)
                 *              if (command.DamageInfo != null)
                 *                  command.DamageInfo.DamageBonus += GetCurrentResourceLevel(0)*0.01f;
                 *      }
                 *
                 *      UpdateDrain();
                 *  }
                 *  break;
                 */
            }
        }
        public bool CheckHP(Object Obj, object instigator)
        {
            Creature c = this.Obj as Creature; // We are casting the script initiator as a Creature

            if (Stage < 0 && !c.IsDead)
            {
                Stage = 0; // Setting control value to 0
            }
            else if (c.Health < c.TotalHealth * 0.2 && Stage < 3 && !c.IsDead)
            {
                var prms = new List <object>()
                {
                    c, (ushort)14897, "This battle may be yours but my will persists. If we meet again, it is you that will return to the soil and eternally serve the Mourkain!"
                };                                                                                                                                                                                              // Iron Body
                c.EvtInterface.AddEvent(DelayedBuff, 100, 1, prms);

                foreach (Object o in c.ObjectsInRange.ToList())
                {
                    GameObject go = o as GameObject;
                    if (go != null && go.Entry == 100524)
                    {
                        go.Say("*** Magical barrier collaps and the gem is in your reach... ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);
                        go.Destroy();
                    }

                    if (go != null && go.Entry == 100523)
                    {
                        go.IsInvulnerable = false;
                        go.IsAttackable   = 1;
                        go.Health         = go.TotalHealth;

                        //go.Say("*** Cracks start to show upon surface of the gem... ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);

                        foreach (Player plr in go.PlayersInRange.ToList())
                        {
                            if (plr != null)
                            {
                                BuffInfo b = AbilityMgr.GetBuffInfo(13058, c, plr); // Killer dot
                                plr.BuffInterface.QueueBuff(new BuffQueueInfo(c, c.Level, b));
                                go.SendMeTo(plr);
                            }
                        }

                        break;
                    }
                }

                Stage = 3;

                //c.Say("Stage 3");
            }
            else if (c.Health < c.TotalHealth * 0.4 && Stage < 2 && !c.IsDead)
            {
                var prms = new List <object>()
                {
                    2000561, 1109983, 1119476, 19138, (int)Obj.Heading, (uint)0
                };                                                                                             // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                prms = new List <object>()
                {
                    2000561, 1110752, 1119141, 19134, (int)Obj.Heading, (uint)0
                };                                                                                         // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                prms = new List <object>()
                {
                    2000561, 1111016, 1119874, 19145, (int)Obj.Heading, (uint)0
                };                                                                                         // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                prms = new List <object>()
                {
                    2000561, 1110467, 1120222, 19146, (int)Obj.Heading, (uint)0
                };                                                                                         // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                c.Say("Arise, my servants, for it is time the Mourkain retake this word!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

                //c.IsInvulnerable = true;

                //c.EvtInterface.AddEvent(RemoveBuffs, 30000, 1);

                Stage = 2;

                //c.Say("Stage 2");
            }
            else if (c.Health < c.TotalHealth * 0.7 && Stage < 1 && !c.IsDead)
            {
                var prms = new List <object>()
                {
                    2000876, 1109983, 1119476, 19138, Obj.Heading
                };                                                                               // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                prms = new List <object>()
                {
                    2000876, 1110752, 1119141, 19134, Obj.Heading
                };                                                                           // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                prms = new List <object>()
                {
                    2000876, 1111016, 1119874, 19145, Obj.Heading
                };                                                                           // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                prms = new List <object>()
                {
                    2000876, 1110467, 1120222, 19146, Obj.Heading
                };                                                                           // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                c.Say("Arise, my servants, for it is time the Mourkain retake this word!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

                //c.IsInvulnerable = true;

                //c.EvtInterface.AddEvent(RemoveBuffs, 30000, 1);

                Stage = 1;

                //c.Say("Stage 1");
            }

            return(false);
        }
Example #4
0
 public override void Initialize(Unit caster, Unit target, ushort buffId, byte buffLevel, byte stackLevel, BuffInfo myBuffInfo, BuffInterface parentInterface)
 {
     base.Initialize(caster, target, buffId, buffLevel, stackLevel, myBuffInfo, parentInterface);
     previousPlayers.Add(target);
 }
Example #5
0
        private void PropagateBehind()
        {
            if (_otherPendingTargetList.Count > 0)
            {
                List <NewBuff> locList = new List <NewBuff>();
                lock (_otherPendingTargetList)
                {
                    locList.AddRange(_otherPendingTargetList);
                    _otherPendingTargetList.Clear();
                }

                foreach (var buff in locList)
                {
                    _otherTargetList.Add(buff.Target, new AuraInfo(buff, _passNum));
                }
            }

            foreach (Object obj in Target.ObjectsInRange)
            {
                Unit ally = obj as Player;

                if (ally == null || ally.Realm != Caster.Realm)
                {
                    continue;
                }

                if (Caster.CanHitWithAoE(ally, 360, MAX_HTL_RADIUS - 10) && !Caster.IsObjectInFront(ally, 270))
                {
                    if (_otherTargetList.ContainsKey(ally))
                    {
                        if (_otherTargetList[ally].Buff.BuffHasExpired) // Group member already has this buff and it's still active, so sustain it
                        {
                            _otherTargetList.Remove(ally);
                        }
                        else
                        {
                            _otherTargetList[ally].PassNum = _passNum;
                        }
                        continue;
                    }

                    if (Duration == 0)
                    {
                        ally.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, ally), RegisterOtherBuff));
                    }

                    else if (RemainingTimeMs * 0.001f > 0)
                    {
                        BuffInfo bi = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, ally);
                        bi.Duration = Math.Max((ushort)1, (ushort)(RemainingTimeMs * 0.001f));

                        ally.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, bi, RegisterOtherBuff));
                    }
                }

                else
                {
                    if (!_otherTargetList.ContainsKey(ally))
                    {
                        continue;
                    }

                    // Group member out of range - finish the buff and remove them
                    if (!_otherTargetList[ally].Buff.BuffHasExpired)
                    {
                        _otherTargetList[ally].Buff.BuffHasExpired = true;
                    }

                    _otherTargetList.Remove(ally);
                }
            }

            List <Unit> oldUnits = _otherTargetList.Keys.ToList();

            // Remove any units not refreshed on this tick
            foreach (Unit oldAlly in oldUnits)
            {
                if (_otherTargetList[oldAlly].PassNum == _passNum)
                {
                    continue;
                }

                _otherTargetList[oldAlly].Buff.BuffHasExpired = true;
                _otherTargetList.Remove(oldAlly);
            }
        }
Example #6
0
        public override void Initialize(Unit caster, Unit target, ushort buffId, byte buffLevel, byte stackLevel, BuffInfo myBuffInfo, BuffInterface parentInterface)
        {
            base.Initialize(caster, target, buffId, buffLevel, stackLevel, myBuffInfo, parentInterface);

            _myPlayer = caster as Player;

            switch (_buffInfo.AuraPropagation)
            {
            case "Group":
                _groupTargetList        = new Dictionary <Unit, NewBuff>();
                _groupPendingTargetList = new List <NewBuff>();
                break;

            case "Foe":
            case "Foe20":
            case "Foe30":
            case "Foe40":
            case "Foe250":
                _otherTargetList        = new Dictionary <Unit, AuraInfo>();
                _otherPendingTargetList = new List <NewBuff>();
                break;

            case "All":
                _groupTargetList        = new Dictionary <Unit, NewBuff>();
                _groupPendingTargetList = new List <NewBuff>();
                _otherTargetList        = new Dictionary <Unit, AuraInfo>();
                _otherPendingTargetList = new List <NewBuff>();
                break;

            case "HTL":
                _otherTargetList        = new Dictionary <Unit, AuraInfo>();
                _otherPendingTargetList = new List <NewBuff>();
                break;
            }

            _propInterval = Entry == 9251 || Entry == 1927 ? 250 : 1000;
        }
Example #7
0
        private void PropagateFoe()
        {
            int addedThisTick = 0;

            if (_otherPendingTargetList.Count > 0)
            {
                lock (_otherPendingTargetList)
                {
                    foreach (NewBuff buff in _otherPendingTargetList)
                    {
                        _otherTargetList.Add(buff.Target, new AuraInfo(buff, _passNum));
                    }

                    _otherPendingTargetList.Clear();
                }
            }

            foreach (Object obj in Target.ObjectsInRange)
            {
                Unit foe = obj as Unit;

                if (foe == null || foe.IsInvulnerable)
                {
                    continue;
                }

                if (!Target.IsDead && foe.ObjectWithinRadiusFeet(Target, MaxFoeRadius - 10) && CombatInterface.CanAttack(Caster, foe) && ((Caster is Creature) || (!(foe is Player) || foe.CbtInterface.IsPvp)) && Target.LOSHit(foe))
                {
                    if (_otherTargetList.ContainsKey(foe))
                    {
                        if (_otherTargetList[foe].Buff.BuffHasExpired)
                        {
                            _otherTargetList.Remove(foe);
                        }
                        else
                        {
                            _otherTargetList[foe].PassNum = _passNum;
                        }
                        continue;
                    }

                    if (addedThisTick + _otherTargetList.Count == 9)
                    {
                        continue;
                    }

                    if (Duration == 0)
                    {
                        foe.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, foe), RegisterOtherBuff));
                    }
                    else
                    {
                        BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, foe);
                        BI.IsAoE    = true;
                        BI.Duration = Math.Max((ushort)1, (ushort)(RemainingTimeMs * 0.001f));
                        foe.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, BI, RegisterOtherBuff));
                    }

                    ++addedThisTick;
                }

                else
                {
                    if (!_otherTargetList.ContainsKey(foe))
                    {
                        continue;
                    }

                    // Group member out of range - finish the buff and remove them
                    if (!_otherTargetList[foe].Buff.BuffHasExpired)
                    {
                        _otherTargetList[foe].Buff.BuffHasExpired = true;
                    }

                    _otherTargetList.Remove(foe);
                }
            }


            List <Unit> oldUnits = _otherTargetList.Keys.ToList();

            // Remove any units not refreshed on this tick
            foreach (Unit oldfoe in oldUnits)
            {
                if (_otherTargetList[oldfoe].PassNum == _passNum)
                {
                    continue;
                }

                _otherTargetList[oldfoe].Buff.BuffHasExpired = true;
                _otherTargetList.Remove(oldfoe);
            }
        }
Example #8
0
        protected virtual 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((Player)Caster))
                {
                    if (member == Caster && Target == Caster)
                    {
                        continue;
                    }

                    if (!Target.IsDead && member.ObjectWithinRadiusFeet(Target, MAX_GROUP_RADIUS - 10))
                    {
                        if (_groupTargetList.ContainsKey(member))
                        {
                            if (_groupTargetList[member].BuffHasExpired)
                            {
                                _groupTargetList.Remove(member);
                            }
                            continue;
                        }

                        if (Duration == 0)
                        {
                            member.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, member), RegisterGroupBuff));
                        }
                        else
                        {
                            BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, member);
                            BI.Duration = (ushort)(Math.Max(1, 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);
                        }
                    }
                }
            }

            else
            {
                if (_myPlayer != Target)
                {
                    if (_myPlayer.IsInCastRange(Target, MAX_GROUP_RADIUS))
                    {
                        if (_groupTargetList.ContainsKey(_myPlayer))
                        {
                            if (_groupTargetList[_myPlayer].BuffHasExpired)
                            {
                                _groupTargetList.Remove(_myPlayer);
                            }
                        }

                        else if (Duration == 0)
                        {
                            _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, _myPlayer), RegisterGroupBuff));
                        }
                        else
                        {
                            BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, _myPlayer);
                            BI.Duration = (ushort)(Math.Max(1, RemainingTimeMs * 0.001f));
                            _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, BI, RegisterGroupBuff));
                        }
                    }

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


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

            foreach (var guy in gtlKeys)
            {
                if (guy == _myPlayer && _myPlayer != Target)
                {
                    continue;
                }

                if (Target.IsDead || myGroup == null || !myGroup.HasUnit(guy))
                {
                    _groupTargetList[guy].BuffHasExpired = true;
                    _groupTargetList.Remove(guy);
                }
            }
        }