Ejemplo n.º 1
0
        /// <summary>
        /// Does damage to the target based on stats and attack power and hidden move type and also STAB
        /// </summary>
        /// <param name="attack"></param>
        /// <param name="target"></param>
        public void doHiddenPowerDamageTo(ActiveMove attack, BattlePokemon target)
        {
            double dDamage = 0.0;
            int    damage  = 0;
            //only this part changes for hidden power
            double strength = TypeStrengths.typeStrength(pokemon.hiddenPowerType, target);
            double stab     = 1.0;

            //calculate Same Type Attack Bonus
            if (attack.bMove.moveType == pokemon.baseStat.Type1.ToString() || attack.bMove.moveType == pokemon.baseStat.Type2.ToString())
            {
                stab = 1.5;
            }

            if (strength > 0.0)
            {
                Random random   = new Random();
                double modifier = Convert.ToDouble(random.Next(85, 100)) / 100.0;
                if (attack.bMove.moveKind == "Special")
                {
                    dDamage = stab * strength * modifier * (((2.0 * pokemon.level + 10.0) / 250.0) * (Convert.ToDouble(effectiveSpAtk) / Convert.ToDouble(target.effectiveSpDef)) * pokemon.hiddenPowerPower + 2);
                    damage  = Convert.ToInt32(Math.Floor(dDamage));
                    target.currentHealth -= damage;
                }
                //I know that hidden power is only special, but screw you!
                else if (attack.bMove.moveKind == "Physical")
                {
                    dDamage = stab * strength * modifier * (((2.0 * pokemon.level + 10.0) / 250.0) * (Convert.ToDouble(effectiveAtk) / Convert.ToDouble(target.effectiveDef)) * pokemon.hiddenPowerPower + 2);
                    damage  = Convert.ToInt32(Math.Floor(dDamage));
                    target.currentHealth -= damage;
                }

                //show message saying it hit, or was supereffective
            }
            else
            {
                //show message saying it was ineffective
            }
        }
Ejemplo n.º 2
0
 private double typeModifier(ActiveMove attack, BattlePokemon target)
 {
     return(TypeStrengths.typeStrength(attack, target));
 }