Пример #1
0
        void _addThreat(Unit victim, float threat)
        {
            var reff = threatContainer.addThreat(victim, threat);

            // Ref is not in the online refs, search the offline refs next
            if (reff == null)
            {
                reff = threatOfflineContainer.addThreat(victim, threat);
            }

            if (reff == null) // there was no ref => create a new one
            {
                bool isFirst = threatContainer.empty();

                // threat has to be 0 here
                var hostileRef = new HostileReference(victim, this, 0);
                threatContainer.addReference(hostileRef);
                hostileRef.addThreat(threat); // now we add the real threat
                if (victim.IsTypeId(TypeId.Player) && victim.ToPlayer().IsGameMaster())
                {
                    hostileRef.setOnlineOfflineState(false); // GM is always offline
                }
                else if (isFirst)
                {
                    setCurrentVictim(hostileRef);
                }
            }
        }