Пример #1
0
        public virtual void DeadlineCheck()
        {
            if (DateTime.UtcNow > Deadline)
            {
                SendMessage(1072258); // You failed to complete an objective in time!
                FinishSequence();
                return;
            }

            TimeSpan timeLeft = Deadline - DateTime.UtcNow;

            if (timeLeft < TimeSpan.FromMinutes(30))
            {
                SendMessage(1075611, timeLeft.TotalSeconds);
            }

            Fighters.ForEach(x =>
            {
                if (x is PlayerMobile)
                {
                    PlayerMobile player = (PlayerMobile)x;

                    if (player.NetState == null)
                    {
                        TimeSpan offline = DateTime.UtcNow - player.LastOnline;

                        if (offline > TimeSpan.FromMinutes(10))
                        {
                            Exit(player);
                        }
                    }
                }
            });
        }
Пример #2
0
        public virtual void BeginSequence(Mobile from)
        {
            if (Peerless == null)
            {
                // spawn boss
                Peerless = Boss;

                if (Peerless == null)
                {
                    return;
                }

                Peerless.Home      = BossLocation;
                Peerless.RangeHome = 12;
                Peerless.MoveToWorld(BossLocation, Map);
                Peerless.Altar = this;

                StartSlayTimer();
            }

            // teleport fighters
            Fighters.ForEach(x =>
            {
                int counter = 0;

                if (x.InRange(from.Location, 15) && CanEnter(x))
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(counter++), () => { Enter(x); });
                }
            });
        }
Пример #3
0
        public virtual void BeginSequence(Mobile from)
        {
            SpawnBoss();

            // teleport fighters
            Fighters.ForEach(x =>
            {
                int counter = 0;

                if (x.InRange(from.Location, 15) && CanEnter(x))
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(counter++), () => { Enter(x); });
                }
            });
        }
Пример #4
0
        public virtual void FinishSequence()
        {
            StopTimers();

            if (Owner != null)
            {
                Owner = null;
            }

            // delete peerless
            if (Peerless != null)
            {
                if (Peerless.Corpse != null && !Peerless.Corpse.Deleted)
                {
                    Peerless.Corpse.Delete();
                }

                if (!Peerless.Deleted)
                {
                    Peerless.Delete();
                }
            }

            // teleport party to exit if not already there
            Fighters.ForEach(x => Exit(x));

            // delete master keys
            MasterKeys.ForEach(x => x.Delete());

            if (MasterKeys != null)
            {
                MasterKeys.Clear();
            }

            if (Fighters != null)
            {
                Fighters.Clear();
            }

            // delete any remaining helpers
            CleanupHelpers();

            // reset summoner, boss
            Peerless = null;

            Deadline = DateTime.MinValue;
        }
Пример #5
0
 public virtual void SendMessage(int message, object param)
 {
     Fighters.ForEach(x => x.SendLocalizedMessage(message, param.ToString()));
 }
Пример #6
0
 public virtual void SendMessage(int message)
 {
     Fighters.ForEach(x => x.SendLocalizedMessage(message));
 }
Пример #7
0
        public async Task <List <CharacterFeatures> > Launch()
        {
            Fighters.ForEach(x =>
            {
                x.OnPower += (sender, e) =>
                {
                    if (Fighters.Count <= 1)
                    {
                        return;
                    }

                    var fighter = sender as CharacterFeatures;

                    if (fighter.CurrentLife > 0)
                    {
                        //Console.WriteLine($"{fighter} utilise son pouvoir");

                        CharacterFeatures enemy;
                        switch (fighter)
                        {
                        case Zombie:
                            enemy = GetDeadEnemy(fighter);
                            fighter.Power(enemy.MaximumLife);
                            break;

                        case Vampire:
                            enemy = GetEnemy(fighter);
                            fighter.Power(enemy);
                            break;

                        case Pretre:
                            fighter.Power();
                            break;

                        case Assassin:
                            if (GetNumberOfAliveFighter() > 5)
                            {
                                fighter.Power();
                            }
                            break;

                        case Necromancien:
                            if (DeadFighters.Count == 0)
                            {
                                fighter.Power();
                            }
                            else
                            {
                                fighter.IsHide = false;
                            }
                            break;

                        default:
                            //fighter.Power();
                            break;
                        }
                    }
                };

                x.OnDeath += (sender, args) =>
                {
                    var deadGuy = sender as CharacterFeatures;
                    if (DeadFighters.All(dead => deadGuy != null && dead.Id != deadGuy.Id))
                    {
                        DeadFighters.Add(deadGuy);
                        Fighters.Remove(deadGuy);

                        Console.WriteLine($"Bouhouhou {deadGuy} is dead");
                    }
                };

                x.OnAttack += (sender, e) =>
                {
                    if (Fighters.Count <= 1)
                    {
                        return;
                    }

                    var fighter = sender as CharacterFeatures;

                    if (fighter.CurrentLife > 0)
                    {
                        var enemy = GetEnemy(fighter);

                        //Console.WriteLine($"{fighter} attaque {enemy}");

                        enemy.SufferAttack(fighter, fighter.DamageType);

                        if (enemy.IsDead())
                        {
                            Death(enemy);
                        }

                        if (fighter.IsDead())
                        {
                            Death(fighter);
                        }
                    }
                };

                x.StartFight();
            });

            do
            {
                await Task.Delay(2000);
            } while (Fighters.Count(x => !x.IsDead()) > 1);

            await Task.Delay(5000);

            return(DeadFighters.Distinct().ToList());
        }