Example #1
0
    public void ResolveFight(uint playerDamage, IEnumerable <DamageCard> playedCards)
    {
        Debug.Log("Resolving");
        foreach (DamageCard card in playedCards)
        {
            GameSystem.Instance.CurrentPlayer.RemoveCard(card);
        }
        uint extraPlayerDamage = (uint)playedCards.Sum(x => x.Damage);
        uint finalPlayerDamage = playerDamage + extraPlayerDamage;
        uint opponentDamage    = this.Opponent.fish.RollDamage();

        ConsoleLog.AddToLog($"{this.Opponent.fish.name} uses {this.Opponent.fish.AttackName}");
        ConsoleLog.AddToLog($"{this.Opponent.name}'s {this.Opponent.fish.name} has rolled a total of {opponentDamage}.");
        ConsoleLog.AddToLog($"{GameSystem.Instance.CurrentPlayer} uses {GameSystem.Instance.CurrentPlayer.SelectedFish.AttackName}");
        ConsoleLog.AddToLog($"{GameSystem.Instance.CurrentPlayer}'s {GameSystem.Instance.CurrentPlayer.SelectedFish.name} has an attack of {finalPlayerDamage}.");
        if (opponentDamage > finalPlayerDamage)
        {
            ConsoleLog.AddToLog($"{GameSystem.Instance.CurrentPlayer}'s {GameSystem.Instance.CurrentPlayer.SelectedFish.name} has been KO'd.");
            GameSystem.Instance.CurrentPlayer.LostFight();
        }
        else
        {
            ConsoleLog.AddToLog($"{GameSystem.Instance.CurrentPlayer.Name} has won the game!");
        }

        Debug.Log("BACK2MENU");
        this._menuHandler.BackToMenu();
        GameSystem.Instance.NextPlayer();
    }
Example #2
0
    private void EndCatchEvent()
    {
        ICard playedCard = GameSystem.Instance.CurrentPlayer.Cards.FirstOrDefault(x => x.Name == this.dropdownCards.captionText.text);
        uint  finalRoll  = this.rollNumber;

        if (null != playedCard)
        {
            ConsoleLog.AddToLog($"Removed card {playedCard.Name}");
            GameSystem.Instance.CurrentPlayer.RemoveCard(playedCard);
            if (playedCard is CatchingCard cc)
            {
                foreach (int bonus in cc.RollBonus)
                {
                    if (this.fishToCatch.WouldCatch(this.rollNumber + (uint)bonus))
                    {
                        finalRoll = this.rollNumber + (uint)bonus;
                        break;
                    }
                }
            }
        }

        if (this.fishToCatch.WouldCatch(finalRoll))
        {
            ConsoleLog.AddToLog($"<color=blue>{GameSystem.Instance.CurrentPlayer.Name} caught a " + this.fishToCatch.Name + "!</color>");
            GameSystem.Instance.CurrentPlayer.AddFish(this.fishToCatch);
        }
        else
        {
            ConsoleLog.AddToLog("<color=maroon>Despite your best efforts " + this.fishToCatch.Name + " got away!</color>");
        }
        GameSystem.Instance.NextPlayer();
        this._defaultScreen.SetActive(true);
        this._catchFishCanvas.SetActive(false);
    }
Example #3
0
 public void NewOpponent()
 {
     this.Opponent = this.ChooseRandomTrainer();
     ConsoleLog.AddToLog($"You're fighting {this.Opponent.name}'s {this.Opponent.fish.name} with your {GameSystem.Instance.CurrentPlayer.SelectedFish.Name}.");
     this._playerRoll      = this.RollPlayer();
     this._rolledText.text = this._playerRoll.ToString();
     this._playerFishInfoCard.ShowFish(GameSystem.Instance.CurrentPlayer.SelectedFish, false);
     this._playerFishText.text = $"{GameSystem.Instance.CurrentPlayer.Name}'s fish";
     this._opponentFishInfoCard.ShowFish(this.Opponent.fish, true);
     this._opponentFishText.text = $"{this.Opponent.name}'s fish";
     Debug.Log("State " + GameSystem.Instance.CurrentState);
     //this.updateCardList.GetComponent<UpdateCardList>().updateList();
 }
Example #4
0
        public void On_Click()
        {
            if (Random.Range(0f, 1f) > this._percChanceToFindCard)
            {
                ConsoleLog.AddToLog($"{GameSystem.Instance.CurrentPlayer.Name} found no card.");
                GameSystem.Instance.NextPlayer();
                return;
            }
            Card c = this._holder.RandomCard();

            GameSystem.Instance.CurrentPlayer.AddCard(c);
            ConsoleLog.AddToLog($"{GameSystem.Instance.CurrentPlayer.Name} found {c.Name}.");
            GameSystem.Instance.NextPlayer();
        }
 public void Test()
 {
     this._fishHolder.RandomFish();
     ConsoleLog.AddToLog("Hello " + Time.time);
 }