Example #1
0
        //Proper input method.
        public Card(int BOGUS_ID, string name, int HP, string stage, string Weakness, string Resistance, string type, Attack[] atk, string[] evolvesInto, string[] evolvesFrom, int pNum)
        {
            this.BOGUS_ID = BOGUS_ID;
            this.Name = name;
            this.HP = HP;
            this.Stage = stage;
            this.Weakness = Weakness;
            this.Resistance = Resistance;
            this.Type = type;
            this.atk = atk;

            //Evolution parsers TODO: Just accept an Int array
        }
Example #2
0
        public int getAttack(Attack atk)
        {
            int atkVal = 0;
            if (atk.damage.EndsWith("x"))
            {
                int tempAtk = int.Parse(atk.damage.Substring(0, 2));
                int tempFlip = 0;
                bool doFlip = true;

                while (doFlip)
                {
                    //Random should generate 0 or 1,
                    //If the random number is 1
                    if (rnd.Next(0,2) == 1)
                    {
                        //Add one to the number of flips
                        tempFlip = tempFlip + 1;
                    }
                    else
                    {
                        //Otherwise
                        doFlip = false;
                    }
                }

                atkVal = tempAtk * tempFlip;
                return atkVal;
            }
            else
            {
                return int.Parse(atk.damage);
            }
        }