Example #1
0
        public virtual int attack(pokemon Ennemy)
        {
            Random rand = new Random(DateTime.Now.Millisecond);
            float attackbasedmg = 1;
            float dmg;
            float multip;   // multip = stab*type*crit*other*rng
            float stab = 1;  //STAB is the same-type attack bonus. This is equal to 1.5 if the attack is of the same type as the user, and 1 if otherwise.
            float type = 1;  //Type is the type effectiveness. This can be either 0, 0.25, 0.5, 1, 2, or 4 depending on the type of attack and the type of the defending Pokémon.
            float crit=1;   //Critical is 2 for a critical hit in Generations I - V, 1.5 for a critical hit in Generation VI, and 1 otherwise.
            float other = 1;  //other counts for things like held items, Abilities, field advantages, and whether the battle is a Double Battle or Triple Battle or not.
            float rng = (float)(rand.Next(85,100)) / 100;  //random is a random number from 0.85 to 1.00.

            multip = stab*type*crit*other*rng;

            if (attacktype == 1)
            {
                dmg = ((2 * 100 + 10) / 250) * (Ennemy.Att / this.Def) * (attackbasedmg) * multip; // * basedmg
            }
            else if (attacktype == 2)
            {
                dmg = ((2 * 100 + 10) / 250) * (Ennemy.Attsp / this.Defsp) * (attackbasedmg) * multip; // * basedmg
            }
            else
            {
                dmg = 0;
            }
            return Convert.ToInt32(dmg);
        }
Example #2
0
 public virtual void Dmgreceive(pokemon Ennemy)
 {
 }