コード例 #1
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);
            }
        }