summaryrefslogtreecommitdiffstats
path: root/pokemod/StatusEffect.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/StatusEffect.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/StatusEffect.cpp')
-rw-r--r--pokemod/StatusEffect.cpp182
1 files changed, 182 insertions, 0 deletions
diff --git a/pokemod/StatusEffect.cpp b/pokemod/StatusEffect.cpp
new file mode 100644
index 00000000..2ecd5f66
--- /dev/null
+++ b/pokemod/StatusEffect.cpp
@@ -0,0 +1,182 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/StatusEffect.cpp
+// Purpose: Define an effect of a status
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Sat June 2 2007 12:16:48
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTStatus or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "StatusEffect.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::StatusEffect::StatusEffect(const unsigned _id) :
+ effect(UINT_MAX),
+ val1(UINT_MAX),
+ val2(UINT_MAX)
+{
+ LogCtor("StatusEffect", _id);
+ id = _id;
+}
+
+PokeGen::PokeMod::StatusEffect::StatusEffect(Ini &ini, const unsigned _id)
+{
+ LogCtorIni("StatusEffect", _id);
+ ImportIni(ini, _id);
+ if (id == UINT_MAX)
+ LogIdError("StatusEffect");
+}
+
+PokeGen::PokeMod::StatusEffect::~StatusEffect()
+{
+ LogDtor("StatusEffect", id);
+}
+
+void PokeGen::PokeMod::StatusEffect::Validate()
+{
+ LogValidateStart("StatusEffect", id);
+ // TODO (Ben#1#): Validation
+ LogValidateOver("StatusEffect", id, isValid);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::StatusEffect::Validate(const wxListBox &output)
+{
+ LogValidateStart("StatusEffect", id);
+ LogValidateOver("StatusEffect", id, isValid);
+}
+#endif
+
+void PokeGen::PokeMod::StatusEffect::ImportIni(Ini &ini, const unsigned _id)
+{
+ LogImportStart("StatusEffect");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("StatusEffect");
+ }
+ else
+ id = _id;
+ ini.GetValue("effect", effect);
+ ini.GetValue("val1", val1);
+ ini.GetValue("val2", val2);
+ LogImportOver("StatusEffect", id);
+}
+
+void PokeGen::PokeMod::StatusEffect::ExportIni(std::ofstream &fout, const String &Status) const
+{
+ LogExportStart("StatusEffect", id);
+ // Make elements
+ Ini exStatusEffect(Status + " StatusEffect");
+ exStatusEffect.AddField("id", id);
+ exStatusEffect.AddField("effect", effect);
+ exStatusEffect.AddField("val1", val1);
+ exStatusEffect.AddField("val2", val2);
+ exStatusEffect.Export(fout);
+ LogExportOver("StatusEffect", id);
+}
+
+void PokeGen::PokeMod::StatusEffect::SetEffect(const unsigned e)
+{
+ LogSetVar("StatusEffect", id, "effect", e);
+ if (e < SE_END)
+ {
+ effect = e;
+ val1 = UINT_MAX;
+ val2 = UINT_MAX;
+ }
+}
+
+void PokeGen::PokeMod::StatusEffect::SetEffect(const String &e)
+{
+ SetEffect(FindIn(SE_END, e, StatusEffectStr));
+}
+
+void PokeGen::PokeMod::StatusEffect::SetVal1(const unsigned v1)
+{
+ LogSetVar("StatusEffect", id, "val1", v1);
+ switch (effect)
+ {
+// LogNoUse("StatusEffect", id, "val1", v1, "effect", StatusEffectStr[effect]);
+// LogOutOfRange("StatusEffect", id, "val1", v1, "effect", StatusEffectStr[effect]);
+ default:
+ LogNotSet("StatusEffect", id, "val1", v1, "effect");
+ }
+}
+
+void PokeGen::PokeMod::StatusEffect::SetVal2(const unsigned v2)
+{
+ LogSetVar("StatusEffect", id, "val2", v2);
+ switch (effect)
+ {
+// LogNoUse("StatusEffect", id, "val2", v2, "effect", StatusEffectStr[effect]);
+// LogOutOfRange("StatusEffect", id, "val2", v2, "effect", StatusEffectStr[effect]);
+ default:
+ LogNotSet("StatusEffect", id, "val2", v2, "effect");
+ }
+}
+
+void PokeGen::PokeMod::StatusEffect::SetVal2(const String &v2)
+{
+ switch (effect)
+ {
+// LogNoUse("StatusEffect", id, "val2", v2, "effect", StatusEffectStr[effect]);
+// SetVal2(FindIn(BM_END, v2, BattleMemberStr));
+ default:
+ LogNotSet("StatusEffect", id, "val2", v2, "effect");
+ }
+}
+
+unsigned PokeGen::PokeMod::StatusEffect::GetEffect() const
+{
+ LogFetchVar("StatusEffect", id, "effect", effect);
+ return effect;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::StatusEffect::GetEffectString() const
+{
+ LogFetchVar("StatusEffect", id, "effect string", effect);
+ if (effect < SE_END)
+ return StatusEffectStr[effect];
+ return "";
+}
+
+unsigned PokeGen::PokeMod::StatusEffect::GetVal1() const
+{
+ LogFetchVar("StatusEffect", id, "val1", val1);
+ return val1;
+}
+
+unsigned PokeGen::PokeMod::StatusEffect::GetVal2() const
+{
+ LogFetchVar("StatusEffect", id, "val2", val2);
+ return val2;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::StatusEffect::GetVal2String() const
+{
+ LogFetchVar("StatusEffect", id, "val2 string", val2);
+ String ret = "";
+ switch (effect)
+ {
+// ret = BattleMemberStr[val2];
+ }
+ return ret;
+}