summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--Changelog9
-rw-r--r--sigbattle/ATBTimer.cpp2
-rw-r--r--sigbattle/TeamMember.cpp31
-rw-r--r--sigbattle/TeamMember.h6
-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
-rw-r--r--sigmodr/BadgeUI.cpp25
-rw-r--r--sigmodr/ItemTypeUI.cpp9
-rw-r--r--sigmodr/ItemTypeUI.h1
-rw-r--r--sigmodr/ItemUI.cpp23
-rw-r--r--sigmodr/ItemUI.h4
-rw-r--r--sigmodr/RulesUI.cpp13
-rw-r--r--sigmodr/RulesUI.h2
-rw-r--r--sigmodr/SpeciesUI.cpp28
-rw-r--r--sigmodr/SpeciesUI.h1
-rw-r--r--sigmodr/SpriteUI.cpp40
-rw-r--r--sigmodr/SpriteUI.h3
-rw-r--r--sigmodr/TileUI.cpp2
-rw-r--r--sigmodr/gui/item.ui56
-rw-r--r--sigmodr/gui/itemtype.ui25
-rw-r--r--sigmodr/gui/rules.ui37
-rw-r--r--sigmodr/gui/species.ui25
-rw-r--r--sigmodr/gui/sprite.ui13
-rw-r--r--sigscript/ItemTypeWrapper.cpp7
-rw-r--r--sigscript/ItemTypeWrapper.h1
-rw-r--r--sigscript/ItemWrapper.cpp12
-rw-r--r--sigscript/ItemWrapper.h2
-rw-r--r--sigscript/RulesWrapper.cpp14
-rw-r--r--sigscript/RulesWrapper.h2
-rw-r--r--sigscript/SpeciesWrapper.cpp5
-rw-r--r--sigscript/SpeciesWrapper.h1
49 files changed, 554 insertions, 79 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 905b67df..4efd9e2c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,8 @@ SET(BUILT_FROM_ROOT
TRUE
)
+ADD_DEFINITIONS(-O0)
+
IF(MINGW_CROSS)
SET(CMAKE_TOOLCHAIN_FILE
cross-mingw32.cmake
diff --git a/Changelog b/Changelog
index 64f629b6..e6dc6d50 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,13 @@
-----------------
+Rev: 267
+Date: 25 September 2008
+User: MathStuf
+-----------------
+[FIX] Removed *_End defines
+[FIX] Added weights to items and associated fields
+[FIX] Option for pausing during ATB battles when choosing moves added
+
+-----------------
Rev: 266
Date: 23 September 2008
User: MathStuf
diff --git a/sigbattle/ATBTimer.cpp b/sigbattle/ATBTimer.cpp
index ad00e2d3..d4d6ac02 100644
--- a/sigbattle/ATBTimer.cpp
+++ b/sigbattle/ATBTimer.cpp
@@ -32,6 +32,8 @@
// STL includes
#include <functional>
+// TODO: Obey the options about pausing
+
bool Sigbattle::compareTimers(TeamMember* const & member1, TeamMember* const & member2)
{
return member1->timer() < member2->timer();
diff --git a/sigbattle/TeamMember.cpp b/sigbattle/TeamMember.cpp
index 2210d7c1..b0742380 100644
--- a/sigbattle/TeamMember.cpp
+++ b/sigbattle/TeamMember.cpp
@@ -105,7 +105,7 @@ Sigbattle::TeamMember::TeamMember(const int speciesId, const QString& name, cons
m_gender = (m_species->genderFactor().poll() ? Male : Female);
else
m_gender = Genderless;
- for (int i = 0; i < Sigmod::ST_End_GSC; ++i)
+ for (int i = 0; i <= Sigmod::ST_SpecialDefense; ++i)
m_statExp[i] = 0;
if (m_containment->isMutable())
{
@@ -140,7 +140,7 @@ Sigbattle::TeamMember::TeamMember(Sigscript::MapTrainerTeamMemberWrapper* teamMe
m_gender = (m_species->genderFactor().poll() ? Male : Female);
else
m_gender = Genderless;
- for (int i = 0; i < Sigmod::ST_End_GSC; ++i)
+ for (int i = 0; i <= Sigmod::ST_SpecialDefense; ++i)
m_statExp[i] = 0;
m_currentHp = statValue(Sigmod::ST_HP);
}
@@ -330,8 +330,8 @@ void Sigbattle::TeamMember::boostLevels(const int levels)
void Sigbattle::TeamMember::evolveInto(Sigscript::SpeciesWrapper* newSpecies)
{
emit(evolveStart());
- int oldStats[Sigmod::ST_End_GSC] = {};
- int newStats[Sigmod::ST_End_GSC] = {};
+ int oldStats[Sigmod::ST_SpecialDefense - Sigmod::ST_HP + 1] = {};
+ int newStats[Sigmod::ST_SpecialDefense - Sigmod::ST_HP + 1] = {};
oldStats[Sigmod::ST_Attack] = statValue(Sigmod::ST_Attack);
oldStats[Sigmod::ST_Defense] = statValue(Sigmod::ST_Defense);
oldStats[Sigmod::ST_Speed] = statValue(Sigmod::ST_Speed);
@@ -433,13 +433,12 @@ void Sigbattle::TeamMember::giveLevelExp(const int exp)
void Sigbattle::TeamMember::giveStatExp(const Sigmod::Stat stat, const int exp)
{
- Q_ASSERT(stat < (sigmod()->rules()->specialSplit() ? Sigmod::ST_End_GSC : Sigmod::ST_End_RBY));
const int oldStat = statValue(stat);
int expToGive = exp;
if (sigmod()->rules()->effortValuesAllowed())
{
int totalEV = 0;
- for (int i = 0; i < Sigmod::ST_End_GSC; ++i)
+ for (int i = 0; i <= Sigmod::ST_SpecialDefense; ++i)
totalEV += m_statExp[i];
while (expToGive && (totalEV < sigmod()->rules()->maxTotalEV()) && (m_statExp[stat] < sigmod()->rules()->maxEVPerStat()))
{
@@ -472,7 +471,7 @@ void Sigbattle::TeamMember::takeItem(Sigscript::ItemWrapper* item)
void Sigbattle::TeamMember::giveItem(Sigscript::ItemWrapper* item)
{
- if (m_items.size() < sigmod()->rules()->maxHeldItems())
+ if ((m_items.size() < sigmod()->rules()->maxHeldItems()) && checkWeight(item))
{
m_items.append(item);
emit(itemGiven(item));
@@ -602,6 +601,14 @@ void Sigbattle::TeamMember::levelGrown()
}
}
+bool Sigbattle::TeamMember::checkWeight(const Sigscript::ItemWrapper* item)
+{
+ int totalWeight = item->weight();
+ foreach (Sigscript::ItemWrapper* item, m_items)
+ totalWeight += item->weight();
+ return (totalWeight <= species()->maxHoldWeight());
+}
+
void Sigbattle::TeamMember::makeConnections()
{
// TODO: make connections that are necessary (watching Config changes mainly)
@@ -627,7 +634,11 @@ void Sigbattle::TeamMember::initItems()
for (int i = 0; i < sigmod()->rules()->maxHeldItems(); ++i)
{
if (m_species->itemChance().poll())
- m_items.append(hat.pick());
+ {
+ Sigscript::ItemWrapper* item = hat.pick();
+ if (checkWeight(item))
+ m_items.append(item);
+ }
}
}
@@ -671,12 +682,12 @@ void Sigbattle::TeamMember::initStats()
{
if (sigmod()->rules()->specialDVSplit())
{
- for (int i = 0; i < Sigmod::ST_End_GSC; ++i)
+ for (int i = Sigmod::ST_HP; i <= Sigmod::ST_SpecialDefense; ++i)
m_dv[i] = qrand() & 31;
}
else
{
- for (int i = Sigmod::ST_No_HP_Start; i < Sigmod::ST_End_RBY; ++i)
+ for (int i = Sigmod::ST_Attack; i <= Sigmod::ST_Special; ++i)
m_dv[i] = qrand() & 15;
m_dv[Sigmod::ST_HP] = ((m_dv[Sigmod::ST_Attack] & 1) << 3) + ((m_dv[Sigmod::ST_Defense] & 1) << 2) + ((m_dv[Sigmod::ST_Speed] & 1) << 1) + (m_dv[Sigmod::ST_Special] & 1);
}
diff --git a/sigbattle/TeamMember.h b/sigbattle/TeamMember.h
index f0416460..2104bc2f 100644
--- a/sigbattle/TeamMember.h
+++ b/sigbattle/TeamMember.h
@@ -169,6 +169,8 @@ class SIGBATTLE_EXPORT TeamMember : public Sigscript::Config
private slots:
void levelGrown();
protected:
+ bool checkWeight(const Sigscript::ItemWrapper* item);
+
Containment* m_containment;
const QUuid m_id;
@@ -179,8 +181,8 @@ class SIGBATTLE_EXPORT TeamMember : public Sigscript::Config
Gender m_gender;
long long m_levelExp;
int m_level;
- long long m_statExp[Sigmod::ST_End_GSC];
- int m_dv[Sigmod::ST_End_GSC];
+ long long m_statExp[Sigmod::ST_SpecialDefense - Sigmod::ST_HP + 1];
+ int m_dv[Sigmod::ST_SpecialDefense - Sigmod::ST_HP + 1];
QMultiMap<Sigscript::StatusWrapper*, Kross::Action*> m_status;
QMap<Sigscript::AbilityWrapper*, Kross::Action*> m_abilities;
QList<Sigscript::ItemWrapper*> m_items;
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;
};
}
diff --git a/sigmodr/BadgeUI.cpp b/sigmodr/BadgeUI.cpp
index e6c02d04..28098d13 100644
--- a/sigmodr/BadgeUI.cpp
+++ b/sigmodr/BadgeUI.cpp
@@ -24,6 +24,9 @@
#include "../sigmod/Sigmod.h"
#include "../sigmod/Sprite.h"
+// Qt includes
+#include <QListWidgetItem>
+
Sigmodr::BadgeUI::BadgeUI(Sigmod::Badge* badge, QWidget* parent) :
ObjectUI(parent)
{
@@ -42,15 +45,23 @@ void Sigmodr::BadgeUI::initGui()
void Sigmodr::BadgeUI::refreshGui()
{
+ int maxHeight = 0;
+ int maxWidth = 0;
varObey->setMaximum(sigmod()->rules()->maxLevel());
varFace->clear();
varBadge->clear();
for (int i = 0; i < sigmod()->spriteCount(); ++i)
{
const Sigmod::Sprite* sprite = sigmod()->sprite(i);
- varFace->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id());
- varBadge->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id());
+ const QPixmap& icon = QPixmap::fromImage(sprite->sprite());
+ maxHeight = qMax(maxHeight, icon.height());
+ maxWidth = qMax(maxWidth, icon.width());
+ varFace->addItem(icon, sprite->name(), sprite->id());
+ varBadge->addItem(icon, sprite->name(), sprite->id());
}
+ const QSize maxSize(maxWidth, maxHeight);
+ varFace->setIconSize(maxSize);
+ varBadge->setIconSize(maxSize);
varStat->clear();
const bool isSplit = sigmod()->rules()->specialSplit();
const QStringList& statNames = (isSplit ? Sigmod::StatGSCStr : Sigmod::StatRBYStr);
@@ -68,13 +79,17 @@ void Sigmodr::BadgeUI::refreshGui()
void Sigmodr::BadgeUI::setGui()
{
+ const int statIndex = varStat->currentIndex();
varName->setText(qobject_cast<Sigmod::Badge*>(modified())->name());
varObey->setValue(qobject_cast<Sigmod::Badge*>(modified())->obey());
varFace->setCurrentIndex(varFace->findData(qobject_cast<Sigmod::Badge*>(modified())->face()));
varBadge->setCurrentIndex(varBadge->findData(qobject_cast<Sigmod::Badge*>(modified())->badge()));
- Sigmod::Stat stat = varStat->itemData(varStat->currentIndex()).value<Sigmod::Stat>();
- Sigmod::Fraction multiplier = qobject_cast<Sigmod::Badge*>(modified())->stat(stat);
- varStatMultiplier->setValue(qobject_cast<Sigmod::Badge*>(modified())->stat(varStat->itemData(varStat->currentIndex()).value<Sigmod::Stat>()));
+ if (0 <= statIndex)
+ {
+ Sigmod::Stat stat = varStat->itemData(statIndex).value<Sigmod::Stat>();
+ Sigmod::Fraction multiplier = qobject_cast<Sigmod::Badge*>(modified())->stat(stat);
+ varStatMultiplier->setValue(qobject_cast<Sigmod::Badge*>(modified())->stat(stat));
+ }
}
void Sigmodr::BadgeUI::apply()
diff --git a/sigmodr/ItemTypeUI.cpp b/sigmodr/ItemTypeUI.cpp
index 7c25c0b9..87507504 100644
--- a/sigmodr/ItemTypeUI.cpp
+++ b/sigmodr/ItemTypeUI.cpp
@@ -20,6 +20,8 @@
// Sigmod includes
#include "../sigmod/ItemType.h"
+#include "../sigmod/Rules.h"
+#include "../sigmod/Sigmod.h"
Sigmodr::ItemTypeUI::ItemTypeUI(Sigmod::ItemType* itemType, QWidget* parent) :
ObjectUI(parent)
@@ -36,6 +38,7 @@ void Sigmodr::ItemTypeUI::initGui()
{
varCount->addItem(Sigmod::ItemType::CountStr[Sigmod::ItemType::Distinct], QVariant::fromValue(Sigmod::ItemType::Distinct));
varCount->addItem(Sigmod::ItemType::CountStr[Sigmod::ItemType::Total], QVariant::fromValue(Sigmod::ItemType::Total));
+ varMaxWeight->setMaximum(sigmod()->rules()->maxTotalWeight());
}
void Sigmodr::ItemTypeUI::setGui()
@@ -43,6 +46,7 @@ void Sigmodr::ItemTypeUI::setGui()
varName->setText(qobject_cast<Sigmod::ItemType*>(modified())->name());
varComputer->setValue(qobject_cast<Sigmod::ItemType*>(modified())->computer());
varPlayer->setValue(qobject_cast<Sigmod::ItemType*>(modified())->player());
+ varMaxWeight->setValue(qobject_cast<Sigmod::ItemType*>(modified())->maxWeight());
varCount->setCurrentIndex(qobject_cast<Sigmod::ItemType*>(modified())->count());
}
@@ -76,6 +80,11 @@ void Sigmodr::ItemTypeUI::on_varPlayer_valueChanged(const int player)
qobject_cast<Sigmod::ItemType*>(modified())->setPlayer(player);
}
+void Sigmodr::ItemTypeUI::on_varMaxWeight_valueChanged(const int maxWeight)
+{
+ qobject_cast<Sigmod::ItemType*>(modified())->setMaxWeight(maxWeight);
+}
+
void Sigmodr::ItemTypeUI::on_varCount_currentIndexChanged(const int count)
{
qobject_cast<Sigmod::ItemType*>(modified())->setCount(varCount->itemData(count).value<Sigmod::ItemType::Count>());
diff --git a/sigmodr/ItemTypeUI.h b/sigmodr/ItemTypeUI.h
index 7ab0d2da..1df8a5ec 100644
--- a/sigmodr/ItemTypeUI.h
+++ b/sigmodr/ItemTypeUI.h
@@ -46,6 +46,7 @@ class ItemTypeUI : public ObjectUI, private Ui::formItemType
void on_varName_textChanged(const QString& name);
void on_varComputer_valueChanged(const int computer);
void on_varPlayer_valueChanged(const int player);
+ void on_varMaxWeight_valueChanged(const int maxWeight);
void on_varCount_currentIndexChanged(const int count);
private slots:
void initGui();
diff --git a/sigmodr/ItemUI.cpp b/sigmodr/ItemUI.cpp
index 41207c14..337181db 100644
--- a/sigmodr/ItemUI.cpp
+++ b/sigmodr/ItemUI.cpp
@@ -25,7 +25,8 @@
#include "../sigmod/Sigmod.h"
Sigmodr::ItemUI::ItemUI(Sigmod::Item* item, QWidget* parent) :
- ObjectUI(parent)
+ ObjectUI(parent),
+ m_lastType(-1)
{
setupUi(this);
setObjects(item, new Sigmod::Item(*item));
@@ -48,10 +49,20 @@ void Sigmodr::ItemUI::refreshGui()
void Sigmodr::ItemUI::setGui()
{
+ const bool resetWeight = (qobject_cast<Sigmod::Item*>(modified())->type() != m_lastType);
varName->setText(qobject_cast<Sigmod::Item*>(modified())->name());
boxSellable->setChecked(qobject_cast<Sigmod::Item*>(modified())->sellable() ? Qt::Checked : Qt::Unchecked);
varType->setCurrentIndex(varType->findData(qobject_cast<Sigmod::Item*>(modified())->type()));
+ m_lastType = qobject_cast<Sigmod::Item*>(modified())->type();
varPrice->setValue(qobject_cast<Sigmod::Item*>(modified())->price());
+ varSellPrice->setValue(qobject_cast<Sigmod::Item*>(modified())->sellPrice());
+ if (resetWeight)
+ {
+ const int itemTypeIndex = sigmod()->itemTypeIndex(qobject_cast<Sigmod::Item*>(modified())->type());
+ if (itemTypeIndex != INT_MAX)
+ varWeight->setMaximum(sigmod()->itemType(itemTypeIndex)->maxWeight());
+ }
+ varWeight->setValue(qobject_cast<Sigmod::Item*>(modified())->weight());
varDescription->setText(qobject_cast<Sigmod::Item*>(modified())->description());
varScript->setValue(qobject_cast<Sigmod::Item*>(modified())->script());
}
@@ -91,6 +102,16 @@ void Sigmodr::ItemUI::on_varPrice_valueChanged(const int price)
qobject_cast<Sigmod::Item*>(modified())->setPrice(price);
}
+void Sigmodr::ItemUI::on_varSellPrice_valueChanged(const int sellPrice)
+{
+ qobject_cast<Sigmod::Item*>(modified())->setSellPrice(sellPrice);
+}
+
+void Sigmodr::ItemUI::on_varWeight_valueChanged(const int weight)
+{
+ qobject_cast<Sigmod::Item*>(modified())->setWeight(weight);
+}
+
void Sigmodr::ItemUI::on_varDescription_textChanged(const QString& description)
{
qobject_cast<Sigmod::Item*>(modified())->setDescription(description);
diff --git a/sigmodr/ItemUI.h b/sigmodr/ItemUI.h
index 08cdb55f..9584f303 100644
--- a/sigmodr/ItemUI.h
+++ b/sigmodr/ItemUI.h
@@ -47,11 +47,15 @@ class ItemUI : public ObjectUI, private Ui::formItem
void on_boxSellable_toggled(const bool sellable);
void on_varType_activated(const int type);
void on_varPrice_valueChanged(const int price);
+ void on_varSellPrice_valueChanged(const int sellPrice);
+ void on_varWeight_valueChanged(const int weight);
void on_varDescription_textChanged(const QString& description);
void on_varScript_valueChanged(const Sigmod::Script& script);
private slots:
void refreshGui();
void setGui();
+ private:
+ int m_lastType;
};
}
diff --git a/sigmodr/RulesUI.cpp b/sigmodr/RulesUI.cpp
index 1e7db476..13580849 100644
--- a/sigmodr/RulesUI.cpp
+++ b/sigmodr/RulesUI.cpp
@@ -40,6 +40,8 @@ void Sigmodr::RulesUI::setGui()
varHardCash->setChecked(qobject_cast<Sigmod::Rules*>(modified())->hardCash() ? Qt::Checked : Qt::Unchecked);
varSwitchStyle->setChecked(qobject_cast<Sigmod::Rules*>(modified())->allowSwitchStyle() ? Qt::Checked : Qt::Unchecked);
varUseTurns->setChecked(qobject_cast<Sigmod::Rules*>(modified())->useTurns() ? Qt::Checked : Qt::Unchecked);
+ varPausedATB->setDisabled(qobject_cast<Sigmod::Rules*>(modified())->useTurns());
+ varPausedATB->setChecked(qobject_cast<Sigmod::Rules*>(modified())->pausedATB() ? Qt::Checked : Qt::Unchecked);
boxSplitSpecial->setChecked(qobject_cast<Sigmod::Rules*>(modified())->specialSplit() ? Qt::Checked : Qt::Unchecked);
varSplitSpecialDV->setCheckState(qobject_cast<Sigmod::Rules*>(modified())->specialDVSplit() ? Qt::Checked : Qt::Unchecked);
boxEffortValues->setChecked(qobject_cast<Sigmod::Rules*>(modified())->effortValuesAllowed() ? Qt::Checked : Qt::Unchecked);
@@ -61,6 +63,7 @@ void Sigmodr::RulesUI::setGui()
varMaxAbilities->setValue(qobject_cast<Sigmod::Rules*>(modified())->maxAbilities());
varMaxStages->setValue(qobject_cast<Sigmod::Rules*>(modified())->maxStages());
varMaxMoney->setValue(qobject_cast<Sigmod::Rules*>(modified())->maxMoney());
+ varMaxTotalWeight->setValue(qobject_cast<Sigmod::Rules*>(modified())->maxTotalWeight());
}
void Sigmodr::RulesUI::apply()
@@ -106,6 +109,11 @@ void Sigmodr::RulesUI::on_varUseTurns_toggled(const bool useTurns)
qobject_cast<Sigmod::Rules*>(modified())->setUseTurns(useTurns);
}
+void Sigmodr::RulesUI::on_varPausedATB_toggled(const bool pausedATB)
+{
+ qobject_cast<Sigmod::Rules*>(modified())->setPausedATB(pausedATB);
+}
+
void Sigmodr::RulesUI::on_boxSplitSpecial_toggled(const bool splitSpecial)
{
qobject_cast<Sigmod::Rules*>(modified())->setSpecialSplit(splitSpecial);
@@ -192,3 +200,8 @@ void Sigmodr::RulesUI::on_varMaxMoney_valueChanged(const int maxMoney)
{
qobject_cast<Sigmod::Rules*>(modified())->setMaxMoney(maxMoney);
}
+
+void Sigmodr::RulesUI::on_varMaxTotalWeight_valueChanged(const int maxTotalWeight)
+{
+ qobject_cast<Sigmod::Rules*>(modified())->setMaxTotalWeight(maxTotalWeight);
+}
diff --git a/sigmodr/RulesUI.h b/sigmodr/RulesUI.h
index 9eb58fae..abe2388e 100644
--- a/sigmodr/RulesUI.h
+++ b/sigmodr/RulesUI.h
@@ -49,6 +49,7 @@ class RulesUI : public ObjectUI, private Ui::formRules
void on_varHardCash_toggled(const bool hardCash);
void on_varSwitchStyle_toggled(const bool switchStyle);
void on_varUseTurns_toggled(const bool useTurns);
+ void on_varPausedATB_toggled(const bool pausedATB);
void on_boxSplitSpecial_toggled(const bool specialSplit);
void on_varSplitSpecialDV_toggled(const bool specialSplitDV);
void on_boxEffortValues_toggled(const bool effortValues);
@@ -66,6 +67,7 @@ class RulesUI : public ObjectUI, private Ui::formRules
void on_varMaxAbilities_valueChanged(const int maxAbilities);
void on_varMaxStages_valueChanged(const int maxStages);
void on_varMaxMoney_valueChanged(const int maxMoney);
+ void on_varMaxTotalWeight_valueChanged(const int maxTotalWeight);
private slots:
void setGui();
};
diff --git a/sigmodr/SpeciesUI.cpp b/sigmodr/SpeciesUI.cpp
index 1892aade..210fecdc 100644
--- a/sigmodr/SpeciesUI.cpp
+++ b/sigmodr/SpeciesUI.cpp
@@ -85,14 +85,28 @@ void Sigmodr::SpeciesUI::refreshGui()
boxEffortValues->setEnabled(false);
if (!sigmod()->rules()->maxHeldItems())
boxItemChance->setEnabled(false);
+ int maxHeight = 0;
+ int maxWidth = 0;
+ varMaleFront->clear();
+ varMaleBack->clear();
+ varFemaleFront->clear();
+ varFemaleBack->clear();
for (int i = 0; i < sigmod()->spriteCount(); ++i)
{
const Sigmod::Sprite* sprite = sigmod()->sprite(i);
- varMaleFront->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id());
- varMaleBack->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id());
- varFemaleFront->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id());
- varFemaleBack->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id());
+ const QPixmap& icon = QPixmap::fromImage(sprite->sprite());
+ maxHeight = qMax(maxHeight, icon.height());
+ maxWidth = qMax(maxWidth, icon.width());
+ varMaleFront->addItem(icon, sprite->name(), sprite->id());
+ varMaleBack->addItem(icon, sprite->name(), sprite->id());
+ varFemaleFront->addItem(icon, sprite->name(), sprite->id());
+ varFemaleBack->addItem(icon, sprite->name(), sprite->id());
}
+ const QSize maxSize(maxWidth, maxHeight);
+ varMaleFront->setIconSize(maxSize);
+ varMaleBack->setIconSize(maxSize);
+ varFemaleFront->setIconSize(maxSize);
+ varFemaleBack->setIconSize(maxSize);
for (int i = 0; i < sigmod()->skinCount(); ++i)
{
const Sigmod::Skin* skin = sigmod()->skin(i);
@@ -145,6 +159,7 @@ void Sigmodr::SpeciesUI::setGui()
varGrowth->setCurrentIndex(qobject_cast<Sigmod::Species*>(modified())->growth());
varExperienceValue->setValue(qobject_cast<Sigmod::Species*>(modified())->experienceValue());
varCatchValue->setValue(qobject_cast<Sigmod::Species*>(modified())->catchValue());
+ varMaxHoldWeight->setValue(qobject_cast<Sigmod::Species*>(modified())->maxHoldWeight());
varRunChance->setValue(qobject_cast<Sigmod::Species*>(modified())->runChance());
varItemChance->setValue(qobject_cast<Sigmod::Species*>(modified())->itemChance());
varEncyclopediaNumber->setValue(qobject_cast<Sigmod::Species*>(modified())->encyclopediaNumber());
@@ -221,6 +236,11 @@ void Sigmodr::SpeciesUI::on_varCatchValue_valueChanged(const int catchValue)
qobject_cast<Sigmod::Species*>(modified())->setCatchValue(catchValue);
}
+void Sigmodr::SpeciesUI::on_varMaxHoldWeight_valueChanged(const int maxHoldWeight)
+{
+ qobject_cast<Sigmod::Species*>(modified())->setMaxHoldWeight(maxHoldWeight);
+}
+
void Sigmodr::SpeciesUI::on_varRunChance_valueChanged(const Sigmod::Fraction& runChance)
{
qobject_cast<Sigmod::Species*>(modified())->setRunChance(runChance);
diff --git a/sigmodr/SpeciesUI.h b/sigmodr/SpeciesUI.h
index a6fbc9cc..552e1ed4 100644
--- a/sigmodr/SpeciesUI.h
+++ b/sigmodr/SpeciesUI.h
@@ -49,6 +49,7 @@ class SpeciesUI : public ObjectUI, private Ui::formSpecies
void on_varGrowth_activated(const int growth);
void on_varExperienceValue_valueChanged(const int experienceValue);
void on_varCatchValue_valueChanged(const int catchValue);
+ void on_varMaxHoldWeight_valueChanged(const int maxHoldWeight);
void on_varRunChance_valueChanged(const Sigmod::Fraction& runChance);
void on_varItemChance_valueChanged(const Sigmod::Fraction& itemChance);
void on_varEncyclopediaNumber_valueChanged(const int encyclopediaNumber);
diff --git a/sigmodr/SpriteUI.cpp b/sigmodr/SpriteUI.cpp
index 19562b4c..4edd38f1 100644
--- a/sigmodr/SpriteUI.cpp
+++ b/sigmodr/SpriteUI.cpp
@@ -25,6 +25,8 @@
// KDE includes
#include <KFileDialog>
#include <KImageFilePreview>
+#include <KMessageBox>
+#include <KIO/NetAccess>
Sigmodr::SpriteUI::SpriteUI(Sigmod::Sprite* sprite, QWidget* parent) :
ObjectUI(parent)
@@ -37,12 +39,15 @@ Sigmodr::SpriteUI::~SpriteUI()
{
}
+void Sigmodr::SpriteUI::initGui()
+{
+ buttonBrowse->setIcon(KIcon("document-open"));
+}
+
void Sigmodr::SpriteUI::setGui()
{
- const QImage sprite = qobject_cast<Sigmod::Sprite*>(modified())->sprite();
varName->setText(qobject_cast<Sigmod::Sprite*>(modified())->name());
- varSprite->setIcon(QPixmap::fromImage(sprite));
- varSprite->setMinimumSize(sprite.size());
+ varSprite->setPixmap(QPixmap::fromImage(qobject_cast<Sigmod::Sprite*>(modified())->sprite()));
}
void Sigmodr::SpriteUI::apply()
@@ -65,16 +70,37 @@ void Sigmodr::SpriteUI::on_varName_textChanged(const QString& name)
varName->setCursorPosition(cursor);
}
-void Sigmodr::SpriteUI::on_varSprite_pressed()
+void Sigmodr::SpriteUI::on_buttonBrowse_pressed()
{
- KFileDialog* dialog = new KFileDialog(KUrl("kfiledialog:///image"), "image/*|Image files", NULL);
+ KFileDialog* dialog = new KFileDialog(KUrl("kfiledialog:///image"), "image/png image/jpeg image/tiff image/bmp image/gif", this);
dialog->setCaption("Use Image File");
dialog->setOperationMode(KFileDialog::Opening);
dialog->setPreviewWidget(new KImageFilePreview);
if (dialog->exec() == QDialog::Accepted)
{
- qobject_cast<Sigmod::Sprite*>(modified())->setSprite(QImage(dialog->selectedFile()));
- setGui();
+ KUrl url = dialog->selectedFile();
+ if (url.isValid())
+ {
+ if (url.isLocalFile())
+ {
+ qobject_cast<Sigmod::Sprite*>(modified())->setSprite(QImage(url.path()));
+ setGui();
+ }
+ else
+ {
+ QString path;
+ if (KIO::NetAccess::download(url, path, this))
+ {
+ qobject_cast<Sigmod::Sprite*>(modified())->setSprite(QImage(path));
+ setGui();
+ KIO::NetAccess::removeTempFile(path);
+ }
+ else
+ KMessageBox::error(this, KIO::NetAccess::lastErrorString(), "KIO Error");
+ }
+ }
+ else
+ KMessageBox::error(this, "The URL is not valid", "Malformed URL");
}
delete dialog;
}
diff --git a/sigmodr/SpriteUI.h b/sigmodr/SpriteUI.h
index 34eac4d0..5d11d3f4 100644
--- a/sigmodr/SpriteUI.h
+++ b/sigmodr/SpriteUI.h
@@ -44,8 +44,9 @@ class SpriteUI : public ObjectUI, private Ui::formSprite
void discard();
protected slots:
void on_varName_textChanged(const QString& name);
- void on_varSprite_pressed();
+ void on_buttonBrowse_pressed();
private slots:
+ void initGui();
void setGui();
};
}
diff --git a/sigmodr/TileUI.cpp b/sigmodr/TileUI.cpp
index f0932e24..61cb3cbf 100644
--- a/sigmodr/TileUI.cpp
+++ b/sigmodr/TileUI.cpp
@@ -49,12 +49,14 @@ void Sigmodr::TileUI::initGui()
void Sigmodr::TileUI::refreshGui()
{
+ varSprite->clear();
for (int i = 0; i < sigmod()->spriteCount(); ++i)
{
const Sigmod::Sprite* sprite = sigmod()->sprite(i);
if (sprite->sprite().size() == QSize(64, 64))
varSprite->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id());
}
+ varSprite->setIconSize(QSize(64, 64));
}
void Sigmodr::TileUI::setGui()
diff --git a/sigmodr/gui/item.ui b/sigmodr/gui/item.ui
index 7f679dd5..d83c5306 100644
--- a/sigmodr/gui/item.ui
+++ b/sigmodr/gui/item.ui
@@ -73,13 +73,13 @@
<string>Price</string>
</property>
<property name="toolTip" >
- <string>Price of the item at a store (resell value is 50%)</string>
+ <string>Price of the item at a store</string>
</property>
<property name="statusTip" >
- <string>Price of the item at a store (resell value is 50%)</string>
+ <string>Price of the item at a store</string>
</property>
<property name="whatsThis" >
- <string>Price of the item at a store (resell value is 50%)</string>
+ <string>Price of the item at a store</string>
</property>
<layout class="QHBoxLayout" >
<item>
@@ -93,6 +93,56 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="boxSellPrice" >
+ <property name="title" >
+ <string>Price</string>
+ </property>
+ <property name="toolTip" >
+ <string>Amount received when item is sold</string>
+ </property>
+ <property name="statusTip" >
+ <string>Amount received when item is sold</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Amount received when item is sold</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="KIntNumInput" name="varSellPrice" >
+ <property name="minimum" >
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="boxWeight" >
+ <property name="title" >
+ <string>Weight</string>
+ </property>
+ <property name="toolTip" >
+ <string>Weight of the item</string>
+ </property>
+ <property name="statusTip" >
+ <string>Weight of the item</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Weight of the item</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="KIntNumInput" name="varWeight" >
+ <property name="minimum" >
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QGroupBox" name="boxDescription" >
<property name="title" >
<string>Description</string>
diff --git a/sigmodr/gui/itemtype.ui b/sigmodr/gui/itemtype.ui
index db8e78f4..9f1b70ee 100644
--- a/sigmodr/gui/itemtype.ui
+++ b/sigmodr/gui/itemtype.ui
@@ -78,6 +78,31 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="boxMaxWeight" >
+ <property name="title" >
+ <string>Maximum Weight</string>
+ </property>
+ <property name="toolTip" >
+ <string>How much weight can be carried of these items</string>
+ </property>
+ <property name="statusTip" >
+ <string>How much weight can be carried of these items</string>
+ </property>
+ <property name="whatsThis" >
+ <string>How much weight can be carried of these items</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="KIntNumInput" name="varMaxWeight" >
+ <property name="minimum" >
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QGroupBox" name="boxCount" >
<property name="title" >
<string>Count</string>
diff --git a/sigmodr/gui/rules.ui b/sigmodr/gui/rules.ui
index 466b551b..7ad2f126 100644
--- a/sigmodr/gui/rules.ui
+++ b/sigmodr/gui/rules.ui
@@ -13,7 +13,7 @@
<property name="whatsThis" >
<string>If checked, there can be male and female counterparts of species</string>
</property>
- <property name="title" >
+ <property name="title" >int
<string>Genders</string>
</property>
<property name="checkable" >
@@ -109,6 +109,22 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="varPausedATB" >
+ <property name="toolTip" >
+ <string>If checked, the "ready" bar will pause when a player is being asked for an action</string>
+ </property>
+ <property name="statusTip" >
+ <string>If checked, the "ready" bar will pause when a player is being asked for an action</string>
+ </property>
+ <property name="whatsThis" >
+ <string>If checked, the "ready" bar will pause when a player is being asked for an action</string>
+ </property>
+ <property name="text" >
+ <string>Paused ATB</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -336,6 +352,25 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="KIntNumInput" name="varMaxTotalWeight" >
+ <property name="label" >
+ <string>Max Total Weight</string>
+ </property>
+ <property name="toolTip" >
+ <string>Maximum amount of weight that can be carried by the player</string>
+ </property>
+ <property name="statusTip" >
+ <string>Maximum amount of weight that can be carried by the player</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Maximum amount of weight that can be carried by the player</string>
+ </property>
+ <property name="minimum" >
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/sigmodr/gui/species.ui b/sigmodr/gui/species.ui
index 918f2730..0f60f13a 100644
--- a/sigmodr/gui/species.ui
+++ b/sigmodr/gui/species.ui
@@ -60,6 +60,31 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="boxMaxHoldWeight" >
+ <property name="title" >
+ <string>Max Hold Weight</string>
+ </property>
+ <property name="toolTip" >
+ <string>The maximum weight that the species can hold at one time</string>
+ </property>
+ <property name="statusTip" >
+ <string>The maximum weight that the species can hold at one time</string>
+ </property>
+ <property name="whatsThis" >
+ <string>The maximum weight that the species can hold at one time</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="KIntNumInput" name="varMaxHoldWeight" >
+ <property name="minimum" >
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QGroupBox" name="boxRunChance" >
<property name="title" >
<string>Run Chance</string>
diff --git a/sigmodr/gui/sprite.ui b/sigmodr/gui/sprite.ui
index 0d5499ab..f6d7c939 100644
--- a/sigmodr/gui/sprite.ui
+++ b/sigmodr/gui/sprite.ui
@@ -56,7 +56,18 @@
</spacer>
</item>
<item>
- <widget class="KPushButton" name="varSprite" />
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLabel" name="varSprite" />
+ </item>
+ <item>
+ <widget class="KPushButton" name="buttonBrowse" >
+ <property name="text" >
+ <string>Browse...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<spacer>
diff --git a/sigscript/ItemTypeWrapper.cpp b/sigscript/ItemTypeWrapper.cpp
index 12f47876..aebd20c3 100644
--- a/sigscript/ItemTypeWrapper.cpp
+++ b/sigscript/ItemTypeWrapper.cpp
@@ -58,6 +58,13 @@ int Sigscript::ItemTypeWrapper::player() const
return m_itemType->player();
}
+int Sigscript::ItemTypeWrapper::maxWeight() const
+{
+ if (hasValueOfType<int>("maxWeight"))
+ return valueOfType<int>("maxWeight");
+ return m_itemType->maxWeight();
+}
+
int Sigscript::ItemTypeWrapper::count() const
{
return m_itemType->count();
diff --git a/sigscript/ItemTypeWrapper.h b/sigscript/ItemTypeWrapper.h
index ad8ed75a..790a00fd 100644
--- a/sigscript/ItemTypeWrapper.h
+++ b/sigscript/ItemTypeWrapper.h
@@ -38,6 +38,7 @@ class SIGSCRIPT_EXPORT ItemTypeWrapper : public ObjectWrapper
Q_SCRIPTABLE QString name() const;
Q_SCRIPTABLE int computer() const;
Q_SCRIPTABLE int player() const;
+ Q_SCRIPTABLE int maxWeight() const;
Q_SCRIPTABLE int count() const;
private:
ItemTypeWrapper(const Sigmod::ItemType* itemType, SigmodWrapper* parent);
diff --git a/sigscript/ItemWrapper.cpp b/sigscript/ItemWrapper.cpp
index 71e36149..18803dbb 100644
--- a/sigscript/ItemWrapper.cpp
+++ b/sigscript/ItemWrapper.cpp
@@ -56,6 +56,18 @@ int Sigscript::ItemWrapper::price() const
return m_item->price();
}
+int Sigscript::ItemWrapper::sellPrice() const
+{
+ if (hasValueOfType<int>("sellPrice"))
+ return valueOfType<int>("sellPrice");
+ return m_item->sellPrice();
+}
+
+int Sigscript::ItemWrapper::weight() const
+{
+ return m_item->weight();
+}
+
QString Sigscript::ItemWrapper::description() const
{
return m_item->description();
diff --git a/sigscript/ItemWrapper.h b/sigscript/ItemWrapper.h
index 99ef693e..84b33af5 100644
--- a/sigscript/ItemWrapper.h
+++ b/sigscript/ItemWrapper.h
@@ -40,6 +40,8 @@ class SIGSCRIPT_EXPORT ItemWrapper : public ObjectWrapper
Q_SCRIPTABLE bool sellable() const;
Q_SCRIPTABLE ItemTypeWrapper* type();
Q_SCRIPTABLE int price() const;
+ Q_SCRIPTABLE int sellPrice() const;
+ Q_SCRIPTABLE int weight() const;
Q_SCRIPTABLE QString description() const;
Q_SCRIPTABLE Sigmod::Script script() const;
private:
diff --git a/sigscript/RulesWrapper.cpp b/sigscript/RulesWrapper.cpp
index f1493208..a5374678 100644
--- a/sigscript/RulesWrapper.cpp
+++ b/sigscript/RulesWrapper.cpp
@@ -54,6 +54,13 @@ bool Sigscript::RulesWrapper::useTurns() const
return m_rules->useTurns();
}
+bool Sigscript::RulesWrapper::pausedATB() const
+{
+ if (hasValueOfType<bool>("pausedATB"))
+ return valueOfType<bool>("pausedATB");
+ return m_rules->pausedATB();
+}
+
int Sigscript::RulesWrapper::numBoxes() const
{
if (hasValueOfType<int>("numBoxes"))
@@ -134,6 +141,13 @@ int Sigscript::RulesWrapper::maxMoney() const
return m_rules->maxMoney();
}
+int Sigscript::RulesWrapper::maxTotalWeight() const
+{
+ if (hasValueOfType<int>("maxTotalWeight"))
+ return valueOfType<int>("maxTotalWeight");
+ return m_rules->maxTotalWeight();
+}
+
bool Sigscript::RulesWrapper::hardCash() const
{
return m_rules->hardCash();
diff --git a/sigscript/RulesWrapper.h b/sigscript/RulesWrapper.h
index 45383ee6..9846f302 100644
--- a/sigscript/RulesWrapper.h
+++ b/sigscript/RulesWrapper.h
@@ -37,6 +37,7 @@ class SIGSCRIPT_EXPORT RulesWrapper : public ObjectWrapper
Q_SCRIPTABLE bool breedingAllowed() const;
Q_SCRIPTABLE bool criticalDomains() const;
Q_SCRIPTABLE bool useTurns() const;
+ Q_SCRIPTABLE bool pausedATB() const;
Q_SCRIPTABLE int numBoxes() const;
Q_SCRIPTABLE int boxSize() const;
Q_SCRIPTABLE int maxParty() const;
@@ -49,6 +50,7 @@ class SIGSCRIPT_EXPORT RulesWrapper : public ObjectWrapper
Q_SCRIPTABLE int maxLevel() const;
Q_SCRIPTABLE int maxStages() const;
Q_SCRIPTABLE int maxMoney() const;
+ Q_SCRIPTABLE int maxTotalWeight() const;
Q_SCRIPTABLE bool hardCash() const;
Q_SCRIPTABLE bool allowSwitchStyle() const;
Q_SCRIPTABLE bool specialSplit() const;
diff --git a/sigscript/SpeciesWrapper.cpp b/sigscript/SpeciesWrapper.cpp
index 5f1b1a72..42a46a50 100644
--- a/sigscript/SpeciesWrapper.cpp
+++ b/sigscript/SpeciesWrapper.cpp
@@ -100,6 +100,11 @@ int Sigscript::SpeciesWrapper::catchValue() const
return m_species->catchValue();
}
+int Sigscript::SpeciesWrapper::maxHoldWeight() const
+{
+ return m_species->maxHoldWeight();
+}
+
Sigmod::Fraction Sigscript::SpeciesWrapper::runChance() const
{
if (hasValueOfType<Sigmod::Fraction>("runChance"))
diff --git a/sigscript/SpeciesWrapper.h b/sigscript/SpeciesWrapper.h
index 54e4203b..5a4209da 100644
--- a/sigscript/SpeciesWrapper.h
+++ b/sigscript/SpeciesWrapper.h
@@ -56,6 +56,7 @@ class SIGSCRIPT_EXPORT SpeciesWrapper : public ObjectWrapper
Q_SCRIPTABLE Sigmod::Species::Style growth() const;
Q_SCRIPTABLE int experienceValue() const;
Q_SCRIPTABLE int catchValue() const;
+ Q_SCRIPTABLE int maxHoldWeight() const;
Q_SCRIPTABLE Sigmod::Fraction runChance() const;
Q_SCRIPTABLE Sigmod::Fraction fleeChance() const;
Q_SCRIPTABLE Sigmod::Fraction itemChance() const;