// Start is called before the first frame update void Start() { if (typeOfPokemon == TypeOfPokemon.Ally) { allyPokemon = new AllyPokemon(moveList, type, stats, level, maxExperience, experience, name, sprite); } else if (typeOfPokemon == TypeOfPokemon.Enemy) { enemyPokemon = new EnemyPokemon(moveList, type, stats, level, name, sprite); } }
//Attacking pokemon 0 is ally 1 is the enemy public void useMove(AllyPokemon allyPokemon, EnemyPokemon enemyPokemon, int attackingPokemon) { //Check what type of move //Attacking if (this.m_typeOfMove == MoveType.Physical) { //Checks if the move hits through accuracy if (m_accuracy * 100 >= m_random.Next(1, 101)) { float moveDamage = 0; //Ally Pokemon attacks if (attackingPokemon == 0) { moveDamage = (((((2 * allyPokemon.m_level) / 5f) + 2) * this.m_power * ((allyPokemon.m_stats[1] / (float)enemyPokemon.m_stats[2])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, enemyPokemon.m_type); //Checks for crit 1/16 if (m_random.Next(1, 17) == 1) { moveDamage *= 2; } this.m_powerPoints--; enemyPokemon.m_stats[6] -= (int)moveDamage; } else if (attackingPokemon == 1) { moveDamage = (((((2 * enemyPokemon.m_level) / 5f) + 2) * this.m_power * ((enemyPokemon.m_stats[1] / (float)allyPokemon.m_stats[2])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, allyPokemon.m_type) / 2.5f; //Checks for crit 1/16 if (m_random.Next(1, 17) == 1) { moveDamage *= 2; } this.m_powerPoints--; allyPokemon.m_stats[6] -= (int)moveDamage; } } } else if (this.m_typeOfMove == MoveType.Special) { //Checks if the move hits through accuracy if (m_accuracy * 100 >= m_random.Next(1, 101)) { float moveDamage = 0; //Ally Pokemon attacks if (attackingPokemon == 0) { moveDamage = (((((2 * allyPokemon.m_level) / 5f) + 2) * this.m_power * ((allyPokemon.m_stats[3] / (float)enemyPokemon.m_stats[4])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, enemyPokemon.m_type); //Checks for crit 1/16 if (m_random.Next(1, 17) == 1) { moveDamage *= 2; } this.m_powerPoints--; enemyPokemon.m_stats[6] -= (int)moveDamage; } else if (attackingPokemon == 1) { moveDamage = (((((2 * enemyPokemon.m_level) / 5f) + 2) * this.m_power * ((enemyPokemon.m_stats[3] / (float)allyPokemon.m_stats[4])) / 50f) + 2) * Type.checkEffectiveness(this.m_type, allyPokemon.m_type) / 2.5f; //Checks for crit 1/16 if (m_random.Next(1, 17) == 1) { moveDamage *= 2; } this.m_powerPoints--; allyPokemon.m_stats[6] -= (int)moveDamage; } } } //Defensive else if (this.m_typeOfMove == MoveType.Defensive) { if (attackingPokemon == 0) { allyPokemon.m_stats[6] += allyPokemon.m_stats[0] / 10; if (allyPokemon.m_stats[6] > allyPokemon.m_stats[0]) { allyPokemon.m_stats[6] = allyPokemon.m_stats[0]; } } else if (attackingPokemon == 1) { enemyPokemon.m_stats[6] += enemyPokemon.m_stats[0] / 8; if (enemyPokemon.m_stats[6] > enemyPokemon.m_stats[0]) { enemyPokemon.m_stats[6] = enemyPokemon.m_stats[0]; } } } }