diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 16:18:17 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 16:18:17 -0500 |
| commit | b28b0cb3d52336f77b7ad8b313b3d6fd6b7d0e67 (patch) | |
| tree | 01971661209ccb6d6844a096a5ea3d39baeabe68 /sigscript/GameWrapper.cpp | |
| parent | b6d07f0ca14256a42268e69190891c56bf978bd4 (diff) | |
| download | sigen-b28b0cb3d52336f77b7ad8b313b3d6fd6b7d0e67.tar.gz sigen-b28b0cb3d52336f77b7ad8b313b3d6fd6b7d0e67.tar.xz sigen-b28b0cb3d52336f77b7ad8b313b3d6fd6b7d0e67.zip | |
Moved SigmodWrapper to GameWrapper
Diffstat (limited to 'sigscript/GameWrapper.cpp')
| -rw-r--r-- | sigscript/GameWrapper.cpp | 485 |
1 files changed, 485 insertions, 0 deletions
diff --git a/sigscript/GameWrapper.cpp b/sigscript/GameWrapper.cpp new file mode 100644 index 00000000..39e51f17 --- /dev/null +++ b/sigscript/GameWrapper.cpp @@ -0,0 +1,485 @@ +/* + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "SigmodWrapper.h" + +// Sigscript includes +#include "AbilityWrapper.h" +#include "AuthorWrapper.h" +#include "BadgeWrapper.h" +#include "CoinListWrapper.h" +#include "EggGroupWrapper.h" +#include "GlobalScriptWrapper.h" +#include "ItemWrapper.h" +#include "ItemTypeWrapper.h" +#include "MapWrapper.h" +#include "MapWarpWrapper.h" +#include "MoveWrapper.h" +#include "NatureWrapper.h" +#include "RulesWrapper.h" +#include "SkinWrapper.h" +#include "SoundWrapper.h" +#include "SpeciesWrapper.h" +#include "SpriteWrapper.h" +#include "StatusWrapper.h" +#include "StoreWrapper.h" +#include "TileWrapper.h" +#include "TimeWrapper.h" +#include "TrainerWrapper.h" +#include "TypeWrapper.h" +#include "WeatherWrapper.h" + +// Sigmod includes +#include <sigmod/Ability.h> +#include <sigmod/Author.h> +#include <sigmod/Badge.h> +#include <sigmod/CoinList.h> +#include <sigmod/EggGroup.h> +#include <sigmod/GlobalScript.h> +#include <sigmod/Item.h> +#include <sigmod/Move.h> +#include <sigmod/Nature.h> +#include <sigmod/Sigmod.h> +#include <sigmod/Store.h> +#include <sigmod/Skin.h> +#include <sigmod/Sprite.h> +#include <sigmod/Status.h> +#include <sigmod/Tile.h> +#include <sigmod/Time.h> +#include <sigmod/Type.h> +#include <sigmod/Weather.h> + +Sigscript::SigmodWrapper::SigmodWrapper(const Sigmod::Sigmod* sigmod) : + ObjectWrapper(sigmod, NULL), + m_sigmod(sigmod) +{ +} + +Sigcore::Hat<Sigscript::NatureWrapper*> Sigscript::SigmodWrapper::natureHat() +{ + Sigcore::Hat<NatureWrapper*> hat; + for (int i = 0; i < m_sigmod->natureCount(); ++i) + { + NatureWrapper* nature = NatureWrapper::create(m_sigmod->nature(i), this); + hat.add(nature, nature->weight()); + } + return hat; +} + +Sigscript::AbilityWrapper* Sigscript::SigmodWrapper::ability(const int id) +{ + return AbilityWrapper::create(m_sigmod->abilityById(id), this); +} + +Sigscript::AuthorWrapper* Sigscript::SigmodWrapper::author(const int id) +{ + return AuthorWrapper::create(m_sigmod->authorById(id), this); +} + +Sigscript::BadgeWrapper* Sigscript::SigmodWrapper::badge(const int id) +{ + return BadgeWrapper::create(m_sigmod->badgeById(id), this); +} + +Sigscript::CoinListWrapper* Sigscript::SigmodWrapper::coinList(const int id) +{ + return CoinListWrapper::create(m_sigmod->coinListById(id), this); +} + +Sigscript::EggGroupWrapper* Sigscript::SigmodWrapper::eggGroup(const int id) +{ + return EggGroupWrapper::create(m_sigmod->eggGroupById(id), this); +} + +Sigscript::GlobalScriptWrapper* Sigscript::SigmodWrapper::globalScript(const int id) +{ + return GlobalScriptWrapper::create(m_sigmod->globalScriptById(id), this); +} + +Sigscript::ItemWrapper* Sigscript::SigmodWrapper::item(const int id) +{ + return ItemWrapper::create(m_sigmod->itemById(id), this); +} + +Sigscript::ItemTypeWrapper* Sigscript::SigmodWrapper::itemType(const int id) +{ + return ItemTypeWrapper::create(m_sigmod->itemTypeById(id), this); +} + +Sigscript::MapWrapper* Sigscript::SigmodWrapper::map(const int id) +{ + return MapWrapper::create(m_sigmod->mapById(id), this); +} + +Sigscript::MoveWrapper* Sigscript::SigmodWrapper::move(const int id) +{ + return MoveWrapper::create(m_sigmod->moveById(id), this); +} + +Sigscript::NatureWrapper* Sigscript::SigmodWrapper::nature(const int id) +{ + return NatureWrapper::create(m_sigmod->natureById(id), this); +} + +Sigscript::SkinWrapper* Sigscript::SigmodWrapper::skin(const int id) +{ + return SkinWrapper::create(m_sigmod->skinById(id), this); +} + +Sigscript::SoundWrapper* Sigscript::SigmodWrapper::sound(const int id) +{ + return SoundWrapper::create(m_sigmod->soundById(id), this); +} + +Sigscript::SpeciesWrapper* Sigscript::SigmodWrapper::species(const int id) +{ + return SpeciesWrapper::create(m_sigmod->speciesById(id), this); +} + +Sigscript::SpriteWrapper* Sigscript::SigmodWrapper::sprite(const int id) +{ + return SpriteWrapper::create(m_sigmod->spriteById(id), this); +} + +Sigscript::StatusWrapper* Sigscript::SigmodWrapper::status(const int id) +{ + return StatusWrapper::create(m_sigmod->statusById(id), this); +} + +Sigscript::StoreWrapper* Sigscript::SigmodWrapper::store(const int id) +{ + return StoreWrapper::create(m_sigmod->storeById(id), this); +} + +Sigscript::TileWrapper* Sigscript::SigmodWrapper::tile(const int id) +{ + return TileWrapper::create(m_sigmod->tileById(id), this); +} + +Sigscript::TimeWrapper* Sigscript::SigmodWrapper::time(const int id) +{ + return TimeWrapper::create(m_sigmod->timeById(id), this); +} + +Sigscript::TrainerWrapper* Sigscript::SigmodWrapper::trainer(const int id) +{ + return TrainerWrapper::create(m_sigmod->trainerById(id), this); +} + +Sigscript::TypeWrapper* Sigscript::SigmodWrapper::type(const int id) +{ + return TypeWrapper::create(m_sigmod->typeById(id), this); +} + +Sigscript::WeatherWrapper* Sigscript::SigmodWrapper::weather(const int id) +{ + return WeatherWrapper::create(m_sigmod->weatherById(id), this); +} + +Sigmod::Stat Sigscript::SigmodWrapper::stat(const QString& name) const +{ + if (name == "HP") + return Sigmod::ST_HP; + else if (name == "Attack") + return Sigmod::ST_Attack; + else if (name == "Defense") + return Sigmod::ST_Defense; + else if (name == "Speed") + return Sigmod::ST_Speed; + else if (name == "Special") + return Sigmod::ST_Special; + else if (name == "Special Attack") + return Sigmod::ST_SpecialAttack; + else if (name == "Special Defense") + return Sigmod::ST_SpecialAttack; + else if (name == "Accuracy") + return Sigmod::ST_Accuracy; + else if (name == "Evasion") + return Sigmod::ST_Evasion; + return QVariant(-1).value<Sigmod::Stat>(); +} + +Sigmod::Direction Sigscript::SigmodWrapper::direction(const QString& name) const +{ + if (name == "Up") + return Sigmod::D_Up; + else if (name == "Down") + return Sigmod::D_Down; + else if (name == "Left") + return Sigmod::D_Left; + else if (name == "Right") + return Sigmod::D_Right; + else if (name == "None") + return Sigmod::D_None; + return QVariant(-1).value<Sigmod::Direction>(); +} + +QString Sigscript::SigmodWrapper::title() const +{ + return m_sigmod->title(); +} + +QString Sigscript::SigmodWrapper::version() const +{ + return m_sigmod->version(); +} + +QString Sigscript::SigmodWrapper::description() const +{ + return m_sigmod->description(); +} + +bool Sigscript::SigmodWrapper::singlePlayer() const +{ + return m_sigmod->singlePlayer(); +} + +Sigcore::Script Sigscript::SigmodWrapper::startScript() +{ + return m_sigmod->startScript(); +} + +Sigcore::Fraction Sigscript::SigmodWrapper::effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const +{ + return m_sigmod->typechart(m_sigmod->typeIndex(attacker->id()), m_sigmod->typeIndex(defender->id())); +} + +Sigscript::RulesWrapper* Sigscript::SigmodWrapper::rules() +{ + return RulesWrapper::create(m_sigmod->rules(), this); +} + +Sigscript::AbilityWrapper* Sigscript::SigmodWrapper::ability(const QString& name) +{ + for (int i = 0; i < m_sigmod->abilityCount(); ++i) + { + if (m_sigmod->ability(i)->name() == name) + return AbilityWrapper::create(m_sigmod->ability(i), this); + } + return NULL; +} + +Sigscript::AuthorWrapper* Sigscript::SigmodWrapper::author(const QString& name) +{ + for (int i = 0; i < m_sigmod->authorCount(); ++i) + { + if (m_sigmod->author(i)->name() == name) + return AuthorWrapper::create(m_sigmod->author(i), this); + } + return NULL; +} + +Sigscript::BadgeWrapper* Sigscript::SigmodWrapper::badge(const QString& name) +{ + for (int i = 0; i < m_sigmod->badgeCount(); ++i) + { + if (m_sigmod->badge(i)->name() == name) + return BadgeWrapper::create(m_sigmod->badge(i), this); + } + return NULL; +} + +Sigscript::CoinListWrapper* Sigscript::SigmodWrapper::coinList(const QString& name) +{ + for (int i = 0; i < m_sigmod->coinListCount(); ++i) + { + if (m_sigmod->coinList(i)->name() == name) + return CoinListWrapper::create(m_sigmod->coinList(i), this); + } + return NULL; +} + +Sigscript::EggGroupWrapper* Sigscript::SigmodWrapper::eggGroup(const QString& name) +{ + for (int i = 0; i < m_sigmod->eggGroupCount(); ++i) + { + if (m_sigmod->eggGroup(i)->name() == name) + return EggGroupWrapper::create(m_sigmod->eggGroup(i), this); + } + return NULL; +} + +Sigscript::GlobalScriptWrapper* Sigscript::SigmodWrapper::globalScript(const QString& name) +{ + for (int i = 0; i < m_sigmod->globalScriptCount(); ++i) + { + if (m_sigmod->globalScript(i)->name() == name) + return GlobalScriptWrapper::create(m_sigmod->globalScript(i), this); + } + return NULL; +} + +Sigscript::ItemWrapper* Sigscript::SigmodWrapper::item(const QString& name) +{ + for (int i = 0; i < m_sigmod->itemCount(); ++i) + { + if (m_sigmod->item(i)->name() == name) + return ItemWrapper::create(m_sigmod->item(i), this); + } + return NULL; +} + +Sigscript::ItemTypeWrapper* Sigscript::SigmodWrapper::itemType(const QString& name) +{ + for (int i = 0; i < m_sigmod->itemTypeCount(); ++i) + { + if (m_sigmod->itemType(i)->name() == name) + return ItemTypeWrapper::create(m_sigmod->itemType(i), this); + } + return NULL; +} + +Sigscript::MapWrapper* Sigscript::SigmodWrapper::map(const QString& name) +{ + for (int i = 0; i < m_sigmod->mapCount(); ++i) + { + if (m_sigmod->map(i)->name() == name) + return MapWrapper::create(m_sigmod->map(i), this); + } + return NULL; +} + +Sigscript::MoveWrapper* Sigscript::SigmodWrapper::move(const QString& name) +{ + for (int i = 0; i < m_sigmod->moveCount(); ++i) + { + if (m_sigmod->move(i)->name() == name) + return MoveWrapper::create(m_sigmod->move(i), this); + } + return NULL; +} + +Sigscript::NatureWrapper* Sigscript::SigmodWrapper::nature(const QString& name) +{ + for (int i = 0; i < m_sigmod->natureCount(); ++i) + { + if (m_sigmod->nature(i)->name() == name) + return NatureWrapper::create(m_sigmod->nature(i), this); + } + return NULL; +} + +Sigscript::SkinWrapper* Sigscript::SigmodWrapper::skin(const QString& name) +{ + for (int i = 0; i < m_sigmod->skinCount(); ++i) + { + if (m_sigmod->skin(i)->name() == name) + return SkinWrapper::create(m_sigmod->skin(i), this); + } + return NULL; +} + +Sigscript::SoundWrapper* Sigscript::SigmodWrapper::sound(const QString& name) +{ + for (int i = 0; i < m_sigmod->soundCount(); ++i) + { + if (m_sigmod->sound(i)->name() == name) + return SoundWrapper::create(m_sigmod->sound(i), this); + } + return NULL; +} + +Sigscript::SpeciesWrapper* Sigscript::SigmodWrapper::species(const QString& name) +{ + for (int i = 0; i < m_sigmod->speciesCount(); ++i) + { + if (m_sigmod->species(i)->name() == name) + return SpeciesWrapper::create(m_sigmod->species(i), this); + } + return NULL; +} + +Sigscript::SpriteWrapper* Sigscript::SigmodWrapper::sprite(const QString& name) +{ + for (int i = 0; i < m_sigmod->spriteCount(); ++i) + { + if (m_sigmod->sprite(i)->name() == name) + return SpriteWrapper::create(m_sigmod->sprite(i), this); + } + return NULL; +} + +Sigscript::StatusWrapper* Sigscript::SigmodWrapper::status(const QString& name) +{ + for (int i = 0; i < m_sigmod->statusCount(); ++i) + { + if (m_sigmod->status(i)->name() == name) + return StatusWrapper::create(m_sigmod->status(i), this); + } + return NULL; +} + +Sigscript::StoreWrapper* Sigscript::SigmodWrapper::store(const QString& name) +{ + for (int i = 0; i < m_sigmod->storeCount(); ++i) + { + if (m_sigmod->store(i)->name() == name) + return StoreWrapper::create(m_sigmod->store(i), this); + } + return NULL; +} + +Sigscript::TileWrapper* Sigscript::SigmodWrapper::tile(const QString& name) +{ + for (int i = 0; i < m_sigmod->tileCount(); ++i) + { + if (m_sigmod->tile(i)->name() == name) + return TileWrapper::create(m_sigmod->tile(i), this); + } + return NULL; +} + +Sigscript::TimeWrapper* Sigscript::SigmodWrapper::time(const QString& name) +{ + for (int i = 0; i < m_sigmod->timeCount(); ++i) + { + if (m_sigmod->time(i)->name() == name) + return TimeWrapper::create(m_sigmod->time(i), this); + } + return NULL; +} + +Sigscript::TrainerWrapper* Sigscript::SigmodWrapper::trainer(const QString& name) +{ + for (int i = 0; i < m_sigmod->trainerCount(); ++i) + { + if (m_sigmod->trainer(i)->name() == name) + return TrainerWrapper::create(m_sigmod->trainer(i), this); + } + return NULL; +} + +Sigscript::TypeWrapper* Sigscript::SigmodWrapper::type(const QString& name) +{ + for (int i = 0; i < m_sigmod->typeCount(); ++i) + { + if (m_sigmod->type(i)->name() == name) + return TypeWrapper::create(m_sigmod->type(i), this); + } + return NULL; +} + +Sigscript::WeatherWrapper* Sigscript::SigmodWrapper::weather(const QString& name) +{ + for (int i = 0; i < m_sigmod->weatherCount(); ++i) + { + if (m_sigmod->weather(i)->name() == name) + return WeatherWrapper::create(m_sigmod->weather(i), this); + } + return NULL; +} |
