diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-09-05 20:41:05 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-09-05 20:41:05 +0000 |
| commit | b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7 (patch) | |
| tree | 6609f31b1635d948cf7a216c7fea72cfb3c905a0 /sigscript/PokemodWrapper.cpp | |
| parent | b99ffef4aa68dd5f0af64de9aec0f610e267d8cc (diff) | |
| download | sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.tar.gz sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.tar.xz sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.zip | |
[FIX] Moving stuff for the move to the new name, Sigma Game Engine (sigen for short)
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@249 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigscript/PokemodWrapper.cpp')
| -rw-r--r-- | sigscript/PokemodWrapper.cpp | 460 |
1 files changed, 460 insertions, 0 deletions
diff --git a/sigscript/PokemodWrapper.cpp b/sigscript/PokemodWrapper.cpp new file mode 100644 index 00000000..247fb409 --- /dev/null +++ b/sigscript/PokemodWrapper.cpp @@ -0,0 +1,460 @@ +/* + * Copyright 2008 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 "PokemodWrapper.h" + +// Pokescripting 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" + +Pokescripting::PokemodWrapper::PokemodWrapper(const Pokemod::Pokemod* pokemod) : + ObjectWrapper(pokemod, NULL), + m_pokemod(pokemod) +{ +} + +Pokemod::Hat<Pokescripting::NatureWrapper*> Pokescripting::PokemodWrapper::natureHat() +{ + Pokemod::Hat<NatureWrapper*> hat; + for (int i = 0; i < m_pokemod->natureCount(); ++i) + { + NatureWrapper* nature = NatureWrapper::create(m_pokemod->nature(i), this); + hat.add(nature, nature->weight()); + } + return hat; +} + +Pokescripting::AbilityWrapper* Pokescripting::PokemodWrapper::ability(const int id) +{ + return AbilityWrapper::create(m_pokemod->abilityById(id), this); +} + +Pokescripting::AuthorWrapper* Pokescripting::PokemodWrapper::author(const int id) +{ + return AuthorWrapper::create(m_pokemod->authorById(id), this); +} + +Pokescripting::BadgeWrapper* Pokescripting::PokemodWrapper::badge(const int id) +{ + return BadgeWrapper::create(m_pokemod->badgeById(id), this); +} + +Pokescripting::CoinListWrapper* Pokescripting::PokemodWrapper::coinList(const int id) +{ + return CoinListWrapper::create(m_pokemod->coinListById(id), this); +} + +Pokescripting::EggGroupWrapper* Pokescripting::PokemodWrapper::eggGroup(const int id) +{ + return EggGroupWrapper::create(m_pokemod->eggGroupById(id), this); +} + +Pokescripting::GlobalScriptWrapper* Pokescripting::PokemodWrapper::globalScript(const int id) +{ + return GlobalScriptWrapper::create(m_pokemod->globalScriptById(id), this); +} + +Pokescripting::ItemWrapper* Pokescripting::PokemodWrapper::item(const int id) +{ + return ItemWrapper::create(m_pokemod->itemById(id), this); +} + +Pokescripting::ItemTypeWrapper* Pokescripting::PokemodWrapper::itemType(const int id) +{ + return ItemTypeWrapper::create(m_pokemod->itemTypeById(id), this); +} + +Pokescripting::MapWrapper* Pokescripting::PokemodWrapper::map(const int id) +{ + return MapWrapper::create(m_pokemod->mapById(id), this); +} + +Pokescripting::MoveWrapper* Pokescripting::PokemodWrapper::move(const int id) +{ + return MoveWrapper::create(m_pokemod->moveById(id), this); +} + +Pokescripting::NatureWrapper* Pokescripting::PokemodWrapper::nature(const int id) +{ + return NatureWrapper::create(m_pokemod->natureById(id), this); +} + +Pokescripting::SkinWrapper* Pokescripting::PokemodWrapper::skin(const int id) +{ + return SkinWrapper::create(m_pokemod->skinById(id), this); +} + +Pokescripting::SoundWrapper* Pokescripting::PokemodWrapper::sound(const int id) +{ + return SoundWrapper::create(m_pokemod->soundById(id), this); +} + +Pokescripting::SpeciesWrapper* Pokescripting::PokemodWrapper::species(const int id) +{ + return SpeciesWrapper::create(m_pokemod->speciesById(id), this); +} + +Pokescripting::SpriteWrapper* Pokescripting::PokemodWrapper::sprite(const int id) +{ + return SpriteWrapper::create(m_pokemod->spriteById(id), this); +} + +Pokescripting::StatusWrapper* Pokescripting::PokemodWrapper::status(const int id) +{ + return StatusWrapper::create(m_pokemod->statusById(id), this); +} + +Pokescripting::StoreWrapper* Pokescripting::PokemodWrapper::store(const int id) +{ + return StoreWrapper::create(m_pokemod->storeById(id), this); +} + +Pokescripting::TileWrapper* Pokescripting::PokemodWrapper::tile(const int id) +{ + return TileWrapper::create(m_pokemod->tileById(id), this); +} + +Pokescripting::TimeWrapper* Pokescripting::PokemodWrapper::time(const int id) +{ + return TimeWrapper::create(m_pokemod->timeById(id), this); +} + +Pokescripting::TrainerWrapper* Pokescripting::PokemodWrapper::trainer(const int id) +{ + return TrainerWrapper::create(m_pokemod->trainerById(id), this); +} + +Pokescripting::TypeWrapper* Pokescripting::PokemodWrapper::type(const int id) +{ + return TypeWrapper::create(m_pokemod->typeById(id), this); +} + +Pokescripting::WeatherWrapper* Pokescripting::PokemodWrapper::weather(const int id) +{ + return WeatherWrapper::create(m_pokemod->weatherById(id), this); +} + +Pokemod::Stat Pokescripting::PokemodWrapper::stat(const QString& name) const +{ + if (name == "HP") + return Pokemod::ST_HP; + else if (name == "Attack") + return Pokemod::ST_Attack; + else if (name == "Defense") + return Pokemod::ST_Defense; + else if (name == "Speed") + return Pokemod::ST_Speed; + else if (name == "Special") + return Pokemod::ST_Special; + else if (name == "Special Attack") + return Pokemod::ST_SpecialAttack; + else if (name == "Special Defense") + return Pokemod::ST_SpecialAttack; + else if (name == "Accuracy") + return Pokemod::ST_Accuracy; + else if (name == "Evasion") + return Pokemod::ST_Evasion; + return QVariant(-1).value<Pokemod::Stat>(); +} + +Pokemod::Direction Pokescripting::PokemodWrapper::direction(const QString& name) const +{ + if (name == "Up") + return Pokemod::D_Up; + else if (name == "Down") + return Pokemod::D_Down; + else if (name == "Left") + return Pokemod::D_Left; + else if (name == "Right") + return Pokemod::D_Right; + else if (name == "None") + return Pokemod::D_None; + return QVariant(-1).value<Pokemod::Direction>(); +} + +QString Pokescripting::PokemodWrapper::title() const +{ + return m_pokemod->title(); +} + +QString Pokescripting::PokemodWrapper::version() const +{ + return m_pokemod->version(); +} + +QString Pokescripting::PokemodWrapper::description() const +{ + return m_pokemod->description(); +} + +Pokescripting::MapWarpWrapper* Pokescripting::PokemodWrapper::startWarp() +{ + return map(m_pokemod->startMap())->warp(m_pokemod->startWarp()); +} + +Pokemod::Fraction Pokescripting::PokemodWrapper::effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const +{ + return m_pokemod->typechart(m_pokemod->typeIndex(attacker->id()), m_pokemod->typeIndex(defender->id())); +} + +Pokescripting::RulesWrapper* Pokescripting::PokemodWrapper::rules() +{ + return RulesWrapper::create(m_pokemod->rules(), this); +} + +Pokescripting::AbilityWrapper* Pokescripting::PokemodWrapper::ability(const QString& name) +{ + for (int i = 0; i < m_pokemod->abilityCount(); ++i) + { + if (m_pokemod->ability(i)->name() == name) + return AbilityWrapper::create(m_pokemod->ability(i), this); + } + return NULL; +} + +Pokescripting::AuthorWrapper* Pokescripting::PokemodWrapper::author(const QString& name) +{ + for (int i = 0; i < m_pokemod->authorCount(); ++i) + { + if (m_pokemod->author(i)->name() == name) + return AuthorWrapper::create(m_pokemod->author(i), this); + } + return NULL; +} + +Pokescripting::BadgeWrapper* Pokescripting::PokemodWrapper::badge(const QString& name) +{ + for (int i = 0; i < m_pokemod->badgeCount(); ++i) + { + if (m_pokemod->badge(i)->name() == name) + return BadgeWrapper::create(m_pokemod->badge(i), this); + } + return NULL; +} + +Pokescripting::CoinListWrapper* Pokescripting::PokemodWrapper::coinList(const QString& name) +{ + for (int i = 0; i < m_pokemod->coinListCount(); ++i) + { + if (m_pokemod->coinList(i)->name() == name) + return CoinListWrapper::create(m_pokemod->coinList(i), this); + } + return NULL; +} + +Pokescripting::EggGroupWrapper* Pokescripting::PokemodWrapper::eggGroup(const QString& name) +{ + for (int i = 0; i < m_pokemod->eggGroupCount(); ++i) + { + if (m_pokemod->eggGroup(i)->name() == name) + return EggGroupWrapper::create(m_pokemod->eggGroup(i), this); + } + return NULL; +} + +Pokescripting::GlobalScriptWrapper* Pokescripting::PokemodWrapper::globalScript(const QString& name) +{ + for (int i = 0; i < m_pokemod->globalScriptCount(); ++i) + { + if (m_pokemod->globalScript(i)->name() == name) + return GlobalScriptWrapper::create(m_pokemod->globalScript(i), this); + } + return NULL; +} + +Pokescripting::ItemWrapper* Pokescripting::PokemodWrapper::item(const QString& name) +{ + for (int i = 0; i < m_pokemod->itemCount(); ++i) + { + if (m_pokemod->item(i)->name() == name) + return ItemWrapper::create(m_pokemod->item(i), this); + } + return NULL; +} + +Pokescripting::ItemTypeWrapper* Pokescripting::PokemodWrapper::itemType(const QString& name) +{ + for (int i = 0; i < m_pokemod->itemTypeCount(); ++i) + { + if (m_pokemod->itemType(i)->name() == name) + return ItemTypeWrapper::create(m_pokemod->itemType(i), this); + } + return NULL; +} + +Pokescripting::MapWrapper* Pokescripting::PokemodWrapper::map(const QString& name) +{ + for (int i = 0; i < m_pokemod->mapCount(); ++i) + { + if (m_pokemod->map(i)->name() == name) + return MapWrapper::create(m_pokemod->map(i), this); + } + return NULL; +} + +Pokescripting::MoveWrapper* Pokescripting::PokemodWrapper::move(const QString& name) +{ + for (int i = 0; i < m_pokemod->moveCount(); ++i) + { + if (m_pokemod->move(i)->name() == name) + return MoveWrapper::create(m_pokemod->move(i), this); + } + return NULL; +} + +Pokescripting::NatureWrapper* Pokescripting::PokemodWrapper::nature(const QString& name) +{ + for (int i = 0; i < m_pokemod->natureCount(); ++i) + { + if (m_pokemod->nature(i)->name() == name) + return NatureWrapper::create(m_pokemod->nature(i), this); + } + return NULL; +} + +Pokescripting::SkinWrapper* Pokescripting::PokemodWrapper::skin(const QString& name) +{ + for (int i = 0; i < m_pokemod->skinCount(); ++i) + { + if (m_pokemod->skin(i)->name() == name) + return SkinWrapper::create(m_pokemod->skin(i), this); + } + return NULL; +} + +Pokescripting::SoundWrapper* Pokescripting::PokemodWrapper::sound(const QString& name) +{ + for (int i = 0; i < m_pokemod->soundCount(); ++i) + { + if (m_pokemod->sound(i)->name() == name) + return SoundWrapper::create(m_pokemod->sound(i), this); + } + return NULL; +} + +Pokescripting::SpeciesWrapper* Pokescripting::PokemodWrapper::species(const QString& name) +{ + for (int i = 0; i < m_pokemod->speciesCount(); ++i) + { + if (m_pokemod->species(i)->name() == name) + return SpeciesWrapper::create(m_pokemod->species(i), this); + } + return NULL; +} + +Pokescripting::SpriteWrapper* Pokescripting::PokemodWrapper::sprite(const QString& name) +{ + for (int i = 0; i < m_pokemod->spriteCount(); ++i) + { + if (m_pokemod->sprite(i)->name() == name) + return SpriteWrapper::create(m_pokemod->sprite(i), this); + } + return NULL; +} + +Pokescripting::StatusWrapper* Pokescripting::PokemodWrapper::status(const QString& name) +{ + for (int i = 0; i < m_pokemod->statusCount(); ++i) + { + if (m_pokemod->status(i)->name() == name) + return StatusWrapper::create(m_pokemod->status(i), this); + } + return NULL; +} + +Pokescripting::StoreWrapper* Pokescripting::PokemodWrapper::store(const QString& name) +{ + for (int i = 0; i < m_pokemod->storeCount(); ++i) + { + if (m_pokemod->store(i)->name() == name) + return StoreWrapper::create(m_pokemod->store(i), this); + } + return NULL; +} + +Pokescripting::TileWrapper* Pokescripting::PokemodWrapper::tile(const QString& name) +{ + for (int i = 0; i < m_pokemod->tileCount(); ++i) + { + if (m_pokemod->tile(i)->name() == name) + return TileWrapper::create(m_pokemod->tile(i), this); + } + return NULL; +} + +Pokescripting::TimeWrapper* Pokescripting::PokemodWrapper::time(const QString& name) +{ + for (int i = 0; i < m_pokemod->timeCount(); ++i) + { + if (m_pokemod->time(i)->name() == name) + return TimeWrapper::create(m_pokemod->time(i), this); + } + return NULL; +} + +Pokescripting::TrainerWrapper* Pokescripting::PokemodWrapper::trainer(const QString& name) +{ + for (int i = 0; i < m_pokemod->trainerCount(); ++i) + { + if (m_pokemod->trainer(i)->name() == name) + return TrainerWrapper::create(m_pokemod->trainer(i), this); + } + return NULL; +} + +Pokescripting::TypeWrapper* Pokescripting::PokemodWrapper::type(const QString& name) +{ + for (int i = 0; i < m_pokemod->typeCount(); ++i) + { + if (m_pokemod->type(i)->name() == name) + return TypeWrapper::create(m_pokemod->type(i), this); + } + return NULL; +} + +Pokescripting::WeatherWrapper* Pokescripting::PokemodWrapper::weather(const QString& name) +{ + for (int i = 0; i < m_pokemod->weatherCount(); ++i) + { + if (m_pokemod->weather(i)->name() == name) + return WeatherWrapper::create(m_pokemod->weather(i), this); + } + return NULL; +} |
