Example #1
0
    /**
     * roll a die an incur an effect accordinly
     */
    private static void Tavern()
    {
        var result = Random.Range(1, 7);

        if (result <= 2)
        {
            FightGenericEnemy();
        }
        else if (result == 3)
        {
            GameControl.ChangeGold(-1);
            AdventureDeck._deckText = "You gambled and lost 1 gold";
        }
        else if (result >= 4 && result <= 5)
        {
            GameControl.ChangeGold(1);
            AdventureDeck._deckText = "You gambled and gained 1 gold";
        }
        else
        {
            if (GameControl.TurnTracker == 0)
            {
                BluePlayer.MoveRegion("M", 16, "M13");
            }
            else
            {
                YellowPlayer.MoveRegion("M", 16, "M13");
            }
            AdventureDeck._deckText = "You rolled a 6 and were transported to the temple";
        }
    }
 /**
  * Resets the game
  */
 public static void EndGame()
 {
     if (BluePlayer.lives < 1)
     {
         YellowPlayer.Wins += 1;
     }
     else
     {
         BluePlayer.Wins += 1;
     }
     AdventureDeck._deckText = "Game ended and reset";
     BluePlayer.MoveRegion("O", 24, "O1");
     BluePlayer.lives          = Player.StartingLives;
     BluePlayer.strength       = Player.StartingStrength;
     BluePlayer.strengthTrophy = 0;
     BluePlayer.fateTokens     = Player.StatingFateTokens;
     BluePlayer.gold           = Player.StartingGold;
     BluePlayer.alignment      = "";
     BluePlayer.Turns          = 0;
     YellowPlayer.MoveRegion("O", 24, "O13");
     YellowPlayer.lives          = Player.StartingLives;
     YellowPlayer.strength       = Player.StartingStrength;
     YellowPlayer.strengthTrophy = 0;
     YellowPlayer.fateTokens     = Player.StatingFateTokens;
     YellowPlayer.gold           = Player.StartingGold;
     YellowPlayer.alignment      = "";
     YellowPlayer.Turns          = 0;
     SetAlignments();
     TurnCount          = 0;
     DiceRoll.RollCount = 0;
     TurnTracker        = 0;
 }
    /**
     * Calls the respective player's TakeTurn method based on the
     * TurnTracker value. Called in this class's Update method.
     */
    private static void Main()
    {
        switch (TurnTracker)
        {
        case 0:
            BluePlayer.TakeTurn();
            break;

        case 1:
            YellowPlayer.TakeTurn();
            break;
        }
    }
Example #4
0
    /**
     * Roll 2 dice and compare to player strength. Will be teleported based on result
     */
    private static void MinesCrypt()
    {
        var result = Random.Range(1, 7) + Random.Range(1, 7) + Random.Range(1, 7) - GameControl.GetStrength();

        if (GameControl.TurnTracker == 0)
        {
            if (result == 1)
            {
                BluePlayer.MoveRegion("I", 8, "I1");
                AdventureDeck._deckText = "result of 1: transported to plain of peril";
            }
            else if (result >= 2 && result <= 3)
            {
                BluePlayer.MoveRegion("M", 16, "M1");
                AdventureDeck._deckText = "result of 2-3: transported to the portal of power";
            }
            else if (result >= 4 && result <= 5)
            {
                BluePlayer.MoveRegion("M", 16, "M9");
                AdventureDeck._deckText = "result of 4-5: transported to the warlock's cave";
            }
            else if (result >= 6)
            {
                BluePlayer.MoveRegion("O", 24, "O19");
                AdventureDeck._deckText = "result of 6+: transported to the tavern";
            }
        }
        else
        {
            if (result == 1)
            {
                YellowPlayer.MoveRegion("I", 8, "I1");
                AdventureDeck._deckText = "result of 1: transported to plain of peril";
            }
            else if (result >= 2 && result <= 3)
            {
                YellowPlayer.MoveRegion("M", 16, "M1");
                AdventureDeck._deckText = "result of 2-3: transported to the portal of power";
            }
            else if (result >= 4 && result <= 5)
            {
                YellowPlayer.MoveRegion("M", 16, "M9");
                AdventureDeck._deckText = "result of 4-5: transported to the warlock's cave";
            }
            else if (result >= 6)
            {
                YellowPlayer.MoveRegion("O", 24, "O19");
                AdventureDeck._deckText = "result of 6+: transported to the tavern";
            }
        }
    }
Example #5
0
 /**
  * Checks if the player has a talisman. If so, transport them to Crown of Command
  */
 private static void ValleyOfFire()
 {
     if (!GameControl.CheckTalisman())
     {
         return;
     }
     if (GameControl.TurnTracker == 0)
     {
         BluePlayer.MoveRegion("C", 1, "C1");
     }
     else
     {
         YellowPlayer.MoveRegion("C", 1, "C1");
     }
     Crown();
 }
Example #6
0
 /**
  * Roll 2 dice. If the result is less than the player's strength, transport them
  * to the Plain of Peril
  */
 private static void PortalOfPower()
 {
     if (Random.Range(1, 7) + Random.Range(1, 7) <= GameControl.GetStrength())
     {
         AdventureDeck._deckText = "successful roll - transported to Plain of Peril";
         if (GameControl.TurnTracker == 0)
         {
             BluePlayer.MoveRegion("I", 8, "I1");
         }
         else
         {
             YellowPlayer.MoveRegion("I", 8, "I1");
         }
     }
     else
     {
         AdventureDeck._deckText = "Unsuccessful roll";
     }
 }
Example #7
0
    /**
     * Fight the sentinal and if won, cross into the middle region
     */
    private static int FightSentinal()
    {
        var sentinalStrength = 8;
        var SentinalResult   = sentinalStrength + Random.Range(1, 7);
        var playerResult     = GameControl.GetStrength() + Random.Range(1, 7);
        var diff             = playerResult - SentinalResult;

        if (diff > 0)
        {
            AdventureDeck._deckText =
                "You fought the sentinal and won (" + playerResult + " vs " + SentinalResult + ")";
            if (GameControl.TurnTracker == 0)
            {
                BluePlayer.MoveRegion("M", 16, "M4");
            }
            else
            {
                YellowPlayer.MoveRegion("M", 16, "M4");
            }
            Player.Done = true;
            GameControl.AlternateTurnTracker();
        }
        else if (diff < 0)
        {
            AdventureDeck._deckText =
                "You fought the sentinal and lost (" + playerResult + " vs " + SentinalResult + ")";
            Player.Done = false;
            GameControl.ChangeLives(-1);
        }
        else
        {
            AdventureDeck._deckText =
                "You fought the sentinel and tied (" + playerResult + " vs " + SentinalResult + ")";
            Player.Done = true;
            GameControl.AlternateTurnTracker();
        }

        return(diff);
    }
Example #8
0
        private TestPlayer NewPlayerFromBasePlayer(TestPlayer c)
        {
            TestPlayer r    = c;
            bool       init = false;

            switch (c.Character)
            {
            case Character.Blue:
                break;

            case Character.Green:
                break;

            case Character.Grey:
                break;

            case Character.Red:
                r    = new RedPlayer($"#player{c.AssociatedPlayer}", new Position(200, 200), @"C\Chars\Red\w_0_1");
                init = true;
                break;

            case Character.White:
                break;

            case Character.Yellow:
                r    = new YellowPlayer($"#player{c.AssociatedPlayer}", new Position(200, 200), @"C\Chars\Yellow\w_0_0");
                init = true;
                break;
            }
            if (init != false)
            {
                r.FollowCamera     = true;
                r.AssociatedPlayer = c.AssociatedPlayer;
                r.Initialize();
            }
            return(r);
        }