summaryrefslogtreecommitdiffstats
path: root/pokemod/Rules.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-11-27 05:50:14 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-11-27 05:50:14 +0000
commitb2ec6250bb96e7a96898b35ee7271eb1a7b700ad (patch)
tree615ef5c23019361c48eb937b296101853f358c80 /pokemod/Rules.cpp
parent4cc4d62d084bc3002e35f6bd15a73f22157114e4 (diff)
[ADD] Known MoveEffects
[FIX] pokegen.pro error in rpm build target [FIX] EggSpecies not needed (generic species will be used instead) [FIX] StruggleMove not needed (generic will be used instead) [FIX] TypeChart moved back to Pokemod so that Rules are completely Pokemod-neutral git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@29 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Rules.cpp')
-rw-r--r--pokemod/Rules.cpp86
1 files changed, 1 insertions, 85 deletions
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index 0daede2a..92ce05f5 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -26,7 +26,6 @@ PokeGen::PokeMod::Rules::Rules(const Pokemod& par) :
Object(par, 0),
genderAllowed(false),
breedingAllowed(false),
- eggSpecies(UINT_MAX),
holdItems(0),
criticalDomains(false),
abilityAllowed(false),
@@ -49,8 +48,7 @@ PokeGen::PokeMod::Rules::Rules(const Pokemod& par) :
effortValuesAllowed(false),
maxTotalEV(0),
maxEVPerStat(0),
- pokerusChance(1, 1),
- typeChart(1, 1, Frac(1, 1, Frac::Improper))
+ pokerusChance(1, 1)
{
}
@@ -64,11 +62,6 @@ bool PokeGen::PokeMod::Rules::validate() const
{
bool valid = true;
pokemod.validationMsg("---Rules", Pokemod::V_Msg);
- if (genderAllowed && breedingAllowed || (pokemod.getSpeciesByID(eggSpecies) == UINT_MAX))
- {
- pokemod.validationMsg("Invalid egg species");
- valid = false;
- }
if (!numPokemonBoxes)
pokemod.validationMsg("Invalid number of Pokémon boxes", Pokemod::V_Warn);
else if (!numPokemonPerBox)
@@ -118,7 +111,6 @@ void PokeGen::PokeMod::Rules::load(const QString& fname)
unsigned j;
ini.getValue("genderAllowed", genderAllowed, false);
ini.getValue("breedingAllowed", breedingAllowed, false);
- ini.getValue("eggSpecies", eggSpecies);
ini.getValue("holdItems", holdItems, 0);
ini.getValue("criticalDomains", criticalDomains, false);
ini.getValue("abilityAllowed", abilityAllowed, false);
@@ -144,17 +136,6 @@ void PokeGen::PokeMod::Rules::load(const QString& fname)
ini.getValue("pokerusChance-n", i, 1);
ini.getValue("pokerusChance-d", j, 1);
pokerusChance.set(i, j);
- for (unsigned i = 0; i < pokemod.getTypeCount(); ++i)
- {
- for (unsigned j = 0; j < pokemod.getTypeCount(); ++j)
- {
- unsigned k;
- unsigned l;
- ini.getValue(QString("typeChart-%1-%2-n").arg(i).arg(j), k, 1);
- ini.getValue(QString("typeChart-%1-%2-d").arg(i).arg(j), l, 1);
- setTypeChart(i, j, k, l);
- }
- }
}
void PokeGen::PokeMod::Rules::save() const
@@ -162,7 +143,6 @@ void PokeGen::PokeMod::Rules::save() const
Ini ini;
ini.addField("genderAllowed", genderAllowed);
ini.addField("breedingAllowed", breedingAllowed);
- ini.addField("eggSpecies", eggSpecies);
ini.addField("holdItems", holdItems);
ini.addField("criticalDomains", criticalDomains);
ini.addField("abilityAllowed", abilityAllowed);
@@ -187,14 +167,6 @@ void PokeGen::PokeMod::Rules::save() const
ini.addField("maxEVPerStat", maxEVPerStat);
ini.addField("pokerusChance-n", pokerusChance.getNum());
ini.addField("pokerusChance-d", pokerusChance.getDenom());
- for (unsigned i = 1; i < typeChart.getWidth(); ++i)
- {
- for (unsigned j = 1; j < typeChart.getHeight(); ++j)
- {
- ini.addField(QString("typeChart-%1-%2-n").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getNum());
- ini.addField(QString("typeChart-%1-%2-d").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getDenom());
- }
- }
ini.save(QString("%1/rules.pini").arg(pokemod.getPath()));
}
@@ -212,15 +184,6 @@ void PokeGen::PokeMod::Rules::setBreedingAllowed(const bool b)
breedingAllowed = b;
}
-void PokeGen::PokeMod::Rules::setEggSpecies(const unsigned e)
-{
- if (!breedingAllowed)
- throw("Rules: ne eggs without breeding");
- if (pokemod.getSpeciesByID(e) == UINT_MAX)
- throw("Rules: eggSpecies out-of-bounds");
- eggSpecies = e;
-}
-
void PokeGen::PokeMod::Rules::setHoldItems(const unsigned h)
{
holdItems = h;
@@ -372,11 +335,6 @@ bool PokeGen::PokeMod::Rules::getBreedingAllowed() const
return breedingAllowed;
}
-unsigned PokeGen::PokeMod::Rules::getEggSpecies() const
-{
- return eggSpecies;
-}
-
unsigned PokeGen::PokeMod::Rules::getHoldItems() const
{
return holdItems;
@@ -502,53 +460,12 @@ unsigned PokeGen::PokeMod::Rules::getPokerusChanceDenom() const
return pokerusChance.getDenom();
}
-void PokeGen::PokeMod::Rules::setTypeChart(const unsigned att, const unsigned def, const unsigned n, const unsigned d)
-{
- typeChart(att, def).set(n, d);
-}
-
-void PokeGen::PokeMod::Rules::setTypeChartNum(const unsigned att, const unsigned def, const unsigned n)
-{
- typeChart(att, def).setNum(n);
-}
-
-void PokeGen::PokeMod::Rules::setTypeChartDenom(const unsigned att, const unsigned def, const unsigned d)
-{
- typeChart(att, def).setDenom(d);
-}
-
-const PokeGen::FracMatrix& PokeGen::PokeMod::Rules::getTypeChart() const
-{
- return typeChart;
-}
-
-PokeGen::FracMatrix& PokeGen::PokeMod::Rules::getTypeChart()
-{
- return typeChart;
-}
-
-PokeGen::Frac PokeGen::PokeMod::Rules::getTypeChart(const unsigned att, const unsigned def) const
-{
- return typeChart(att, def);
-}
-
-unsigned PokeGen::PokeMod::Rules::getTypeChartNum(const unsigned att, const unsigned def) const
-{
- return getTypeChart(att, def).getNum();
-}
-
-unsigned PokeGen::PokeMod::Rules::getTypeChartDenom(const unsigned att, const unsigned def) const
-{
- return getTypeChart(att, def).getDenom();
-}
-
PokeGen::PokeMod::Rules& PokeGen::PokeMod::Rules::operator=(const Rules& rhs)
{
if (this == &rhs)
return *this;
genderAllowed = rhs.genderAllowed;
breedingAllowed = rhs.breedingAllowed;
- eggSpecies = rhs.eggSpecies;
holdItems = rhs.holdItems;
criticalDomains = rhs.criticalDomains;
abilityAllowed = rhs.abilityAllowed;
@@ -572,6 +489,5 @@ PokeGen::PokeMod::Rules& PokeGen::PokeMod::Rules::operator=(const Rules& rhs)
maxTotalEV = rhs.maxTotalEV;
maxEVPerStat = rhs.maxEVPerStat;
pokerusChance = rhs.pokerusChance;
- typeChart = rhs.typeChart;
return *this;
}