当前位置: 首页>>代码示例>>C++>>正文


C++ Pokemon类代码示例

本文整理汇总了C++中Pokemon的典型用法代码示例。如果您正苦于以下问题:C++ Pokemon类的具体用法?C++ Pokemon怎么用?C++ Pokemon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Pokemon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getPokemon

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;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: doBattle

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;
    }
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例3: displayArr

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++;
        }
	}
}
开发者ID:davemachado,项目名称:Pokemon-Quiz,代码行数:26,代码来源:main.cpp

示例4:

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());
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例5: LoadFromPokemon

  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 ();
  }
开发者ID:Noxalus,项目名称:YAPOG,代码行数:13,代码来源:PokemonEVTable.cpp

示例6: Pokemon

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;
}
开发者ID:cosarara97,项目名称:GBA-Pokemon-Engine,代码行数:13,代码来源:Pokemon.cpp

示例7: main

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;
    

}
开发者ID:hannahayden,项目名称:EECS_268_Lab01,代码行数:14,代码来源:main.cpp

示例8: charPos

bool charPos(char& charToval,int posMo,Pokemon& currentPok){
	if((charToval > 48  && charToval < 53) && currentPok.useMove(posMo-1)  ){
		return true;
	}else{
		return false;
	}
}
开发者ID:juanOH7,项目名称:Pokemon,代码行数:7,代码来源:main.cpp

示例9: xp_gain

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);
}
开发者ID:Hugal31,项目名称:MyPokemon,代码行数:16,代码来源:Combat.cpp

示例10: addText

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;
}
开发者ID:Ishoa,项目名称:EeveeHound2.0,代码行数:27,代码来源:Battle.cpp

示例11: defend

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
	}
}
开发者ID:juanOH7,项目名称:Pokemon,代码行数:58,代码来源:pokemon.cpp

示例12: println_debug

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;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例13: canCatch

//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;
}
开发者ID:ahansen3,项目名称:Cse20212,代码行数:22,代码来源:Pokeball.cpp

示例14: FindBabySpeciesInner

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;
}
开发者ID:cosarara97,项目名称:GBA-Pokemon-Engine,代码行数:39,代码来源:Pokemon.cpp

示例15: battleResetWithMoves

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);
}
开发者ID:Ishoa,项目名称:EeveeHound2.0,代码行数:39,代码来源:Menu.cpp


注:本文中的Pokemon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。