示例#1
0
float Battle::calcHitProb(Pokemon& attacking, Pokemon& defending, Move& move)
{
    // calculate using move accuracy, pokemon accuracy, and pokemon evasiveness
    float moveAcc = move.getAccuracy();
    float pokemonAcc = attacking.getAccuracy().getModValue();
    float pokemonEva = defending.getEvasiveness().getModValue();
    float hitProb = moveAcc * pokemonAcc / pokemonEva;

    // debug messages
    println_debug("Probability of " << attacking.getNickname() << " hitting "
        << defending.getNickname() << " with " << move.getName());
    println_debug("Move Accuracy: " << moveAcc);
    println_debug("Attacking Pokemon Accuracy: " << pokemonAcc);
    println_debug("Defending Pokemon Evasiveness: " << pokemonEva);
    println_debug("Chance of hit: " << hitProb);

    return hitProb;
}