コード例 #1
0
 /**
  * takes the difference between the player and enemy result as an integer
  * and rolls one 6-sided dice to try and make up the difference. If
  * successful, gain back a life.
  */
 private static void UseFate(int diff)
 {
     if (fateTokens < 1)         // insuffienient fate tokens
     {
         Done = true;
         GameControl.AlternateTurnTracker();
         return;
     }
     Decision = "Would you like to use a fate token? (y/n)";
     if (AIDecideFate(diff))
     {
         var challenge = Random.Range(1, 7);
         var result    = challenge + diff;
         if (result >= 0)
         {
             GameControl.ChangeLives(1);
             Decision = "Fate token used and Successful! (rolled = " + challenge + ")";
         }
         else
         {
             Decision = "Fate token used and Unsuccessful (rolled = " + challenge + ")";
         }
         Done = true;
         GameControl.ChangeFate(-1);
         GameControl.AlternateTurnTracker();
     }
     else
     {
         Done = true;
         GameControl.AlternateTurnTracker();
     }
 }
コード例 #2
0
    private static int FightWerewolf()
    {
        // Two to determine its strength, one to determine its fight roll
        var warlockResult = Random.Range(1, 7) + Random.Range(1, 7) + Random.Range(1, 7);
        var playerResult  = GameControl.GetStrength() + Random.Range(1, 7);
        var diff          = playerResult - warlockResult;

        if (diff > 0)
        {
            AdventureDeck._deckText = "You fought the warlock and won (" + playerResult + " vs " + warlockResult + ")";
            Player.Done             = true;
            GameControl.AlternateTurnTracker();
        }
        else if (diff < 0)
        {
            AdventureDeck._deckText = "You fought the warlock and lost (" + playerResult + " vs " + warlockResult + ")";
            Player.Done             = false;
            GameControl.ChangeLives(-1);
        }
        else
        {
            AdventureDeck._deckText = "You fought the warlock and tied (" + playerResult + " vs " + warlockResult + ")";
            Player.Done             = true;
            GameControl.AlternateTurnTracker();
        }

        return(diff);
    }
コード例 #3
0
    /**
     * Enemy has a set strength. A die is rolled for the enemy and one for the player
     * and these are added to their strength to calculate fight results. If player
     * result is higher their strenght trophy is raised by the enemy strength and the
     * turn ends. If they lose, their lives are decremented. If they tie the turn ends.
     * Difference between fight results is returns for use with fate system.
     */
    private static int FightBandit(int bonus)
    {
        var enemyStrength = 4;
        var enemyResult   = enemyStrength + Random.Range(1, 7) + bonus;
        var playerResult  = GameControl.GetStrength() + Random.Range(1, 7);
        var diff          = playerResult - enemyResult;

        if (diff > 0)
        {
            _deckText = "You fought a bandit of strength 4 and won (" + playerResult + " vs " + enemyResult + ")";
            GameControl.ChangeStrengthTrophy(enemyStrength);
            Player.Done = true;
            GameControl.AlternateTurnTracker();
        }
        else if (diff < 0)
        {
            _deckText = "You fought a bandit of strength 4 and lost (" + playerResult + " vs " + enemyResult + ")";
            GameControl.ChangeLives(-1);
            Player.Done = false;
        }
        else
        {
            _deckText   = "You fought a bandit of strength 4 and tied (" + playerResult + " vs " + enemyResult + ")";
            Player.Done = true;
            GameControl.AlternateTurnTracker();
        }
        return(diff);
    }
コード例 #4
0
 /**
  * Called by Taketurn when the player lands on a heal space.
  * Asks the player if they'd like to pay to be healed.
  * If yes, makes the relevant changes to player stats.
  */
 private static void EncounterHealTile()
 {
     if (gold < 1)         // insufficient gold
     {
         GameControl.AlternateTurnTracker();
         return;
     }
     AdventureDeck._deckText = "Would you like to heal 1 life for 1 gold?";
     if (AIDecideHeal())
     {
         GameControl.ChangeLives(1);
         GameControl.ChangeGold(-2);
         GameControl.AlternateTurnTracker();
     }
     else
     {
         GameControl.AlternateTurnTracker();
     }
 }
コード例 #5
0
 /**
  * Called by TakeTurn when the player lands an armoury space.
  * Asks player whether they'd like to purchase improved armaments.
  * If player answers yes, makes relevant changes to player stats.
  */
 private static void EncounterArmouryTile()
 {
     if (gold < 2)         // insufficient gold
     {
         GameControl.AlternateTurnTracker();
         return;
     }
     AdventureDeck._deckText = "Would you like to improve your armaments for 2 gold?";
     if (AIDecideUpgradeArmoury())
     {
         GameControl.ChangeStrength(1);
         GameControl.ChangeGold(-1);
         GameControl.AlternateTurnTracker();
     }
     else
     {
         GameControl.AlternateTurnTracker();
     }
 }
コード例 #6
0
 /**
  * Called by Taketurn when the player lands on a heal space.
  * Asks the player if they'd like to pay to be healed.
  * If yes, makes the relevant changes to player stats.
  */
 private static void EncounterHealTile()
 {
     if (gold < 1)         // insufficient gold
     {
         GameControl.AlternateTurnTracker();
         return;
     }
     AdventureDeck._deckText = "Would you like to heal 1 life for 1 gold?";
     if (Input.GetKey(KeyCode.Y))
     {
         GameControl.ChangeLives(1);
         GameControl.ChangeGold(-1);
         GameControl.AlternateTurnTracker();
     }
     else if (Input.GetKey(KeyCode.N))
     {
         GameControl.AlternateTurnTracker();
     }
 }
コード例 #7
0
 /**
  * Called by TakeTurn when the player lands an armoury space.
  * Asks player whether they'd like to purchase improved armaments.
  * If player answers yes, makes relevant changes to player stats.
  */
 private static void EncounterArmouryTile()
 {
     if (gold < 2)         // insufficient gold
     {
         GameControl.AlternateTurnTracker();
         return;
     }
     AdventureDeck._deckText = "Would you like to improve your armaments for 2 gold?";
     if (Input.GetKey(KeyCode.Y))
     {
         GameControl.ChangeStrength(1);
         GameControl.ChangeGold(-2);
         GameControl.AlternateTurnTracker();
     }
     else if (Input.GetKey(KeyCode.N))
     {
         GameControl.AlternateTurnTracker();
     }
 }
コード例 #8
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);
    }
コード例 #9
0
 /**
  * The player turn's central method. Calls movement and then using the
  * player's current space as an identifier checks which method below
  * should be called next to get the correct method for that space,
  * and calls that.
  */
 public static void TakeTurn()
 {
     Move();
     if (Turns != BluePlayer.Turns)
     {
         return;
     }
     if (AdventureDeck.AllCardTiles.Contains(_startTileName))
     {
         DrawFromDeck();
     }
     else if (UniqueTiles.LifeLossDraw.Contains(_startTileName))
     {
         GameControl.ChangeLives(-1);
         DrawFromDeck();
     }
     else if (UniqueTiles.FightTiles.Contains(_startTileName))
     {
         EncounterUniqueFightTile();
     }
     else if (UniqueTiles.ArmouryTiles.Contains(_startTileName))
     {
         EncounterArmouryTile();
         ActionNeeded = false;
     }
     else if (UniqueTiles.HealTiles.Contains(_startTileName))
     {
         EncounterHealTile();
         ActionNeeded = false;
     }
     else if (UniqueTiles.Tiles.Contains(_startTileName))
     {
         UniqueTiles.ChooseTile(_startTileName);
         ActionNeeded = false;
         GameControl.AlternateTurnTracker();
     }
 }
コード例 #10
0
 private static void Talisman()
 {
     GameControl.GiveTalisman();
     _deckText = "You found a talisman!";
     GameControl.AlternateTurnTracker();
 }
コード例 #11
0
 private static void BagOfGold()
 {
     GameControl.ChangeGold(1);
     _deckText = "You found a bag of gold!";
     GameControl.AlternateTurnTracker();
 }