Beispiel #1
0
        public void EndGame(CockFightingControlStone controller)
        {
            if (ChickenList.Count > 0)
            {
                for (int i = 0; i < ChickenList.Count; i++)
                {
                    if (controller != null && !controller.Deleted)
                    {
                        FightingChicken fc = (FightingChicken)ChickenList[i];

                        if (fc.Owner != null && !(fc.Owner.Deleted))
                        {
                            controller.LastWinner = fc.Owner;
                            Account acct            = (Account)fc.Owner.Account;
                            bool    CockFightBetted = Convert.ToBoolean(acct.GetTag("CockFightBetted"));
                            if (controller.Bet > 0)
                            {
                                BankCheck bc = new BankCheck(controller.MaxPlayers * controller.Bet);
                                fc.Owner.AddToBackpack(bc);
                                fc.Owner.SendMessage("You won the c**k fight!");
                                acct.SetTag("CockFightBetted", "false");
                            }
                            fc.Delete();
                        }
                    }
                }
            }
            controller.ChickenList.Clear();
            controller.DeadChickens    = 0;
            controller.NumberOfPlayers = 0;
            controller.GameRunning     = false;
            controller.LastChicken     = null;
        }
Beispiel #2
0
        public void JoinGame(Mobile from, CockFightingControlStone controller)
        {
            if (!controller.GameRunning)
            {
                controller.NumberOfPlayers++;

                FightingChicken fc = new FightingChicken(from, controller);

                fc.Blessed = true;
                fc.Frozen  = true;
                fc.Map     = from.Map;

                switch (Utility.Random(4))
                {
                case 0: { fc.Location = controller.Corner1; } break;

                case 1: { fc.Location = controller.Corner2; } break;

                case 2: { fc.Location = controller.Corner3; } break;

                case 3: { fc.Location = controller.Corner4; } break;
                }

                if (controller.NumberOfPlayers == controller.MaxPlayers)
                {
                    controller.GameRunning = true;
                    controller.ReleaseTheChickens();
                }

                fc.Combatant           = controller.LastChicken;
                controller.LastChicken = fc;
            }
            else
            {
                from.SendMessage("A fight is currently in progress, please wait until it is over.");
            }
        }