Exemple #1
0
        public override void Process()
        {
            base.Process();

            if (Dead || SEnvir.Now < CheckTime)
            {
                return;
            }

            CheckTime = SEnvir.Now.AddSeconds(10);

            foreach (MapObject ob in CurrentMap.Objects) //Expensive.
            {
                if (ob.Race != ObjectType.Monster)
                {
                    continue;
                }

                MonsterObject mob = (MonsterObject)ob;


                if (mob.MonsterInfo.Flag != MonsterFlag.SamaSorcerer)
                {
                    continue;
                }

                if (Functions.InRange(mob.CurrentLocation, CurrentLocation, MonsterInfo.ViewRange - 3))
                {
                    continue;
                }

                mob.Teleport(CurrentMap, CurrentMap.GetRandomLocation(Functions.Move(CurrentLocation, MirDirection.DownLeft, 2), 1));
                break;
            }
        }
Exemple #2
0
        public override void Die()
        {
            if (SEnvir.Random.Next(15) == 0)
            {
                for (int i = CurrentMap.Objects.Count - 1; i >= 0; i--)
                {
                    MonsterObject mob = CurrentMap.Objects[i] as MonsterObject;

                    if (mob == null)
                    {
                        continue;
                    }

                    if (mob.PetOwner != null)
                    {
                        continue;
                    }

                    if (mob is Guard || mob is ChristmasMonster)
                    {
                        continue;
                    }

                    if (mob.Dead || mob.MoveDelay == 0 || !mob.CanMove)
                    {
                        continue;
                    }

                    if (mob.Target != null)
                    {
                        continue;
                    }

                    if (mob.Level >= 300)
                    {
                        continue;
                    }

                    mob.Teleport(CurrentMap, CurrentMap.GetRandomLocation(CurrentLocation, 15));
                }
            }

            if (EXPOwner != null)
            {
                List <MapObject> targets = EXPOwner.GetTargets(CurrentMap, CurrentLocation, 18);

                foreach (MapObject mapObject in targets)
                {
                    if (mapObject.Race != ObjectType.Monster)
                    {
                        continue;
                    }

                    MonsterObject mob = (MonsterObject)mapObject;

                    if (mob.MonsterInfo.IsBoss || mob.Dead)
                    {
                        continue;
                    }

                    if (mob.EXPOwner != null && mob.EXPOwner != EXPOwner)
                    {
                        continue;
                    }

                    if (mob is ChristmasMonster)
                    {
                        continue;
                    }

                    mob.ExtraExperienceRate = Math.Max(mob.ExtraExperienceRate, ExtraExperienceRate);
                    mob.EXPOwner            = EXPOwner;
                    mob.SetHP(0);
                }
            }


            base.Die();
        }
        public override void Die()
        {
            base.Die();

            if (CurrentMap.HasSafeZone)
            {
                return;
            }

            if (SEnvir.Random.Next(2) == 0)
            {
                MonsterInfo boss;

                while (true)
                {
                    boss = SEnvir.BossList[SEnvir.Random.Next(SEnvir.BossList.Count)];

                    if (boss.Level >= 300)
                    {
                        continue;
                    }

                    break;
                }

                MonsterObject mob = GetMonster(boss);

                mob.Spawn(CurrentMap, CurrentMap.GetRandomLocation(CurrentLocation, 2));
            }
            else
            {
                for (int i = CurrentMap.Objects.Count - 1; i >= 0; i--)
                {
                    MonsterObject mob = CurrentMap.Objects[i] as MonsterObject;

                    if (mob == null)
                    {
                        continue;
                    }

                    if (mob.PetOwner != null)
                    {
                        continue;
                    }

                    if (mob is Guard)
                    {
                        continue;
                    }

                    if (mob.Dead || mob.MoveDelay == 0 || !mob.CanMove)
                    {
                        continue;
                    }

                    if (mob.Target != null)
                    {
                        continue;
                    }

                    if (mob.Level >= 300)
                    {
                        continue;
                    }

                    mob.Teleport(CurrentMap, CurrentMap.GetRandomLocation(CurrentLocation, 15));
                }
            }
        }