diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-10-06 00:50:02 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-10-06 00:50:02 +0000 |
| commit | 2c0a3866e09140d8d5ff84178decddc22db15778 (patch) | |
| tree | 8d780290c2b1738cb17cec832dd866b068b9a31f /sigscript | |
| parent | 61276d172306a14c110a7c3631b484ccf93f9ffa (diff) | |
| download | sigen-2c0a3866e09140d8d5ff84178decddc22db15778.tar.gz sigen-2c0a3866e09140d8d5ff84178decddc22db15778.tar.xz sigen-2c0a3866e09140d8d5ff84178decddc22db15778.zip | |
[FIX] Added single player option to Sigmod
[FIX] Doxygen generation cleaned up
[FIX] Can no longer override variables in the Sigmod if not a single player game
[FIX] When checking for modified move priority, blean up afterwards
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@271 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigscript')
| -rw-r--r-- | sigscript/AbilityWrapper.cpp | 2 | ||||
| -rw-r--r-- | sigscript/CoinListObjectWrapper.cpp | 4 | ||||
| -rw-r--r-- | sigscript/ItemTypeWrapper.cpp | 2 | ||||
| -rw-r--r-- | sigscript/ItemWrapper.cpp | 4 | ||||
| -rw-r--r-- | sigscript/MapEffectWrapper.cpp | 4 | ||||
| -rw-r--r-- | sigscript/MapTrainerTeamMemberWrapper.cpp | 2 | ||||
| -rw-r--r-- | sigscript/MapWarpWrapper.cpp | 2 | ||||
| -rw-r--r-- | sigscript/MapWildListEncounterWrapper.cpp | 4 | ||||
| -rw-r--r-- | sigscript/MoveWrapper.cpp | 6 | ||||
| -rw-r--r-- | sigscript/RulesWrapper.cpp | 30 | ||||
| -rw-r--r-- | sigscript/SigmodWrapper.cpp | 5 | ||||
| -rw-r--r-- | sigscript/SigmodWrapper.h | 1 | ||||
| -rw-r--r-- | sigscript/SpeciesItemWrapper.cpp | 2 | ||||
| -rw-r--r-- | sigscript/SpeciesWrapper.cpp | 8 | ||||
| -rw-r--r-- | sigscript/TileWrapper.cpp | 4 | ||||
| -rw-r--r-- | sigscript/TrainerWrapper.cpp | 4 |
16 files changed, 45 insertions, 39 deletions
diff --git a/sigscript/AbilityWrapper.cpp b/sigscript/AbilityWrapper.cpp index 35e8dd82..42a40541 100644 --- a/sigscript/AbilityWrapper.cpp +++ b/sigscript/AbilityWrapper.cpp @@ -41,7 +41,7 @@ QString Sigscript::AbilityWrapper::name() const int Sigscript::AbilityWrapper::priority() const { - if (hasValueOfType<int>("priority")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("priority")) return valueOfType<int>("priority"); return m_ability->priority(); } diff --git a/sigscript/CoinListObjectWrapper.cpp b/sigscript/CoinListObjectWrapper.cpp index b0b540a5..6520b8d1 100644 --- a/sigscript/CoinListObjectWrapper.cpp +++ b/sigscript/CoinListObjectWrapper.cpp @@ -65,14 +65,14 @@ Sigscript::SpeciesWrapper* Sigscript::CoinListObjectWrapper::speciesObject() int Sigscript::CoinListObjectWrapper::amount() const { - if (hasValueOfType<int>("amount")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("amount")) return valueOfType<int>("amount"); return m_object->amount(); } int Sigscript::CoinListObjectWrapper::cost() const { - if (hasValueOfType<int>("cost")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("cost")) return valueOfType<int>("cost"); return m_object->cost(); } diff --git a/sigscript/ItemTypeWrapper.cpp b/sigscript/ItemTypeWrapper.cpp index aebd20c3..ae3fb45a 100644 --- a/sigscript/ItemTypeWrapper.cpp +++ b/sigscript/ItemTypeWrapper.cpp @@ -60,7 +60,7 @@ int Sigscript::ItemTypeWrapper::player() const int Sigscript::ItemTypeWrapper::maxWeight() const { - if (hasValueOfType<int>("maxWeight")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxWeight")) return valueOfType<int>("maxWeight"); return m_itemType->maxWeight(); } diff --git a/sigscript/ItemWrapper.cpp b/sigscript/ItemWrapper.cpp index 18803dbb..642b6303 100644 --- a/sigscript/ItemWrapper.cpp +++ b/sigscript/ItemWrapper.cpp @@ -51,14 +51,14 @@ Sigscript::ItemTypeWrapper* Sigscript::ItemWrapper::type() int Sigscript::ItemWrapper::price() const { - if (hasValueOfType<int>("price")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("price")) return valueOfType<int>("price"); return m_item->price(); } int Sigscript::ItemWrapper::sellPrice() const { - if (hasValueOfType<int>("sellPrice")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("sellPrice")) return valueOfType<int>("sellPrice"); return m_item->sellPrice(); } diff --git a/sigscript/MapEffectWrapper.cpp b/sigscript/MapEffectWrapper.cpp index 52bd4de9..c06d7c10 100644 --- a/sigscript/MapEffectWrapper.cpp +++ b/sigscript/MapEffectWrapper.cpp @@ -42,7 +42,7 @@ QString Sigscript::MapEffectWrapper::name() const QPoint Sigscript::MapEffectWrapper::coordinate() const { - if (hasValueOfType<QPoint>("coordinate")) + if (sigmod()->singlePlayer() && hasValueOfType<QPoint>("coordinate")) return valueOfType<QPoint>("coordinate"); return m_effect->coordinate(); } @@ -54,7 +54,7 @@ Sigscript::SkinWrapper* Sigscript::MapEffectWrapper::skin() bool Sigscript::MapEffectWrapper::isGhost() const { - if (hasValueOfType<bool>("ghost")) + if (sigmod()->singlePlayer() && hasValueOfType<bool>("ghost")) return valueOfType<bool>("ghost"); return m_effect->isGhost(); } diff --git a/sigscript/MapTrainerTeamMemberWrapper.cpp b/sigscript/MapTrainerTeamMemberWrapper.cpp index e875008a..74e500c4 100644 --- a/sigscript/MapTrainerTeamMemberWrapper.cpp +++ b/sigscript/MapTrainerTeamMemberWrapper.cpp @@ -42,7 +42,7 @@ Sigscript::SpeciesWrapper* Sigscript::MapTrainerTeamMemberWrapper::species() int Sigscript::MapTrainerTeamMemberWrapper::level() const { - if (hasValueOfType<int>("level")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("level")) return valueOfType<int>("level"); return m_teamMember->level(); } diff --git a/sigscript/MapWarpWrapper.cpp b/sigscript/MapWarpWrapper.cpp index bacba9b0..d09646cf 100644 --- a/sigscript/MapWarpWrapper.cpp +++ b/sigscript/MapWarpWrapper.cpp @@ -55,7 +55,7 @@ QString Sigscript::MapWarpWrapper::name() const QPoint Sigscript::MapWarpWrapper::coordinate() const { - if (hasValueOfType<QPoint>("coordinate")) + if (sigmod()->singlePlayer() && hasValueOfType<QPoint>("coordinate")) return valueOfType<QPoint>("coordinate"); return m_warp->coordinate(); } diff --git a/sigscript/MapWildListEncounterWrapper.cpp b/sigscript/MapWildListEncounterWrapper.cpp index 1eea2ce8..3fd49c9c 100644 --- a/sigscript/MapWildListEncounterWrapper.cpp +++ b/sigscript/MapWildListEncounterWrapper.cpp @@ -42,14 +42,14 @@ Sigscript::SpeciesWrapper* Sigscript::MapWildListEncounterWrapper::species() int Sigscript::MapWildListEncounterWrapper::level() const { - if (hasValueOfType<int>("level")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("level")) return valueOfType<int>("level"); return m_encounter->level(); } int Sigscript::MapWildListEncounterWrapper::weight() const { - if (hasValueOfType<int>("weight")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("weight")) return valueOfType<int>("weight"); return m_encounter->weight(); } diff --git a/sigscript/MoveWrapper.cpp b/sigscript/MoveWrapper.cpp index 6c21cc38..60dc2729 100644 --- a/sigscript/MoveWrapper.cpp +++ b/sigscript/MoveWrapper.cpp @@ -41,14 +41,14 @@ QString Sigscript::MoveWrapper::name() const Sigmod::Fraction Sigscript::MoveWrapper::accuracy() const { - if (hasValueOfType<Sigmod::Fraction>("accuracy")) + if (sigmod()->singlePlayer() && hasValueOfType<Sigmod::Fraction>("accuracy")) return valueOfType<Sigmod::Fraction>("accuracy"); return m_move->accuracy(); } int Sigscript::MoveWrapper::power() const { - if (hasValueOfType<int>("power")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("power")) return valueOfType<int>("power"); return m_move->power(); } @@ -70,7 +70,7 @@ int Sigscript::MoveWrapper::powerPoints() const int Sigscript::MoveWrapper::priority() const { - if (hasValueOfType<int>("priority")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("priority")) return valueOfType<int>("priority"); return m_move->priority(); } diff --git a/sigscript/RulesWrapper.cpp b/sigscript/RulesWrapper.cpp index a5374678..662383f3 100644 --- a/sigscript/RulesWrapper.cpp +++ b/sigscript/RulesWrapper.cpp @@ -56,49 +56,49 @@ bool Sigscript::RulesWrapper::useTurns() const bool Sigscript::RulesWrapper::pausedATB() const { - if (hasValueOfType<bool>("pausedATB")) + if (sigmod()->singlePlayer() && hasValueOfType<bool>("pausedATB")) return valueOfType<bool>("pausedATB"); return m_rules->pausedATB(); } int Sigscript::RulesWrapper::numBoxes() const { - if (hasValueOfType<int>("numBoxes")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("numBoxes")) return valueOfType<int>("numBoxes"); return m_rules->numBoxes(); } int Sigscript::RulesWrapper::boxSize() const { - if (hasValueOfType<int>("boxSize")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("boxSize")) return valueOfType<int>("boxSize"); return m_rules->boxSize(); } int Sigscript::RulesWrapper::maxParty() const { - if (hasValueOfType<int>("maxParty")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxParty")) return valueOfType<int>("maxParty"); return m_rules->maxParty(); } int Sigscript::RulesWrapper::maxFight() const { - if (hasValueOfType<int>("maxFight")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxFight")) return valueOfType<int>("maxFight"); return m_rules->maxFight(); } int Sigscript::RulesWrapper::maxPlayers() const { - if (hasValueOfType<int>("maxFight")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxFight")) return valueOfType<int>("maxFight"); return m_rules->maxPlayers(); } int Sigscript::RulesWrapper::maxHeldItems() const { - if (hasValueOfType<int>("maxHeldItems")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxHeldItems")) return valueOfType<int>("maxHeldItems"); return m_rules->maxHeldItems(); } @@ -115,35 +115,35 @@ int Sigscript::RulesWrapper::maxNatures() const int Sigscript::RulesWrapper::maxMoves() const { - if (hasValueOfType<int>("maxMoves")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxMoves")) return valueOfType<int>("maxMoves"); return m_rules->maxMoves(); } int Sigscript::RulesWrapper::maxLevel() const { - if (hasValueOfType<int>("maxLevel")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxLevel")) return valueOfType<int>("maxLevel"); return m_rules->maxLevel(); } int Sigscript::RulesWrapper::maxStages() const { - if (hasValueOfType<int>("maxStages")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxStages")) return valueOfType<int>("maxStages"); return m_rules->maxStages(); } int Sigscript::RulesWrapper::maxMoney() const { - if (hasValueOfType<int>("maxMoney")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxMoney")) return valueOfType<int>("maxMoney"); return m_rules->maxMoney(); } int Sigscript::RulesWrapper::maxTotalWeight() const { - if (hasValueOfType<int>("maxTotalWeight")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxTotalWeight")) return valueOfType<int>("maxTotalWeight"); return m_rules->maxTotalWeight(); } @@ -155,7 +155,7 @@ bool Sigscript::RulesWrapper::hardCash() const bool Sigscript::RulesWrapper::allowSwitchStyle() const { - if (hasValueOfType<bool>("allowSwitchStyle")) + if (sigmod()->singlePlayer() && hasValueOfType<bool>("allowSwitchStyle")) return valueOfType<bool>("allowSwitchStyle"); return m_rules->allowSwitchStyle(); } @@ -177,14 +177,14 @@ bool Sigscript::RulesWrapper::effortValuesAllowed() const int Sigscript::RulesWrapper::maxTotalEV() const { - if (hasValueOfType<int>("maxTotalEV")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxTotalEV")) return valueOfType<int>("maxTotalEV"); return m_rules->maxTotalEV(); } int Sigscript::RulesWrapper::maxEVPerStat() const { - if (hasValueOfType<int>("maxEVPerStat")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("maxEVPerStat")) return valueOfType<int>("maxEVPerStat"); return m_rules->maxEVPerStat(); } diff --git a/sigscript/SigmodWrapper.cpp b/sigscript/SigmodWrapper.cpp index 473ffddc..cb70ec64 100644 --- a/sigscript/SigmodWrapper.cpp +++ b/sigscript/SigmodWrapper.cpp @@ -224,6 +224,11 @@ QString Sigscript::SigmodWrapper::description() const return m_sigmod->description(); } +bool Sigscript::SigmodWrapper::singlePlayer() const +{ + return m_sigmod->singlePlayer(); +} + Sigscript::MapWarpWrapper* Sigscript::SigmodWrapper::startWarp() { return map(m_sigmod->startMap())->warp(m_sigmod->startWarp()); diff --git a/sigscript/SigmodWrapper.h b/sigscript/SigmodWrapper.h index 1d9093b5..fa740a8a 100644 --- a/sigscript/SigmodWrapper.h +++ b/sigscript/SigmodWrapper.h @@ -91,6 +91,7 @@ class SIGSCRIPT_EXPORT SigmodWrapper : public ObjectWrapper Q_SCRIPTABLE QString title() const; Q_SCRIPTABLE QString version() const; Q_SCRIPTABLE QString description() const; + Q_SCRIPTABLE bool singlePlayer() const; Q_SCRIPTABLE MapWarpWrapper* startWarp(); Q_SCRIPTABLE Sigmod::Fraction effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const; Q_SCRIPTABLE RulesWrapper* rules(); diff --git a/sigscript/SpeciesItemWrapper.cpp b/sigscript/SpeciesItemWrapper.cpp index 8bc86ef3..8a36ee8b 100644 --- a/sigscript/SpeciesItemWrapper.cpp +++ b/sigscript/SpeciesItemWrapper.cpp @@ -42,7 +42,7 @@ Sigscript::ItemWrapper* Sigscript::SpeciesItemWrapper::item() int Sigscript::SpeciesItemWrapper::weight() const { - if (hasValueOfType<int>("weight")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("weight")) return valueOfType<int>("weight"); return m_item->weight(); } diff --git a/sigscript/SpeciesWrapper.cpp b/sigscript/SpeciesWrapper.cpp index 42a46a50..d79f2e5f 100644 --- a/sigscript/SpeciesWrapper.cpp +++ b/sigscript/SpeciesWrapper.cpp @@ -107,21 +107,21 @@ int Sigscript::SpeciesWrapper::maxHoldWeight() const Sigmod::Fraction Sigscript::SpeciesWrapper::runChance() const { - if (hasValueOfType<Sigmod::Fraction>("runChance")) + if (sigmod()->singlePlayer() && hasValueOfType<Sigmod::Fraction>("runChance")) return valueOfType<Sigmod::Fraction>("runChance"); return m_species->runChance(); } Sigmod::Fraction Sigscript::SpeciesWrapper::fleeChance() const { - if (hasValueOfType<Sigmod::Fraction>("fleeChance")) + if (sigmod()->singlePlayer() && hasValueOfType<Sigmod::Fraction>("fleeChance")) return valueOfType<Sigmod::Fraction>("fleeChance"); return m_species->fleeChance(); } Sigmod::Fraction Sigscript::SpeciesWrapper::itemChance() const { - if (hasValueOfType<Sigmod::Fraction>("itemChance")) + if (sigmod()->singlePlayer() && hasValueOfType<Sigmod::Fraction>("itemChance")) return valueOfType<Sigmod::Fraction>("itemChance"); return m_species->itemChance(); } @@ -178,7 +178,7 @@ Sigmod::Fraction Sigscript::SpeciesWrapper::genderFactor() const int Sigscript::SpeciesWrapper::eggSpecies() const { - if (hasValueOfType<int>("eggSpecies")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("eggSpecies")) return valueOfType<int>("eggSpecies"); return m_species->eggSpecies(); } diff --git a/sigscript/TileWrapper.cpp b/sigscript/TileWrapper.cpp index 3ef2525d..8417b003 100644 --- a/sigscript/TileWrapper.cpp +++ b/sigscript/TileWrapper.cpp @@ -42,7 +42,7 @@ QString Sigscript::TileWrapper::name() const Sigscript::SpriteWrapper* Sigscript::TileWrapper::sprite() { - if (hasValueOfType<QString>("sprite")) + if (sigmod()->singlePlayer() && hasValueOfType<QString>("sprite")) { SpriteWrapper* sprite = sigmod()->sprite(valueOfType<QString>("sprite")); if (sprite && sprite->sprite().size() == QSize(64, 64)) @@ -53,7 +53,7 @@ Sigscript::SpriteWrapper* Sigscript::TileWrapper::sprite() bool Sigscript::TileWrapper::from(const Sigmod::Direction direction) const { - if (hasValueOfType<bool>(QString("direction-%1").arg(direction))) + if (sigmod()->singlePlayer() && hasValueOfType<bool>(QString("direction-%1").arg(direction))) return valueOfType<bool>(QString("direction-%1").arg(direction)); return m_tile->from(direction); } diff --git a/sigscript/TrainerWrapper.cpp b/sigscript/TrainerWrapper.cpp index bc937058..47f27505 100644 --- a/sigscript/TrainerWrapper.cpp +++ b/sigscript/TrainerWrapper.cpp @@ -54,7 +54,7 @@ QString Sigscript::TrainerWrapper::TrainerWrapper::name() const int Sigscript::TrainerWrapper::TrainerWrapper::moneyFactor() const { - if (hasValueOfType<int>("moneyFactor")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("moneyFactor")) return valueOfType<int>("moneyFactor"); return m_trainer->moneyFactor(); } @@ -66,7 +66,7 @@ Sigscript::SkinWrapper* Sigscript::TrainerWrapper::TrainerWrapper::skin() int Sigscript::TrainerWrapper::TrainerWrapper::depth() const { - if (hasValueOfType<int>("depth")) + if (sigmod()->singlePlayer() && hasValueOfType<int>("depth")) return valueOfType<int>("depth"); return m_trainer->depth(); } |
