summaryrefslogtreecommitdiffstats
path: root/pokemod/MapTrainerPokemon.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-10-26 20:01:48 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-10-26 20:01:48 +0000
commit1f08afc80c73087bf9bde639754670548b89fc9f (patch)
tree70a80d7998d9279a75509fed14238b3ba493e9eb /pokemod/MapTrainerPokemon.cpp
parent5b55d13ead7e352ee1feaae72009e8abf5bd071a (diff)
[ADD] DISCLAIMER
[FIX] PokemonEvolution styles [ADD] Relative enumeration [DEL] pokemod/Status.{h, cpp} [DEL] pokemod/StatusEffect.{h, cpp} [FIX] Status effects will be added as needed instead of customized [FIX] Completed ItemEffects [FIX] Factored out Natures to be global [DEL] pokemod/PokemonNature.{h, cpp} [DEL] ai/Net.{h, cpp} [DEL] ai/Layer/{h, cpp} [ADD] battle/Arena.{h, cpp} [ADD] battle/Team.{h, cpp} [ADD] battle/Human.{h, cpp} [ADD] battle/Bot.{h, cpp} [ADD] battle/GhostBot.{h, cpp} [ADD] battle/Pokemon.{h, cpp} [ADD] battle/Ghost.{h, cpp} [FIX] Fixed some scope errors in pokemod [ADD] audio/audio.pro [ADD] audio/Audio.{h, cpp} [ADD] audio/AudioLibrary.{h, cpp} [ADD] audio/AudioSystem.{h, cpp} [ADD] audio/Music.{h, cpp} [ADD] audio/SoundEffect.{h, cpp} [DEL] old audio system (was in C) [FIX] Optimized some routines in pokemod [FIX] Moved global classes (Ini, Frac, Matrix, FracMatrix, Point, Flag) to general git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@25 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MapTrainerPokemon.cpp')
-rw-r--r--pokemod/MapTrainerPokemon.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/pokemod/MapTrainerPokemon.cpp b/pokemod/MapTrainerPokemon.cpp
index 1acb6dcd..6ba80bb8 100644
--- a/pokemod/MapTrainerPokemon.cpp
+++ b/pokemod/MapTrainerPokemon.cpp
@@ -25,7 +25,8 @@
PokeGen::PokeMod::MapTrainerPokemon::MapTrainerPokemon(const Pokemod* par, const unsigned _id) :
Object(_id, par),
species(UINT_MAX),
- level(1)
+ level(UINT_MAX),
+ nature(UINT_MAX)
{
}
@@ -38,7 +39,7 @@ PokeGen::PokeMod::MapTrainerPokemon::MapTrainerPokemon(const Pokemod* par, Ini&
bool PokeGen::PokeMod::MapTrainerPokemon::Validate()
{
pokemod->ValidationMsg(QString("---------Pokémon with id %1---").arg(id), Pokemod::V_Msg);
- if (pokemod->GetPokemonByID(species) == UINT_MAX)
+ if (pokemod->GetSpeciesByID(species) == UINT_MAX)
{
pokemod->ValidationMsg("Invalid species");
isValid = false;
@@ -79,6 +80,11 @@ bool PokeGen::PokeMod::MapTrainerPokemon::Validate()
}
}
}
+ if (pokemod->GetNatureByID(nature) == UINT_MAX)
+ {
+ pokemod->ValidationMsg("Invalid nature");
+ isValid = false;
+ }
else if (GetItemCount())
{
pokemod->ValidationMsg("Too many held items");
@@ -99,7 +105,8 @@ void PokeGen::PokeMod::MapTrainerPokemon::ImportIni(Ini& ini, const unsigned _id
unsigned j;
items.clear();
ini.GetValue("species", species);
- ini.GetValue("level", level, 1);
+ ini.GetValue("level", level);
+ ini.GetValue("nature", nature);
ini.GetValue("numItems", i, 0);
for (unsigned k = 0; k < i; ++k)
{
@@ -115,6 +122,7 @@ void PokeGen::PokeMod::MapTrainerPokemon::ExportIni(QFile& fout, const QString&
exMapTrainerPokemon.AddField("id", id);
exMapTrainerPokemon.AddField("species", species);
exMapTrainerPokemon.AddField("level", level);
+ exMapTrainerPokemon.AddField("nature", nature);
exMapTrainerPokemon.AddField("numItems", GetItemCount());
for (unsigned i = 0; i < GetItemCount(); ++i)
exMapTrainerPokemon.AddField(QString("item-%1").arg(i), items[i]);
@@ -123,7 +131,7 @@ void PokeGen::PokeMod::MapTrainerPokemon::ExportIni(QFile& fout, const QString&
bool PokeGen::PokeMod::MapTrainerPokemon::SetSpecies(const unsigned s)
{
- if (pokemod->GetPokemonByID(s) != UINT_MAX)
+ if (pokemod->GetSpeciesByID(s) != UINT_MAX)
species = s;
return (species == s);
}
@@ -135,6 +143,13 @@ bool PokeGen::PokeMod::MapTrainerPokemon::SetLevel(const unsigned l)
return (level == l);
}
+bool PokeGen::PokeMod::MapTrainerPokemon::SetNature(const unsigned n)
+{
+ if (pokemod->GetNatureByID(n) != UINT_MAX)
+ nature = n;
+ return (nature == n);
+}
+
unsigned PokeGen::PokeMod::MapTrainerPokemon::GetSpecies() const
{
return species;
@@ -145,6 +160,11 @@ unsigned PokeGen::PokeMod::MapTrainerPokemon::GetLevel() const
return level;
}
+unsigned PokeGen::PokeMod::MapTrainerPokemon::GetNature() const
+{
+ return nature;
+}
+
unsigned PokeGen::PokeMod::MapTrainerPokemon::GetItem(const unsigned i) const
{
if (i < GetItemCount())