diff options
Diffstat (limited to 'sigscript/GameWrapper.cpp')
| -rw-r--r-- | sigscript/GameWrapper.cpp | 148 |
1 files changed, 76 insertions, 72 deletions
diff --git a/sigscript/GameWrapper.cpp b/sigscript/GameWrapper.cpp index 695212bf..d93aee86 100644 --- a/sigscript/GameWrapper.cpp +++ b/sigscript/GameWrapper.cpp @@ -64,15 +64,19 @@ #include <sigmod/Type.h> #include <sigmod/Weather.h> -Sigscript::GameWrapper::GameWrapper(const Sigmod::Game* game) : +using namespace Sigcore; +using namespace Sigmod; +using namespace Sigscript; + +GameWrapper::GameWrapper(const Game* game) : ObjectWrapper(game, NULL), m_game(game) { } -Sigcore::Hat<Sigscript::NatureWrapper*> Sigscript::GameWrapper::natureHat() +Hat<NatureWrapper*> GameWrapper::natureHat() { - Sigcore::Hat<NatureWrapper*> hat; + Hat<NatureWrapper*> hat; for (int i = 0; i < m_game->natureCount(); ++i) { NatureWrapper* nature = NatureWrapper::create(m_game->nature(i), this); @@ -81,190 +85,190 @@ Sigcore::Hat<Sigscript::NatureWrapper*> Sigscript::GameWrapper::natureHat() return hat; } -Sigscript::AbilityWrapper* Sigscript::GameWrapper::ability(const int id) +AbilityWrapper* GameWrapper::ability(const int id) { return AbilityWrapper::create(m_game->abilityById(id), this); } -Sigscript::AuthorWrapper* Sigscript::GameWrapper::author(const int id) +AuthorWrapper* GameWrapper::author(const int id) { return AuthorWrapper::create(m_game->authorById(id), this); } -Sigscript::BadgeWrapper* Sigscript::GameWrapper::badge(const int id) +BadgeWrapper* GameWrapper::badge(const int id) { return BadgeWrapper::create(m_game->badgeById(id), this); } -Sigscript::CoinListWrapper* Sigscript::GameWrapper::coinList(const int id) +CoinListWrapper* GameWrapper::coinList(const int id) { return CoinListWrapper::create(m_game->coinListById(id), this); } -Sigscript::EggGroupWrapper* Sigscript::GameWrapper::eggGroup(const int id) +EggGroupWrapper* GameWrapper::eggGroup(const int id) { return EggGroupWrapper::create(m_game->eggGroupById(id), this); } -Sigscript::GlobalScriptWrapper* Sigscript::GameWrapper::globalScript(const int id) +GlobalScriptWrapper* GameWrapper::globalScript(const int id) { return GlobalScriptWrapper::create(m_game->globalScriptById(id), this); } -Sigscript::ItemWrapper* Sigscript::GameWrapper::item(const int id) +ItemWrapper* GameWrapper::item(const int id) { return ItemWrapper::create(m_game->itemById(id), this); } -Sigscript::ItemTypeWrapper* Sigscript::GameWrapper::itemType(const int id) +ItemTypeWrapper* GameWrapper::itemType(const int id) { return ItemTypeWrapper::create(m_game->itemTypeById(id), this); } -Sigscript::MapWrapper* Sigscript::GameWrapper::map(const int id) +MapWrapper* GameWrapper::map(const int id) { return MapWrapper::create(m_game->mapById(id), this); } -Sigscript::MoveWrapper* Sigscript::GameWrapper::move(const int id) +MoveWrapper* GameWrapper::move(const int id) { return MoveWrapper::create(m_game->moveById(id), this); } -Sigscript::NatureWrapper* Sigscript::GameWrapper::nature(const int id) +NatureWrapper* GameWrapper::nature(const int id) { return NatureWrapper::create(m_game->natureById(id), this); } -Sigscript::SkinWrapper* Sigscript::GameWrapper::skin(const int id) +SkinWrapper* GameWrapper::skin(const int id) { return SkinWrapper::create(m_game->skinById(id), this); } -Sigscript::SoundWrapper* Sigscript::GameWrapper::sound(const int id) +SoundWrapper* GameWrapper::sound(const int id) { return SoundWrapper::create(m_game->soundById(id), this); } -Sigscript::SpeciesWrapper* Sigscript::GameWrapper::species(const int id) +SpeciesWrapper* GameWrapper::species(const int id) { return SpeciesWrapper::create(m_game->speciesById(id), this); } -Sigscript::SpriteWrapper* Sigscript::GameWrapper::sprite(const int id) +SpriteWrapper* GameWrapper::sprite(const int id) { return SpriteWrapper::create(m_game->spriteById(id), this); } -Sigscript::StatusWrapper* Sigscript::GameWrapper::status(const int id) +StatusWrapper* GameWrapper::status(const int id) { return StatusWrapper::create(m_game->statusById(id), this); } -Sigscript::StoreWrapper* Sigscript::GameWrapper::store(const int id) +StoreWrapper* GameWrapper::store(const int id) { return StoreWrapper::create(m_game->storeById(id), this); } -Sigscript::TileWrapper* Sigscript::GameWrapper::tile(const int id) +TileWrapper* GameWrapper::tile(const int id) { return TileWrapper::create(m_game->tileById(id), this); } -Sigscript::TimeWrapper* Sigscript::GameWrapper::time(const int id) +TimeWrapper* GameWrapper::time(const int id) { return TimeWrapper::create(m_game->timeById(id), this); } -Sigscript::TrainerWrapper* Sigscript::GameWrapper::trainer(const int id) +TrainerWrapper* GameWrapper::trainer(const int id) { return TrainerWrapper::create(m_game->trainerById(id), this); } -Sigscript::TypeWrapper* Sigscript::GameWrapper::type(const int id) +TypeWrapper* GameWrapper::type(const int id) { return TypeWrapper::create(m_game->typeById(id), this); } -Sigscript::WeatherWrapper* Sigscript::GameWrapper::weather(const int id) +WeatherWrapper* GameWrapper::weather(const int id) { return WeatherWrapper::create(m_game->weatherById(id), this); } -Sigmod::Stat Sigscript::GameWrapper::stat(const QString& name) const +Stat GameWrapper::stat(const QString& name) const { if (name == "HP") - return Sigmod::ST_HP; + return ST_HP; else if (name == "Attack") - return Sigmod::ST_Attack; + return ST_Attack; else if (name == "Defense") - return Sigmod::ST_Defense; + return ST_Defense; else if (name == "Speed") - return Sigmod::ST_Speed; + return ST_Speed; else if (name == "Special") - return Sigmod::ST_Special; + return ST_Special; else if (name == "Special Attack") - return Sigmod::ST_SpecialAttack; + return ST_SpecialAttack; else if (name == "Special Defense") - return Sigmod::ST_SpecialAttack; + return ST_SpecialAttack; else if (name == "Accuracy") - return Sigmod::ST_Accuracy; + return ST_Accuracy; else if (name == "Evasion") - return Sigmod::ST_Evasion; - return QVariant(-1).value<Sigmod::Stat>(); + return ST_Evasion; + return QVariant(-1).value<Stat>(); } -Sigmod::Direction Sigscript::GameWrapper::direction(const QString& name) const +Direction GameWrapper::direction(const QString& name) const { if (name == "Up") - return Sigmod::D_Up; + return D_Up; else if (name == "Down") - return Sigmod::D_Down; + return D_Down; else if (name == "Left") - return Sigmod::D_Left; + return D_Left; else if (name == "Right") - return Sigmod::D_Right; + return D_Right; else if (name == "None") - return Sigmod::D_None; - return QVariant(-1).value<Sigmod::Direction>(); + return D_None; + return QVariant(-1).value<Direction>(); } -QString Sigscript::GameWrapper::title() const +QString GameWrapper::title() const { return m_game->title(); } -QString Sigscript::GameWrapper::version() const +QString GameWrapper::version() const { return m_game->version(); } -QString Sigscript::GameWrapper::description() const +QString GameWrapper::description() const { return m_game->description(); } -bool Sigscript::GameWrapper::singlePlayer() const +bool GameWrapper::singlePlayer() const { return m_game->singlePlayer(); } -Sigcore::Script Sigscript::GameWrapper::startScript() +Script GameWrapper::startScript() { return m_game->startScript(); } -Sigcore::Fraction Sigscript::GameWrapper::effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const +Fraction GameWrapper::effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const { return m_game->typechart(m_game->typeIndex(attacker->id()), m_game->typeIndex(defender->id())); } -Sigscript::RulesWrapper* Sigscript::GameWrapper::rules() +RulesWrapper* GameWrapper::rules() { return RulesWrapper::create(m_game->rules(), this); } -Sigscript::AbilityWrapper* Sigscript::GameWrapper::ability(const QString& name) +AbilityWrapper* GameWrapper::ability(const QString& name) { for (int i = 0; i < m_game->abilityCount(); ++i) { @@ -274,7 +278,7 @@ Sigscript::AbilityWrapper* Sigscript::GameWrapper::ability(const QString& name) return NULL; } -Sigscript::AuthorWrapper* Sigscript::GameWrapper::author(const QString& name) +AuthorWrapper* GameWrapper::author(const QString& name) { for (int i = 0; i < m_game->authorCount(); ++i) { @@ -284,7 +288,7 @@ Sigscript::AuthorWrapper* Sigscript::GameWrapper::author(const QString& name) return NULL; } -Sigscript::BadgeWrapper* Sigscript::GameWrapper::badge(const QString& name) +BadgeWrapper* GameWrapper::badge(const QString& name) { for (int i = 0; i < m_game->badgeCount(); ++i) { @@ -294,7 +298,7 @@ Sigscript::BadgeWrapper* Sigscript::GameWrapper::badge(const QString& name) return NULL; } -Sigscript::CoinListWrapper* Sigscript::GameWrapper::coinList(const QString& name) +CoinListWrapper* GameWrapper::coinList(const QString& name) { for (int i = 0; i < m_game->coinListCount(); ++i) { @@ -304,7 +308,7 @@ Sigscript::CoinListWrapper* Sigscript::GameWrapper::coinList(const QString& name return NULL; } -Sigscript::EggGroupWrapper* Sigscript::GameWrapper::eggGroup(const QString& name) +EggGroupWrapper* GameWrapper::eggGroup(const QString& name) { for (int i = 0; i < m_game->eggGroupCount(); ++i) { @@ -314,7 +318,7 @@ Sigscript::EggGroupWrapper* Sigscript::GameWrapper::eggGroup(const QString& name return NULL; } -Sigscript::GlobalScriptWrapper* Sigscript::GameWrapper::globalScript(const QString& name) +GlobalScriptWrapper* GameWrapper::globalScript(const QString& name) { for (int i = 0; i < m_game->globalScriptCount(); ++i) { @@ -324,7 +328,7 @@ Sigscript::GlobalScriptWrapper* Sigscript::GameWrapper::globalScript(const QStri return NULL; } -Sigscript::ItemWrapper* Sigscript::GameWrapper::item(const QString& name) +ItemWrapper* GameWrapper::item(const QString& name) { for (int i = 0; i < m_game->itemCount(); ++i) { @@ -334,7 +338,7 @@ Sigscript::ItemWrapper* Sigscript::GameWrapper::item(const QString& name) return NULL; } -Sigscript::ItemTypeWrapper* Sigscript::GameWrapper::itemType(const QString& name) +ItemTypeWrapper* GameWrapper::itemType(const QString& name) { for (int i = 0; i < m_game->itemTypeCount(); ++i) { @@ -344,7 +348,7 @@ Sigscript::ItemTypeWrapper* Sigscript::GameWrapper::itemType(const QString& name return NULL; } -Sigscript::MapWrapper* Sigscript::GameWrapper::map(const QString& name) +MapWrapper* GameWrapper::map(const QString& name) { for (int i = 0; i < m_game->mapCount(); ++i) { @@ -354,7 +358,7 @@ Sigscript::MapWrapper* Sigscript::GameWrapper::map(const QString& name) return NULL; } -Sigscript::MoveWrapper* Sigscript::GameWrapper::move(const QString& name) +MoveWrapper* GameWrapper::move(const QString& name) { for (int i = 0; i < m_game->moveCount(); ++i) { @@ -364,7 +368,7 @@ Sigscript::MoveWrapper* Sigscript::GameWrapper::move(const QString& name) return NULL; } -Sigscript::NatureWrapper* Sigscript::GameWrapper::nature(const QString& name) +NatureWrapper* GameWrapper::nature(const QString& name) { for (int i = 0; i < m_game->natureCount(); ++i) { @@ -374,7 +378,7 @@ Sigscript::NatureWrapper* Sigscript::GameWrapper::nature(const QString& name) return NULL; } -Sigscript::SkinWrapper* Sigscript::GameWrapper::skin(const QString& name) +SkinWrapper* GameWrapper::skin(const QString& name) { for (int i = 0; i < m_game->skinCount(); ++i) { @@ -384,7 +388,7 @@ Sigscript::SkinWrapper* Sigscript::GameWrapper::skin(const QString& name) return NULL; } -Sigscript::SoundWrapper* Sigscript::GameWrapper::sound(const QString& name) +SoundWrapper* GameWrapper::sound(const QString& name) { for (int i = 0; i < m_game->soundCount(); ++i) { @@ -394,7 +398,7 @@ Sigscript::SoundWrapper* Sigscript::GameWrapper::sound(const QString& name) return NULL; } -Sigscript::SpeciesWrapper* Sigscript::GameWrapper::species(const QString& name) +SpeciesWrapper* GameWrapper::species(const QString& name) { for (int i = 0; i < m_game->speciesCount(); ++i) { @@ -404,7 +408,7 @@ Sigscript::SpeciesWrapper* Sigscript::GameWrapper::species(const QString& name) return NULL; } -Sigscript::SpriteWrapper* Sigscript::GameWrapper::sprite(const QString& name) +SpriteWrapper* GameWrapper::sprite(const QString& name) { for (int i = 0; i < m_game->spriteCount(); ++i) { @@ -414,7 +418,7 @@ Sigscript::SpriteWrapper* Sigscript::GameWrapper::sprite(const QString& name) return NULL; } -Sigscript::StatusWrapper* Sigscript::GameWrapper::status(const QString& name) +StatusWrapper* GameWrapper::status(const QString& name) { for (int i = 0; i < m_game->statusCount(); ++i) { @@ -424,7 +428,7 @@ Sigscript::StatusWrapper* Sigscript::GameWrapper::status(const QString& name) return NULL; } -Sigscript::StoreWrapper* Sigscript::GameWrapper::store(const QString& name) +StoreWrapper* GameWrapper::store(const QString& name) { for (int i = 0; i < m_game->storeCount(); ++i) { @@ -434,7 +438,7 @@ Sigscript::StoreWrapper* Sigscript::GameWrapper::store(const QString& name) return NULL; } -Sigscript::TileWrapper* Sigscript::GameWrapper::tile(const QString& name) +TileWrapper* GameWrapper::tile(const QString& name) { for (int i = 0; i < m_game->tileCount(); ++i) { @@ -444,7 +448,7 @@ Sigscript::TileWrapper* Sigscript::GameWrapper::tile(const QString& name) return NULL; } -Sigscript::TimeWrapper* Sigscript::GameWrapper::time(const QString& name) +TimeWrapper* GameWrapper::time(const QString& name) { for (int i = 0; i < m_game->timeCount(); ++i) { @@ -454,7 +458,7 @@ Sigscript::TimeWrapper* Sigscript::GameWrapper::time(const QString& name) return NULL; } -Sigscript::TrainerWrapper* Sigscript::GameWrapper::trainer(const QString& name) +TrainerWrapper* GameWrapper::trainer(const QString& name) { for (int i = 0; i < m_game->trainerCount(); ++i) { @@ -464,7 +468,7 @@ Sigscript::TrainerWrapper* Sigscript::GameWrapper::trainer(const QString& name) return NULL; } -Sigscript::TypeWrapper* Sigscript::GameWrapper::type(const QString& name) +TypeWrapper* GameWrapper::type(const QString& name) { for (int i = 0; i < m_game->typeCount(); ++i) { @@ -474,7 +478,7 @@ Sigscript::TypeWrapper* Sigscript::GameWrapper::type(const QString& name) return NULL; } -Sigscript::WeatherWrapper* Sigscript::GameWrapper::weather(const QString& name) +WeatherWrapper* GameWrapper::weather(const QString& name) { for (int i = 0; i < m_game->weatherCount(); ++i) { |
