bool Player::canSwap(int index) { // bounds checking if(index < 1 or index >= getNumPokemon()) { return false; } // check if the entering pokemon is fainted Pokemon* enteringPokemon = getPokemon(index); if(enteringPokemon->isFainted()) { return false; } // check if any of the lead pokemon's minor afflictions prevent them from // leaving Pokemon* leadPokemon = getPokemon(0); assert_debug(leadPokemon != NULL); for(int i = 0; i < leadPokemon->getNumMinorAfflictions(); ++i) { if(leadPokemon->getMinorAffliction(i)->isTrapped()) { return false; } } return true; }
void Battle::doBattle(Pokemon& attacking, Pokemon& defending, Move& move) { // print the pokemon and move involved in this battle println_debug("Running Battle"); cout << attacking.getNickname() << " used " << move.getName() << "." << endl; // determine if move will hit bool moveHit = willMoveHit(attacking, defending, move); if(moveHit) { // do the actual move if(move.getCategory() == STATUS) { // status moves just use a hook move.doEffect(attacking, defending); } else { // physical and special moves do damage int damage = getDamage(attacking, defending, move); defending.changeHp(-damage); } // hook for post-move effect move.onMoveEnd(attacking, defending, moveHit); } else { // print miss statement cout << attacking.getNickname() << "'s attack missed." << endl; } }
void displayArr(Pokemon arr[], int numGenPokemon, int genNum) { Pokemon tempPoke; int nameLength = 0; string tempName; for (int i = 0; i < numGenPokemon; i++) { tempPoke = arr[i]; if(genNum == 0 && i % 10 == 0) cout << endl << endl; //National Dex line breaks else if (genNum != 0 && i % 6 == 0) cout << endl << endl; // All other region line breaks if(tempPoke.getRevealed()) tempName = tempPoke.getName(); else tempName = tempPoke.getID(); printSpace(MAX_SPACE); nameLength = tempName.size(); cout << tempName; while(nameLength < MAX_SPACE){ printSpace(1); nameLength++; } } }
void IncreaseSpeed2::doEffect(const Move& move, Pokemon& owner, Pokemon& defending) { Stat& speed = owner.getSpeed(); println_debug("Current speed: " << speed.getModValue()); speed -= 2; cout << owner.getNickname() << "'s speed rose." << endl; println_debug("Current speed: " << speed.getModValue()); }
void PokemonEVTable::LoadFromPokemon (const Pokemon& pokemon) { pokemonID_ = pokemon.GetUniqueID (); const yap::PokemonStat& stats = pokemon.GetStats (); hp_ = stats.GetHitPoint ().GetEffortValue (); attack_ = stats.GetAttack ().GetEffortValue (); defense_ = stats.GetDefense ().GetEffortValue (); specialAttack_ = stats.GetSpecialAttack ().GetEffortValue (); specialDefense_ = stats.GetSpecialDefense ().GetEffortValue (); speed_ = stats.GetSpeed ().GetEffortValue (); }
Pokemon* Pokemon::GenerateTrainerPokemon(u8 level, u16 species, char* trainerName, u32 id, u32 formeIndex) { Pokemon* thePokemon = new Pokemon(level, species); thePokemon->Encrypt(OTID, id); thePokemon->Encrypt(OTName, (u32)trainerName); InternalBaseData* data = (InternalBaseData*)((void**)pokemonBaseData[species].baseDataInfo.pointerToData)[formeIndex]; thePokemon->Encrypt(Friendship, data[0].baseFriendship); if (formeIndex != 0) { thePokemon->Encrypt(FormeIndex, formeIndex); } return thePokemon; }
int main() { Pokemon firstPokemon; std::cout << "Player 1, build your Pokemon!" << "\n=======================\n"; firstPokemon.userBuild(); Pokemon secondPokemon; std::cout << "Player 2, build your Pokemon!" << "\n=======================\n"; secondPokemon.userBuild(); Pokemon pokemon1; Pokemon pokemon2; }
void Pokemon::GivePokemonToPlayer(u8 level, u16 species, u32 formeIndex) { Pokemon* thePokemon = new Pokemon(level, species); thePokemon->Encrypt(OTID, Game::GetPlayer().completeTrainerID); thePokemon->Encrypt(OTName, (u32)&Game::GetPlayer().name); InternalBaseData* data = (InternalBaseData*)((void**)pokemonBaseData[species].baseDataInfo.pointerToData)[formeIndex]; thePokemon->Encrypt(Friendship, data[0].baseFriendship); if (formeIndex != 0) { thePokemon->Encrypt(FormeIndex, formeIndex); } Game::AddNewPokemon(*thePokemon); delete thePokemon; }
bool charPos(char& charToval,int posMo,Pokemon& currentPok){ if((charToval > 48 && charToval < 53) && currentPok.useMove(posMo-1) ){ return true; }else{ return false; } }
unsigned int xp_gain(Pokemon &poke, Pokemon &poke_adv) { (void) poke; unsigned int xp; unsigned int e; //Lucky egg float a; float s; //xp_share, pokemon on the battle etc... cf poke_doc/xp.info a = (poke_adv.get_owner() == IS_WILD) ? 1 : 1.5; e = 1; s = 1.0; xp = static_cast<unsigned int>(((a * PokemonModel::pokedex[poke_adv.get_id()]->get_xp_base() * poke_adv.get_level()) / static_cast<unsigned int>(5 * s)) * (static_cast<unsigned int>(std::pow((2 * poke_adv.get_level()), 2.5) + 1) * e)); return (xp); }
void Battle::addText(Pokemon a_user, Move a_move) { D3DXCOLOR tempcolor = D3DXCOLOR(0.0f,0.0f,0.0f,1.0f); swprintf_s(charactertempthingy[curtextincrement], a_user.getName()); battletext[curtextincrement].text = charactertempthingy[curtextincrement];// User's name battletext[curtextincrement].rec.top = 375; battletext[curtextincrement].rec.bottom = 450; battletext[curtextincrement].rec.left = 300; battletext[curtextincrement].rec.right = 500; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"used"); battletext[curtextincrement].text = charactertempthingy[curtextincrement];// Used battletext[curtextincrement].rec.top = 375; battletext[curtextincrement].rec.bottom = 450; battletext[curtextincrement].rec.left = 425; battletext[curtextincrement].rec.right = 625; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], a_move.getName()); battletext[curtextincrement].text = charactertempthingy[curtextincrement];// User's move's name battletext[curtextincrement].rec.top = 375; battletext[curtextincrement].rec.bottom = 450; battletext[curtextincrement].rec.left = 575; battletext[curtextincrement].rec.right = 775; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; }
void Pokemon::defend(Pokemon& attacker, int positionMv){ double inDmg =attacker.useMove(positionMv); int tyDmg = attacker.moves[positionMv]->atktype; int typeDmg = attacker.moves[positionMv]->typeM; int levelOut = attacker.level; double Satk = attacker.stats[3]; double atk = attacker.stats[1]; int atkType = attacker.type; if (inDmg < 0){ setState(inDmg); }else if (inDmg > 0){ if (tyDmg == 0){//Physical if (effectiveness(typeDmg) == 1){ if (typeDmg == atkType){//STAB GamHP -= ( ((2 * levelOut + 10)/250) * (atk/stats[2]) * inDmg + 2) * 2 * 1.5; }else{ GamHP-= ( ((2 * levelOut + 10)/250) * (atk/stats[2]) * inDmg + 2) * 2; } }else if (effectiveness(typeDmg) == 2){ if (typeDmg == atkType){//STAB GamHP -= 1.5 * 0.5 * ( ((2 * levelOut + 10)/250) * (atk/stats[2]) * inDmg + 2); }else{ GamHP -= 0.5 * ( ((2 * levelOut + 10)/250) * (atk/stats[2]) * inDmg + 2); } }else if (effectiveness(typeDmg) == 3){ }else if (effectiveness(typeDmg) == 4){ if (typeDmg == atkType){//STAB GamHP -= 1.5 * ( ((2 * levelOut + 10)/250) * (atk/stats[2]) * inDmg + 2); }else{ GamHP -= ( ((2 * levelOut + 10)/250) * (atk/stats[2]) * inDmg + 2); } } }else{//Special if (effectiveness(typeDmg) == 1){ if (typeDmg == atkType){//STAB GamHP -= ( ((2 * levelOut + 10)/250) * (Satk/stats[4]) * inDmg + 2) * 2 * 1.5; }else{ GamHP -= ( ((2 * levelOut + 10)/250) * (Satk/stats[4]) * inDmg + 2) * 2; } }else if (effectiveness(typeDmg) == 2){ if (typeDmg == atkType){//STAB GamHP -= 1.5 * 0.5 * ( ((2 * levelOut + 10)/250) * (Satk/stats[4]) * inDmg + 2); }else{ GamHP -= 0.5 * ( ((2 * levelOut + 10)/250) * (Satk/stats[4]) * inDmg + 2); } }else if (effectiveness(typeDmg) == 3){ }else if (effectiveness(typeDmg) == 4){ if (typeDmg == atkType){//STAB GamHP -= 1.5 * ( ((2 * levelOut + 10)/250) * (Satk/stats[4]) * inDmg + 2); }else{ GamHP -= ( ((2 * levelOut + 10)/250) * (Satk/stats[4]) * inDmg + 2); } } } }else{ //MISS HIT } }
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; }
//determines if the pokemon will be caught will the given pokeball, and pokemon passed in int Pokeball::canCatch(Pokemon p) { if (!p.isWild()) { //cout << "Cannot capture other trainer's Pokemon!" << endl; return -1; } double f[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; f[0] = 100 - p.getLevel(); f[1] = (1.0 - 1.0*p.getHP() / p.getMaxHP()) * 200; f[2] = rand() % 200; double prob = f[0] + f[1] + f[2]; if (prob >= 250) { // cout << p.getName() << " was successfully caught!" << endl; return 1; } //cout << "Oh no, it broke free!" << endl; return 0; }
Pokemon* Pokemon::GenerateEgg(Pokemon* mother, Pokemon* father) { u16 motherItem = mother->Decrypt(HeldItem); //u16 fatherItem = PokemonDecrypter(father, HeldItem); u16 species = mother->Decrypt(Species); if (pokemonBaseData[species].eggGroup1 == EGG_GROUP_DITTO && pokemonBaseData[species].eggGroup2 == EGG_GROUP_DITTO) { species = father->Decrypt(Species); } species = FindBabySpeciesInner(species); if (species == Manaphy) { species = Phione; } for (int i = 0; i < 3; i++) { if (species == alternativeSpeciesChecks[i][0]) { species = alternativeSpeciesChecks[i][Maths::GetDelimitedRandom32BitValue(2)]; break; } } for (int i = 0; i < 9; i++) { if (species == incenseItemEggs[i].foundSpecies) { if (motherItem != incenseItemEggs[i].itemID && motherItem != incenseItemEggs[i].itemID) { species = incenseItemEggs[i].alternativeSpecies; } break; } } Pokemon* egg = new Pokemon(0, species); egg->Encrypt(IsEgg, true); egg->Encrypt(Friendship, pokemonBaseData[species].hatchSteps); // Calculate Egg Moves and award where necessary return egg; }
void Menu::battleResetWithMoves(Pokemon a_pikachu) { int w,h; //store curent res h = height; w = width; //change res for ez placment height = 600; width = 800; setRes(width,height); buttons[0].setActive(true); buttons[0].setLoc(450,525,10,210); buttons[1].setActive(true); buttons[1].setLoc(450,525,210,410); buttons[2].setActive(true); buttons[2].setLoc(525,600,10,210); buttons[3].setActive(true); buttons[3].setLoc(525,600,210,410); for(int i = 4;i<numBut;++i) { buttons[i].setActive(false); buttons[i].setLoc(100+60*i,150+60*i,300,500); } buttons[0].setlable(a_pikachu.getMove(0).getName()); buttons[0].setVisAct(true); buttons[1].setlable(a_pikachu.getMove(1).getName()); buttons[1].setVisAct(true); buttons[2].setlable(a_pikachu.getMove(2).getName()); buttons[2].setVisAct(true); buttons[3].setlable(a_pikachu.getMove(3).getName()); buttons[3].setVisAct(true); for(int i = 4;i<numBut;++i) { buttons[i].setlable(L"Blank"); buttons[i].setVisAct(false); } //reset res setRes(800,600); }
bool Colosseum::attack(const Pokemon& attacker, Pokemon& defender) //function that deals with attacks and lowers hit points if hit { bool returnValue=false; cout << attacker.get_name() << " is attacking " << defender.get_name() << endl; int attbonus=d20.roll(); int defbonus=d20.roll(); cout << attacker.get_name() << " rolls an attack bonus of " << attbonus << endl; cout << defender.get_name() << " rolls an defense bonus of " << defbonus << endl; int total_att=attbonus+attacker.get_attackLevel(); int total_def=defbonus+defender.get_defLevel(); int damage; if(total_att>total_def) { int roll1=d6.roll(); int roll2=d6.roll(); int roll3=d6.roll(); damage=roll1+roll2+roll3; cout << "The attack hits dealing 3-D6 damage!" << endl; cout << "The rolls are: " << roll1 << " " << roll2 << " " << roll3 << " totalling: " << damage << " damage!" << endl; defender.reduceHP(damage); if(defender.get_hp() <=0 ) { returnValue=true; } else { returnValue=false; cout << defender.get_name() << " has " << defender.get_hp() << " hit points left." << endl; } } else { damage=0; cout << "The attack is missed!" << endl; } return returnValue; }
char charValMov(Graphics test1,Pokemon& currentPok, int HP2, int& CurrHP2){ char resp; int posMo; char posMoch[1]; bool validarEntrada = true; getch(); int HP1 = currentPok.HP(), otHP2 = HP2; int CurrHP1 = currentPok.HP(), otCurrHP2 = CurrHP2; setStage(test1, HP1, CurrHP1, HP2, CurrHP2); while(validarEntrada){ setStage(test1, HP1, CurrHP1, HP2, CurrHP2); mvprintw(29,61,"Move: "); currentPok.drawMoves(); noecho(); char temp; temp = getch(); posMoch[0] = temp; posMo = atoi(posMoch); if(charPos(temp, posMo, currentPok)){ echo(); resp = temp; attron(COLOR_PAIR(3)); mvaddch(29,75,resp); validarEntrada = false; }else{ setStage(test1, HP1, CurrHP1, HP2, CurrHP2); currentPok.drawMoves(); validarEntrada == true; mvprintw(29,61,"Move: "); mvprintw(31,61,"Invalid Input!!!"); } getch(); clear(); } return resp; }
bool Infatuation::whenAttacks(Pokemon& defending) { if(&defending == &infatSrc) { if(rand() % 100 < 50 and oppositeGender(afflictedPokemon.getGender(), defending.getGender())) { cout << afflictedPokemon.getNickname() << " is infatuated." << endl; return true; } else { cout << afflictedPokemon.getNickname() << " resists infatuation." << endl; return false; } } else { infatSrcHasChanged = true; return false; } }
float Pokemon::attacking(Pokemon& p, Attack a) { float stab = 1.0f; if (type == a.getType()) stab = 1.5f; float effectiveness = 1.0f; if ((a.getType() == Constants::FLYING && p.type == Constants::FIGHTING) || (a.getType() == Constants::FIGHTING && p.type == Constants::ROCK) || (a.getType() == Constants::ROCK && p.type == Constants::FLYING)) effectiveness = 2.0f; if ((a.getType() == Constants::FLYING && p.type == Constants::ROCK) || (a.getType() == Constants::ROCK && p.type == Constants::FIGHTING) || (a.getType() == Constants::FIGHTING && p.type == Constants::FLYING)) effectiveness = 0.5f; float random = 85 + rand() % (100 + 1 - 85); p.currentHP -= (int)(0.01f * random * stab * effectiveness * ((0.2 * Lv + 1) * attack * a.getPower() / 25 / p.defence + 2)); if (p.currentHP <= 0) { updateHP(); p.updateHP(); effectiveness = -1.0f; } return effectiveness; }
void Battle::addText(Pokemon a_user, Move a_move) { D3DXCOLOR tempcolor = D3DXCOLOR(0.0f,0.0f,0.0f,1.0f); battletext[curtextincrement].text = a_user.getName();// User's name battletext[curtextincrement].rec.top = 375; battletext[curtextincrement].rec.bottom = 450; battletext[curtextincrement].rec.left = 300; battletext[curtextincrement].rec.right = 500; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; battletext[curtextincrement].text = L"used";// Used battletext[curtextincrement].rec.top = 375; battletext[curtextincrement].rec.bottom = 450; battletext[curtextincrement].rec.left = 425; battletext[curtextincrement].rec.right = 625; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; battletext[curtextincrement].text = a_move.getName();// User's move's name battletext[curtextincrement].rec.top = 375; battletext[curtextincrement].rec.bottom = 450; battletext[curtextincrement].rec.left = 575; battletext[curtextincrement].rec.right = 775; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; }
std::vector<std::string> AttackAction::execute() { Pokemon *defendingPokemon = defendingTrainer->getActivePokemon(); // float effectiveness = 1; float effectiveness = Effectiveness::attackingxDefendingChart[attack->getType()][defendingPokemon->getType()] *Effectiveness::attackingxDefendingChart[attack->getType()][defendingPokemon->getType2()]; float damage = attack->getBaseDamage() * effectiveness; int newHp = round(defendingPokemon->getCurrentHp() - damage); std::string attackingPokemonName = attackingPokemon->getName(); std::string defendingPokemonName = defendingPokemon->getName(); std::ostringstream damageAmount; //retVal.push_back(attackingPokemonName + " dealt " + damageAmount.str() + " damage to " + defendingPokemonName); retVal.push_back(attackingPokemonName + " used " + attack->getName()); if (effectiveness == 0) { retVal.push_back("It's ineffective..."); } else if (effectiveness == 0.5 || effectiveness == 0.25) { retVal.push_back("It's not very effective..."); } else if (effectiveness == 2 || effectiveness == 4) { retVal.push_back("It's super effective!"); } if(newHp < 0) { newHp = 0; defendingPokemon->setCurrentHp(newHp); retVal.push_back(defendingPokemonName + " died!"); } defendingPokemon->setCurrentHp(newHp); attack->setCurrentPp(attack->getCurrentPp()-1); damageAmount << attack->getBaseDamage(); return retVal; }
void Play2(Pokemon& Tail,Pokemon& Volt, Graphics test1, int posMo2, int& CurrHP1, int& CurrHP2){ int HP1 = Tail.HP(), HP2 = Volt.HP(); setStage(test1, HP1, CurrHP1, HP2, CurrHP2); if (Volt.useMove(posMo2) == 0){ mvprintw(31,61,"Miss Hit"); }else if (Volt.useMove(posMo2) > 0){ setStage(test1, HP1, CurrHP1, HP2, CurrHP2); if (Tail.effectiveness(Volt.ATKDMGT(posMo2)) == 1){ Tail.defend(Volt, posMo2); CurrHP1 = Tail.GamHP1(); mvprintw(31,61,"Super Effective!"); }else if (Tail.effectiveness(Volt.ATKDMGT(posMo2)) == 2){ Tail.defend(Volt, posMo2); CurrHP1 = Tail.GamHP1(); mvprintw(31,61,"Not very Effective!"); }else if (Tail.effectiveness(Volt.ATKDMGT(posMo2)) == 3){ Tail.defend(Volt, posMo2); CurrHP1 = Tail.GamHP1(); mvprintw(31,61,"Doesn't affect opponent"); }else{ mvprintw(31,61,"It Hit!"); Tail.defend(Volt, posMo2); CurrHP1 = Tail.GamHP1(); } setStage(test1, HP1, CurrHP1, HP2, CurrHP2); getch(); }else{ Tail.defend(Volt, posMo2); CurrHP1 = Tail.GamHP1(); Tail.setState(Volt.useMove(posMo2)); mvprintw(31,61,"Status Given"); } }
void AfflictBurn::onMoveEnd(const Move& move, Pokemon& owner, Pokemon& defending, bool moveHit) { defending.setMajorAffliction(new Burn(defending)); }
void Confuse::doEffect(const Move& move, Pokemon& owner, Pokemon& defending) { defending.addMinorAffliction(new Confusion(defending)); }
void Pokemon::launchAttack(Pokemon &pkmTarget, Attack &attack){ if (attack.getPP() > 0) { pkmTarget.takeDamage(attack.getDamage()); attack--; } }
void Battle::menuReset(Pokemon a_pikachu, Pokemon a_enemy) { battlemenu.battleReset(); //wchar_t tempwchar_t[256]; D3DXCOLOR tempcolor = D3DXCOLOR(0.0f,0.0f,0.0f,1.0f); curtextincrement = 0; battletext[curtextincrement].text = a_pikachu.getName();// Pikachu's name battletext[curtextincrement].rec.top = 450; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 600; battletext[curtextincrement].rec.right = 800; ++curtextincrement; battletext[curtextincrement].text = L"hp:"; // hp's hp: battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 490; battletext[curtextincrement].rec.right = 720; ++curtextincrement; battletext[curtextincrement].text = terribleJankyIntToLPCWSTR(a_pikachu.getCurHP()); // Pikachu's curhp battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 555; battletext[curtextincrement].rec.right = 750; ++curtextincrement; battletext[curtextincrement].text = L"/"; // hp's slash battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 610; battletext[curtextincrement].rec.right = 780; ++curtextincrement; battletext[curtextincrement].text = terribleJankyIntToLPCWSTR(a_pikachu.getMaxHP()); // pikach's max hp battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 660; battletext[curtextincrement].rec.right = 800; ++curtextincrement; // enemy start battletext[curtextincrement].text = a_enemy.getName();// Enemy's name battletext[curtextincrement].rec.top = 75; battletext[curtextincrement].rec.bottom = 0; battletext[curtextincrement].rec.left = 0; battletext[curtextincrement].rec.right = 200; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; battletext[curtextincrement].text = L"hp:"; // hp's hp: battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 0; battletext[curtextincrement].rec.right = 100; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; battletext[curtextincrement].text = terribleJankyIntToLPCWSTR(a_enemy.getCurHP()); // enemy's curhp battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 160; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; battletext[curtextincrement].text = L"/"; // hp's slash battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 210; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; battletext[curtextincrement].text = terribleJankyIntToLPCWSTR(a_enemy.getMaxHP()); // enemy's max hp battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 60; battletext[curtextincrement].rec.right = 210; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; }
void Colosseum::userBuild(Pokemon& p) //function used to build Pokemon { cout << "Please name your Pokemon:" << endl; string name; p.set_name(name); cout << "How many hit points will it have? (1-50):" << endl; int hp; p.set_hp(hp); int hp1=p.get_hp(); while(hp1>50 || hp1<1) { cout << "Sorry. The hit points should be between (1-50)" << endl; p.set_hp(hp); hp1=p.get_hp(); } cout << "Split fifty points between attack level and defense level" << endl; cout << "Enter your attack level (1-49):" << endl; int att; p.set_attackLvl(att); int att1=p.get_attackLevel(); while(att1>49 || att1<1) { cout << "Sorry. The attack level must be between 1 and 49)" << endl; p.set_attackLvl(att); att1=p.get_attackLevel(); } int g=49-att1; cout << "Give a defense level (from 1 to " << g << "): " << endl; int def; p.set_deflvl(def); int def1=p.get_defLevel(); while(g<def1 || def1<1) { cout << "Sorry. The defense level must be between 1 and " << g << ": " << endl; p.set_deflvl(def); def1=p.get_defLevel(); } }
void Battle::menuReset(Pokemon a_pikachu, Pokemon a_enemy) { battlemenu.battleReset(); //wchar_t tempwchar_t[256]; D3DXCOLOR tempcolor = D3DXCOLOR(0.0f,0.0f,0.0f,1.0f); curtextincrement = 0; swprintf_s(charactertempthingy[curtextincrement], a_pikachu.getName()); battletext[curtextincrement].text = charactertempthingy[curtextincrement];// Pikachu's name battletext[curtextincrement].rec.top = 450; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 600; battletext[curtextincrement].rec.right = 800; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"hp:"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's hp: battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 490; battletext[curtextincrement].rec.right = 720; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getCurHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // Pikachu's curhp battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 555; battletext[curtextincrement].rec.right = 750; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's slash battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 610; battletext[curtextincrement].rec.right = 780; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMaxHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikach's max hp battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 660; battletext[curtextincrement].rec.right = 800; ++curtextincrement; // enemy start swprintf_s(charactertempthingy[curtextincrement], a_enemy.getName()); battletext[curtextincrement].text = charactertempthingy[curtextincrement];// Enemy's name battletext[curtextincrement].rec.top = 75; battletext[curtextincrement].rec.bottom = 0; battletext[curtextincrement].rec.left = 0; battletext[curtextincrement].rec.right = 200; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"hp:"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's hp: battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 0; battletext[curtextincrement].rec.right = 100; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_enemy.getCurHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // enemy's curhp battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 160; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's slash battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 210; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_enemy.getMaxHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // enemy's max hp battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 60; battletext[curtextincrement].rec.right = 210; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; }
void Battle::menuResetWithMoves(Pokemon a_pikachu, Pokemon a_enemy) { battlemenu.battleResetWithMoves(a_pikachu); D3DXCOLOR tempcolor = D3DXCOLOR(0.0f,0.0f,0.0f,1.0f); curtextincrement = 0; swprintf_s(charactertempthingy[curtextincrement], a_pikachu.getName()); battletext[curtextincrement].text = charactertempthingy[curtextincrement];// Pikachu's name battletext[curtextincrement].rec.top = 450; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 600; battletext[curtextincrement].rec.right = 800; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"hp:"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's hp: battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 490; battletext[curtextincrement].rec.right = 720; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getCurHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // Pikachu's curhp battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 555; battletext[curtextincrement].rec.right = 750; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's slash battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 610; battletext[curtextincrement].rec.right = 780; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMaxHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikach's max hp battletext[curtextincrement].rec.top = 525; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 660; battletext[curtextincrement].rec.right = 800; ++curtextincrement; // enemy start swprintf_s(charactertempthingy[curtextincrement], a_enemy.getName()); battletext[curtextincrement].text = charactertempthingy[curtextincrement];// Enemy's name battletext[curtextincrement].rec.top = 75; battletext[curtextincrement].rec.bottom = 0; battletext[curtextincrement].rec.left = 0; battletext[curtextincrement].rec.right = 200; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"hp:"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's hp: battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 0; battletext[curtextincrement].rec.right = 100; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_enemy.getCurHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // enemy's curhp battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 160; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // hp's slash battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 210; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_enemy.getMaxHP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // enemy's max hp battletext[curtextincrement].rec.top = 150; battletext[curtextincrement].rec.bottom = 75; battletext[curtextincrement].rec.left = 60; battletext[curtextincrement].rec.right = 210; battletext[curtextincrement].textColor = tempcolor; ++curtextincrement; // Start move pp's swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(0).getCurPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 1st move's curpp battletext[curtextincrement].rec.top = 480; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 160; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = L"/"; // pikachu's 1st move's slash battletext[curtextincrement].rec.top = 480; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 210; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(0).getMaxPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 1st move's maxpp battletext[curtextincrement].rec.top = 480; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 60; battletext[curtextincrement].rec.right = 210; ++curtextincrement; // second move swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(1).getCurPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 2nd move's curpp battletext[curtextincrement].rec.top = 480; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 210; battletext[curtextincrement].rec.right = 360; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 2nd move's slash battletext[curtextincrement].rec.top = 480; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 210; battletext[curtextincrement].rec.right = 410; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(1).getMaxPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 2nd move's maxpp battletext[curtextincrement].rec.top = 480; battletext[curtextincrement].rec.bottom = 525; battletext[curtextincrement].rec.left = 260; battletext[curtextincrement].rec.right = 410; ++curtextincrement; // third move pp swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(2).getCurPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 3rd move's curpp battletext[curtextincrement].rec.top = 565; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 160; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 3rd move's slash battletext[curtextincrement].rec.top = 565; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 10; battletext[curtextincrement].rec.right = 210; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(2).getMaxPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 3rd move's maxpp battletext[curtextincrement].rec.top = 565; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 60; battletext[curtextincrement].rec.right = 210; ++curtextincrement; // fourth move swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(3).getCurPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 4th move's curpp battletext[curtextincrement].rec.top = 565; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 210; battletext[curtextincrement].rec.right = 360; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"/"); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's fortuh move's slash battletext[curtextincrement].rec.top = 565; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 210; battletext[curtextincrement].rec.right = 410; ++curtextincrement; swprintf_s(charactertempthingy[curtextincrement], L"%d", a_pikachu.getMove(3).getMaxPP()); battletext[curtextincrement].text = charactertempthingy[curtextincrement]; // pikachu's 4th move's maxpp battletext[curtextincrement].rec.top = 565; battletext[curtextincrement].rec.bottom = 600; battletext[curtextincrement].rec.left = 260; battletext[curtextincrement].rec.right = 410; ++curtextincrement; }