Ejemplo n.º 1
0
 public Fight(BaseCard card1, BaseCard card2)
 {
     this.cardPlayerOne        = card1;
     this.cardPlayerTwo        = card2;
     this.currentDamageCardOne = this.cardPlayerOne.damage;
     this.currentDamageCardTwo = this.cardPlayerTwo.damage;
 }
Ejemplo n.º 2
0
        public ArenaLog Fight(Player playerOne, Player playerTwo, Arena arena)
        {
            this.playerOne     = playerOne;
            this.playerTwo     = playerTwo;
            this.deckPlayerOne = playerOne.CurrentDeck;
            this.deckPlayerTwo = playerTwo.CurrentDeck;
            Fight  fight = new MTCG.Fight();
            Random rnd   = new Random();
            int    choosenCardPlayerOne = 0;
            int    choosenCardPlayerTwo = 0;

            while (this.Roundcount < RoundsMax)
            {
                ArenaLog.AddTextToLog("Round: " + Roundcount);
                if (!this.deckPlayerOne.Any())
                {
                    ArenaLog.AddTextToLog("--------------------------------------------------\n" + playerTwo.Username.ToUpper() + " leaves the Arena as Winner!\n--------------------------------------------------");
                    return(ArenaLog);
                }

                if (!this.deckPlayerTwo.Any())
                {
                    ArenaLog.AddTextToLog("--------------------------------------------------\n" + playerOne.Username.ToUpper() + " leaves the Arena as Winner!\n--------------------------------------------------");
                    return(ArenaLog);
                }
                this.cardsInDeckPlayerOne = this.deckPlayerOne.Count;
                this.cardsInDeckPlayerTwo = this.deckPlayerTwo.Count;

                ArenaLog.AddTextToLog("Cards in Deck Player One: " + cardsInDeckPlayerOne);
                ArenaLog.AddTextToLog("Cards in Deck Player Two: " + cardsInDeckPlayerTwo);

                choosenCardPlayerOne = rnd.Next(0, cardsInDeckPlayerOne);
                this.cardPlayerOne   = deckPlayerOne[choosenCardPlayerOne];

                choosenCardPlayerTwo = rnd.Next(0, cardsInDeckPlayerTwo);
                this.cardPlayerTwo   = deckPlayerTwo[choosenCardPlayerTwo];

                winnerCard = fight.FightRound(cardPlayerOne, cardPlayerTwo, arena);

                switch (winnerCard)
                {
                case WinnerCard.CardPlayerOne:
                {
                    deckPlayerOne.Add(deckPlayerTwo[choosenCardPlayerTwo]);
                    deckPlayerTwo.RemoveAt(choosenCardPlayerTwo);
                    break;
                }

                case WinnerCard.CardPlayerTwo:
                {
                    deckPlayerTwo.Add(deckPlayerOne[choosenCardPlayerOne]);
                    deckPlayerOne.RemoveAt(choosenCardPlayerOne);
                    break;
                }

                case WinnerCard.Draw:
                {
                    break;
                }
                }
                this.Roundcount++;
            }
            ArenaLog.AddTextToLog("--------------------------------------------------\nDraw! No Winner after 100 Rounds\n--------------------------------------------------");
            return(ArenaLog);
        }
Ejemplo n.º 3
0
        public WinnerCard FightRound(BaseCard cardPlayerOne, BaseCard cardPlayerTwo, Arena arena)
        {
            this.cardPlayerOne = cardPlayerOne;
            this.cardPlayerTwo = cardPlayerTwo;

            switch (this.cardPlayerOne.category)
            {
            case Category.Monster when this.cardPlayerTwo.category == Category.Monster:
            {
                this.currentDamageCardOne = this.cardPlayerOne.damage;
                this.currentDamageCardTwo = this.cardPlayerTwo.damage;
                arena.ArenaLog.AddTextToLog("Fight between two Monsters!");
                switch (this.cardPlayerOne.race)
                {
                case Race.Dragon when this.cardPlayerTwo.race == Race.Goblin:
                {
                    arena.ArenaLog.AddTextToLog("Goblin from " + arena.playerTwo.Username.ToUpper() + " is too afraid to attack the Dragon from " + arena.playerOne.Username.ToUpper());
                    this.fightResult = WinnerCard.CardPlayerOne;
                    break;
                }

                case Race.Goblin when this.cardPlayerTwo.race == Race.Dragon:
                {
                    arena.ArenaLog.AddTextToLog("Goblin from " + arena.playerOne.Username.ToUpper() + " is too afraid to attack the Dragon from " + arena.playerTwo.Username.ToUpper());
                    this.fightResult = WinnerCard.CardPlayerTwo;
                    break;
                }

                case Race.Wizzard when this.cardPlayerTwo.race == Race.Orc:
                {
                    arena.ArenaLog.AddTextToLog("Wizzard from " + arena.playerOne.Username.ToUpper() + " controls the Orc from " + arena.playerTwo.Username.ToUpper());
                    this.fightResult = WinnerCard.CardPlayerOne;
                    break;
                }

                case Race.Orc when this.cardPlayerTwo.race == Race.Wizzard:
                {
                    arena.ArenaLog.AddTextToLog("Wizzard from " + arena.playerTwo.Username.ToUpper() + " controls the Orc from " + arena.playerOne.Username.ToUpper());
                    this.fightResult = WinnerCard.CardPlayerTwo;
                    break;
                }

                case Race.Elve when this.cardPlayerTwo.race == Race.Dragon:
                {
                    if (this.cardPlayerOne.element == Element.Fire)
                    {
                        arena.ArenaLog.AddTextToLog("FireElve from " + arena.playerOne.Username.ToUpper() + " evede the attack from " + arena.playerTwo.Username.ToUpper() + "'s Dragon");
                        this.fightResult = WinnerCard.CardPlayerOne;
                        break;
                    }
                    else
                    {
                        this.fightResult = CheckWinner(arena);
                        break;
                    }
                }

                case Race.Dragon when this.cardPlayerTwo.race == Race.Elve:
                {
                    if (this.cardPlayerTwo.element == Element.Fire)
                    {
                        arena.ArenaLog.AddTextToLog("FireElve from " + arena.playerTwo.Username.ToUpper() + " evede the attack from " + arena.playerOne.Username.ToUpper() + "'s Dragon");
                        this.fightResult = WinnerCard.CardPlayerTwo;
                        break;
                    }
                    else
                    {
                        this.fightResult = CheckWinner(arena);
                        break;
                    }
                }

                default:
                {
                    this.fightResult = CheckWinner(arena);
                    break;
                }
                }
                return(this.fightResult);
            }

            case Category.Monster when this.cardPlayerTwo.category == Category.Spell:
            {
                arena.ArenaLog.AddTextToLog("Fight between one Monster and one Spell!");
                fightResult = MonsterVsSpell(arena);
                switch (this.fightResult)
                {
                case WinnerCard.CardPlayerOne:
                {
                    break;
                }

                case WinnerCard.CardPlayerTwo:
                {
                    break;
                }

                case WinnerCard.Draw:
                {
                    CheckElement();
                    this.fightResult = CheckWinner(arena);
                    break;
                }
                }
                return(this.fightResult);
            }

            case Category.Spell when this.cardPlayerTwo.category == Category.Monster:
            {
                arena.ArenaLog.AddTextToLog("Fight between one Spell and one Monster!");
                fightResult = MonsterVsSpell(arena);
                switch (this.fightResult)
                {
                case WinnerCard.CardPlayerOne:
                {
                    break;
                }

                case WinnerCard.CardPlayerTwo:
                {
                    break;
                }

                case WinnerCard.Draw:
                {
                    CheckElement();
                    this.fightResult = CheckWinner(arena);
                    break;
                }
                }
                return(this.fightResult);
            }

            case Category.Spell when this.cardPlayerTwo.category == Category.Spell:
            {
                arena.ArenaLog.AddTextToLog("Fight between two Spells!");
                CheckElement();
                this.fightResult = CheckWinner(arena);
                return(this.fightResult);
            }

            default:
            {
                return(this.fightResult);
            }
            }
        }