Ejemplo n.º 1
0
        public void TCGMenu(Player curPlayer, Player otherPlayer)
        {
            //If the player hasn't drawn yet (this turn):
            if (curPlayer.hasDrawn == false)
            {
                //Deck will return the topmost input in the deck so add it to the Hand (straight forward)
                Card tmp; //I hate temp variables but what can you do
                if (curPlayer.draw(out tmp))
                {
                    curPlayer.Hand.Add(tmp); //<-- If the player can't draw they lose (TODO: implement (proably using out)
                }
                else
                {
                    //TODO: What happens when the player loses
                }
                //Set player hasDrawn to true so that they don't draw again.
                curPlayer.hasDrawn = true; //<--TODO: replace these with a state machine?

                //Print the name of the input they drew.
                Console.WriteLine("{0} drew {1}", curPlayer.getName(), curPlayer.getLastCard().Name);
            }

            do
            {
                done = false; //The menu loops until the player is done.
                if (curPlayer.actPkm == null)
                {
                    Console.WriteLine("[{0}]", curPlayer.getName());
                    Console.WriteLine("Please pick an active Pokemon:");
                    curPlayer.setActPkm(curPlayer.Hand, choosecard(curPlayer.Hand));

                }

                Console.WriteLine("[{0}, Active PKM: {1}]", curPlayer.getName(), getStatus(curPlayer.actPkm));
                Console.WriteLine("1. Hand\t 2. Check\t 3.Retreat");
                Console.WriteLine("4. Attack\t 5.Pkmn Power\t 6.Done");
                switch (getValidUserInput(1, 7)) //7 is secret trainer.
                {
                    case 1: //If the user picks Hand
                        menu_Hand(curPlayer);
                        break;

                    case 2: //If the user picks Check
                        //Show the user data on whatever input they choose?
                        break;

                    case 3: //If the user picks Retreat
                        //Check if the user can ever retreat
                        if (curPlayer.retreat()) //If the retreat is sucsessful
                        {
                            Console.WriteLine("Card retreated, please pick a new active pokemon");
                            //Chose a input from player 1s hand
                            curPlayer.setActPkm(curPlayer.Bench, choosecard(curPlayer.Bench));
                        }
                        else
                        {
                            Console.WriteLine("Sorry, you don't have enough energies to retreat");
                        }
                        break;

                    case 4: //If the user picks Attack
                        //Make sure they have an active pokemon
                        if (curPlayer.actPkm == null)
                        {
                            //if the user doesn't have an active pokemon
                            //Tell them they are a dumbass
                            Console.WriteLine("You need to have an active pokemon to attack");
                        }
                        else
                        {
                            //Let the user pick an attack
                            Console.WriteLine("0: {0}, Damage: {1}", curPlayer.actPkm.atk[0].name, curPlayer.actPkm.atk[0].damage);
                            if (curPlayer.actPkm.atk[1] != null)
                            {
                                Console.WriteLine("1: {0}, Damage: {1}", curPlayer.actPkm.atk[1].name, curPlayer.actPkm.atk[1].damage);
                            }
                            int chosen = getValidUserInput(0, 1);
                            if (curPlayer.actPkm.meetsCrit(curPlayer.actPkm.atk[chosen].requirements))
                            {
                                //They have enough energies execute that b**ch
                                //TODO: Extract this out to a method, directly subtracting the damage in the game loop prevents
                                //us from hooking an event in here (for example a pokemon power)
                                otherPlayer.actPkm.HP -= curPlayer.actPkm.getAttack(chosen);
                                //If the damage done is 0 it should say "But it failed" after this
                                Console.WriteLine("{0} used {1}!", curPlayer.actPkm.Name, curPlayer.actPkm.atk[chosen].name);

                                if (otherPlayer.actPkm.HP <= 0)
                                {
                                    //Bitch fainted. TODO handle it.
                                    //Player 2's activePkm goes to discarded pile
                                    otherPlayer.discard(otherPlayer.actPkm);

                                    //You get to draw a prize
                                    if (curPlayer.Prizes.Count > 0)
                                    {
                                        curPlayer.Hand.Add(curPlayer.drawPrize());
                                    }
                                    else
                                    {
                                        //You win
                                        gameInPlay = false;
                                        Console.WriteLine("You win {0}!", curPlayer.getName());
                                    }

                                    //If the other player doesn't have any cards on their bench
                                    if (otherPlayer.Bench.Count == 0)
                                    {
                                        //You win.
                                        gameInPlay = false;
                                        Console.WriteLine("You win {0}!", curPlayer.getName());
                                    }
                                    //else do nothing but end the turn
                                }
                                done = true;
                            }
                            else
                            {
                                //Remind the user that they were an accident in life
                                Console.WriteLine("Sorry you don't have enough energies to execute this attack");
                            }

                            /* I like this code sinpette for some reason.
                            // if (atk[1] != null) { atk = getValidUserInput(0, 1)} else {atk = getValidUserInput(0, 0)}
                                int atk = curPlayer.actPkm.atk[1] != null ? getValidUserInput(0, 1) : getValidUserInput(0, 0);
                                */

                        }

                        //Check if they have enough energies to make the attack
                        //If they do execute the attack

                        //End their turn
                        //else tell them they are a dumbass and go back to the menu
                        break;

                    case 5: //Pokemon Power
                        //Not Implemented Yet
                        break;

                    case 6: //Done
                        done = true;
                        break;

                    case 7: //Trainer
                        exTrainer(scriptPath, curPlayer, otherPlayer, this);
                        break;

                }
            } while (!done);
            //Reset the turn variables
            curPlayer.hasDrawn = false;
            curPlayer.isFirstEnergy = true;
        }
Ejemplo n.º 2
0
        public void setup(Player currentPlayer)
        {
            //Shuffle the opponets deck
            currentPlayer.shuffleDeck();

            //Draw seven cards
            currentPlayer.draw(7);

            //Check that the user got some basics in the draw
            //While the current player doesn't have any basics in their hand
            while (!(currentPlayer.Hand.Exists(p => p.stage == Enums.Stage.Basic)))
            {
                Console.WriteLine("You have no basic cards in your hand; a new hand will be drawn");
                currentPlayer.deck.AddRange(currentPlayer.Hand);
                currentPlayer.Hand.Clear();
                currentPlayer.deck.shuffle();
                currentPlayer.draw(7);

                //Offer player 2 two more cards
                //TODO: ^
            }

            //Place Prizes
            currentPlayer.initPrizes(6);

            //Pick a basic pokemon (Hand to active)
            int choosen = 0;
            Card chsn;
            bool bench = true;
            bool bCont = true;

            // The user wants to put cards in their bench
            /* --- Code beyond this point is a cluster**** and I barely know what it does anymore :/ --- */
            while (bench == true)
            {
                Console.WriteLine("Please select a input to put on your bench (" + currentPlayer.getName() + ")");

                if (choosen != -1)
                {
                    do
                    {
                        int check = choosecard(currentPlayer.Hand);
                        if (currentPlayer.Hand[check] == null || currentPlayer.Hand[check].Stage != "Basic")
                        {
                            Console.WriteLine("The selection was invalid, please slect a basic pokemon");
                        }
                        else
                        {
                            currentPlayer.move(currentPlayer.Hand, check, currentPlayer.Bench);
                            bCont = false;
                        }
                    } while (bCont);
                }
                else if (choosen == -1)
                {
                    bench = false;
                    break;
                }
                Console.WriteLine("Would you like to put another input on the bench?");
                string inputCs = Console.ReadLine();

                //Convert the input to lowercase so that we have less possibilties that they can enter.
                if (inputCs.ToLower() == "no" | inputCs.ToLower() == "n")
                {
                    bench = false;
                }
            }

            //Tell the player to select an active pokemon
            Console.WriteLine("Please select an active pokemon");

            //Call the overloaded chooseCard method which will iterate the cards in the source (bench)
            currentPlayer.setActPkm(currentPlayer.Bench, choosecard(currentPlayer.Bench));

            //choosecard method will be launched before the setActPKM command
            currentPlayer.isFirstTurn = false;

            //Up to 5 basic pkm on the bench

            //Flip coin
            //--Heads player1, Tails Player2
        }