summaryrefslogtreecommitdiffstats
path: root/pokemod/AbilityEffect.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-06-02 18:12:48 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-06-02 18:12:48 +0000
commitc9afda3ab74614fb36986f96b7972c082f275eca (patch)
tree1b7c0b31950597d6ed562d94158dd3f8701496da /pokemod/AbilityEffect.cpp
parentf71140fae5218ee9839ffcd4ec83abfded5124f4 (diff)
downloadsigen-c9afda3ab74614fb36986f96b7972c082f275eca.tar.gz
sigen-c9afda3ab74614fb36986f96b7972c082f275eca.tar.xz
sigen-c9afda3ab74614fb36986f96b7972c082f275eca.zip
Finished off all PokeMod classes, added move validations, fixed up some GUI, various other fixes
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@18 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/AbilityEffect.cpp')
-rw-r--r--pokemod/AbilityEffect.cpp49
1 files changed, 20 insertions, 29 deletions
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index bca7d486..7c50fdc8 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -25,17 +25,17 @@
extern PokeGen::PokeMod::Pokemod curPokeMod;
-PokeGen::PokeMod::AbilityEffect::AbilityEffect(const unsigned _id)
+PokeGen::PokeMod::AbilityEffect::AbilityEffect(const unsigned _id) :
+ chance(1, 1),
+ effect(UINT_MAX),
+ val1(UINT_MAX),
+ val2(UINT_MAX),
+ val3(UINT_MAX),
+ trigger(UINT_MAX),
+ tval1(UINT_MAX),
+ tval2(UINT_MAX)
{
LogCtor("AbilityEffect", _id);
- chance.Set(1, 1);
- effect = UINT_MAX;
- val1 = UINT_MAX;
- val2 = UINT_MAX;
- val3 = INT_MAX;
- trigger = UINT_MAX;
- tval1 = UINT_MAX;
- tval2.Set(1, 1);
id = _id;
}
@@ -411,7 +411,7 @@ void PokeGen::PokeMod::AbilityEffect::ImportIni(Ini &ini, const unsigned _id)
LogImportStart("AbilityEffect");
if (_id == UINT_MAX)
{
- ini.GetValue("id", id, UINT_MAX);
+ ini.GetValue("id", id);
// Was there an id associated with the element?
if (id == UINT_MAX)
LogIdNotFound("AbilityEffect");
@@ -469,28 +469,26 @@ void PokeGen::PokeMod::AbilityEffect::SetChance(const unsigned n, const unsigned
void PokeGen::PokeMod::AbilityEffect::SetChanceNum(const unsigned n)
{
- LogSetVar("AbilityEffect", id, "chance", n, true);
+ LogSetVar("AbilityEffect", id, "chance numerator", n);
chance.SetNum(n);
}
void PokeGen::PokeMod::AbilityEffect::SetChanceDenom(const unsigned d)
{
- LogSetVar("AbilityEffect", id, "chance", d, false);
+ LogSetVar("AbilityEffect", id, "chance denominator", d);
chance.SetDenom(d);
}
void PokeGen::PokeMod::AbilityEffect::SetEffect(const unsigned e)
{
+ LogSetVar("AbilityEffect", id, "effect", e);
if (e < AE_END)
{
- LogSetVar("AbilityEffect", id, "effect", e);
effect = e;
val1 = UINT_MAX;
val2 = UINT_MAX;
val3 = INT_MAX;
}
- else
- LogOutOfRange("AbilityEffect", id, "effect", e, AbilityEffectStr[effect]);
}
void PokeGen::PokeMod::AbilityEffect::SetEffect(const String &e)
@@ -561,9 +559,6 @@ void PokeGen::PokeMod::AbilityEffect::SetVal1(const unsigned v1)
void PokeGen::PokeMod::AbilityEffect::SetVal1(const String &v1)
{
- Status *s;
- Ability *a;
- Type *t;
switch (effect)
{
case AE_DMG_TO_HP:
@@ -579,11 +574,11 @@ void PokeGen::PokeMod::AbilityEffect::SetVal1(const String &v1)
SetVal1(FindIn(BST_END, v1, curPokeMod.IsSpecialSplit() ? BattleStatRBYStr : BattleStatGSCStr));
break;
case AE_STATUS:
- if (s = curPokeMod.GetStatus(v1))
+ if (const Status *s = curPokeMod.GetStatus(v1))
SetVal1(s->GetId());
break;
case AE_ABILITY:
- if (a = curPokeMod.GetAbility(v1))
+ if (const Ability *a = curPokeMod.GetAbility(v1))
SetVal1(a->GetId());
break;
case AE_ACC_POWER:
@@ -593,7 +588,7 @@ void PokeGen::PokeMod::AbilityEffect::SetVal1(const String &v1)
SetVal1(FindIn(ABIT_END, v1, AbilityItemStr));
break;
case AE_TYPE:
- if (t = curPokeMod.GetType(v1))
+ if (const Type *t = curPokeMod.GetType(v1))
SetVal1(t->GetId());
break;
case AE_WEATHER:
@@ -784,8 +779,6 @@ void PokeGen::PokeMod::AbilityEffect::SetTval1(const unsigned tv1)
void PokeGen::PokeMod::AbilityEffect::SetTval1(const String &tv1)
{
- Type *t;
- Status *s;
switch (trigger)
{
case AT_ANYTHING:
@@ -797,7 +790,7 @@ void PokeGen::PokeMod::AbilityEffect::SetTval1(const String &tv1)
SetTval1(FindIn(W_END_ALL, tv1, WeatherStr));
break;
case AT_TYPE:
- if (t = curPokeMod.GetType(tv1))
+ if (const Type *t = curPokeMod.GetType(tv1))
SetTval1(t->GetId());
break;
case AT_HP_BOUND:
@@ -807,7 +800,7 @@ void PokeGen::PokeMod::AbilityEffect::SetTval1(const String &tv1)
SetTval1(FindIn(BST_END, tv1, curPokeMod.IsSpecialSplit() ? BattleStatRBYStr : BattleStatGSCStr));
break;
case AT_STATUS:
- if (s = curPokeMod.GetStatus(tv1))
+ if (const Status *s = curPokeMod.GetStatus(tv1))
SetTval1(s->GetId());
break;
default:
@@ -927,9 +920,8 @@ PokeGen::PokeMod::String PokeGen::PokeMod::AbilityEffect::GetEffectString() cons
{
LogFetchVar("AbilityEffect", id, "effect string", effect);
if (effect < AE_END)
- return "";
- else
return AbilityEffectStr[effect];
+ return "";
}
unsigned PokeGen::PokeMod::AbilityEffect::GetVal1() const
@@ -1023,9 +1015,8 @@ PokeGen::PokeMod::String PokeGen::PokeMod::AbilityEffect::GetTriggerString() con
{
LogFetchVar("AbilityEffect", id, "trigger string", trigger);
if (trigger < AT_END)
- return "";
- else
return AbilityTriggerStr[trigger];
+ return "";
}
unsigned PokeGen::PokeMod::AbilityEffect::GetTval1() const