summaryrefslogtreecommitdiffstats
path: root/pokemod/AbilityEffect.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-10-26 20:46:09 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-10-26 20:46:09 +0000
commit4385af885daf460a18e236f08509358f764b2c8c (patch)
tree6c2838312dd7f42769280e24e8abc16b53c165cb /pokemod/AbilityEffect.cpp
parent1f08afc80c73087bf9bde639754670548b89fc9f (diff)
Reverted repo back to rev24 because committing of rev25 messed up
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@26 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/AbilityEffect.cpp')
-rw-r--r--pokemod/AbilityEffect.cpp48
1 files changed, 19 insertions, 29 deletions
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index fa32ce1b..695778ba 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -22,16 +22,6 @@
#include "AbilityEffect.h"
-const char* PokeGen::PokeMod::AbilityEffect::EffectStr[PokeGen::PokeMod::AbilityEffect::E_End] = {"Damage to HP", "Prevent Damage", "Auto Heal", "Deal Damage", "Wilds", "Stat", "Status", "Ability", "Accuracy/Power Trade", "Bullseye", "Item Effect", "Type", "Fast Hatch", "Weather"};
-const char* PokeGen::PokeMod::AbilityEffect::TriggerStr[PokeGen::PokeMod::AbilityEffect::T_End] = {"Anything", "Contact", "Weather", "Damage", "Type", "HP Boundary", "Stat Change", "Status"};
-const char* PokeGen::PokeMod::AbilityEffect::InteractStr[PokeGen::PokeMod::AbilityEffect::I_End] = {"Trade", "Shadow", "Block"};
-const char* PokeGen::PokeMod::AbilityEffect::PowerAccStr[PokeGen::PokeMod::AbilityEffect::PA_End] = {"Boost Power", "Boost Accuracy"};
-const char* PokeGen::PokeMod::AbilityEffect::ItemStr[PokeGen::PokeMod::AbilityEffect::IT_End] = {"Stat Modifier", "Type Booster", "Flinch", "Go First"};
-const char* PokeGen::PokeMod::AbilityEffect::CauseStr[PokeGen::PokeMod::AbilityEffect::C_End] = {"Prevent", "Inflict"};
-const char* PokeGen::PokeMod::AbilityEffect::BoostStr[PokeGen::PokeMod::AbilityEffect::B_End] = {"Boost", "Hinder"};
-const char* PokeGen::PokeMod::AbilityEffect::SideStr[PokeGen::PokeMod::AbilityEffect::S_End] = {"Above", "Below"};
-
-
PokeGen::PokeMod::AbilityEffect::AbilityEffect(const Pokemod* par, const unsigned _id) :
Object(_id, par),
chance(1, 1),
@@ -55,7 +45,12 @@ bool PokeGen::PokeMod::AbilityEffect::Validate()
{
pokemod->ValidationMsg(QString("------Effect with id %1---").arg(id), Pokemod::V_Msg);
chance.Reduce();
- if (effect < E_End)
+ if (E_End <= effect)
+ {
+ pokemod->ValidationMsg(QString("AbilityEffect with id %1 has invalid effect").arg(id));
+ isValid = false;
+ }
+ else
{
bool ok = true;
switch (effect)
@@ -65,7 +60,7 @@ bool PokeGen::PokeMod::AbilityEffect::Validate()
ok = false;
break;
case E_Status:
- if (STS_End <= val1)
+ if (pokemod->GetStatusByID(val1) == UINT_MAX)
ok = false;
break;
case E_Ability:
@@ -90,7 +85,7 @@ bool PokeGen::PokeMod::AbilityEffect::Validate()
}
if (!ok)
{
- pokemod->ValidationMsg("Invalid value1");
+ pokemod->ValidationMsg(QString("AbilityEffect with id %1 has an invalid value1").arg(id));
isValid = false;
ok = true;
}
@@ -115,7 +110,7 @@ bool PokeGen::PokeMod::AbilityEffect::Validate()
}
if (!ok)
{
- pokemod->ValidationMsg("Invalid value2");
+ pokemod->ValidationMsg(QString("AbilityEffect with id %1 has an invalid value2").arg(id));
isValid = false;
ok = true;
}
@@ -138,17 +133,17 @@ bool PokeGen::PokeMod::AbilityEffect::Validate()
}
if (!ok)
{
- pokemod->ValidationMsg("Invalid value3");
+ pokemod->ValidationMsg(QString("AbilityEffect with id %1 has an invalid value3").arg(id));
isValid = false;
ok = true;
}
}
- else
+ if (T_End <= trigger)
{
- pokemod->ValidationMsg("Invalid effect");
+ pokemod->ValidationMsg(QString("AbilityEffect with id %1 has an invalid trigger").arg(id));
isValid = false;
}
- if (trigger < T_End)
+ else
{
bool ok = true;
switch (trigger)
@@ -170,21 +165,16 @@ bool PokeGen::PokeMod::AbilityEffect::Validate()
ok = false;
break;
case T_Status:
- if (STS_End <= tval1)
+ if (pokemod->GetStatusByID(tval1) == UINT_MAX)
ok = false;
}
if (!ok)
{
- pokemod->ValidationMsg("Invalid trigger value1");
+ pokemod->ValidationMsg(QString("AbilityEffect with id %1 has an invalid trigger value1").arg(id));
isValid = false;
}
tval2.Reduce();
}
- else
- {
- pokemod->ValidationMsg("Invalid trigger");
- isValid = false;
- }
return isValid;
}
@@ -263,7 +253,7 @@ bool PokeGen::PokeMod::AbilityEffect::SetVal1(const unsigned v1)
val1 = v1;
break;
case E_Status:
- if (v1 < STS_End)
+ if (pokemod->GetStatusByID(v1) != UINT_MAX)
val1 = v1;
break;
case E_Ability:
@@ -370,7 +360,7 @@ bool PokeGen::PokeMod::AbilityEffect::SetTval1(const unsigned tv1)
tval1 = tv1;
break;
case T_Status:
- if (tv1 < STS_End)
+ if (pokemod->GetStatusByID(tv1) != UINT_MAX)
tval1 = tv1;
break;
}
@@ -407,7 +397,7 @@ bool PokeGen::PokeMod::AbilityEffect::SetTval2Denom(const unsigned d)
return false;
}
-PokeGen::Frac PokeGen::PokeMod::AbilityEffect::GetChance() const
+PokeGen::PokeMod::Frac PokeGen::PokeMod::AbilityEffect::GetChance() const
{
return chance;
}
@@ -452,7 +442,7 @@ unsigned PokeGen::PokeMod::AbilityEffect::GetTval1() const
return tval1;
}
-PokeGen::Frac PokeGen::PokeMod::AbilityEffect::GetTval2() const
+PokeGen::PokeMod::Frac PokeGen::PokeMod::AbilityEffect::GetTval2() const
{
return tval2;
}