Exemplo n.º 1
0
 public void FishCaught(PlayerID id)
 {
     fishCaught[((int)id) - 1]++;
     if (fishCaught[((int)id) - 1] >= targetFish)
     {
         finished = true;
         Destroy(spawnTimer);
         Fish[] allFish = FindObjectsOfType <Fish>();
         for (int i = 0; i < allFish.Length; i++)
         {
             Destroy(allFish[i].transform.root.gameObject);
         }
         Winners.Add(id);
         if (EndGame != null)
         {
             EndGame();
         }
         for (int i = 0; i < inGameBaskets.Count; i++)
         {
             GameManager.instance.AllPlayers.Find(x => x.Character.Equals(inGameBaskets[i].Character)).ThrowObject();
             inGameBaskets[i].transform.parent = null;
             Destroy(inGameBaskets[i].gameObject);
         }
     }
 }
Exemplo n.º 2
0
        private void CalcularGanador(DA.Motor motor)
        {
            if (Querys.Count() == 0)
            {
                return;
            }

            long mayor = 0;

            DA.Winner mayorQuery = new DA.Winner();
            mayorQuery.Motor = motor;
            long total = 0;
            List <DA.Resultado> resxquery = new List <DA.Resultado>();

            foreach (DA.Query q in Querys)
            {
                resxquery = q.Resultados;
                foreach (DA.Resultado r in resxquery)
                {
                    if (motor.Nombre == r.MotorBusqueda.Nombre)
                    {
                        total = r.Total;
                    }
                }
                if (total > mayor)
                {
                    mayor            = total;
                    mayorQuery.Query = q;
                }
            }

            Winners.Add(mayorQuery);
        }
Exemplo n.º 3
0
        private void CheckAloneFighter()
        {
            for (int i = 0; i < m_Areas.Count; ++i)
            {
                IPooledEnumerable eable   = JoinMap.GetMobilesInBounds(m_Areas[i]);
                List <Mobile>     players = new List <Mobile>();

                foreach (Mobile mob in eable)
                {
                    if (Contestants.Contains(mob))
                    {
                        players.Add(mob);
                    }
                }

                eable.Free();

                if (players.Count == 1) //Alone
                {
                    Mobile m = players[0];
                    m.MoveToWorld(WinLocation, WinMap);
                    m.PublicOverheadMessage(MessageType.Regular, 38, true, "Skipping to next round...");
                    m.Blessed = true;
                    Fighting.Remove(m);
                    Winners.Add(m);
                    UpdateScores(null, m);
                    AddFighters(false);
                }
            }
        }
Exemplo n.º 4
0
        // Method to determine winner of Round.
        // Compares Weapon Types to determine winner.
        // Uses the CanBeat List fields of the Weapon Type to determine if opponent has a weapon that you can beat.
        private string BattleOutcome()
        {
            WeaponsUsed.Add(PlayerOne.CurrentWeapon.WeaponName);
            WeaponsUsed.Add(PlayerTwo.CurrentWeapon.WeaponName);

            var p1Weapon = PlayerOne.CurrentWeapon.GetType();
            var p2Weapon = PlayerTwo.CurrentWeapon.GetType();

            var message = String.Format("\n{0} chose {1}, {2} chose {3}. ",
                                        PlayerOne.Name,
                                        PlayerOne.CurrentWeapon.WeaponName,
                                        PlayerTwo.Name,
                                        PlayerTwo.CurrentWeapon.WeaponName);

            // Determines winner and adds names to Winners List for sorting after the battle
            // Both names are added if a draw.  Only winners name is added for a win.
            if (p1Weapon == p2Weapon)
            {
                Winners.Add(PlayerOne.Name);
                Winners.Add(PlayerTwo.Name);
                return(message + "It's A Draw");
            }
            else if (PlayerOne.CurrentWeapon.CanBeat.Contains(p2Weapon))
            {
                Winners.Add(PlayerOne.Name);
                return(message + PlayerOne.Name + " is the WINNER");
            }
            else
            {
                Winners.Add(PlayerTwo.Name);
                return(message + PlayerTwo.Name + " is the WINNER");
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="el"></param>
 public void SetWinner(XElement el)
 {
     Winners.Clear();
     foreach (var elc in el.Descendants("Candidat"))
     {
         Winners.Add(new CandidatViewModel(elc));
     }
     RaisePropertyChanged("Tooltip");
 }
Exemplo n.º 6
0
        private void ProcessResult(SpinResult result)
        {
            foreach (var bet in Bets)
            {
                bet.WinAmount = 0;
                if (bet.Color.HasValue)
                {
                    if (bet.Color == result.RouletteNumber.Color)
                    {
                        bet.WinAmount += bet.BetAmount * 2;
                    }
                }

                if (bet.OutsideDozens.HasValue)
                {
                    if (bet.OutsideDozens == result.RouletteNumber.IsInOutsizeDozen)
                    {
                        bet.WinAmount += bet.BetAmount * 3;
                    }
                }

                foreach (var r in bet.RouletteNumbers)
                {
                    if (r.Number == "0" || r.Number == "00")
                    {
                        bet.WinAmount += bet.BetAmount * 17;
                    }
                    else
                    if (r.Number == result.RouletteNumber.Number)
                    {
                        if (bet.RouletteNumbers.Count == 4)
                        {
                            bet.WinAmount += bet.BetAmount * 8;
                        }
                        if (bet.RouletteNumbers.Count == 1)
                        {
                            bet.WinAmount += bet.BetAmount * 35;
                        }
                        if (bet.RouletteNumbers.Count == 2)
                        {
                            bet.WinAmount += bet.BetAmount * 16;
                        }
                    }
                }

                if (bet.WinAmount > 0)
                {
                    Winners.Add(bet);
                }
            }
        }
Exemplo n.º 7
0
        private void WinnerFound(object sender, Aiva.Models.Giveaway.Users e)
        {
            Winners.Add(e);
            JoinedUsers.Remove(e);

            if (!string.IsNullOrEmpty(WinnersSeperated))
            {
                WinnersSeperated += $" | {e.Username}";
            }
            else
            {
                WinnersSeperated += e.Username;
            }
        }
        public override void Run()
        {
            int       numDead  = 0;
            Fireplace survivor = null;

            foreach (Fireplace f in inGameFirePlaces)
            {
                if (f.Dead)
                {
                    numDead++;
                }
                else
                {
                    survivor = f;
                }
            }

            if (numDead >= GameManager.instance.AllPlayers.Count - 1)
            {
                winnerFound -= Data.GameManager.instance.DeltaTime;
                if (winnerFound < 0)
                {
                    for (int i = 0; i < GameManager.instance.AllPlayers.Count; i++)
                    {
                        GameManager.instance.AllPlayers[i].ThrowObject();
                    }

                    for (int i = 0; i < inGameLogs.Count; i++)
                    {
                        Destroy(inGameLogs[i].gameObject);
                    }
                    for (int i = 0; i < inGameFirePlaces.Count; i++)
                    {
                        if (inGameFirePlaces[i] != null)
                        {
                            Destroy(inGameFirePlaces[i].gameObject);
                        }
                    }
                    if (survivor)
                    {
                        Winners.Add(GameManager.instance.CharacterToPlayer[survivor.linkedCharacter]);
                    }
                    finished    = true;
                    winnerFound = 2f;
                }
            }
        }
 public override void Run()
 {
     if (!caymanTemp)
     {
         caymanTemp = (GameObject)Instantiate(cayman, new Vector3(0, -7, 0), Quaternion.identity);
     }
     else
     {
         if (caymanTemp.GetComponent <Monster>().winners.Count <= 1)
         {
             finished = true;
             if (caymanTemp.GetComponent <Monster>().winners.Count > 0)
             {
                 Winners.Add(caymanTemp.GetComponent <Monster>().winners[0]);
             }
             Destroy(caymanTemp);
         }
     }
 }
Exemplo n.º 10
0
        public HigherDice(Table table) : base(table)
        {
            PlayerCups = new List <PlayerCup>(Table.Players.Select(p => new PlayerCup(p)));

            rollDices(PlayerCups);
            var maxDiceValue  = PlayerCups.Select(pc => pc.Dices.Last().Value).Max();
            var maxPlayerCups = PlayerCups.Where(pc => pc.Dices.Last().Value == maxDiceValue).ToList();

            while (maxPlayerCups.Count > 1)
            {
                rollDices(maxPlayerCups);
                maxDiceValue  = maxPlayerCups.Select(pc => pc.Dices.Last().Value).Max();
                maxPlayerCups = maxPlayerCups.Where(pc => pc.Dices.Last().Value == maxDiceValue).ToList();
            }

            var winnerPlayerCup = maxPlayerCups.First();

            winnerPlayerCup.Dices.Last().IsHighlighted = true;
            Winners.Add(winnerPlayerCup.Player);
            Table.SetNextPlayer(winnerPlayerCup.Player);

            IsEnded = true;
        }
 public override void Run()
 {
     if (numAlive == 1)
     {
         for (int i = 0; i < GameManager.instance.AllPlayers.Count; i++)
         {
             if (GameManager.instance.AllPlayers[i].LifeComponent.Health > 0)
             {
                 Winners.Add(GameManager.instance.AllPlayers[i].ID);
             }
             finished = true;
             GameManager.instance.AllPlayers[i].MovementComponent.MeleeEnabled = false;
             GameManager.instance.AllPlayers[i].LifeComponent.HideHealth();
         }
     }
     if (numAlive == 0)
     {
         finished = true;
         for (int i = 0; i < GameManager.instance.AllPlayers.Count; i++)
         {
             GameManager.instance.AllPlayers[i].MovementComponent.MeleeEnabled = false;
             GameManager.instance.AllPlayers[i].LifeComponent.HideHealth();
         }
     }
     else
     {
         int temp = 0;
         for (int i = 0; i < GameManager.instance.AllPlayers.Count; i++)
         {
             if (GameManager.instance.AllPlayers[i].LifeComponent.Health > 0)
             {
                 temp++;
             }
         }
         numAlive = temp;
     }
 }
Exemplo n.º 12
0
        public HigherCard(Table table) : base(table)
        {
            Deck        = new Deck();
            PlayerHands = new List <PlayerHand>(Table.Players.Select(p => new PlayerHand(p)));

            dealCards(PlayerHands);
            var maxCardValue   = PlayerHands.Select(ph => ph.Cards.Last().Value).Max();
            var maxPlayerHands = PlayerHands.Where(ph => ph.Cards.Last().Value == maxCardValue).ToList();

            while (maxPlayerHands.Count > 1)
            {
                dealCards(maxPlayerHands);
                maxCardValue   = maxPlayerHands.Select(ph => ph.Cards.Last().Value).Max();
                maxPlayerHands = maxPlayerHands.Where(ph => ph.Cards.Last().Value == maxCardValue).ToList();
            }

            var winnerPlayerHand = maxPlayerHands.First();

            winnerPlayerHand.Cards.Last().IsHighlighted = true;
            Winners.Add(winnerPlayerHand.Player);
            Table.SetNextPlayer(winnerPlayerHand.Player);

            IsEnded = true;
        }
Exemplo n.º 13
0
        public void HandleDeath(Mobile m)
        {
            if (!m_Started)
            {
                return;
            }

            List <Mobile> opponents = new List <Mobile>();
            List <Mobile> referees  = new List <Mobile>();

            Rectangle2D area = GetArea(m);

            // Rob - remove and stop the Match or EndMatch timer
            if (m_MatchTimers.ContainsKey(area))
            {
                Timer t = m_MatchTimers[area];
                t.Stop();
                m_MatchTimers.Remove(area);
            }
            // end Rob
            IPooledEnumerable eable = JoinMap.GetMobilesInBounds(area);

            foreach (Mobile mob in eable)
            {
                if (mob != m && Contestants.Contains(mob))
                {
                    opponents.Add(mob);
                }
                else if (mob is Referee)
                {
                    referees.Add(mob);
                }
            }

            eable.Free();

            for (int i = 0; i < opponents.Count && opponents.Count <= 1; ++i)
            {
                Mobile mob = opponents[i];
                UpdateScores(m, mob);
                mob.MoveToWorld(WinLocation, WinMap);
                FixPlayer(mob);
                mob.Blessed = true;
                Fighting.Remove(mob);
                Winners.Add(mob);

                //Rob -re-add gear in case gear was removed
                if (ForceEnd == ForceEndType.ItemRemoval && NeedRestock.Contains(mob))
                {
                    SupplySystem.RemoveEventGear(mob);
                    SupplySystem.SupplyGear(mob, EventSupplier);
                    NeedRestock.Remove(mob);
                    mob.SendAsciiMessage("You have been resupplied!");
                }
            }

            NeedRestock.Remove(m); // loser doesn't need a restock
            // end - Rob

            for (int i = 0; i < referees.Count; ++i)
            {
                Mobile mob = referees[i];
                mob.Delete();
            }

            Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(ResurrectPlayer), m);

            HandleCorpse(m);

            Fighting.Remove(m);
            RemovePlayer(m, true, false);

            m.LastKiller = null;

            AddFighters(false);
        }
Exemplo n.º 14
0
 private void WinnerFound(object sender, Aiva.Models.Giveaway.Users e)
 {
     Winners.Add(e);
 }