From 2c0a3866e09140d8d5ff84178decddc22db15778 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 6 Oct 2008 00:50:02 +0000 Subject: [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 --- sigscript/AbilityWrapper.cpp | 2 +- sigscript/CoinListObjectWrapper.cpp | 4 ++-- sigscript/ItemTypeWrapper.cpp | 2 +- sigscript/ItemWrapper.cpp | 4 ++-- sigscript/MapEffectWrapper.cpp | 4 ++-- sigscript/MapTrainerTeamMemberWrapper.cpp | 2 +- sigscript/MapWarpWrapper.cpp | 2 +- sigscript/MapWildListEncounterWrapper.cpp | 4 ++-- sigscript/MoveWrapper.cpp | 6 +++--- sigscript/RulesWrapper.cpp | 30 +++++++++++++++--------------- sigscript/SigmodWrapper.cpp | 5 +++++ sigscript/SigmodWrapper.h | 1 + sigscript/SpeciesItemWrapper.cpp | 2 +- sigscript/SpeciesWrapper.cpp | 8 ++++---- sigscript/TileWrapper.cpp | 4 ++-- sigscript/TrainerWrapper.cpp | 4 ++-- 16 files changed, 45 insertions(+), 39 deletions(-) (limited to 'sigscript') 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("priority")) + if (sigmod()->singlePlayer() && hasValueOfType("priority")) return valueOfType("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("amount")) + if (sigmod()->singlePlayer() && hasValueOfType("amount")) return valueOfType("amount"); return m_object->amount(); } int Sigscript::CoinListObjectWrapper::cost() const { - if (hasValueOfType("cost")) + if (sigmod()->singlePlayer() && hasValueOfType("cost")) return valueOfType("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("maxWeight")) + if (sigmod()->singlePlayer() && hasValueOfType("maxWeight")) return valueOfType("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("price")) + if (sigmod()->singlePlayer() && hasValueOfType("price")) return valueOfType("price"); return m_item->price(); } int Sigscript::ItemWrapper::sellPrice() const { - if (hasValueOfType("sellPrice")) + if (sigmod()->singlePlayer() && hasValueOfType("sellPrice")) return valueOfType("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("coordinate")) + if (sigmod()->singlePlayer() && hasValueOfType("coordinate")) return valueOfType("coordinate"); return m_effect->coordinate(); } @@ -54,7 +54,7 @@ Sigscript::SkinWrapper* Sigscript::MapEffectWrapper::skin() bool Sigscript::MapEffectWrapper::isGhost() const { - if (hasValueOfType("ghost")) + if (sigmod()->singlePlayer() && hasValueOfType("ghost")) return valueOfType("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("level")) + if (sigmod()->singlePlayer() && hasValueOfType("level")) return valueOfType("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("coordinate")) + if (sigmod()->singlePlayer() && hasValueOfType("coordinate")) return valueOfType("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("level")) + if (sigmod()->singlePlayer() && hasValueOfType("level")) return valueOfType("level"); return m_encounter->level(); } int Sigscript::MapWildListEncounterWrapper::weight() const { - if (hasValueOfType("weight")) + if (sigmod()->singlePlayer() && hasValueOfType("weight")) return valueOfType("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("accuracy")) + if (sigmod()->singlePlayer() && hasValueOfType("accuracy")) return valueOfType("accuracy"); return m_move->accuracy(); } int Sigscript::MoveWrapper::power() const { - if (hasValueOfType("power")) + if (sigmod()->singlePlayer() && hasValueOfType("power")) return valueOfType("power"); return m_move->power(); } @@ -70,7 +70,7 @@ int Sigscript::MoveWrapper::powerPoints() const int Sigscript::MoveWrapper::priority() const { - if (hasValueOfType("priority")) + if (sigmod()->singlePlayer() && hasValueOfType("priority")) return valueOfType("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("pausedATB")) + if (sigmod()->singlePlayer() && hasValueOfType("pausedATB")) return valueOfType("pausedATB"); return m_rules->pausedATB(); } int Sigscript::RulesWrapper::numBoxes() const { - if (hasValueOfType("numBoxes")) + if (sigmod()->singlePlayer() && hasValueOfType("numBoxes")) return valueOfType("numBoxes"); return m_rules->numBoxes(); } int Sigscript::RulesWrapper::boxSize() const { - if (hasValueOfType("boxSize")) + if (sigmod()->singlePlayer() && hasValueOfType("boxSize")) return valueOfType("boxSize"); return m_rules->boxSize(); } int Sigscript::RulesWrapper::maxParty() const { - if (hasValueOfType("maxParty")) + if (sigmod()->singlePlayer() && hasValueOfType("maxParty")) return valueOfType("maxParty"); return m_rules->maxParty(); } int Sigscript::RulesWrapper::maxFight() const { - if (hasValueOfType("maxFight")) + if (sigmod()->singlePlayer() && hasValueOfType("maxFight")) return valueOfType("maxFight"); return m_rules->maxFight(); } int Sigscript::RulesWrapper::maxPlayers() const { - if (hasValueOfType("maxFight")) + if (sigmod()->singlePlayer() && hasValueOfType("maxFight")) return valueOfType("maxFight"); return m_rules->maxPlayers(); } int Sigscript::RulesWrapper::maxHeldItems() const { - if (hasValueOfType("maxHeldItems")) + if (sigmod()->singlePlayer() && hasValueOfType("maxHeldItems")) return valueOfType("maxHeldItems"); return m_rules->maxHeldItems(); } @@ -115,35 +115,35 @@ int Sigscript::RulesWrapper::maxNatures() const int Sigscript::RulesWrapper::maxMoves() const { - if (hasValueOfType("maxMoves")) + if (sigmod()->singlePlayer() && hasValueOfType("maxMoves")) return valueOfType("maxMoves"); return m_rules->maxMoves(); } int Sigscript::RulesWrapper::maxLevel() const { - if (hasValueOfType("maxLevel")) + if (sigmod()->singlePlayer() && hasValueOfType("maxLevel")) return valueOfType("maxLevel"); return m_rules->maxLevel(); } int Sigscript::RulesWrapper::maxStages() const { - if (hasValueOfType("maxStages")) + if (sigmod()->singlePlayer() && hasValueOfType("maxStages")) return valueOfType("maxStages"); return m_rules->maxStages(); } int Sigscript::RulesWrapper::maxMoney() const { - if (hasValueOfType("maxMoney")) + if (sigmod()->singlePlayer() && hasValueOfType("maxMoney")) return valueOfType("maxMoney"); return m_rules->maxMoney(); } int Sigscript::RulesWrapper::maxTotalWeight() const { - if (hasValueOfType("maxTotalWeight")) + if (sigmod()->singlePlayer() && hasValueOfType("maxTotalWeight")) return valueOfType("maxTotalWeight"); return m_rules->maxTotalWeight(); } @@ -155,7 +155,7 @@ bool Sigscript::RulesWrapper::hardCash() const bool Sigscript::RulesWrapper::allowSwitchStyle() const { - if (hasValueOfType("allowSwitchStyle")) + if (sigmod()->singlePlayer() && hasValueOfType("allowSwitchStyle")) return valueOfType("allowSwitchStyle"); return m_rules->allowSwitchStyle(); } @@ -177,14 +177,14 @@ bool Sigscript::RulesWrapper::effortValuesAllowed() const int Sigscript::RulesWrapper::maxTotalEV() const { - if (hasValueOfType("maxTotalEV")) + if (sigmod()->singlePlayer() && hasValueOfType("maxTotalEV")) return valueOfType("maxTotalEV"); return m_rules->maxTotalEV(); } int Sigscript::RulesWrapper::maxEVPerStat() const { - if (hasValueOfType("maxEVPerStat")) + if (sigmod()->singlePlayer() && hasValueOfType("maxEVPerStat")) return valueOfType("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("weight")) + if (sigmod()->singlePlayer() && hasValueOfType("weight")) return valueOfType("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("runChance")) + if (sigmod()->singlePlayer() && hasValueOfType("runChance")) return valueOfType("runChance"); return m_species->runChance(); } Sigmod::Fraction Sigscript::SpeciesWrapper::fleeChance() const { - if (hasValueOfType("fleeChance")) + if (sigmod()->singlePlayer() && hasValueOfType("fleeChance")) return valueOfType("fleeChance"); return m_species->fleeChance(); } Sigmod::Fraction Sigscript::SpeciesWrapper::itemChance() const { - if (hasValueOfType("itemChance")) + if (sigmod()->singlePlayer() && hasValueOfType("itemChance")) return valueOfType("itemChance"); return m_species->itemChance(); } @@ -178,7 +178,7 @@ Sigmod::Fraction Sigscript::SpeciesWrapper::genderFactor() const int Sigscript::SpeciesWrapper::eggSpecies() const { - if (hasValueOfType("eggSpecies")) + if (sigmod()->singlePlayer() && hasValueOfType("eggSpecies")) return valueOfType("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("sprite")) + if (sigmod()->singlePlayer() && hasValueOfType("sprite")) { SpriteWrapper* sprite = sigmod()->sprite(valueOfType("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(QString("direction-%1").arg(direction))) + if (sigmod()->singlePlayer() && hasValueOfType(QString("direction-%1").arg(direction))) return valueOfType(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("moneyFactor")) + if (sigmod()->singlePlayer() && hasValueOfType("moneyFactor")) return valueOfType("moneyFactor"); return m_trainer->moneyFactor(); } @@ -66,7 +66,7 @@ Sigscript::SkinWrapper* Sigscript::TrainerWrapper::TrainerWrapper::skin() int Sigscript::TrainerWrapper::TrainerWrapper::depth() const { - if (hasValueOfType("depth")) + if (sigmod()->singlePlayer() && hasValueOfType("depth")) return valueOfType("depth"); return m_trainer->depth(); } -- cgit