本文整理汇总了C++中Pokemon::setDead方法的典型用法代码示例。如果您正苦于以下问题:C++ Pokemon::setDead方法的具体用法?C++ Pokemon::setDead怎么用?C++ Pokemon::setDead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pokemon
的用法示例。
在下文中一共展示了Pokemon::setDead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadPokemonList
void PokemonFinder::ReadPokemonList(string kind)
{
//Set les types
SoftwareLogic::Type fire("Fire");
fire.setStrength("Grass","Steel");
fire.setWeakness("Water");
SoftwareLogic::Type water("Water");
water.setStrength("Fire");
water.setWeakness("Grass","Electric");
SoftwareLogic::Type grass("Grass");
grass.setStrength("Water");
grass.setWeakness("Fire","Flying");
SoftwareLogic::Type electric("Electric");
electric.setStrength("Water","Flying");
electric.setWeakness("NULL");
SoftwareLogic::Type flying("Flying");
flying.setStrength("Grass","Fighting");
flying.setWeakness("Electric");
SoftwareLogic::Type normal("Normal");
normal.setStrength("NULL");
normal.setWeakness("Fighting");
SoftwareLogic::Type steel("Steel");
steel.setStrength("NULL");
steel.setWeakness("Fire","Water");
SoftwareLogic::Type fighting("Fighting");
fighting.setStrength("Normal","Dark");
fighting.setWeakness("Flying");
SoftwareLogic::Type dark("Dark");
dark.setStrength("NULL");
dark.setWeakness("Fighting");
for (pugi::xml_node pokemonList = pokemonListNode.child(kind.c_str()); pokemonList!= nullptr; pokemonList= pokemonList.next_sibling(kind.c_str()))
{
Pokemon* pokemonElement = new Pokemon();
string name = pokemonList.child_value("Name");
name.erase(name.find_last_not_of("\n\t\t\t")+1);
name = name.substr(4);
pokemonElement->setName(name);
pokemonElement->setLevel(ConvertStringToInt(pokemonList.child_value("Level")));
pokemonElement->setFullHealth(ConvertStringToInt(pokemonList.child_value("MaxHP")));
pokemonElement->setCurrentHealth(ConvertStringToInt(pokemonList.child_value("MaxHP")));
pokemonElement->setAttack(ConvertStringToInt(pokemonList.child_value("Attack")));
pokemonElement->setDefense(ConvertStringToInt(pokemonList.child_value("Defense")));
pokemonElement->setSpeed(ConvertStringToInt(pokemonList.child_value("Speed")));
int expToLevelUp = (4*pow((ConvertStringToInt(pokemonList.child_value("Level"))),3))/5;
pokemonElement->setExperienceToLevelUp(expToLevelUp);
pokemonElement->setCurrentExperience(0);
pokemonElement->setDead(false);
string type = pokemonList.child_value("Type");
type.erase(type.find_last_not_of("\n\t\t\t")+1);
type = type.substr(4);
if(type == fire.getTypeName())
{
pokemonElement->setType(fire);
}
else if(type == water.getTypeName())
{
pokemonElement->setType(water);
}
else if(type == electric.getTypeName())
{
pokemonElement->setType(electric);
}
else if(type == grass.getTypeName())
{
pokemonElement->setType(grass);
}
else if(type == normal.getTypeName())
{
pokemonElement->setType(normal);
}
else if(type == flying.getTypeName())
{
pokemonElement->setType(flying);
}
vector<Move*> movePokemon;
for (pugi::xml_node moveList = pokemonList.child("Move"); moveList!= nullptr; moveList= moveList.next_sibling("Move"))
{
string typeName = moveList.child_value("MoveType");
typeName.erase(typeName.find_last_not_of("\n\t\t\t")+1);
typeName = typeName.substr(5);
SoftwareLogic::Type type;
if(typeName == fire.getTypeName())
{
type = fire;
}
else if(typeName == water.getTypeName())
{
type = water;
}
else if(typeName == electric.getTypeName())
{
type = electric;
}
else if(typeName == grass.getTypeName())
{
//.........这里部分代码省略.........