private TextBox MakeDetailsBox(Card.PokemonCard card) { TextBox newTextBox = new TextBox(); newTextBox.Multiline = true; newTextBox.Size = new System.Drawing.Size(245, 500); newTextBox.AppendText("Name: " + card.Name + Environment.NewLine); newTextBox.AppendText("Stage: " + card.Stage + Environment.NewLine); newTextBox.AppendText("HP: " + card.HP.ToString() + Environment.NewLine); newTextBox.AppendText("Type: " + card.PokemonType.ToString() + Environment.NewLine); newTextBox.AppendText("Ability Name: " + card.AbilityName + Environment.NewLine); newTextBox.AppendText("Ability Text: " + card.AbilityText + Environment.NewLine); newTextBox.AppendText("Moves: " + Environment.NewLine); foreach(Move move in card.MoveData) { newTextBox.AppendText(move.ToString() + Environment.NewLine); } newTextBox.AppendText("Weakness Type: " + card.WeaknessType.ToString() + Environment.NewLine); newTextBox.AppendText("Weakness Amount: " + card.WeaknessAmount + Environment.NewLine); newTextBox.AppendText("Resistance Type: " + card.ResistanceType.ToString() + Environment.NewLine); newTextBox.AppendText("Resistance Amount: " + card.ResistanceAmount + Environment.NewLine); newTextBox.AppendText("Retreat Cost: " + card.RetreatCost.ToString() + Environment.NewLine); newTextBox.AppendText("Card Set: " + card.CardSet + Environment.NewLine); newTextBox.AppendText("Card Number: " + card.CardNumber + Environment.NewLine); newTextBox.AppendText("Rarity: " + card.CardRarity.ToString() + Environment.NewLine); newTextBox.AppendText("Illustrator: " + card.Illustrator + Environment.NewLine); newTextBox.AppendText("Price: " + card.CardPrice); return newTextBox; }
public void burn(Card input) { //If tails. zero is tails by convention if (flipCoin() == 0) { input.HP -= 20; } }
public void addCard(Card card) { if (counter < this.max - 1) { this.hnd[counter] = card; } else { //Tell the game somehow that the hand is full } }
//overloaded it incase the calling method knows which card it wants. public Card chooseCard() { /* Get choosecard to show us the cards in Hand, * use the index it returns to get that card and store it temporarly * Remove that card from hand and return it to the calling method */ int intTemp = Program.choosecard(this.hnd); temp = hnd[intTemp]; removeCard(intTemp); return temp; }
public Card chooseCard(int index) { //Check if the card it wants is valid if (hnd[index] != null) { temp = hnd[index]; removeCard(index); return temp; } else { //Someway to tell the calling method this is not vaild //Since the contrustor isn't called, it will return a card that is null return errCard; } }
/// <summary> /// Checks that the evolution is valid /// </summary> /// <param name="from">The card that is in play</param> /// <param name="to">The card you want to evolve to</param> /// <returns>True or false</returns> public bool validEvol(Card from, Card to) { foreach (int i in to.evolvesFrom) { if (i == from.pNum) return true; } //if none of the values of evolves from match the pokemon number of the input. return false; }
public void setActPkm(List<Card> input, int index) { this.actPkm = input[index]; input.RemoveAt(index); }
private void check(Card card) { throw new NotImplementedException(); }
public void paralyzed(Card input) { throw new System.NotImplementedException(); }
public void discard(Card c) { //Probably passing in the actPKM in this case move(c, Discarded); }
/// <summary> /// Check if the input the calling method wants is valid, /// if it is, the input is removed from the source list and /// returned /// </summary> /// <param name="index">The index of the input in question</param> /// <returns>The chosen input or null if there is an error</returns> public Card chooseCard(int index) { //Check if the input it wants is valid if (Hand[index] != null) { temp = Hand[index]; this.Hand.RemoveAt(index); return temp; } else { //Someway to tell the calling method this is not vaild //Since the contrustor isn't called, it will return a input that is null return null; } }
/// <summary> /// Presents a menu with the availible cards in the source list /// </summary> /// <param name="source">A List</param> /// <returns>A input</returns> public Card chooseCard(List<Card> source) { /* Get choosecard to show us the cards in Hand, * use the index it returns to get that input and store it temporarly * Remove that input from hand and return it to the calling method */ int intTemp = gInstance.choosecard(source); temp = source[intTemp]; source.RemoveAt(intTemp); return temp; }
public void attachEnergy(Card c, List<Card> source) { //Predicate is a method that will return true or flase based on the passed in input Predicate<Card> energy = new Predicate<Card>(isEnergy); //If an energy input exists in the source: if(source.Exists(energy)) { //Keeps track of the index of the input in the array int i = 0; //Keeps track of the number of energies in the players hand. int j = 0; //Takes the return from getValidInput(); int chosen = 0; Console.WriteLine("Pick an energy:"); foreach (Card lCard in source) //I know that is a weird variable name but I was hoping to keep it from being confusing { i++; if(isEnergy(lCard)) { j++; Console.WriteLine("{0}: {1}", i, lCard.Name); } } chosen = gInstance.getValidUserInput(0,j); move(source, chosen, c.attached); } else { Console.WriteLine("You have no enegeries in your hand"); } }
//This is a repeat of makeActPKM? public void addCard(Card card) { this.Hand.Add(card); }
private bool isEnergy(Card c) { if (c.stage == Enums.Stage.Energy) { return true; } //Else return false; }
//Player may get a key section for encrypting and decryting keys //Methods //Constructor public Player(string name, Card[] deck, Game gInst) { this.name = name; this.deck = new Deck(); this.deck.AddRange(deck); }
/// <summary> /// Calls the deck /// </summary> /// <returns></returns> public bool draw(out Card draw) { bool tmpReturn = deck.draw(out draw); return tmpReturn; }
public void confused(Card input) { throw new System.NotImplementedException(); }
public bool isBasic(Card c) { return (c.stage == Enums.Stage.Basic); }
public void poisoned(Card input) { //Subtract ten from the Cards health input.HP -= 10; }
public bool isStage(Card c, Enums.Stage stage) { //Return whatever this expression evaluates to (true or false) return (c.stage == stage); }
//This might be a confusing name, since status like burn and such need to be implemented as well public string getStatus(Card c) { string status = c.Name + " || HP: " + c.HP + " Status: " + c.Status; return status; }
//This method seems useless however it is also used for active pokemon which is a input type instead of a list //Therefore it's usefull there. public void move(Card c, List<Card> dest) { dest.Add(c); c = null; //Are objects passed by ref in C#? //Todo: find out }
private Card[] intArrayDeck(int[] intDeck) { int Size = intDeck.Length; Card[] deck = new Card[Size]; //TODO: If mongo can't connect for some reason find out why and correct the issue, //To improve performance and to ensure that we don't run out of connections //A universal connection is created outside the loop, then closed after the deck is created. //Instanate the connection MongoDataStore ms = new MongoDataStore(); try { ms.connect(); deck = ms.getCardArray(intDeck).ToArray(); //TODO: Figure out why this method (intArrayDeck) returns a Card array instead of a list? } catch (Exception e) { Console.WriteLine("Error: Unable to connect to the database, please try again."); deck = null; System.Environment.Exit(-1); } ms.disconnect(); return deck; }
//Todo: Fix this method; it assumes that the only thing that can be attached is energies. //Realized you can only retreat the actPKm so no point having parameters :P public bool retreat() { //Check if the retreat cost can be met if (actPkm.attached.Count > actPkm.retreatCost) { //If it can remove the number of cards from the attached for (int i = 0; i < actPkm.retreatCost; i++) { move(actPkm.attached, 0, Discarded); //Move the first input from the attached array to discarded. } //Move the input to the bench move(actPkm, Bench); actPkm = null; return true; //<-- The operation was sucsessful } else { return false; //<-- The requirements for the retreat cost were not met } }