summaryrefslogtreecommitdiffstats
path: root/pokemod/Nature.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/Nature.cpp')
-rw-r--r--pokemod/Nature.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 816d005d..ac028170 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pokemod/Nature.cpp
-// Purpose: Define a nature that Pokémon can possess
+// Purpose: Define a nature that species can possess
// Author: Ben Boeckel
// Modified by: Ben Boeckel
// Created: Sun Mar 18 22:58:48 2007
@@ -24,7 +24,8 @@
PokeGen::PokeMod::Nature::Nature(const Pokemod* par, const unsigned _id) :
Object(_id, par),
- name("")
+ name(""),
+ weight(1)
{
for (unsigned i = 0; i < ST_End_GSC; ++i)
stats[i].Set(1, 1, true);
@@ -44,6 +45,11 @@ bool PokeGen::PokeMod::Nature::Validate()
pokemod->ValidationMsg("Name is not defined");
isValid = false;
}
+ if (!weight)
+ {
+ pokemod->ValidationMsg("Weight is not valid");
+ isValid = false;
+ }
return isValid;
}
@@ -62,6 +68,7 @@ void PokeGen::PokeMod::Nature::ImportIni(Ini& ini, const unsigned _id)
ini.GetValue(QString("stat-%1-n").arg(k), j, 1);
stats[k].Set(1, 1, true);
}
+ ini.GetValue("weight", weight);
}
void PokeGen::PokeMod::Nature::ExportIni(QFile& fout) const
@@ -73,6 +80,7 @@ void PokeGen::PokeMod::Nature::ExportIni(QFile& fout) const
exNature.AddField(QString("stat-%1-n").arg(i), stats[i].GetNum());
exNature.AddField(QString("stat-%1-d").arg(i), stats[i].GetNum());
}
+ exNature.AddField("weight", weight);
exNature.Export(fout);
}
@@ -102,12 +110,19 @@ bool PokeGen::PokeMod::Nature::SetStatDenom(const unsigned s, const unsigned d)
return false;
}
+bool PokeGen::PokeMod::Nature::SetWeight(const unsigned w)
+{
+ if (w)
+ weight = w;
+ return (weight == w);
+}
+
QString PokeGen::PokeMod::Nature::GetName() const
{
return name;
}
-PokeGen::PokeMod::Frac PokeGen::PokeMod::Nature::GetStat(const unsigned s) const
+PokeGen::Frac PokeGen::PokeMod::Nature::GetStat(const unsigned s) const
{
if (s < (pokemod->IsSpecialSplit() ? ST_End_GSC : ST_End_RBY))
return stats[s];
@@ -123,3 +138,8 @@ unsigned PokeGen::PokeMod::Nature::GetStatDenom(const unsigned s) const
{
return GetStat(s).GetDenom();
}
+
+unsigned PokeGen::PokeMod::Nature::GetWeight() const
+{
+ return weight;
+}