/* * Copyright 2008 Ben Boeckel * * 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 . */ // Header include #include "MoveWrapper.h" // Sigscript includes #include "SigmodWrapper.h" Sigscript::MoveWrapper* Sigscript::MoveWrapper::create(const Sigmod::Move* move, SigmodWrapper* parent) { Signature sig = Signature(parent, Subsignature(move->className(), move->id())); if (!m_instances.contains(sig)) m_instances[sig] = new MoveWrapper(move, parent); return qobject_cast(m_instances[sig]); } Sigscript::MoveWrapper::MoveWrapper(const Sigmod::Move* move, SigmodWrapper* parent) : ObjectWrapper(move, parent), m_move(move) { } QString Sigscript::MoveWrapper::name() const { return m_move->name(); } Sigcore::Fraction Sigscript::MoveWrapper::accuracy() const { if (sigmod()->singlePlayer() && hasValueOfType("accuracy")) return valueOfType("accuracy"); return m_move->accuracy(); } int Sigscript::MoveWrapper::power() const { if (sigmod()->singlePlayer() && hasValueOfType("power")) return valueOfType("power"); return m_move->power(); } Sigscript::TypeWrapper* Sigscript::MoveWrapper::type() { return sigmod()->type(m_move->type()); } bool Sigscript::MoveWrapper::special() const { return m_move->special(); } int Sigscript::MoveWrapper::powerPoints() const { return m_move->powerPoints(); } int Sigscript::MoveWrapper::priority() const { if (sigmod()->singlePlayer() && hasValueOfType("priority")) return valueOfType("priority"); return m_move->priority(); } QString Sigscript::MoveWrapper::description() const { return m_move->description(); } Sigcore::Script Sigscript::MoveWrapper::battleScript() const { return m_move->battleScript(); } Sigcore::Script Sigscript::MoveWrapper::worldScript() const { return m_move->worldScript(); } Sigcore::Script Sigscript::MoveWrapper::priorityScript() const { return m_move->priorityScript(); }