Exemplo n.º 1
0
        public void SpawnRatmen(Mobile target)
        {
            Map map = Map;

            if (map == null)
            {
                return;
            }

            IPooledEnumerable <BaseCreature> eable = GetMobilesInRange <BaseCreature>(10);
            int rats = eable.Aggregate(0, (c, m) => c + (m is Ratman || m is RatmanArcher || m is RatmanMage ? 1 : 0));

            eable.Free();

            if (rats >= 16)
            {
                return;
            }

            PlaySound(0x3D);

            rats = Utility.RandomMinMax(3, 6);

            for (int i = 0; i < rats; ++i)
            {
                var rat = Utility.Random(5) switch
                {
                    2 => (BaseCreature) new RatmanArcher(),
                    3 => new RatmanArcher(),
                    4 => new RatmanMage(),
                    _ => new Ratman()
                };

                rat.Team = Team;
                rat.MoveToWorld(map.GetRandomNearbyLocation(Location), map);
                rat.Combatant = target;
            }
        }