summaryrefslogtreecommitdiffstats
path: root/sigmod
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-09-25 22:55:25 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-09-25 22:55:25 +0000
commit64730b32e2c595469eb23e9cd40332b4a80e3e27 (patch)
treea75a17a7c7ac78e2e323e1cdecef8f6a3939f844 /sigmod
parent4c4fdc8d4540bd1bd52021b502f05f27a8ef98e1 (diff)
downloadsigen-64730b32e2c595469eb23e9cd40332b4a80e3e27.tar.gz
sigen-64730b32e2c595469eb23e9cd40332b4a80e3e27.tar.xz
sigen-64730b32e2c595469eb23e9cd40332b4a80e3e27.zip
[FIX] Removed *_End defines
[FIX] Added weights to items and associated fields [FIX] Option for pausing during ATB battles when choosing moves added git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@267 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigmod')
-rw-r--r--sigmod/Badge.cpp18
-rw-r--r--sigmod/Badge.h2
-rw-r--r--sigmod/Fraction.cpp2
-rw-r--r--sigmod/Global.h7
-rw-r--r--sigmod/Item.cpp44
-rw-r--r--sigmod/Item.h6
-rw-r--r--sigmod/ItemType.cpp23
-rw-r--r--sigmod/ItemType.h3
-rw-r--r--sigmod/MapTrainerTeamMember.cpp24
-rw-r--r--sigmod/MapTrainerTeamMember.h2
-rw-r--r--sigmod/Nature.cpp12
-rw-r--r--sigmod/Nature.h2
-rw-r--r--sigmod/Object.h1
-rw-r--r--sigmod/Rules.cpp31
-rw-r--r--sigmod/Rules.h6
-rw-r--r--sigmod/Species.cpp32
-rw-r--r--sigmod/Species.h7
-rw-r--r--sigmod/Tile.cpp8
-rw-r--r--sigmod/Tile.h2
19 files changed, 188 insertions, 44 deletions
diff --git a/sigmod/Badge.cpp b/sigmod/Badge.cpp
index c1077934..231fba47 100644
--- a/sigmod/Badge.cpp
+++ b/sigmod/Badge.cpp
@@ -26,7 +26,7 @@
Sigmod::Badge::Badge(const Badge& badge) :
Object(badge.parent(), badge.id()),
- m_stat(ST_End_GSC - ST_No_HP_Start)
+ m_stat(ST_SpecialDefense - ST_Attack + 1)
{
*this = badge;
}
@@ -37,7 +37,7 @@ Sigmod::Badge::Badge(const Sigmod* parent, const int id) :
m_face(-1),
m_badge(-1),
m_obey(0),
- m_stat(ST_End_GSC - ST_No_HP_Start)
+ m_stat(ST_SpecialDefense - ST_Attack + 1)
{
for (int i = 0; i < m_stat.size(); ++i)
m_stat[i].set(1, 1);
@@ -45,14 +45,14 @@ Sigmod::Badge::Badge(const Sigmod* parent, const int id) :
Sigmod::Badge::Badge(const Badge& badge, const Sigmod* parent, const int id) :
Object(parent, id),
- m_stat(ST_End_GSC - ST_No_HP_Start)
+ m_stat(ST_SpecialDefense - ST_Attack + 1)
{
*this = badge;
}
Sigmod::Badge::Badge(const QDomElement& xml, const Sigmod* parent, const int id) :
Object(parent, id),
- m_stat(ST_End_GSC - ST_No_HP_Start)
+ m_stat(ST_SpecialDefense - ST_Attack + 1)
{
LOAD_ID();
load(xml);
@@ -66,7 +66,7 @@ void Sigmod::Badge::validate()
TEST(setFace, face);
TEST(setBadge, badge);
TEST(setObey, obey);
- TEST_ARRAY(setStat, stat, ST_End_GSC);
+ TEST_ARRAY(setStat, stat, ST_SpecialDefense - ST_Attack + 1);
TEST_END();
}
@@ -131,7 +131,7 @@ void Sigmod::Badge::setStat(const Stat stat, const Fraction& multiplier)
}
switch (stat)
{
- case ST_SpecialDefense:
+ case ST_SpecialDefense - ST_Attack + 1:
if (qobject_cast<const Sigmod*>(sigmod())->rules()->specialSplit())
case ST_Attack ... ST_Special:
break;
@@ -139,7 +139,7 @@ void Sigmod::Badge::setStat(const Stat stat, const Fraction& multiplier)
emit(warning(bounds("stat")));
return;
}
- CHECK_ARRAY(stat[stat - ST_No_HP_Start], multiplier);
+ CHECK_ARRAY(stat[stat - ST_Attack], multiplier);
}
void Sigmod::Badge::setStat(const Fraction& multiplier)
@@ -172,10 +172,10 @@ Sigmod::Fraction Sigmod::Badge::stat(const Stat stat) const
{
switch (stat)
{
- case ST_SpecialDefense:
+ case ST_SpecialDefense - ST_Attack + 1:
if (qobject_cast<const Sigmod*>(sigmod())->rules()->specialSplit())
case ST_Attack ... ST_Special:
- return m_stat[stat - ST_No_HP_Start];
+ return m_stat[stat - ST_Attack];
default:
emit(warning(bounds("stat")));
return Fraction();
diff --git a/sigmod/Badge.h b/sigmod/Badge.h
index 8c96bc85..dda68ec8 100644
--- a/sigmod/Badge.h
+++ b/sigmod/Badge.h
@@ -62,7 +62,7 @@ class SIGMOD_EXPORT Badge : public Object
int m_face;
int m_badge;
int m_obey;
- QVarLengthArray<Fraction, ST_End_GSC - ST_No_HP_Start> m_stat;
+ QVarLengthArray<Fraction, ST_SpecialDefense - ST_Attack + 1> m_stat;
};
}
diff --git a/sigmod/Fraction.cpp b/sigmod/Fraction.cpp
index d51c1922..f3f1ecd7 100644
--- a/sigmod/Fraction.cpp
+++ b/sigmod/Fraction.cpp
@@ -21,13 +21,11 @@
Sigmod::Fraction::Fraction(const int numerator, const int denominator)
{
set(numerator, denominator);
- reduce();
}
Sigmod::Fraction::Fraction(const Fraction& fraction)
{
set(fraction.numerator(), fraction.denominator());
- reduce();
}
void Sigmod::Fraction::set(const int numerator, const int denominator)
diff --git a/sigmod/Global.h b/sigmod/Global.h
index 7cb4a9ed..ea75387a 100644
--- a/sigmod/Global.h
+++ b/sigmod/Global.h
@@ -44,20 +44,16 @@ namespace Sigmod
enum Stat
{
ST_HP = 0,
- ST_No_HP_Start = 1,
ST_Attack = 1,
ST_Defense = 2,
ST_Speed = 3,
ST_Special = 4,
- ST_End_RBY = 5,
ST_SpecialAttack = 4,
ST_SpecialDefense = 5,
- ST_End_GSC = 6,
ST_Accuracy = 6,
ST_Evasion = 7,
- ST_End_Battle = 8
};
-const QStringList StatRBYStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special" << "Special" << "Accuracy" << "Evasion";
+const QStringList StatRBYStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special" << "" << "Accuracy" << "Evasion";
const QStringList StatGSCStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special Attack" << "Special Defense" << "Accuracy" << "Evasion";
enum Direction
@@ -66,7 +62,6 @@ enum Direction
D_Down = 1,
D_Left = 2,
D_Right = 3,
- D_End = 4,
D_None = 4
};
const QStringList DirectionStr = QStringList() << "Up" << "Down" << "Left" << "Right" << "None";
diff --git a/sigmod/Item.cpp b/sigmod/Item.cpp
index 1f1fdca6..d0eb9a91 100644
--- a/sigmod/Item.cpp
+++ b/sigmod/Item.cpp
@@ -19,6 +19,7 @@
#include "Item.h"
// Sigmod includes
+#include "ItemType.h"
#include "Macros.h"
#include "Rules.h"
#include "Sigmod.h"
@@ -38,6 +39,8 @@ Sigmod::Item::Item(const Sigmod* parent, const int id) :
m_sellable(false),
m_type(INT_MAX),
m_price(0),
+ m_sellPrice(0),
+ m_weight(0),
m_description(""),
m_script("", "")
{
@@ -67,6 +70,8 @@ void Sigmod::Item::validate()
emit(error("Name is empty"));
TEST(setType, type);
TEST(setPrice, price);
+ TEST(setSellPrice, sellPrice);
+ TEST(setWeight, weight);
TEST_END();
}
@@ -77,6 +82,8 @@ void Sigmod::Item::load(const QDomElement& xml)
LOAD(sellable);
LOAD(type);
LOAD(price);
+ LOAD(sellPrice);
+ LOAD(weight);
LOAD(description);
LOAD(script);
}
@@ -88,6 +95,8 @@ QDomElement Sigmod::Item::save() const
SAVE(sellable);
SAVE(type);
SAVE(price);
+ SAVE(sellPrice);
+ SAVE(weight);
SAVE(description);
SAVE(script);
return xml;
@@ -113,12 +122,34 @@ void Sigmod::Item::setType(const int type)
void Sigmod::Item::setPrice(const int price)
{
- if (qobject_cast<const Sigmod*>(sigmod())->rules()->maxMoney() < price)
+ if ((price < 0) || (qobject_cast<const Sigmod*>(sigmod())->rules()->maxMoney() < price))
emit(error(bounds("price")));
else
CHECK(price);
}
+void Sigmod::Item::setSellPrice(const int sellPrice)
+{
+ if ((sellPrice < 0) || (m_price < sellPrice))
+ emit(error(bounds("sellPrice")));
+ else
+ CHECK(sellPrice);
+}
+
+void Sigmod::Item::setWeight(const int weight)
+{
+ const int typeIndex = qobject_cast<const Sigmod*>(sigmod())->itemTypeIndex(m_type);
+ if (typeIndex != INT_MAX)
+ {
+ if (qobject_cast<const Sigmod*>(sigmod())->itemType(typeIndex)->maxWeight() < weight)
+ emit(error(bounds("weight")));
+ else if (weight < 0)
+ emit(error(bounds("weight")));
+ else
+ CHECK(weight);
+ }
+}
+
void Sigmod::Item::setDescription(const QString& description)
{
CHECK(description);
@@ -149,6 +180,16 @@ int Sigmod::Item::price() const
return m_price;
}
+int Sigmod::Item::sellPrice() const
+{
+ return m_sellPrice;
+}
+
+int Sigmod::Item::weight() const
+{
+ return m_weight;
+}
+
QString Sigmod::Item::description() const
{
return m_description;
@@ -167,6 +208,7 @@ Sigmod::Item& Sigmod::Item::operator=(const Item& rhs)
COPY(sellable);
COPY(type);
COPY(price);
+ COPY(weight);
COPY(description);
COPY(script);
return *this;
diff --git a/sigmod/Item.h b/sigmod/Item.h
index 64ae01aa..4b4cc74a 100644
--- a/sigmod/Item.h
+++ b/sigmod/Item.h
@@ -47,6 +47,8 @@ class SIGMOD_EXPORT Item : public Object
void setSellable(const bool sellable);
void setType(const int type);
void setPrice(const int price);
+ void setSellPrice(const int sellPrice);
+ void setWeight(const int weight);
void setDescription(const QString& description);
void setScript(const Script& script);
@@ -54,6 +56,8 @@ class SIGMOD_EXPORT Item : public Object
bool sellable() const;
int type() const;
int price() const;
+ int sellPrice() const;
+ int weight() const;
QString description() const;
Script script() const;
@@ -63,6 +67,8 @@ class SIGMOD_EXPORT Item : public Object
bool m_sellable;
int m_type;
int m_price;
+ int m_sellPrice;
+ int m_weight;
QString m_description;
Script m_script;
};
diff --git a/sigmod/ItemType.cpp b/sigmod/ItemType.cpp
index 525af757..80e1b40d 100644
--- a/sigmod/ItemType.cpp
+++ b/sigmod/ItemType.cpp
@@ -20,9 +20,10 @@
// Sigmod includes
#include "Macros.h"
+#include "Rules.h"
#include "Sigmod.h"
-QStringList Sigmod::ItemType::CountStr = QStringList() << "Distinct" << "Total";
+QStringList Sigmod::ItemType::CountStr = QStringList() << "Distinct" << "Total" << "Weight";
Sigmod::ItemType::ItemType(const ItemType& itemType) :
Object(itemType.parent(), itemType.id())
@@ -35,6 +36,7 @@ Sigmod::ItemType::ItemType(const Sigmod* parent, const int id) :
m_name(""),
m_computer(0),
m_player(1),
+ m_maxWeight(0),
m_count(Distinct)
{
}
@@ -58,6 +60,7 @@ void Sigmod::ItemType::validate()
if (m_name.isEmpty())
emit(error("Name is empty"));
TEST(setPlayer, player);
+ TEST(setMaxWeight, maxWeight);
TEST_END();
}
@@ -67,6 +70,7 @@ void Sigmod::ItemType::load(const QDomElement& xml)
LOAD(name);
LOAD(computer);
LOAD(player);
+ LOAD(maxWeight);
LOAD(count);
}
@@ -76,6 +80,7 @@ QDomElement Sigmod::ItemType::save() const
SAVE(name);
SAVE(computer);
SAVE(player);
+ SAVE(maxWeight);
SAVE(count);
return xml;
}
@@ -98,6 +103,16 @@ void Sigmod::ItemType::setPlayer(const int player)
CHECK(player);
}
+void Sigmod::ItemType::setMaxWeight(const int maxWeight)
+{
+ if (qobject_cast<const Sigmod*>(sigmod())->rules()->maxTotalWeight() < maxWeight)
+ emit(error(bounds("maxWeight")));
+ else if (maxWeight < 0)
+ emit(error(bounds("maxWeight")));
+ else
+ CHECK(maxWeight);
+}
+
void Sigmod::ItemType::setCount(const Count count)
{
CHECK(count);
@@ -118,6 +133,11 @@ int Sigmod::ItemType::player() const
return m_player;
}
+int Sigmod::ItemType::maxWeight() const
+{
+ return m_maxWeight;
+}
+
Sigmod::ItemType::Count Sigmod::ItemType::count() const
{
return m_count;
@@ -130,6 +150,7 @@ Sigmod::ItemType& Sigmod::ItemType::operator=(const ItemType& rhs)
COPY(name);
COPY(computer);
COPY(player);
+ COPY(maxWeight);
COPY(count);
return *this;
}
diff --git a/sigmod/ItemType.h b/sigmod/ItemType.h
index a1644215..b3f48c7e 100644
--- a/sigmod/ItemType.h
+++ b/sigmod/ItemType.h
@@ -52,11 +52,13 @@ class SIGMOD_EXPORT ItemType : public Object
void setName(const QString& name);
void setComputer(const int computer);
void setPlayer(const int player);
+ void setMaxWeight(const int maxWeight);
void setCount(const Count count);
QString name() const;
int computer() const;
int player() const;
+ int maxWeight() const;
Count count() const;
ItemType& operator=(const ItemType& rhs);
@@ -64,6 +66,7 @@ class SIGMOD_EXPORT ItemType : public Object
QString m_name;
int m_computer;
int m_player;
+ int m_maxWeight;
Count m_count;
};
}
diff --git a/sigmod/MapTrainerTeamMember.cpp b/sigmod/MapTrainerTeamMember.cpp
index beab6d54..595277df 100644
--- a/sigmod/MapTrainerTeamMember.cpp
+++ b/sigmod/MapTrainerTeamMember.cpp
@@ -144,8 +144,13 @@ void Sigmod::MapTrainerTeamMember::setItem(const int item, const bool state)
{
if (m_item.size() < qobject_cast<const Sigmod*>(sigmod())->rules()->maxHeldItems())
{
- m_item.append(item);
- emit(changed());
+ if (checkWeight(item))
+ {
+ m_item.append(item);
+ emit(changed());
+ }
+ else
+ emit(error("Cannot carry that much weight"));
}
else
emit(error("Cannot hold any more items"));
@@ -271,3 +276,18 @@ Sigmod::MapTrainerTeamMember& Sigmod::MapTrainerTeamMember::operator=(const MapT
COPY(nature);
return *this;
}
+
+bool Sigmod::MapTrainerTeamMember::checkWeight(const int item)
+{
+ const int speciesIndex = qobject_cast<const Sigmod*>(sigmod())->speciesIndex(m_species);
+ if (speciesIndex == INT_MAX)
+ return true;
+ int totalWeight = qobject_cast<const Sigmod*>(sigmod())->itemById(item)->weight();
+ foreach (int item, m_item)
+ {
+ const int itemIndex = qobject_cast<const Sigmod*>(sigmod())->itemIndex(item);
+ if (itemIndex != INT_MAX)
+ totalWeight += qobject_cast<const Sigmod*>(sigmod())->item(itemIndex)->weight();
+ }
+ return (totalWeight <= qobject_cast<const Sigmod*>(sigmod())->species(speciesIndex)->maxHoldWeight());
+}
diff --git a/sigmod/MapTrainerTeamMember.h b/sigmod/MapTrainerTeamMember.h
index 36394258..2b5de59c 100644
--- a/sigmod/MapTrainerTeamMember.h
+++ b/sigmod/MapTrainerTeamMember.h
@@ -63,6 +63,8 @@ class SIGMOD_EXPORT MapTrainerTeamMember : public Object
QList<int> natures() const;
MapTrainerTeamMember& operator=(const MapTrainerTeamMember& p);
+ protected:
+ bool checkWeight(const int item);
private:
int m_species;
int m_level;
diff --git a/sigmod/Nature.cpp b/sigmod/Nature.cpp
index 11a301e6..add4a764 100644
--- a/sigmod/Nature.cpp
+++ b/sigmod/Nature.cpp
@@ -25,7 +25,7 @@
Sigmod::Nature::Nature(const Nature& nature) :
Object(nature.parent(), nature.id()),
- m_stat(ST_End_GSC - ST_No_HP_Start)
+ m_stat(ST_SpecialDefense - ST_Attack + 1)
{
*this = nature;
}
@@ -33,7 +33,7 @@ Sigmod::Nature::Nature(const Nature& nature) :
Sigmod::Nature::Nature(const Sigmod* parent, const int id) :
Object(parent, id),
m_name(""),
- m_stat(ST_End_GSC - ST_No_HP_Start),
+ m_stat(ST_SpecialDefense - ST_Attack + 1),
m_weight(1)
{
for (int i = 0; i < m_stat.size(); ++i)
@@ -42,14 +42,14 @@ Sigmod::Nature::Nature(const Sigmod* parent, const int id) :
Sigmod::Nature::Nature(const Nature& nature, const Sigmod* parent, const int id) :
Object(parent, id),
- m_stat(ST_End_GSC - ST_No_HP_Start)
+ m_stat(ST_SpecialDefense - ST_Attack + 1)
{
*this = nature;
}
Sigmod::Nature::Nature(const QDomElement& xml, const Sigmod* parent, const int id) :
Object(parent, id),
- m_stat(ST_End_GSC - ST_No_HP_Start)
+ m_stat(ST_SpecialDefense - ST_Attack + 1)
{
LOAD_ID();
load(xml);
@@ -98,7 +98,7 @@ void Sigmod::Nature::setStat(const Stat stat, const Fraction& multiplier)
emit(warning(bounds("stat")));
return;
}
- CHECK_ARRAY(stat[stat - ST_No_HP_Start], multiplier);
+ CHECK_ARRAY(stat[stat - ST_Attack], multiplier);
}
void Sigmod::Nature::setWeight(const int weight)
@@ -121,7 +121,7 @@ Sigmod::Fraction Sigmod::Nature::stat(const Stat stat) const
case ST_SpecialDefense:
if (qobject_cast<const Sigmod*>(sigmod())->rules()->specialSplit())
case ST_Attack ... ST_Special:
- return m_stat[stat - ST_No_HP_Start];
+ return m_stat[stat - ST_Attack];
default:
emit(warning(bounds("stat")));
return Fraction();
diff --git a/sigmod/Nature.h b/sigmod/Nature.h
index 8b0bed04..68f15a91 100644
--- a/sigmod/Nature.h
+++ b/sigmod/Nature.h
@@ -55,7 +55,7 @@ class SIGMOD_EXPORT Nature : public Object
void setStat(const Fraction& multiplier);
QString m_name;
- QVarLengthArray<Fraction, ST_End_GSC - ST_No_HP_Start> m_stat;
+ QVarLengthArray<Fraction, ST_SpecialDefense - ST_Attack + 1> m_stat;
int m_weight;
};
}
diff --git a/sigmod/Object.h b/sigmod/Object.h
index 2d44c82f..6b4ca974 100644
--- a/sigmod/Object.h
+++ b/sigmod/Object.h
@@ -113,6 +113,7 @@ template<> inline void Object::loadValue<int>(const QDomElement& xml, int* value
template<> inline void Object::loadValue<Fraction>(const QDomElement& xml, Fraction* value)
{
value->set(xml.attribute("numerator", "1").toInt(), xml.attribute("denominator", "1").toInt());
+ value->reduce();
}
template<> inline void Object::loadValue<QPoint>(const QDomElement& xml, QPoint* value)
diff --git a/sigmod/Rules.cpp b/sigmod/Rules.cpp
index 22402a03..5442dbdf 100644
--- a/sigmod/Rules.cpp
+++ b/sigmod/Rules.cpp
@@ -36,6 +36,7 @@ Sigmod::Rules::Rules(const Sigmod* parent) :
m_breedingAllowed(false),
m_criticalDomains(false),
m_useTurns(true),
+ m_pausedATB(false),
m_numBoxes(0),
m_boxSize(1),
m_maxParty(1),
@@ -48,6 +49,7 @@ Sigmod::Rules::Rules(const Sigmod* parent) :
m_maxLevel(1),
m_maxStages(6),
m_maxMoney(0),
+ m_maxTotalWeight(0),
m_hardCash(false),
m_allowSwitchStyle(false),
m_specialSplit(false),
@@ -97,6 +99,7 @@ void Sigmod::Rules::load(const QDomElement& xml)
LOAD(breedingAllowed);
LOAD(criticalDomains);
LOAD(useTurns);
+ LOAD(pausedATB);
LOAD(numBoxes);
LOAD(boxSize);
LOAD(maxParty);
@@ -109,6 +112,7 @@ void Sigmod::Rules::load(const QDomElement& xml)
LOAD(maxLevel);
LOAD(maxStages);
LOAD(maxMoney);
+ LOAD(maxTotalWeight);
LOAD(hardCash);
LOAD(allowSwitchStyle);
LOAD(specialSplit);
@@ -125,6 +129,7 @@ QDomElement Sigmod::Rules::save() const
SAVE(breedingAllowed);
SAVE(criticalDomains);
SAVE(useTurns);
+ SAVE(pausedATB);
SAVE(numBoxes);
SAVE(boxSize);
SAVE(maxParty);
@@ -137,6 +142,7 @@ QDomElement Sigmod::Rules::save() const
SAVE(maxLevel);
SAVE(maxStages);
SAVE(maxMoney);
+ SAVE(maxTotalWeight);
SAVE(hardCash);
SAVE(allowSwitchStyle);
SAVE(specialSplit);
@@ -170,6 +176,14 @@ void Sigmod::Rules::setUseTurns(const bool useTurns)
CHECK(useTurns);
}
+void Sigmod::Rules::setPausedATB(const bool pausedATB)
+{
+ if (m_useTurns && pausedATB)
+ emit(error(bounds("pausedATB")));
+ else
+ CHECK(pausedATB);
+}
+
void Sigmod::Rules::setNumBoxes(const int numBoxes)
{
CHECK(numBoxes);
@@ -248,6 +262,11 @@ void Sigmod::Rules::setMaxMoney(const int maxMoney)
CHECK(maxMoney);
}
+void Sigmod::Rules::setMaxTotalWeight(const int maxTotalWeight)
+{
+ CHECK(maxTotalWeight);
+}
+
void Sigmod::Rules::setHardCash(const bool hardCash)
{
CHECK(hardCash);
@@ -312,6 +331,11 @@ bool Sigmod::Rules::useTurns() const
return m_useTurns;
}
+bool Sigmod::Rules::pausedATB() const
+{
+ return m_pausedATB;
+}
+
int Sigmod::Rules::numBoxes() const
{
return m_numBoxes;
@@ -372,6 +396,11 @@ int Sigmod::Rules::maxMoney() const
return m_maxMoney;
}
+int Sigmod::Rules::maxTotalWeight() const
+{
+ return m_maxTotalWeight;
+}
+
bool Sigmod::Rules::hardCash() const
{
return m_hardCash;
@@ -415,6 +444,7 @@ Sigmod::Rules& Sigmod::Rules::operator=(const Rules& rhs)
COPY(breedingAllowed);
COPY(criticalDomains);
COPY(useTurns);
+ COPY(pausedATB);
COPY(numBoxes);
COPY(boxSize);
COPY(maxParty);
@@ -427,6 +457,7 @@ Sigmod::Rules& Sigmod::Rules::operator=(const Rules& rhs)
COPY(maxLevel);
COPY(maxStages);
COPY(maxMoney);
+ COPY(maxTotalWeight);
COPY(hardCash);
COPY(allowSwitchStyle);
COPY(specialSplit);
diff --git a/sigmod/Rules.h b/sigmod/Rules.h
index 0373264c..5e491f71 100644
--- a/sigmod/Rules.h
+++ b/sigmod/Rules.h
@@ -47,6 +47,7 @@ class SIGMOD_EXPORT Rules : public Object
void setBreedingAllowed(const bool breedingAllowed);
void setCriticalDomains(const bool criticalDomains);
void setUseTurns(const bool useTurns);
+ void setPausedATB(const bool pausedATB);
void setNumBoxes(const int numBoxes);
void setBoxSize(const int boxSize);
void setMaxParty(const int maxParty);
@@ -59,6 +60,7 @@ class SIGMOD_EXPORT Rules : public Object
void setMaxLevel(const int maxLevel);
void setMaxStages(const int maxStage);
void setMaxMoney(const int maxMoney);
+ void setMaxTotalWeight(const int maxTotalWeight);
void setHardCash(const bool hardCash);
void setAllowSwitchStyle(const bool allowSwitchStyle);
void setSpecialSplit(const bool specialSplit);
@@ -71,6 +73,7 @@ class SIGMOD_EXPORT Rules : public Object
bool breedingAllowed() const;
bool criticalDomains() const;
bool useTurns() const;
+ bool pausedATB() const;
int numBoxes() const;
int boxSize() const;
int maxParty() const;
@@ -83,6 +86,7 @@ class SIGMOD_EXPORT Rules : public Object
int maxLevel() const;
int maxStages() const;
int maxMoney() const;
+ int maxTotalWeight() const;
bool hardCash() const;
bool allowSwitchStyle() const;
bool specialSplit() const;
@@ -97,6 +101,7 @@ class SIGMOD_EXPORT Rules : public Object
bool m_breedingAllowed;
bool m_criticalDomains;
bool m_useTurns;
+ bool m_pausedATB;
int m_numBoxes;
int m_boxSize;
int m_maxParty;
@@ -109,6 +114,7 @@ class SIGMOD_EXPORT Rules : public Object
int m_maxLevel;
int m_maxStages;
int m_maxMoney;
+ int m_maxTotalWeight;
bool m_hardCash;
bool m_allowSwitchStyle;
bool m_specialSplit;
diff --git a/sigmod/Species.cpp b/sigmod/Species.cpp
index 570004bc..4e217317 100644
--- a/sigmod/Species.cpp
+++ b/sigmod/Species.cpp
@@ -33,8 +33,8 @@ const QStringList Sigmod::Species::StyleStr = QStringList() << "Fluctuating" <<
Sigmod::Species::Species(const Species& species) :
Object(species.parent(), species.id()),
- m_baseStat(ST_End_GSC),
- m_effortValue(ST_End_GSC)
+ m_baseStat(ST_SpecialDefense - ST_HP + 1),
+ m_effortValue(ST_SpecialDefense - ST_HP + 1)
{
*this = species;
}
@@ -42,10 +42,11 @@ Sigmod::Species::Species(const Species& species) :
Sigmod::Species::Species(const Sigmod* parent, const int id) :
Object(parent, id),
m_name(""),
- m_baseStat(ST_End_GSC),
- m_effortValue(ST_End_GSC),
+ m_baseStat(ST_SpecialDefense - ST_HP + 1),
+ m_effortValue(ST_SpecialDefense - ST_HP + 1),
m_growth(Normal),
m_catchValue(0),
+ m_maxHoldWeight(0),
m_runChance(1, 1),
m_fleeChance(1, 1),
m_itemChance(1, 1),
@@ -71,16 +72,16 @@ Sigmod::Species::Species(const Sigmod* parent, const int id) :
Sigmod::Species::Species(const Species& species, const Sigmod* parent, const int id) :
Object(parent, id),
- m_baseStat(ST_End_GSC),
- m_effortValue(ST_End_GSC)
+ m_baseStat(ST_SpecialDefense - ST_HP + 1),
+ m_effortValue(ST_SpecialDefense - ST_HP + 1)
{
*this = species;
}
Sigmod::Species::Species(const QDomElement& xml, const Sigmod* parent, const int id) :
Object(parent, id),
- m_baseStat(ST_End_GSC),
- m_effortValue(ST_End_GSC)
+ m_baseStat(ST_SpecialDefense - ST_HP + 1),
+ m_effortValue(ST_SpecialDefense - ST_HP + 1)
{
LOAD_ID();
load(xml);
@@ -96,7 +97,7 @@ void Sigmod::Species::validate()
TEST_BEGIN();
if (m_name.isEmpty())
emit(error("Name is empty"));
- TEST_ARRAY(setEffortValue, effortValue, ST_End_GSC);
+ TEST_ARRAY(setEffortValue, effortValue, ST_SpecialDefense - ST_HP + 1);
TEST(setGrowth, growth);
TEST(setRunChance, runChance);
TEST(setFleeChance, fleeChance);
@@ -159,6 +160,7 @@ void Sigmod::Species::load(const QDomElement& xml)
LOAD(growth);
LOAD(experienceValue);
LOAD(catchValue);
+ LOAD(maxHoldWeight);
LOAD(runChance);
LOAD(fleeChance);
LOAD(itemChance);
@@ -191,6 +193,7 @@ QDomElement Sigmod::Species::save() const
SAVE(growth);
SAVE(experienceValue);
SAVE(catchValue);
+ SAVE(maxHoldWeight);
SAVE(runChance);
SAVE(fleeChance);
SAVE(itemChance);
@@ -278,6 +281,11 @@ void Sigmod::Species::setCatchValue(const int catchValue)
CHECK(catchValue);
}
+void Sigmod::Species::setMaxHoldWeight(const int maxHoldWeight)
+{
+ CHECK(maxHoldWeight);
+}
+
void Sigmod::Species::setRunChance(const Fraction& runChance)
{
if (1 < runChance)
@@ -481,6 +489,11 @@ int Sigmod::Species::catchValue() const
return m_catchValue;
}
+int Sigmod::Species::maxHoldWeight() const
+{
+ return m_maxHoldWeight;
+}
+
Sigmod::Fraction Sigmod::Species::runChance() const
{
return m_runChance;
@@ -826,6 +839,7 @@ Sigmod::Species& Sigmod::Species::operator=(const Species& rhs)
COPY(growth);
COPY(experienceValue);
COPY(catchValue);
+ COPY(maxHoldWeight);
COPY(runChance);
COPY(fleeChance);
COPY(itemChance);
diff --git a/sigmod/Species.h b/sigmod/Species.h
index 3dc79472..5435ba0a 100644
--- a/sigmod/Species.h
+++ b/sigmod/Species.h
@@ -68,6 +68,7 @@ class SIGMOD_EXPORT Species : public Object
void setGrowth(const Style growth);
void setExperienceValue(const int experienceValue);
void setCatchValue(const int catchValue);
+ void setMaxHoldWeight(const int maxHoldWeight);
void setRunChance(const Fraction& runChance);
void setFleeChance(const Fraction& fleeChance);
void setItemChance(const Fraction& itemChance);
@@ -93,6 +94,7 @@ class SIGMOD_EXPORT Species : public Object
Style growth() const;
int experienceValue() const;
int catchValue() const;
+ int maxHoldWeight() const;
Fraction runChance() const;
Fraction fleeChance() const;
Fraction itemChance() const;
@@ -166,11 +168,12 @@ class SIGMOD_EXPORT Species : public Object
void clear();
QString m_name;
- QVarLengthArray<bool, ST_End_GSC> m_baseStat;
- QVarLengthArray<bool, ST_End_GSC> m_effortValue;
+ QVarLengthArray<bool, ST_SpecialDefense - ST_HP + 1> m_baseStat;
+ QVarLengthArray<bool, ST_SpecialDefense - ST_HP + 1> m_effortValue;
Style m_growth;
int m_experienceValue;
int m_catchValue;
+ int m_maxHoldWeight;
Fraction m_runChance;
Fraction m_fleeChance;
Fraction m_itemChance;
diff --git a/sigmod/Tile.cpp b/sigmod/Tile.cpp
index 37854648..31f51c6b 100644
--- a/sigmod/Tile.cpp
+++ b/sigmod/Tile.cpp
@@ -33,7 +33,7 @@ Sigmod::Tile::Tile(const Sigmod* parent, const int id) :
Object(parent, id),
m_name(""),
m_sprite(-1),
- m_from(D_End),
+ m_from(D_Right - D_Up + 1),
m_script("", "")
{
for (int i = 0; i < m_from.size(); ++i)
@@ -41,13 +41,15 @@ Sigmod::Tile::Tile(const Sigmod* parent, const int id) :
}
Sigmod::Tile::Tile(const Tile& tile, const Sigmod* parent, const int id) :
- Object(parent, id)
+ Object(parent, id),
+ m_from(D_Right - D_Up + 1)
{
*this = tile;
}
Sigmod::Tile::Tile(const QDomElement& xml, const Sigmod* parent, const int id) :
- Object(parent, id)
+ Object(parent, id),
+ m_from(D_Right - D_Up + 1)
{
LOAD_ID();
load(xml);
diff --git a/sigmod/Tile.h b/sigmod/Tile.h
index 9b444707..e64b037a 100644
--- a/sigmod/Tile.h
+++ b/sigmod/Tile.h
@@ -56,7 +56,7 @@ class SIGMOD_EXPORT Tile : public Object
private:
QString m_name;
int m_sprite;
- QVarLengthArray<bool, D_End> m_from;
+ QVarLengthArray<bool, D_Right - D_Up + 1> m_from;
Script m_script;
};
}