94 lines
4.2 KiB
C++
94 lines
4.2 KiB
C++
#include "pokemon_battle_sim.h"
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
|
|
using namespace PokEng;
|
|
|
|
void printPokemonStats(const Pokemon& pokemon, const std::string& name) {
|
|
std::cout << "\n=== " << name << " ===\n";
|
|
std::cout << "ID: " << pokemon.getId() << "\n";
|
|
std::cout << "Current HP: " << pokemon.getCurrentHP() << "/" << pokemon.getMaxHP() << "\n";
|
|
std::cout << "Attack: " << pokemon.getAttack() << "\n";
|
|
std::cout << "Defense: " << pokemon.getDefense() << "\n";
|
|
std::cout << "Sp. Attack: " << pokemon.getSpAttack() << "\n";
|
|
std::cout << "Sp. Defense: " << pokemon.getSpDefense() << "\n";
|
|
std::cout << "Speed: " << pokemon.getSpeed() << "\n";
|
|
std::cout << "Friendship: " << static_cast<int>(pokemon.getFriendship()) << "\n";
|
|
std::cout << "Primary Type: " << static_cast<int>(pokemon.getPrimaryType()) << "\n";
|
|
if (pokemon.getSecondaryType() != Type::NONE) {
|
|
std::cout << "Secondary Type: " << static_cast<int>(pokemon.getSecondaryType()) << "\n";
|
|
}
|
|
}
|
|
|
|
void printNatureEffect(Nature nature) {
|
|
std::cout << "\nNature: " << static_cast<int>(nature);
|
|
StatIndex increased = NatureUtils::getIncreasedStat(nature);
|
|
StatIndex decreased = NatureUtils::getDecreasedStat(nature);
|
|
|
|
if (increased != StatIndex::HP) {
|
|
std::cout << " (+10% to stat " << static_cast<int>(increased) << ")";
|
|
}
|
|
if (decreased != StatIndex::HP) {
|
|
std::cout << " (-10% to stat " << static_cast<int>(decreased) << ")";
|
|
}
|
|
if (NatureUtils::isNeutralNature(nature)) {
|
|
std::cout << " (Neutral nature)";
|
|
}
|
|
std::cout << "\n";
|
|
}
|
|
|
|
int main() {
|
|
std::cout << "Pokemon Battle Simulator - Stat System Example\n";
|
|
std::cout << "===============================================\n";
|
|
|
|
// Create base stats for a Charizard-like Pokemon
|
|
BaseStats charizardBase(78, 84, 78, 109, 85, 100);
|
|
|
|
// Create different Pokemon with different configurations
|
|
|
|
// 1. Level 50 Charizard with neutral nature and no EVs/IVs
|
|
PokemonInfo basicInfo(charizardBase, 50, Nature::HARDY);
|
|
Pokemon basicCharizard(6, basicInfo, PokemonTypes(Type::FIRE, Type::FLYING), 128);
|
|
|
|
// 2. Level 100 Charizard with Modest nature (+Sp.Atk, -Atk) and perfect IVs
|
|
IndividualValues perfectIVs(31, 31, 31, 31, 31, 31);
|
|
PokemonInfo competitiveInfo(charizardBase, 100, Nature::MODEST, perfectIVs);
|
|
Pokemon competitiveCharizard(6, competitiveInfo, PokemonTypes(Type::FIRE, Type::FLYING), 255);
|
|
|
|
// 3. Level 100 Charizard with Adamant nature (+Atk, -Sp.Atk) and Attack EVs
|
|
EffortValues attackEVs(0, 252, 0, 0, 4, 252); // Max Attack and Speed, some HP
|
|
PokemonInfo physicalInfo(charizardBase, 100, Nature::ADAMANT, perfectIVs, attackEVs);
|
|
Pokemon physicalCharizard(6, physicalInfo, PokemonTypes(Type::FIRE, Type::FLYING), 255);
|
|
|
|
// Print all Pokemon
|
|
printPokemonStats(basicCharizard, "Basic Charizard (Lv50, Neutral)");
|
|
|
|
printNatureEffect(Nature::MODEST);
|
|
printPokemonStats(competitiveCharizard, "Competitive Charizard (Lv100, Modest, Perfect IVs)");
|
|
|
|
printNatureEffect(Nature::ADAMANT);
|
|
printPokemonStats(physicalCharizard, "Physical Charizard (Lv100, Adamant, Attack EVs)");
|
|
|
|
// Demonstrate Generation I/II calculation
|
|
std::cout << "\n=== Generation I/II Calculation Example ===\n";
|
|
Pokemon gen1Charizard(6, basicInfo.calculateBattleStats<Generation::I>(), PokemonTypes(Type::FIRE, Type::FLYING), 128);
|
|
printPokemonStats(gen1Charizard, "Gen I Charizard (Same base stats)");
|
|
|
|
// Show EV validation
|
|
std::cout << "\n=== EV Validation ===\n";
|
|
EffortValues validEVs(85, 85, 85, 85, 85, 85); // 510 total
|
|
EffortValues invalidEVs(100, 100, 100, 100, 100, 100); // 600 total
|
|
|
|
std::cout << "Valid EVs (510 total): " << (validEVs.isValid() ? "VALID" : "INVALID") << "\n";
|
|
std::cout << "Invalid EVs (600 total): " << (invalidEVs.isValid() ? "VALID" : "INVALID") << "\n";
|
|
|
|
// Show IV validation
|
|
IndividualValues validIVs(31, 31, 31, 31, 31, 31);
|
|
IndividualValues invalidIVs(32, 32, 32, 32, 32, 32);
|
|
|
|
std::cout << "Valid IVs (all 31): " << (validIVs.isValid() ? "VALID" : "INVALID") << "\n";
|
|
std::cout << "Invalid IVs (all 32): " << (invalidIVs.isValid() ? "VALID" : "INVALID") << "\n";
|
|
|
|
return 0;
|
|
}
|