summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-05-25 00:15:36 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-05-25 00:15:36 +0000
commit75b7d5c767428f7061365a186cb17a22de4112cc (patch)
tree46db9c129f3fa848a6ea084a31e01f2c59e67b2a
parent1a4b623c8ecb9d0c7d991312c12d78be4a68eff2 (diff)
downloadsigen-75b7d5c767428f7061365a186cb17a22de4112cc.tar.gz
sigen-75b7d5c767428f7061365a186cb17a22de4112cc.tar.xz
sigen-75b7d5c767428f7061365a186cb17a22de4112cc.zip
More modules PokéMod added
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@14 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog11
-rw-r--r--pokegen.cbp40
-rw-r--r--pokegen.layout65
-rw-r--r--pokemod/AbilityEffect.cpp12
-rw-r--r--pokemod/CoinItem.cpp2
-rw-r--r--pokemod/CoinList.cpp2
-rw-r--r--pokemod/Debug.cpp4
-rw-r--r--pokemod/Dialog.cpp107
-rw-r--r--pokemod/Dialog.h62
-rw-r--r--pokemod/Ini.cpp15
-rw-r--r--pokemod/Ini.h11
-rw-r--r--pokemod/Item.cpp2
-rw-r--r--pokemod/ItemEffect.cpp818
-rw-r--r--pokemod/ItemEffect.h94
-rw-r--r--pokemod/ItemStorage.cpp2
-rw-r--r--pokemod/MapTrainerTeam.cpp2
-rw-r--r--pokemod/MapWildList.cpp2
-rw-r--r--pokemod/MapWildPokemon.cpp2
-rw-r--r--pokemod/MoveEffect.cpp205
-rw-r--r--pokemod/MoveEffect.h78
-rw-r--r--pokemod/NatureEffect.cpp155
-rw-r--r--pokemod/NatureEffect.h69
-rw-r--r--pokemod/Object.cpp8
-rw-r--r--pokemod/Pokemod.cpp9
-rw-r--r--pokemod/PokemonEvolution.cpp2
-rw-r--r--pokemod/PokemonMove.cpp2
-rw-r--r--pokemod/Store.cpp2
27 files changed, 1727 insertions, 56 deletions
diff --git a/Changelog b/Changelog
index 9f6abe17..5f515abf 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,15 @@
-----------------
+Rev: 14
+Date: 24 May 2007
+User: MathStuf
+-----------------
+[ADD] /pokemod/MoveEffect.{h, cpp}
+[ADD] /pokemod/ItemEffect.{h, cpp}
+[ADD] /pokemod/Dialog.{h, cpp}
+[ADD] /pokemod/NatureEffect.{h, cpp}
+[FIX] Various minor typos
+
+-----------------
Rev: 13
Date: 22 May 2007
User: MathStuf
diff --git a/pokegen.cbp b/pokegen.cbp
index 6f08535b..8e260f3c 100644
--- a/pokegen.cbp
+++ b/pokegen.cbp
@@ -143,6 +143,16 @@
<Unit filename="pokemod\Debug.h">
<Option target="pokemod-DLL" />
</Unit>
+ <Unit filename="pokemod\Dialog.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\Dialog.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
<Unit filename="pokemod\Flag.cpp">
<Option target="pokemod-DLL" />
</Unit>
@@ -171,6 +181,16 @@
<Option target="pokegen" />
<Option target="pokemod-DLL" />
</Unit>
+ <Unit filename="pokemod\ItemEffect.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\ItemEffect.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
<Unit filename="pokemod\ItemStorage.cpp">
<Option target="pokemodr" />
<Option target="pokegen" />
@@ -214,12 +234,32 @@
<Unit filename="pokemod\Matrix.h">
<Option target="pokemod-DLL" />
</Unit>
+ <Unit filename="pokemod\MoveEffect.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\MoveEffect.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
<Unit filename="pokemod\Nature.cpp">
<Option target="pokemod-DLL" />
</Unit>
<Unit filename="pokemod\Nature.h">
<Option target="pokemod-DLL" />
</Unit>
+ <Unit filename="pokemod\NatureEffect.cpp">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
+ <Unit filename="pokemod\NatureEffect.h">
+ <Option target="pokemodr" />
+ <Option target="pokegen" />
+ <Option target="pokemod-DLL" />
+ </Unit>
<Unit filename="pokemod\Object.cpp">
<Option target="pokemod-DLL" />
</Unit>
diff --git a/pokegen.layout b/pokegen.layout
index 441133d1..828ae9df 100644
--- a/pokegen.layout
+++ b/pokegen.layout
@@ -2,7 +2,7 @@
<CodeBlocks_layout_file>
<ActiveTarget name="pokemod-DLL" />
<File name="Changelog" open="1" top="1" tabpos="1">
- <Cursor position="253" topLine="0" />
+ <Cursor position="185" topLine="0" />
</File>
<File name="STANDARDS" open="0" top="0" tabpos="0">
<Cursor position="2" topLine="0" />
@@ -25,14 +25,14 @@
<File name="ai\Node.h" open="0" top="0" tabpos="0">
<Cursor position="1408" topLine="0" />
</File>
- <File name="pokemod\Ability.cpp" open="1" top="0" tabpos="2">
+ <File name="pokemod\Ability.cpp" open="0" top="0" tabpos="2">
<Cursor position="4420" topLine="117" />
</File>
<File name="pokemod\Ability.h" open="0" top="0" tabpos="2">
<Cursor position="2059" topLine="0" />
</File>
<File name="pokemod\AbilityEffect.cpp" open="0" top="0" tabpos="2">
- <Cursor position="2972" topLine="6" />
+ <Cursor position="25165" topLine="622" />
</File>
<File name="pokemod\AbilityEffect.h" open="0" top="0" tabpos="3">
<Cursor position="103" topLine="0" />
@@ -50,23 +50,29 @@
<Cursor position="1402" topLine="0" />
</File>
<File name="pokemod\CoinItem.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1570" topLine="27" />
+ <Cursor position="1565" topLine="27" />
</File>
<File name="pokemod\CoinItem.h" open="0" top="0" tabpos="0">
<Cursor position="1718" topLine="36" />
</File>
<File name="pokemod\CoinList.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1604" topLine="32" />
+ <Cursor position="1599" topLine="32" />
</File>
<File name="pokemod\CoinList.h" open="0" top="0" tabpos="0">
<Cursor position="2449" topLine="33" />
</File>
<File name="pokemod\Debug.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1310" topLine="0" />
+ <Cursor position="1588" topLine="27" />
</File>
<File name="pokemod\Debug.h" open="0" top="0" tabpos="4">
<Cursor position="9129" topLine="0" />
</File>
+ <File name="pokemod\Dialog.cpp" open="0" top="0" tabpos="0">
+ <Cursor position="2798" topLine="74" />
+ </File>
+ <File name="pokemod\Dialog.h" open="0" top="0" tabpos="0">
+ <Cursor position="1501" topLine="24" />
+ </File>
<File name="pokemod\Flag.cpp" open="0" top="0" tabpos="8">
<Cursor position="2832" topLine="0" />
</File>
@@ -83,34 +89,40 @@
<Cursor position="3247" topLine="0" />
</File>
<File name="pokemod\Ini.h" open="0" top="0" tabpos="12">
- <Cursor position="2687" topLine="0" />
+ <Cursor position="1745" topLine="30" />
</File>
<File name="pokemod\Item.cpp" open="0" top="0" tabpos="2">
- <Cursor position="6832" topLine="25" />
+ <Cursor position="1538" topLine="25" />
</File>
<File name="pokemod\Item.h" open="0" top="0" tabpos="0">
<Cursor position="2095" topLine="33" />
</File>
+ <File name="pokemod\ItemEffect.cpp" open="0" top="0" tabpos="0">
+ <Cursor position="1647" topLine="0" />
+ </File>
+ <File name="pokemod\ItemEffect.h" open="0" top="0" tabpos="0">
+ <Cursor position="2919" topLine="0" />
+ </File>
<File name="pokemod\ItemStorage.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1524" topLine="27" />
+ <Cursor position="1579" topLine="27" />
</File>
<File name="pokemod\ItemStorage.h" open="0" top="0" tabpos="0">
<Cursor position="103" topLine="0" />
</File>
<File name="pokemod\MapTrainerTeam.cpp" open="0" top="0" tabpos="3">
- <Cursor position="6583" topLine="165" />
+ <Cursor position="1578" topLine="12" />
</File>
<File name="pokemod\MapTrainerTeam.h" open="0" top="0" tabpos="0">
<Cursor position="1743" topLine="24" />
</File>
<File name="pokemod\MapWildList.cpp" open="0" top="0" tabpos="2">
- <Cursor position="1617" topLine="21" />
+ <Cursor position="1612" topLine="21" />
</File>
<File name="pokemod\MapWildList.h" open="0" top="0" tabpos="0">
<Cursor position="1775" topLine="30" />
</File>
<File name="pokemod\MapWildPokemon.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1595" topLine="30" />
+ <Cursor position="1590" topLine="24" />
</File>
<File name="pokemod\MapWildPokemon.h" open="0" top="0" tabpos="0">
<Cursor position="1872" topLine="34" />
@@ -118,14 +130,26 @@
<File name="pokemod\Matrix.h" open="0" top="0" tabpos="4">
<Cursor position="3839" topLine="0" />
</File>
+ <File name="pokemod\MoveEffect.cpp" open="0" top="0" tabpos="0">
+ <Cursor position="1557" topLine="33" />
+ </File>
+ <File name="pokemod\MoveEffect.h" open="0" top="0" tabpos="0">
+ <Cursor position="2518" topLine="45" />
+ </File>
<File name="pokemod\Nature.cpp" open="0" top="0" tabpos="5">
<Cursor position="4418" topLine="7" />
</File>
<File name="pokemod\Nature.h" open="0" top="0" tabpos="4">
<Cursor position="1307" topLine="14" />
</File>
+ <File name="pokemod\NatureEffect.cpp" open="0" top="0" tabpos="0">
+ <Cursor position="5219" topLine="121" />
+ </File>
+ <File name="pokemod\NatureEffect.h" open="0" top="0" tabpos="0">
+ <Cursor position="2253" topLine="27" />
+ </File>
<File name="pokemod\Object.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1358" topLine="0" />
+ <Cursor position="1643" topLine="16" />
</File>
<File name="pokemod\Object.h" open="0" top="0" tabpos="0">
<Cursor position="1644" topLine="0" />
@@ -142,11 +166,8 @@
<File name="pokemod\Point.h" open="0" top="0" tabpos="20">
<Cursor position="1594" topLine="0" />
</File>
- <File name="pokemod\Pokemod.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1866" topLine="0" />
- </File>
<File name="pokemod\Pokemod.h" open="0" top="0" tabpos="0">
- <Cursor position="1346" topLine="17" />
+ <Cursor position="125" topLine="0" />
</File>
<File name="pokemod\PokemonAbility.cpp" open="0" top="0" tabpos="0">
<Cursor position="1580" topLine="18" />
@@ -155,7 +176,7 @@
<Cursor position="1743" topLine="27" />
</File>
<File name="pokemod\PokemonEvolution.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1647" topLine="18" />
+ <Cursor position="1642" topLine="18" />
</File>
<File name="pokemod\PokemonEvolution.h" open="0" top="0" tabpos="0">
<Cursor position="1765" topLine="24" />
@@ -167,13 +188,13 @@
<Cursor position="1740" topLine="30" />
</File>
<File name="pokemod\PokemonMove.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1558" topLine="30" />
+ <Cursor position="1553" topLine="30" />
</File>
<File name="pokemod\PokemonMove.h" open="0" top="0" tabpos="0">
<Cursor position="1719" topLine="21" />
</File>
<File name="pokemod\PokemonNature.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1570" topLine="24" />
+ <Cursor position="1570" topLine="27" />
</File>
<File name="pokemod\PokemonNature.h" open="0" top="0" tabpos="0">
<Cursor position="1712" topLine="27" />
@@ -182,10 +203,10 @@
<Cursor position="103" topLine="0" />
</File>
<File name="pokemod\Ref.h" open="0" top="0" tabpos="0">
- <Cursor position="103" topLine="0" />
+ <Cursor position="3422" topLine="86" />
</File>
<File name="pokemod\Store.cpp" open="0" top="0" tabpos="0">
- <Cursor position="1503" topLine="21" />
+ <Cursor position="1498" topLine="21" />
</File>
<File name="pokemod\Store.h" open="0" top="0" tabpos="0">
<Cursor position="103" topLine="0" />
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index 06d03afb..ee054010 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -782,13 +782,13 @@ PokeGen::PokeMod::Frac PokeGen::PokeMod::AbilityEffect::GetTval2() const
case AT_TYPE:
case AT_STAT_CHANGE:
case AT_STATUS:
- LogNoUse("AbilityEffect", id, "tVal2", LONG_MAX, "trigger", AbilityTriggerStr[trigger]);
+ LogNoUse("AbilityEffect", id, "tVal2", "trigger", AbilityTriggerStr[trigger]);
break;
case AT_HP_BOUND:
LogFetchVar("AbilityEffect", id, "tVal2");
break;
default:
- LogNotSet("AbilityEffect", id, "tVal2", LONG_MAX, "trigger");
+ LogNotSet("AbilityEffect", id, "tVal2", "trigger");
}
return tval2;
}
@@ -804,13 +804,13 @@ unsigned PokeGen::PokeMod::AbilityEffect::GetTval2Num() const
case AT_TYPE:
case AT_STAT_CHANGE:
case AT_STATUS:
- LogNoUse("AbilityEffect", id, "tVal2 numerator", LONG_MAX, "trigger", AbilityTriggerStr[trigger]);
+ LogNoUse("AbilityEffect", id, "tVal2 numerator", "trigger", AbilityTriggerStr[trigger]);
break;
case AT_HP_BOUND:
LogFetchVar("AbilityEffect", id, "tVal2", tval2.GetNum());
return tval2.GetNum();
default:
- LogNotSet("AbilityEffect", id, "tVal2 numerator", LONG_MAX, "trigger");
+ LogNotSet("AbilityEffect", id, "tVal2 numerator", "trigger");
}
return 0;
}
@@ -826,13 +826,13 @@ unsigned PokeGen::PokeMod::AbilityEffect::GetTval2Denom() const
case AT_TYPE:
case AT_STAT_CHANGE:
case AT_STATUS:
- LogNoUse("AbilityEffect", id, "tVal2 denominator", LONG_MAX, "trigger", AbilityTriggerStr[trigger]);
+ LogNoUse("AbilityEffect", id, "tVal2 denominator", "trigger", AbilityTriggerStr[trigger]);
break;
case AT_HP_BOUND:
LogFetchVar("AbilityEffect", id, "tVal2", tval2.GetDenom());
return tval2.GetDenom();
default:
- LogNotSet("AbilityEffect", id, "tVal2 denominator", LONG_MAX, "trigger");
+ LogNotSet("AbilityEffect", id, "tVal2 denominator", "trigger");
}
return 0;
}
diff --git a/pokemod/CoinItem.cpp b/pokemod/CoinItem.cpp
index d1b26125..c04582ce 100644
--- a/pokemod/CoinItem.cpp
+++ b/pokemod/CoinItem.cpp
@@ -38,7 +38,7 @@ PokeGen::PokeMod::CoinItem::CoinItem(unsigned _id)
PokeGen::PokeMod::CoinItem::CoinItem(Ini &ini, unsigned _id)
{
LogCtorIni("CoinItem", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("CoinItem");
}
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index d9bb353d..175daf39 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -38,7 +38,7 @@ PokeGen::PokeMod::CoinList::CoinList(unsigned _id)
PokeGen::PokeMod::CoinList::CoinList(Ini &ini, unsigned _id)
{
LogCtorIni("CoinList", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("CoinList");
}
diff --git a/pokemod/Debug.cpp b/pokemod/Debug.cpp
index cb2e4bff..87a9b7e0 100644
--- a/pokemod/Debug.cpp
+++ b/pokemod/Debug.cpp
@@ -29,14 +29,14 @@
extern debugWindow PokeModDebugWindow;
#endif
-int PokModDebugLevel;
+int PokeModDebugLevel;
void PokeGen::PokeMod::Log(const char *msg, int level)
{
// Actual strings of the debugging levels
const char *PokeModDebugStr[8] = {"Emergency", "Alert", "Critical Error", "Error", "Warning", "Notice", "Info", "Debug"};
// Only log if wanted
- if (level <= PokModDebugLevel)
+ if (level <= PokeModDebugLevel)
{
// Get the current time
char path[21];
diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp
new file mode 100644
index 00000000..8e62e368
--- /dev/null
+++ b/pokemod/Dialog.cpp
@@ -0,0 +1,107 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/Dialog.cpp
+// Purpose: Define a dialog in a PokéMod
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Wed Feb 28 21:05:56 2007
+// 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
+// MERCHANTABILITY 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 "Dialog.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::Dialog::Dialog(unsigned _id)
+{
+ LogCtor("Dialog", _id);
+ dialog = "";
+ id = _id;
+}
+
+PokeGen::PokeMod::Dialog::Dialog(Ini &ini, unsigned _id)
+{
+ LogCtorIni("Dialog", _id);
+ ImportIni(ini, _id);
+ if (id == UINT_MAX)
+ LogIdError("Dialog");
+}
+
+PokeGen::PokeMod::Dialog::~Dialog()
+{
+ LogDtor("Dialog", id);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::Dialog::Validate(const wxListBox &output)
+#else
+void PokeGen::PokeMod::Dialog::Validate()
+#endif
+{
+ isValid = true;
+ LogValidateStart("Dialog", id);
+ // TODO (Validation#1#): Dialog Validation
+ LogValidateOver("Dialog", id, isValid);
+}
+
+void PokeGen::PokeMod::Dialog::ImportIni(Ini &ini, unsigned _id)
+{
+ LogImportStart("Dialog");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("Dialog");
+ }
+ else
+ id = _id;
+ ini.GetValue("dialog", dialog, "");
+ LogImportOver("Dialog", id);
+}
+
+void PokeGen::PokeMod::Dialog::ExportIni(std::ofstream &fout) const
+{
+ LogExportStart("Dialog", id);
+ // Make elements
+ Ini exDialog("dialog");
+ exDialog.AddField("id", id);
+ exDialog.AddField("dialog", dialog);
+ exDialog.Export(fout);
+ LogExportOver("Dialog", id);
+}
+
+void PokeGen::PokeMod::Dialog::SetDialog(const String &d)
+{
+ LogSetVar("Dialog", id, "dialog", d);
+ dialog = d;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::Dialog::GetDialog() const
+{
+ LogFetchVar("Dialog", id, "dialog", dialog);
+ return dialog;
+}
+
+void PokeGen::PokeMod::Dialog::InsertDialogCommand(unsigned cmd, unsigned pos)
+{
+ // TODO (Ben#1#): Dialog commands
+}
+
+void PokeGen::PokeMod::Dialog::InsertDialogCommand(const String &cmd, unsigned pos)
+{
+ // TODO (Ben#1#): Dialog commands
+}
diff --git a/pokemod/Dialog.h b/pokemod/Dialog.h
new file mode 100644
index 00000000..858055de
--- /dev/null
+++ b/pokemod/Dialog.h
@@ -0,0 +1,62 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/Dialog.h
+// Purpose: Define a dialog in a PokéMod
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Wed Feb 28 21:05:56 2007
+// 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
+// MERCHANTABILITY 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.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_DIALOG__
+#define __POKEMOD_DIALOG__
+
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class Dialog : public Object
+ {
+ public:
+ Dialog(unsigned _id);
+ Dialog(Ini &ini, unsigned _id = UINT_MAX);
+ ~Dialog();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream &fout) const;
+
+ void SetDialog(const String &d);
+
+ String GetDialog() const;
+
+ void InsertDialogCommand(unsigned cmd, unsigned pos);
+ void InsertDialogCommand(const String &cmd, unsigned pos);
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ String dialog;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/Ini.cpp b/pokemod/Ini.cpp
index 5c75e64c..4b3d9eb6 100644
--- a/pokemod/Ini.cpp
+++ b/pokemod/Ini.cpp
@@ -57,6 +57,11 @@ void PokeGen::PokeMod::Ini::AddField(const String &n, const unsigned v)
fields[n] = String("%u", v);
}
+void PokeGen::PokeMod::Ini::AddField(const String &n, const char *v)
+{
+ fields[n] = v;
+}
+
void PokeGen::PokeMod::Ini::AddField(const String &n, const String &v)
{
fields[n] = v;
@@ -77,7 +82,7 @@ PokeGen::PokeMod::String PokeGen::PokeMod::Ini::GetName() const
return name;
}
-void PokeGen::PokeMod::Ini::GetValue(const String &field, int &val, int def) const
+void PokeGen::PokeMod::Ini::GetValue(const String &field, int &val, int def)
{
if (!fields.count(field))
{
@@ -90,7 +95,7 @@ void PokeGen::PokeMod::Ini::GetValue(const String &field, int &val, int def) con
val = ((temp < INT_MIN) || (INT_MAX < temp) || *end) ? def : temp;
}
-void PokeGen::PokeMod::Ini::GetValue(const String &field, unsigned &val, unsigned def) const
+void PokeGen::PokeMod::Ini::GetValue(const String &field, unsigned &val, unsigned def)
{
if (!fields.count(field))
{
@@ -103,7 +108,7 @@ void PokeGen::PokeMod::Ini::GetValue(const String &field, unsigned &val, unsigne
val = ((UINT_MAX < temp) || *end) ? def : temp;
}
-void PokeGen::PokeMod::Ini::GetValue(const String &field, String &val, const String &def) const
+void PokeGen::PokeMod::Ini::GetValue(const String &field, String &val, const String &def)
{
if (!fields.count(field))
{
@@ -113,7 +118,7 @@ void PokeGen::PokeMod::Ini::GetValue(const String &field, String &val, const Str
val = fields[field];
}
-void PokeGen::PokeMod::Ini::GetValue(const String &field, bool &val, bool def) const
+void PokeGen::PokeMod::Ini::GetValue(const String &field, bool &val, bool def)
{
if (!fields.count(field))
{
@@ -128,7 +133,7 @@ void PokeGen::PokeMod::Ini::GetValue(const String &field, bool &val, bool def) c
val = def;
}
-void PokeGen::PokeMod::Ini::GetValue(const String &field, double &val, double def) const
+void PokeGen::PokeMod::Ini::GetValue(const String &field, double &val, double def)
{
if (!fields.count(field))
{
diff --git a/pokemod/Ini.h b/pokemod/Ini.h
index 6d11e649..b37ed3b8 100644
--- a/pokemod/Ini.h
+++ b/pokemod/Ini.h
@@ -43,16 +43,17 @@ namespace PokeGen
void AddField(const String &n, const int v);
void AddField(const String &n, const unsigned v);
+ void AddField(const String &n, const char *v);
void AddField(const String &n, const String &v);
void AddField(const String &n, const bool v);
void AddField(const String &n, const double v);
String GetName() const;
- void GetValue(const String &field, int &val, int def = -1) const;
- void GetValue(const String &field, unsigned &val, unsigned def = UINT_MAX) const;
- void GetValue(const String &field, String &val, const String &def = "") const;
- void GetValue(const String &field, bool &val, bool def = true) const;
- void GetValue(const String &field, double &val, double def = 0) const;
+ void GetValue(const String &field, int &val, int def = -1);
+ void GetValue(const String &field, unsigned &val, unsigned def = UINT_MAX);
+ void GetValue(const String &field, String &val, const String &def = "");
+ void GetValue(const String &field, bool &val, bool def = true);
+ void GetValue(const String &field, double &val, double def = 0);
bool IsValid() const;
protected:
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp
index 70207def..40388447 100644
--- a/pokemod/Item.cpp
+++ b/pokemod/Item.cpp
@@ -40,7 +40,7 @@ PokeGen::PokeMod::Item::Item(unsigned _id)
PokeGen::PokeMod::Item::Item(Ini &ini, unsigned _id)
{
LogCtorIni("Item", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError();
}
diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp
new file mode 100644
index 00000000..64f9a4d5
--- /dev/null
+++ b/pokemod/ItemEffect.cpp
@@ -0,0 +1,818 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/ItemEffect.cpp
+// Purpose: Define an effect of an item
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:25:26 2007
+// 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
+// MERCHANTABILITY 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 "ItemEffect.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::ItemEffect::ItemEffect(unsigned _id)
+{
+ LogCtor("ItemEffect", _id);
+ overworld = false;
+ battle = false;
+ held = false;
+ effect = -1;
+ val1 = -1;
+ val2 = -1;
+ val3.Set(1, 1);
+ val4 = -1;
+ val5 = -1;
+ id = _id;
+}
+
+PokeGen::PokeMod::ItemEffect::ItemEffect(Ini &xml, unsigned _id)
+{
+ LogCtorIni("ItemEffect", _id);
+ ImportIni(ini, _id);
+ if (id == UINT_MAX)
+ LogIdError("ItemEffect");
+}
+
+PokeGen::PokeMod::ItemEffect::~ItemEffect()
+{
+ LogDtor("ItemEffect", id);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::ItemEffect::Validate(const wxListBox &output)
+#else
+void PokeGen::PokeMod::ItemEffect::Validate()
+#endif
+{
+ isValid = true;
+ LogValidateStart("ItemEffect", id);
+ // TODO (Validation#1#): ItemEffect Validation
+ LogValidateOver("ItemEffect", id, isValid);
+}
+
+void PokeGen::PokeMod::ItemEffect::ImportIni(Ini &ini, unsigned _id)
+{
+ LogImportStart("ItemEffect");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("ItemEffect");
+ }
+ else
+ id = _id;
+ unsigned i;
+ unsigned j;
+ ini.GetValue("overworld", overworld, false);
+ ini.GetValue("battle", battle, false);
+ ini.GetValue("held", held, false);
+ ini.GetValue("effect", effect, -1);
+ ini.GetValue("val1", val1, -1);
+ ini.GetValue("val2", val2, -1);
+ ini.GetValue("val3-n", i, 1);
+ ini.GetValue("val3-n", j, 1);
+ val3.Set(i, j);
+ ini.GetValue("val4", val4, -1);
+ ini.GetValue("val5", val5, -1);
+ LogImportOver("ItemEffect", id);
+}
+
+void PokeGen::PokeMod::ItemEffect::ExportIni(std::ofstream &fout, const String &item) const
+{
+ LogExportStart("ItemEffect", id);
+ // Make elements
+ Ini exItemEffect(item + " itemEffect");
+ exItemEffect.AddField("id", id);
+ exItemEffect.AddField("overworld", overworld);
+ exItemEffect.AddField("battle", battle);
+ exItemEffect.AddField("held", held);
+ exItemEffect.AddField("effect", effect);
+ exItemEffect.AddField("val1", val1);
+ exItemEffect.AddField("val2", val2);
+ exItemEffect.AddField("val3-n", val3.GetNum());
+ exItemEffect.AddField("val3-d", val3.GetDenom());
+ exItemEffect.AddField("val4", val4);
+ exItemEffect.AddField("val5", val5);
+ exItemEffect.Export(fout);
+ LogExportOver("ItemEffect", id);
+}
+
+void PokeGen::PokeMod::ItemEffect::SetOverworld(bool o)
+{
+ LogSetVar("ItemEffect", id, "overworld", o);
+ overworld = o;
+}
+
+void PokeGen::PokeMod::ItemEffect::SetBattle(bool b)
+{
+ LogSetVar("ItemEffect", id, "battle", b);
+ battle = b;
+}
+
+void PokeGen::PokeMod::ItemEffect::SetHeld(bool h)
+{
+ LogSetVar("ItemEffect", id, "held", h);
+ held = h;
+}
+
+void PokeGen::PokeMod::ItemEffect::SetEffect(int e)
+{
+ LogSetVar("ItemEffect", id, "effect", e);
+ if ((IE_NONE < e) && (e < IE_END))
+ {
+ effect = e;
+ val1 = -1;
+ val2 = -1;
+ val3.Set(1, 1, (e == IE_BALL) || (e == IE_TYPE) || (e == IE_PP_BOOST));
+ val4 = -1;
+ val5 = -1;
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetEffect(const String &e)
+{
+ LogSetVar("ItemEffect", id, "effect string", e);
+ effect = FindIn(IE_END, e, ItemEffectStr);
+ if (effect != IE_END)
+ {
+ val1 = -1;
+ val2 = -1;
+ val3.Set(1, 1, (e == IE_BALL) || (e == IE_TYPE) || (e == IE_PP_BOOST));
+ val4 = -1;
+ val5 = -1;
+ }
+}
+
+// TODO (Ben#1#): Values code
+void PokeGen::PokeMod::ItemEffect::SetVal1(int v1)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ if (val4 == REL_ABSOLUTE)
+ {
+ if (v1)
+ {
+ PMLog(PMString("ItemEffect: Set val1 to %d (%s)", v1, ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ val1 = v1;
+ }
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val1 to 0 (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ }
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val1 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_CURE_STATUS:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_RUN_BAT:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ PMLog(PMString("ItemEffect: Attempting to set val1 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_LEVEL_BOOST:
+ case IE_SHIELD_BAT:
+ case IE_PP_BOOST:
+ case IE_REPEL:
+ if (v1)
+ val1 = v1;
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val1 to 0 (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_STAT_BOOST:
+ case IE_ACORN:
+ if ((v1 <= 0) || (65536 <= v1))
+ PMLog(PMString("ItemEffect: Attempting to set val1 out of range (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ else
+ {
+ PMLog(PMString("ItemEffect: Set val1 to %d (%s)", v1, ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ val1 = v1;
+ }
+ break;
+ case IE_MODIFY_STAT_BAT:
+ if ((v1 <= -7) || (7 <= v1))
+ PMLog("ItemEffect: Attempting to set val1 out of range (Modify Stat (Battle))", PM_DEBUG_ERROR);
+ else
+ {
+ PMLog(PMString("ItemEffect: Set val1 to %d (Modify Stat (Battle))", v1), PM_DEBUG_ERROR);
+ val1 = v1;
+ }
+ break;
+ case IE_FISH:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ PMLog(PMString("ItemEffect: Set val1 to %d (%s)", v1, ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ val1 = v1;
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val1
+ // Depends on val4
+ break;
+ case IE_BERRY:
+ // TODO (Ben#1#): Berry Effect val1
+ // Depends on val4
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val1 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal2(int v2)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ case IE_CURE_STATUS:
+ case IE_LEVEL_BOOST:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_MODIFY_STAT_BAT:
+ case IE_SHIELD_BAT:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_FISH:
+ case IE_REPEL:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_BERRY:
+ case IE_ACORN:
+ PMLog(PMString("ItemEffect: Attempting to set val2 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_STAT_BOOST:
+ if ((v2 <= 0) || (65536 <= v2))
+ PMLog("ItemEffect: Attempting to set val2 out of range (Stat Boost)", PM_DEBUG_ERROR);
+ else
+ {
+ PMLog(PMString("ItemEffect: Set val2 to %d (%s)", v2), PM_DEBUG_ERROR);
+ val2 = v2;
+ }
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val2
+ // Depends on val4
+ break;
+ case IE_COIN:
+ case IE_COIN_CASE:
+ if (v2)
+ val2 = v2;
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val2 to 0 (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val2 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal3(const PMFrac &v3)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_SHIELD_BAT:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_REPEL:
+ PMLog(PMString("ItemEffect: Setting val3 (%s)", ItemEffectStr[effect]), PM_DEBUG_DEBUG);
+ val3 = v3;
+ break;
+ case IE_CURE_STATUS:
+ case IE_LEVEL_BOOST:
+ case IE_STAT_BOOST:
+ case IE_MODIFY_STAT_BAT:
+ case IE_FISH:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ case IE_ACORN:
+ PMLog(PMString("ItemEffect: Attempting to set val3 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val3
+ // Depends on val4
+ break;
+ case IE_BERRY:
+ // TODO (Ben#1#): Berry Effect val3
+ // Depends on val4
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val3 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal3(unsigned n, unsigned d)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_SHIELD_BAT:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_REPEL:
+ PMLog(PMString("ItemEffect: Setting val3 (%s)", ItemEffectStr[effect]), PM_DEBUG_DEBUG);
+ val3.Set(n, d)
+ break;
+ case IE_CURE_STATUS:
+ case IE_LEVEL_BOOST:
+ case IE_STAT_BOOST:
+ case IE_MODIFY_STAT_BAT:
+ case IE_FISH:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ case IE_ACORN:
+ PMLog(PMString("ItemEffect: Attempting to set val3 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val3
+ // Depends on val4
+ break;
+ case IE_BERRY:
+ // TODO (Ben#1#): Berry Effect val3
+ // Depends on val4
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val3 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal3Num(unsigned n)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_SHIELD_BAT:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_REPEL:
+ PMLog(PMString("ItemEffect: Setting val3 (%s)", ItemEffectStr[effect]), PM_DEBUG_DEBUG);
+ val3.SetNum(n)
+ break;
+ case IE_CURE_STATUS:
+ case IE_LEVEL_BOOST:
+ case IE_STAT_BOOST:
+ case IE_MODIFY_STAT_BAT:
+ case IE_FISH:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ case IE_ACORN:
+ PMLog(PMString("ItemEffect: Attempting to set val3 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val3
+ // Depends on val4
+ break;
+ case IE_BERRY:
+ // TODO (Ben#1#): Berry Effect val3
+ // Depends on val4
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val3 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal3Denom(unsigned d)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_SHIELD_BAT:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_REPEL:
+ PMLog(PMString("ItemEffect: Setting val3 (%s)", ItemEffectStr[effect]), PM_DEBUG_DEBUG);
+ val3.SetDenom(d)
+ break;
+ case IE_CURE_STATUS:
+ case IE_LEVEL_BOOST:
+ case IE_STAT_BOOST:
+ case IE_MODIFY_STAT_BAT:
+ case IE_FISH:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ case IE_ACORN:
+ PMLog(PMString("ItemEffect: Attempting to set val3 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val3
+ // Depends on val4
+ break;
+ case IE_BERRY:
+ // TODO (Ben#1#): Berry Effect val3
+ // Depends on val4
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val3 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal4(int v4)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ if ((v4 <= REL_NONE) || (REL_END <= v4))
+ PMLog(PMString("ItemEffect: Attempting to set val4 out of range (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ else
+ {
+ PMLog(PMString("ItemEffect: Set val4 to %d (%s)", v4, ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ val4 = v4;
+ }
+ break;
+ case IE_CURE_STATUS:
+ if (curPokeMod.GetStatus(v4))
+ {
+ PMLog(PMString("ItemEffect: Set val1 to %d (%s)", v4, curPokeMod.GetStatus(v4)->GetName().c_str()), PM_DEBUG_DEBUG);
+ val4 = v4;
+ }
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val4 out of range (Cure Status, %s)", v4), PM_DEBUG_ERROR);
+ break;
+ case IE_LEVEL_BOOST:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_EXP_SHARE:
+ case IE_FISH:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ PMLog(PMString("ItemEffect: Attempting to set val3 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_STAT_BOOST:
+ case IE_MODIFY_STAT_BAT:
+ // Stat
+ break;
+ case IE_SHIELD_BAT:
+ // Special/Physical
+ break;
+ case IE_TYPE_BOOST:
+ if (curPokeMod.GetType(v4))
+ {
+ PMLog(PMString("ItemEffect: Set val1 to %d (%s)", v4, curPokeMod.GetType(v4)->GetName().c_str()), PM_DEBUG_DEBUG);
+ val4 = v4;
+ }
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val4 out of range (Type Boost, %s)", v4), PM_DEBUG_ERROR);
+ break;
+ case IE_PP_RESTORE:
+ // All/One
+ break;
+ case IE_REPEL:
+ // First/Max/All
+ break;
+ case IE_ESCAPE:
+ // Anywhere/Dungeon
+ break;
+ case IE_TM:
+ case IE_HM:
+ if (curPokeMod.GetMove(v4))
+ {
+ PMLog(PMString("ItemEffect: Set val1 to %d (%s)", v4, curPokeMod.GetMove(v4)->GetName().c_str()), PM_DEBUG_DEBUG);
+ val4 = v4;
+ }
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val4 out of range (TM/HM, %s)", v4), PM_DEBUG_ERROR);
+ break;
+ case IE_BALL:
+ // BallType
+ break;
+ case IE_BERRY:
+ // BerryType
+ break;
+ case IE_ACORN:
+ if (curPokeMod.GetItem(v4))
+ {
+ PMLog(PMString("ItemEffect: Set val1 to %d (%s)", v4, curPokeMod.GetItem(v4)->GetName().c_str()), PM_DEBUG_DEBUG);
+ val4 = v4;
+ }
+ else
+ PMLog(PMString("ItemEffect: Attempting to set val4 out of range (Acorn, %s)", v4), PM_DEBUG_ERROR);
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val4 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal4(const PMString &v4)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ // Percent/Abs
+ break;
+ case IE_CURE_STATUS:
+ // Status
+ break;
+ case IE_LEVEL_BOOST:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_EXP_SHARE:
+ case IE_FISH:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ PMLog(PMString("ItemEffect: Attempting to set val4 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_STAT_BOOST:
+ case IE_MODIFY_STAT_BAT:
+ // Stat
+ break;
+ case IE_SHIELD_BAT:
+ // Special/Physical
+ break;
+ case IE_TYPE_BOOST:
+ // Type
+ break;
+ case IE_PP_RESTORE:
+ // All/One
+ break;
+ case IE_REPEL:
+ // First/Max/All
+ break;
+ case IE_ESCAPE:
+ // Anywhere/Dungeon
+ break;
+ case IE_TM:
+ case IE_HM:
+ // Move
+ break;
+ case IE_BALL:
+ // BallType
+ break;
+ case IE_BERRY:
+ // BerryType
+ break;
+ case IE_ACORN:
+ // Item
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val4 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal5(int v5)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ case IE_CURE_STATUS:
+ case IE_LEVEL_BOOST:
+ case IE_STAT_BOOST:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_MODIFY_STAT_BAT:
+ case IE_SHIELD_BAT:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_FISH:
+ case IE_REPEL:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ case IE_ACORN:
+ PMLog(PMString("ItemEffect: Attempting to set val5 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val5
+ // Depends on val4
+ break;
+ case IE_BERRY:
+ // TODO (Ben#1#): Berry Effect val5
+ // Depends on val4
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val5 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+void PokeGen::PokeMod::ItemEffect::SetVal5(const PMString &v5)
+{
+ switch (effect)
+ {
+ case IE_HP_CURE:
+ case IE_REVIVE:
+ case IE_CURE_STATUS:
+ case IE_LEVEL_BOOST:
+ case IE_STAT_BOOST:
+ case IE_FLINCH:
+ case IE_FIRST:
+ case IE_KEEP_ALIVE:
+ case IE_MODIFY_STAT_BAT:
+ case IE_SHIELD_BAT:
+ case IE_RUN_BAT:
+ case IE_PP_BOOST:
+ case IE_TYPE_BOOST:
+ case IE_PP_RESTORE:
+ case IE_EXP_SHARE:
+ case IE_FISH:
+ case IE_REPEL:
+ case IE_ESCAPE:
+ case IE_TM:
+ case IE_HM:
+ case IE_MAP:
+ case IE_ITEMFINDER:
+ case IE_BIKE:
+ case IE_SCOPE:
+ case IE_COIN:
+ case IE_COIN_CASE:
+ case IE_ACORN:
+ PMLog(PMString("ItemEffect: Attempting to set val5 of effect that doesn\'t use it (%s)", ItemEffectStr[effect]), PM_DEBUG_ERROR);
+ break;
+ case IE_BALL:
+ // TODO (Ben#1#): Ball Effect val5
+ // Depends on val4
+ break;
+ case IE_BERRY:
+ // TODO (Ben#1#): Berry Effect val5
+ // Depends on val4
+ break;
+ default:
+ PMLog("ItemEffect: Attempting to set val5 of effect that isn\'t set", PM_DEBUG_ERROR);
+ }
+}
+
+bool PokeGen::PokeMod::ItemEffect::GetOverworld()
+{
+ PMLog("ItemEffect: Fetching overworld", PM_DEBUG_DEBUG);
+ return overworld;
+}
+
+bool PokeGen::PokeMod::ItemEffect::GetBattle()
+{
+ PMLog("ItemEffect: Fetching battle", PM_DEBUG_DEBUG);
+ return battle;
+}
+
+bool PokeGen::PokeMod::ItemEffect::GetHeld()
+{
+ PMLog("ItemEffect: Fetching held", PM_DEBUG_DEBUG);
+ return held;
+}
+
+int PokeGen::PokeMod::ItemEffect::GetEffect()
+{
+ PMLog("ItemEffect: Fetching effect", PM_DEBUG_DEBUG);
+ return effect;
+}
+
+ PokeGen::PokeMod::ItemEffect::GetVal1()
+{
+ PMLog("ItemEffect: Fetching val1", PM_DEBUG_DEBUG);
+ return val1;
+}
+
+int PokeGen::PokeMod::ItemEffect::GetVal2()
+{
+ PMLog("ItemEffect: Fetching val2", PM_DEBUG_DEBUG);
+ return val2;
+}
+
+int PokeGen::PokeMod::ItemEffect::GetVal3()
+{
+ PMLog("ItemEffect: Fetching val3", PM_DEBUG_DEBUG);
+ return val3;
+}
+
+PokeGen::PokeMod::PMString PokeGen::PokeMod::ItemEffect::GetVal3String()
+{
+ PMLog("ItemEffect: Fetching val3", PM_DEBUG_DEBUG);
+ return val3;
+}
+
+int PokeGen::PokeMod::ItemEffect::GetVal4()
+{
+ PMLog("ItemEffect: Fetching val4", PM_DEBUG_DEBUG);
+ return val4;
+}
+
+PokeGen::PokeMod::PMString PokeGen::PokeMod::ItemEffect::GetVal4String()
+{
+ PMLog("ItemEffect: Fetching val4", PM_DEBUG_DEBUG);
+ return val4;
+}
+
+int PokeGen::PokeMod::ItemEffect::GetVal5()
+{
+ PMLog("ItemEffect: Fetching val5", PM_DEBUG_DEBUG);
+ return val5;
+}
+
+PokeGen::PokeMod::PMString PokeGen::PokeMod::ItemEffect::GetVal5String()
+{
+ PMLog("ItemEffect: Fetching val5", PM_DEBUG_DEBUG);
+ return val5;
+}
diff --git a/pokemod/ItemEffect.h b/pokemod/ItemEffect.h
new file mode 100644
index 00000000..04e0b517
--- /dev/null
+++ b/pokemod/ItemEffect.h
@@ -0,0 +1,94 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/ItemEffect.h
+// Purpose: Define an effect of an item
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:25:26 2007
+// 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
+// MERCHANTABILITY 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.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_ITEMEFFECT__
+#define __POKEMOD_ITEMEFFECT__
+
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class ItemEffect : public Object
+ {
+ public:
+ ItemEffect(unsigned _id);
+ ItemEffect(Ini &ini, unsigned _id = UINT_MAX);
+ ~ItemEffect();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream &fout, const String &item);
+
+ void SetOverworld(bool o);
+ void SetBattle(bool b);
+ void SetHeld(bool h);
+ void SetEffect(int e);
+ void SetEffect(const String &e);
+ void SetVal1(int v1);
+ void SetVal2(int v2);
+ void SetVal3(const Frac &v3);
+ void SetVal3(unsigned n, unsigned d);
+ void SetVal3Num(unsigned n);
+ void SetVal3Denom(unsigned d);
+ void SetVal4(int v4);
+ void SetVal4(const String &v4);
+ void SetVal5(int v5);
+ void SetVal5(const String &v5);
+
+ bool GetOverworld();
+ bool GetBattle();
+ bool GetHeld();
+ int GetEffect();
+ int GetEffectString();
+ int GetVal1();
+ int GetVal2();
+ Frac GetVal3();
+ unsigned GetVal3Num();
+ unsigned GetVal3Denom();
+ int GetVal4();
+ String GetVal4String();
+ int GetVal5();
+ String GetVal5String();
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ bool overworld;
+ bool battle;
+ bool held;
+ int effect;
+ int val1;
+ int val2;
+ Frac val3;
+ int val4;
+ int val5;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/ItemStorage.cpp b/pokemod/ItemStorage.cpp
index c0de1701..6901e677 100644
--- a/pokemod/ItemStorage.cpp
+++ b/pokemod/ItemStorage.cpp
@@ -35,7 +35,7 @@ PokeGen::PokeMod::ItemStorage::ItemStorage(unsigned _id)
PokeGen::PokeMod::ItemStorage::ItemStorage(Ini &ini, unsigned _id)
{
LogCtorIni("ItemStorage", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("ItemStorage");
}
diff --git a/pokemod/MapTrainerTeam.cpp b/pokemod/MapTrainerTeam.cpp
index bc069497..5fc6c3e5 100644
--- a/pokemod/MapTrainerTeam.cpp
+++ b/pokemod/MapTrainerTeam.cpp
@@ -37,7 +37,7 @@ PokeGen::PokeMod::MapTrainerTeam::MapTrainerTeam(unsigned _id)
PokeGen::PokeMod::MapTrainerTeam::MapTrainerTeam(Ini &ini, unsigned _id)
{
LogCtorIni("MapTrainerTeam", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("MapTrainerTeam");
}
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index 053aebc1..9973a8be 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -39,7 +39,7 @@ PokeGen::PokeMod::MapWildList::MapWildList(unsigned _id)
PokeGen::PokeMod::MapWildList::MapWildList(Ini &ini, unsigned _id)
{
LogCtorIni("MapWildList", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("MapWildList");
}
diff --git a/pokemod/MapWildPokemon.cpp b/pokemod/MapWildPokemon.cpp
index 765142b6..eda00a55 100644
--- a/pokemod/MapWildPokemon.cpp
+++ b/pokemod/MapWildPokemon.cpp
@@ -37,7 +37,7 @@ PokeGen::PokeMod::MapWildPokemon::MapWildPokemon(unsigned _id)
PokeGen::PokeMod::MapWildPokemon::MapWildPokemon(Ini &ini, unsigned _id)
{
LogCtorIni("MapWildPokemon", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("MapWildPokemon");
}
diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp
new file mode 100644
index 00000000..8558c44a
--- /dev/null
+++ b/pokemod/MoveEffect.cpp
@@ -0,0 +1,205 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MoveEffect.cpp
+// Purpose: Define an effect of a move
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:29:40 2007
+// 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
+// MERCHANTABILITY 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 "MoveEffect.h"
+
+extern PokeGen::PokeMod::Pokemod curPokeMod;
+
+PokeGen::PokeMod::MoveEffect::MoveEffect(unsigned _id)
+{
+ LogCtor("MoveEffect", _id);
+ chance.Set(1, 1);
+ effect = -1;
+ val1 = -1;
+ val2 = -1;
+ id = _id;
+}
+
+PokeGen::PokeMod::MoveEffect::MoveEffect(Ini &ini, unsigned _id)
+{
+ LogCtorIni("MoveEffect", _id);
+ ImportIni(ini, _id);
+ if (id == UINT_MAX)
+ LogIdError("MoveEffect");
+}
+
+PokeGen::PokeMod::MoveEffect::~MoveEffect()
+{
+ LogDtor("MoveEffect", id);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::MoveEffect::Validate(const wxListBox &output)
+#else
+void PokeGen::PokeMod::MoveEffect::Validate()
+#endif
+{
+ isValid = true;
+ LogValidateStart("MoveEffect", id);
+ // TODO (Validation#1#): MoveEffect Validation
+ LogValidateOver("MoveEffect", id, isValid);
+}
+
+void PokeGen::PokeMod::MoveEffect::ImportIni(Ini &ini, unsigned _id)
+{
+ LogImportStart("MoveEffect");
+ if (_id == UINT_MAX)
+ {
+ ini.GetValue("id", id, UINT_MAX);
+ // Was there an id associated with the element?
+ if (id == UINT_MAX)
+ LogIdNotFound("MoveEffect");
+ }
+ else
+ id = _id;
+ unsigned i;
+ unsigned j;
+ ini.GetValue("chance-n", i, 1);
+ ini.GetValue("chance-d", j, 1);
+ chance.Set(i, j);
+ ini.GetValue("effect", effect, -1);
+ ini.GetValue("val1", val1, -1);
+ ini.GetValue("val2", val2, -1);
+}
+
+void PokeGen::PokeMod::MoveEffect::ExportIni(std::ofstream &fout, const String &move) const
+{
+ LogExportStart("MoveEffect", id, name);
+ // Make elements
+ Ini exMoveEffect(move + " moveEffect");
+ exMoveEffect.AddField("id", id);
+ exMoveEffect.AddField("chance-n", chance.GetNum());
+ exMoveEffect.AddField("chance-d", chance.GetDenom());
+ exMoveEffect.AddField("effect", effect);
+ exMoveEffect.AddField("val1", val1);
+ exMoveEffect.AddField("val2", val2);
+ exMoveEffect.Export(fout);
+ LogExportOver("MoveEffect", id, name);
+}
+
+void PokeGen::PokeMod::MoveEffect::SetChance(const Frac &c)
+{
+ LogSetVar("MoveEffect", id, "chance", c.GetNum(), c.GetDenom());
+ chance = c;
+}
+
+void PokeGen::PokeMod::MoveEffect::SetChance(unsigned n, unsigned d)
+{
+ LogSetVar("MoveEffect", id, "chance", n, d);
+ chance.Set(n, d);
+}
+
+void PokeGen::PokeMod::MoveEffect::SetChanceNum(unsigned n)
+{
+ LogSetVar("MoveEffect", id, "chance numerator", n, true);
+ chance.SetNum(n);
+}
+
+void PokeGen::PokeMod::MoveEffect::SetChanceDenom(unsigned d)
+{
+ LogSetVar("MoveEffect", id, "chance denominator", d, false);
+ chance.SetDenom(d);
+}
+
+void PokeGen::PokeMod::MoveEffect::SetEffect(int e)
+{
+ LogSetVar("MoveEffect", id, "effect", e);
+ effect = e;
+ val1 = -1;
+ val2 = -1;
+}
+
+void PokeGen::PokeMod::MoveEffect::SetEffect(const String &e)
+{
+ LogSetVar("MoveEffect", id, "effect string", e);
+ effect = FindIn(ME_END, e, MoveEffectStr);
+ val1 = -1;
+ val2 = -1;
+}
+
+// TODO (Ben#1#): Effect code
+void PokeGen::PokeMod::MoveEffect::SetVal1(int v1)
+{
+ PMLog("MoveEffect: Setting val1", PM_DEBUG_DEBUG);
+ val1 = v1;
+}
+
+void PokeGen::PokeMod::MoveEffect::SetVal2(int v2)
+{
+ PMLog("MoveEffect: Setting val2", PM_DEBUG_DEBUG);
+ val2 = v2;
+}
+
+void PokeGen::PokeMod::MoveEffect::SetVal2(const PMString &v2)
+{
+ PMLog("MoveEffect: Setting val2", PM_DEBUG_DEBUG);
+ val2 = v2;
+}
+
+PokeGen::PokeMod::Frac PokeGen::PokeMod::MoveEffect::GetChance() const
+{
+ LogFetchVar("MoveEffect", id, "chance", chance.GetNum());
+ return chance;
+}
+
+unsigned PokeGen::PokeMod::MoveEffect::GetChanceNum() const
+{
+ LogFetchVar("MoveEffect", id, "chance numerator", chance.GetNum());
+ return chance.GetNum();
+}
+
+unsigned PokeGen::PokeMod::MoveEffect::GetChanceDenom() const
+{
+ LogFetchVar("MoveEffect", id, "chance denominator", chance.GetDenom());
+ return chance.GetDenom();
+}
+
+int PokeGen::PokeMod::MoveEffect::GetEffect() const
+{
+ LogFetchVar("MoveEffect", id, "effect", effect);
+ return effect;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::MoveEffect::GetEffectString() const
+{
+ LogFetchVar("MoveEffect", id, "effect string", MoveEffectStr[effect]);
+ return MoveEffectStr[effect];
+}
+
+int PokeGen::PokeMod::MoveEffect::GetVal1() const
+{
+ LogFetchVar("MoveEffect", id, "val1", val1);
+ return val1;
+}
+
+int PokeGen::PokeMod::MoveEffect::GetVal2() const
+{
+ LogFetchVar("MoveEffect", id, "val2", val2);
+ return val2;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::MoveEffect::GetVal2String() const
+{
+ LogFetchVar("MoveEffect", id, "val2 string", val2);
+ return val2;
+}
diff --git a/pokemod/MoveEffect.h b/pokemod/MoveEffect.h
new file mode 100644
index 00000000..d30bfe09
--- /dev/null
+++ b/pokemod/MoveEffect.h
@@ -0,0 +1,78 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MoveEffect.h
+// Purpose: Define an effect of a move
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:29:40 2007
+// 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
+// MERCHANTABILITY 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.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_MOVEEFFECT__
+#define __POKEMOD_MOVEEFFECT__
+
+#include "Object.h"
+#include "String.h"
+#include "Pokemod.h"
+#include "Frac.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class MoveEffect : public Object
+ {
+ public:
+ MoveEffect(unsigned _id);
+ MoveEffect(Ini &ini, unsigned _id = UINT_MAX);
+ ~MoveEffect();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream _fout, const String &move);
+
+ void SetChance(const Frac &c);
+ void SetChance(unsigned n, unsigned d);
+ void SetChanceNum(unsigned n);
+ void SetChanceDenom(unsigned d);
+ void SetEffect(int e);
+ void SetEffect(const String &e);
+ void SetVal1(int v1);
+ void SetVal2(int v2);
+ void SetVal2(const String &v2);
+
+ Frac GetChance();
+ unsigned GetChanceNum();
+ unsigned GetChanceDenom();
+ int GetEffect();
+ String GetEffectString();
+ int GetVal1();
+ int GetVal2();
+ String GetVal2String();
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ Frac chance;
+ int effect;
+ int val1;
+ int val2;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/NatureEffect.cpp b/pokemod/NatureEffect.cpp
new file mode 100644
index 00000000..6b249a58
--- /dev/null
+++ b/pokemod/NatureEffect.cpp
@@ -0,0 +1,155 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/NatureEffect.cpp
+// Purpose: Define an effect of a nature
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Sun Mar 18 23:01:22 2007
+// 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
+// MERCHANTABILITY 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 "NatureEffect.h"
+
+PokeGen::PokeMod::NatureEffect::NatureEffect(unsigned _id)
+{
+ LogCtor("NatureEffect", _id);
+ stat = 0;
+ multiplier.Set(1, 1);
+ id = _id;
+}
+
+PokeGen::PokeMod::NatureEffect::NatureEffect(Ini &ini, unsigned _id)
+{
+ LogCtorIni("NatureEffect", _id);
+ ImportIni(ini, _id);
+ if (id == UINT_MAX)
+ LogIdError("NatureEffect");
+}
+
+PokeGen::PokeMod::NatureEffect::~NatureEffect()
+{
+ LogDtor("NatureEffect", id);
+}
+
+#ifdef PG_DEBUG_WINDOW
+void PokeGen::PokeMod::NatureEffect::Validate(const wxListBox &output)
+#else
+void PokeGen::PokeMod::NatureEffect::Validate()
+#endif
+{
+ LogValidateStart("NatureEffect", _id);
+ // TODO (Validation#1#): NatureEffect Validation
+ LogValidateOver("NatureEffect", _id);
+}
+
+void PokeGen::PokeMod::NatureEffect::ImportIni(Ini &ini, unsigned _id)
+{
+ PMLog("NatureEffect Import: Starting", PM_DEBUG_INFO);
+ std::string curName;
+ xml.GetAttributeOrDefault("id", &id, UINT_MAX);
+ if (id == UINT_MAX)
+ PMLog("NatureEffect Import: No id attribute found!", PM_DEBUG_ERROR);
+ for (ticpp::Element *child = xml.FirstChildElement(); child; child = child->NextSiblingElement())
+ {
+ curName = child->Value();
+ if (curName == "stat")
+ child->GetTextOrDefault(&stat, 0);
+ else if (curName == "multiplier")
+ multiplier.ImportXml(*child);
+ else
+ PMLog(PMString("NatureEffect Import: Unknown XML element \"%s\"", curName.c_str()), PM_DEBUG_ERROR);
+ }
+ PMLog("NatureEffect Import: Finished", PM_DEBUG_INFO);
+}
+
+void PokeGen::PokeMod::NatureEffect::ExportXml(std::ofstream &fout, const String &nature) const
+{
+ LogExportStart("NatureEffect", id, name);
+ // Make elements
+ Ini exNatureEffect(nature + " natureEffect");
+ exNatureEffect.AddField("id", id);
+ exNatureEffect.AddField("stat", stat);
+ exNatureEffect.AddField("multiplier-n", multiplier.GetNum());
+ exNatureEffect.AddField("multiplier-d", multiplier.GetDenom());
+ exNatureEffect.Export(fout);
+ LogExportOver("NatureEffect", id, name);
+}
+
+void PokeGen::PokeMod::NatureEffect::SetStat(unsigned s)
+{
+ LogSetVar("NatureEffect", id, "stat", s);
+ stat = s;
+}
+
+void PokeGen::PokeMod::NatureEffect::SetStat(const String &s)
+{
+ LogSetVar("NatureEffect", id, "stat string", s);
+ stat = FindIn(curPokeMod.IsSpecialSplit() ? STH_END_GSC : STH_END_RBY, s, curPokeMod.IsSpecialSplit() ? StatHPGSCStr : StatHPRBYStr);
+}
+
+void PokeGen::PokeMod::NatureEffect::SetMultiplier(const Frac &m)
+{
+ LogSetVar("NatureEffect", id, "multiplier frac", m.GetNum(), m.GetDenom());
+ multiplier = m;
+}
+
+void PokeGen::PokeMod::NatureEffect::SetMultiplier(unsigned n, unsigned d)
+{
+ LogSetVar("NatureEffect", id, "multiplier", n, d);
+ multiplier.Set(n, d);
+}
+
+void PokeGen::PokeMod::NatureEffect::SetMultiplierNum(unsigned n)
+{
+ LogSetVar("NatureEffect", id, "multiplier numerator", n);
+ multiplier.SetNum(n);
+}
+
+void PokeGen::PokeMod::NatureEffect::SetMultiplierDenom(unsigned d)
+{
+ LogSetVar("NatureEffect", id, "multiplier denominator", d);
+ multiplier.SetDenom(d);
+}
+
+unsigned PokeGen::PokeMod::NatureEffect::GetStat() const
+{
+ LogFetchVar("NatureEffect", id, "stat", stat);
+ return stat;
+}
+
+PokeGen::PokeMod::String PokeGen::PokeMod::NatureEffect::GetStatString() const
+{
+ LogFetchVar("NatureEffect", id, "stat string", stat);
+ return (curPokeMod.IsSpecialSplit() ? StatHPGSCStr : StatHPRBYStr)[stat];
+}
+
+PokeGen::PokeMod::Frac PokeGen::PokeMod::NatureEffect::GetMultiplier() const
+{
+ LogFetchVar("NatureEffect", id, "multiplier", multiplier.GetNum());
+ return multiplier;
+}
+
+unsigned PokeGen::PokeMod::NatureEffect::GetMultiplierNum() const
+{
+ LogFetchVar("NatureEffect", id, "multiplier numerator", multiplier.GetNum());
+ return multiplier.GetNum();
+}
+
+unsigned PokeGen::PokeMod::NatureEffect::GetMultiplierDenom() const
+{
+ LogFetchVar("NatureEffect", id, "multiplier denominator", multiplier.GetDenom());
+ return multiplier.GetDenom();
+}
diff --git a/pokemod/NatureEffect.h b/pokemod/NatureEffect.h
new file mode 100644
index 00000000..9c41c0a2
--- /dev/null
+++ b/pokemod/NatureEffect.h
@@ -0,0 +1,69 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/NatureEffect.h
+// Purpose: Define an effect of a nature
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Sun Mar 18 23:01:22 2007
+// 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
+// MERCHANTABILITY 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.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMOD_NATUREEFFECT__
+#define __POKEMOD_NATUREEFFECT__
+
+#include "Object.h"
+#include "String.h"
+#include "Frac.h"
+
+namespace PokeGen
+{
+ namespace PokeMod
+ {
+ class NatureEffect : public Object
+ {
+ public:
+ NatureEffect(unsigned _id);
+ NatureEffect(Ini &ini, unsigned _id = UINT_MAX);
+ ~NatureEffect();
+
+ void ImportIni(Ini &ini, unsigned _id = UINT_MAX);
+ void ExportIni(std::ofstream &fout, const String &nature) const;
+
+ void SetStat(unsigned s);
+ void SetStat(const String &s);
+ void SetMultiplier(const Frac &m);
+ void SetMultiplier(unsigned n, unsigned d);
+ void SetMultiplierNum(unsigned n);
+ void SetMultiplierDenom(unsigned d);
+
+ unsigned GetStat() const;
+ String GetStatString() const;
+ Frac GetMultiplier() const;
+ unsigned GetMultiplierNum() const;
+ unsigned GetMultiplierDenom() const;
+ private:
+ void Validate();
+# ifdef PG_DEBUG_WINDOW
+ void Validate(const wxListBox &output);
+# endif
+
+ unsigned stat;
+ Frac multiplier;
+ };
+ }
+}
+
+#endif
diff --git a/pokemod/Object.cpp b/pokemod/Object.cpp
index a305b15a..cb9f1f8b 100644
--- a/pokemod/Object.cpp
+++ b/pokemod/Object.cpp
@@ -31,7 +31,9 @@ unsigned PokeGen::PokeMod::Object::GetId() const
bool PokeGen::PokeMod::Object::IsValid()
{
- Validate();
+ isValid = (id != UINT_MAX);
+ if (isValid)
+ Validate();
return isValid;
}
@@ -39,7 +41,9 @@ bool PokeGen::PokeMod::Object::IsValid()
bool PokeGen::PokeMod::Object::IsValid(const wxListBox &output)
{
// Validate with debugging console output
- Validate(output);
+ isValid = (id != UINT_MAX);
+ if (isValid)
+ Validate(output);
return isValid;
}
#endif
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 906aee1e..e0bf0a0e 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -25,11 +25,12 @@
PokeGen::PokeMod::PokeMod::Pokemod()
{
+ LogCtor("Pokemod", 0);
}
PokeGen::PokeMod::PokeMod::Pokemod(std::ifstream &fin)
{
- Log("Pokemod: Constructing by XML", PM_DEBUG_DEBUG);
+ LogCtorIni("Pokemod", 0);
ImportIni(fin);
}
@@ -52,10 +53,10 @@ void PokeGen::PokeMod::PokeMod::Validate(const wxListBox &output)
void PokeGen::PokeMod::PokeMod::ImportIni(std::ifstream &fin)
{
- // TODO (Xml#1#): Import Pokemod from XML
+ // TODO (Ini#1#): Import Pokemod
}
-void PokeGen::PokeMod::PokeMod::ExportIni(std::ofstream &fout)
+void PokeGen::PokeMod::PokeMod::ExportIni(std::ofstream &fout) const
{
- // TODO (Xml#1#): Export Pokemod to XML
+ // TODO (Ini#1#): Export Pokemod
}
diff --git a/pokemod/PokemonEvolution.cpp b/pokemod/PokemonEvolution.cpp
index 89cc45eb..94148e2b 100644
--- a/pokemod/PokemonEvolution.cpp
+++ b/pokemod/PokemonEvolution.cpp
@@ -39,7 +39,7 @@ PokeGen::PokeMod::PokemonEvolution::PokemonEvolution(unsigned _id)
PokeGen::PokeMod::PokemonEvolution::PokemonEvolution(Ini &ini, unsigned _id)
{
LogCtorIni("PokemonEvolution", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("PokemonEvolution");
}
diff --git a/pokemod/PokemonMove.cpp b/pokemod/PokemonMove.cpp
index 39709094..53703387 100644
--- a/pokemod/PokemonMove.cpp
+++ b/pokemod/PokemonMove.cpp
@@ -37,7 +37,7 @@ PokeGen::PokeMod::PokemonMove::PokemonMove(unsigned _id)
PokeGen::PokeMod::PokemonMove::PokemonMove(Ini &ini, unsigned _id)
{
LogCtorIni("PokemonMove", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("PokemonMove");
}
diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp
index 05315a43..ca7b2d52 100644
--- a/pokemod/Store.cpp
+++ b/pokemod/Store.cpp
@@ -36,7 +36,7 @@ PokeGen::PokeMod::Store::Store(unsigned _id)
PokeGen::PokeMod::Store::Store(Ini &ini, unsigned _id)
{
LogCtorIni("Store", _id);
- ImportIni(ini);
+ ImportIni(ini, _id);
if (id == UINT_MAX)
LogIdError("Store");
}