Example #1
0
    private void Update()
    {
        if (!stop)
        {
            Main17 = Generate17(true);
            win    = new WinCheck(Main17);

            if ((win.IsWin) && (win.combinations.Count >= 3))
            {
                stop = true;
            }

            trial++;

            if (trial > 1000)
            {
                stop = true;
            }
        }

        if (stop && !shown)
        {
            Show(Main17);
            Show(win.combinations);
            shown = true;
        }
    }
Example #2
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        win = new WinCheck(Generate17(true));
    }
Example #3
0
        public void CheckWin()
        {
            bool win = true;

            for (int ii = 0; ii < WinCheck.Count(); ii++)
            {
                if (EmptyList[ii].Value != WinCheck[ii].Value)
                {
                    win = false;
                    ii  = WinCheck.Count();
                }
            }
            IsWinner = win;
        }
Example #4
0
    public void CheckForWinnings()
    {
        List <Card> a = new List <Card>();

        foreach (var card in cards)
        {
            a.Add(card.cardData);
        }
        a.TrimExcess();
        if (WinCheck.CheckForRoyalFlush(a))
        {
            betManager.AddWinnings(8);
        }
        else if (WinCheck.CheckForStraightFlush(a))
        {
            betManager.AddWinnings(7);
        }
        else if (WinCheck.CheckForFourOfAKind(a))
        {
            betManager.AddWinnings(6);
        }
        else if (WinCheck.CheckForFullHouse(a))
        {
            betManager.AddWinnings(5);
        }
        else if (WinCheck.CheckForFlush(a))
        {
            betManager.AddWinnings(4);
        }
        else if (WinCheck.CheckForStraight(a))
        {
            betManager.AddWinnings(3);
        }
        else if (WinCheck.CheckForThreeKind(a))
        {
            betManager.AddWinnings(2);
        }
        else if (WinCheck.CheckForTwoPair(a))
        {
            betManager.AddWinnings(1);
        }
        else if (WinCheck.CheckForJacksOrBetter(a))
        {
            betManager.AddWinnings(0);
        }
        //If it gets here nothing happens, the game is already reset
        betManager.SetCurrencyUI();
    }
Example #5
0
                         string description) GenerateMission(int difficulty, int Round, ref Map map, Player player)
        {
            string desc = "Debug mission ";

            #region Player Creation

            List <Player> players = new List <Player>()
            {
                player
            };

            //Set player position
            players[0].troop.Position = new Point(0, 1);

            #endregion Player Creation

            #region WinCodition Creation

            List <WinCheck> wins = new List <WinCheck> {
            };
            WinCheck fail        = ((_map, main) => false);
            wins.Add(fail);

            #endregion WinCodition Creation

            #region DeathCondition Creation

            List <WinCheck> deaths = new List <WinCheck>
            {
                playerDeath
            };

            desc += "Do not die. ";

            #endregion DeathCondition Creation

            desc += "Good luck! ";
            return(players, wins, deaths, desc);
        }
Example #6
0
        GenerateMission(int difficulty, int Round, ref Map map, Player player)
        {
            EnemyMoveTogether = true;

            string desc = "Welcome to the mission. ";

            #region Player Creation

            List <Player> players = new List <Player>()
            {
                player
            };

            //Set player position
            List <Point> startPos = map.DeterminSpawnPoint(1, SpawnType.road);
            if (startPos.Count == 0)
            {
                startPos = map.DeterminSpawnPoint(1, SpawnType.randomLand);
            }
            players[0].troop.Position = startPos[0];

            //Generate basic spiders and set position
            int enemyNumber = Round * 2 + 10;

            List <Point> spawnPoints = map.DeterminSpawnPoint(enemyNumber,
                                                              SpawnType.randomLand);

            for (int i = 0; i < enemyNumber; i++)
            {
                string          name = $"Spider Warrior {i}";
                WarriorSpiderAI item = new WarriorSpiderAI(PlayerType.computer, name, map, new Player[] { player });
                item.troop = new Troop(name,
                                       new Weapon(1 + difficulty / 5 + Round / 2,
                                                  BaseAttackType.melee, BaseDamageType.sharp, 1, "Fangs", 1, false),
                                       Resources.spiderWarrior, 0, map, item, Dodge: 25);
                players.Add(item);
                players[i + 1].troop.Position = spawnPoints[i];
            }

            //Generate the spider nest
            //Choose the land tile which is the furthest away, which is sorrounded by land tiles and is a land tile
            Map _map = map;
            IOrderedEnumerable <MapTile> orderedEnumerable = map.map.Cast <MapTile>().ToList().Where(p => _map.map[p.position.X, p.position.Y].type.type == MapTileTypeEnum.land && _map.map[p.position.X, p.position.Y].neighbours.rawMaptiles.All(m => m.type.type == MapTileTypeEnum.land))
                                                             .OrderByDescending(p => (Math.Abs(p.position.X - player.troop.Position.X) + Math.Abs(p.position.Y - player.troop.Position.Y)));
            Point spawnPoint = orderedEnumerable.FirstOrDefault().position;

            SpiderNestAI item1 = new SpiderNestAI(PlayerType.computer, "Spider Nest", map, new Player[] { player }, difficulty, Round);
            item1.troop = new Troop("Spider Nest", null, Resources.spiderNest, 2, map, item1, 0)
            {
                Position = spawnPoint
            };
            players.Add(item1);

            #endregion Player Creation

            #region WinCodition Creation

            //Must kill spider nest to win

            WinCheck nestState = new WinCheck((__map, main) => !__map.troops.Exists(t => t.Name == "Spider Nest"));

            List <WinCheck> wins = new List <WinCheck>
            {
                nestState
            };
            desc += "Destroy the spider nest. ";

            #endregion WinCodition Creation

            #region DeathCondition Creation

            List <WinCheck> deaths = new List <WinCheck>
            {
                playerDeath
            };

            desc += "Do not die. ";

            #endregion DeathCondition Creation

            desc += "Good luck! ";
            return(players, wins, deaths, desc);
        }
Example #7
0
                         string description) GenerateMission(int difficulty, int Round, ref Map map, Player player)
        {
            string desc = "Welcome to an epic dragon fight! Reach the dragons nest to win! ";

            #region Player Creation

            List <Player> players = new List <Player>()
            {
                player
            };
            xp = (int)((player as HumanPlayer).levelXP * (World.World.random.NextDouble() + 2));

            //Set player position
            players[0].troop.Position = map.DeterminSpawnPoint(1, SpawnType.road)[0];

            //Find highest peak
            Point peak = map.DeterminSpawnPoint(1, SpawnType.heighestField)[0];

            //Create the nest
            Building egg = new Building("Nest", peak, Resources.DragonEggNest, map, true);
            map.entities.Add(egg);
            map.renderObjects.Add(new EntityRenderObject(egg, new TeleportPointAnimation(new Point(0, 0), egg.Position)));

            //Spawn dragon close to the highest peak
            Point dragonSpawn = new Point(peak.X + World.World.random.Next(3), peak.Y + World.World.random.Next(3));
            while (dragonSpawn.X >= map.map.GetUpperBound(0) && dragonSpawn.Y >= map.map.GetUpperBound(1))
            {
                dragonSpawn.X = dragonSpawn.X >= map.map.GetUpperBound(0) ? dragonSpawn.X - 1 : dragonSpawn.X;
                dragonSpawn.Y = dragonSpawn.Y >= map.map.GetUpperBound(1) ? dragonSpawn.Y - 1 : dragonSpawn.Y;
            }

            Dictionary <DamageType, double> vurn = new Dictionary <DamageType, double>
            {
                { DamageType.fire, 0 }
            };

            DragonMotherAI dragonMother = new DragonMotherAI(PlayerType.computer, "Dragon", map, new Player[] { player }, peak, Round, difficulty);

            dragonMother.troop = new Troop("Dragon",
                                           new Weapon(8 + difficulty / 4 + Round - 1,
                                                      BaseAttackType.melee, BaseDamageType.sharp, 3, "Claw", 1, false),
                                           Resources.Dragon, 0, map, dragonMother, Vurneabilities: vurn);

            players.Add(dragonMother);
            players[1].troop.Position = dragonSpawn;
            players[1].troop.weapons.Add(new Weapon(6 + difficulty / 3 + Round, BaseAttackType.melee, BaseDamageType.blunt, 6, "Tail", 1, false, 1));

            #endregion Player Creation

            #region WinCodition Creation

            List <WinCheck> wins = new List <WinCheck>
            {
                deathCheck,
                (_map, _main) =>
                {
                    return(AIUtility.Distance(_main.humanPlayer.troop.Position, peak) == 1);
                }
            };
            WinCheck fail = ((_map, main) => false);
            wins.Add(fail);

            #endregion WinCodition Creation

            #region DeathCondition Creation

            List <WinCheck> deaths = new List <WinCheck>
            {
                playerDeath
            };

            desc += "Do not die. ";

            #endregion DeathCondition Creation

            desc += "Good luck! ";
            return(players, wins, deaths, desc);
        }
    private IEnumerator GoEndScreen()
    {
        teamColor = (TeamColor)GameManager.Instance.PlayerTeam;
        if (teamColor == 0)
        {
            LogManager.Log("Team None. -> Team Blue");
            teamColor = TeamColor.Blue;
        }

        whitePanel.enabled = true;
        goIntroButton.gameObject.SetActive(true);

        WinCheck winCheckTemp = WhoIsWinner();

        RedCharacter.SetActive(false);
        BlueCharacter.SetActive(false);

        switch (teamColor)
        {
        case TeamColor.None:
            LogManager.Log("None Team");
            RedCharacter.SetActive(false);
            BlueCharacter.SetActive(false);
            break;

        case TeamColor.Red:
            LogManager.Log("Red Team");
            teamScoreText.enabled = true;
            RedCharacter.SetActive(true);
            if (winCheckTemp == WinCheck.RedWin)
            {
                testSoundSystem.PlayOneShotSFX(3);
                teamScoreText.text = redScore + "% 완성!";
                teamWin.enabled    = true;
                //PlayerWin();
            }
            else if (winCheckTemp == WinCheck.Draw)
            {
                testSoundSystem.PlayOneShotSFX(4);
                teamScoreText.text = redScore + "% 완성";
                teamDraw.enabled   = true;
                //PlayerLose();
            }
            else
            {
                testSoundSystem.PlayOneShotSFX(4);
                teamScoreText.text = redScore + "% 완성...";
                teamLose.enabled   = true;
                //PlayerLose();
            }
            break;

        case TeamColor.Blue:
            LogManager.Log("Blue Team");
            teamScoreText.enabled = true;
            BlueCharacter.SetActive(true);
            if (winCheckTemp == WinCheck.BlueWin)
            {
                testSoundSystem.PlayOneShotSFX(3);
                teamScoreText.text = blueScore + "% 완성!";
                teamWin.enabled    = true;
                //PlayerWin();
            }
            else if (winCheckTemp == WinCheck.Draw)
            {
                testSoundSystem.PlayOneShotSFX(4);
                teamScoreText.text = blueScore + "% 완성";
                teamDraw.enabled   = true;
                // PlayerLose();
            }
            else
            {
                testSoundSystem.PlayOneShotSFX(4);
                teamScoreText.text = blueScore + "% 완성...";
                teamLose.enabled   = true;
                // PlayerLose();
            }
            break;

        default:
            break;
        }
        yield return(null);
    }
Example #9
0
 void Start()
 {
     check = winCheck.GetComponent <WinCheck>();
 }