summaryrefslogtreecommitdiffstats
path: root/pokemod/Status.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-10-26 21:21:38 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-10-26 21:21:38 +0000
commit83f4b43f63960ba30e38cf5bb53cd98ae738ef74 (patch)
tree80f37f9e4a35ea11b8b1f0369f90208f393df83f /pokemod/Status.cpp
parent4385af885daf460a18e236f08509358f764b2c8c (diff)
downloadsigen-83f4b43f63960ba30e38cf5bb53cd98ae738ef74.tar.gz
sigen-83f4b43f63960ba30e38cf5bb53cd98ae738ef74.tar.xz
sigen-83f4b43f63960ba30e38cf5bb53cd98ae738ef74.zip
Redoing rev25
[ADD] DISCLAIMER [FIX] PokemonEvolution styles [ADD] Relative enumeration [DEL] pokemod/Status.{h, cpp} [DEL] pokemod/StatusEffect.{h, cpp} [FIX] Status effects will be added as needed instead of customized [FIX] Completed ItemEffects [FIX] Factored out Natures to be global [DEL] pokemod/PokemonNature.{h, cpp} [DEL] ai/Net.{h, cpp} [DEL] ai/Layer/{h, cpp} [ADD] battle/Arena.{h, cpp} [ADD] battle/Team.{h, cpp} [ADD] battle/Human.{h, cpp} [ADD] battle/Bot.{h, cpp} [ADD] battle/GhostBot.{h, cpp} [ADD] battle/Pokemon.{h, cpp} [ADD] battle/Ghost.{h, cpp} [FIX] Fixed some scope errors in pokemod [ADD] audio/audio.pro [ADD] audio/Audio.{h, cpp} [ADD] audio/AudioLibrary.{h, cpp} [ADD] audio/AudioSystem.{h, cpp} [ADD] audio/Music.{h, cpp} [ADD] audio/SoundEffect.{h, cpp} [DEL] old audio system (was in C) [FIX] Optimized some routines in pokemod [FIX] Moved global classes (Ini, Frac, Matrix, FracMatrix, Point, Flag) to general git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@27 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Status.cpp')
-rw-r--r--pokemod/Status.cpp259
1 files changed, 0 insertions, 259 deletions
diff --git a/pokemod/Status.cpp b/pokemod/Status.cpp
deleted file mode 100644
index 7ea407e8..00000000
--- a/pokemod/Status.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokemod/Status.cpp
-// Purpose: Define an Status that Pokémon can possess to add extra
-// dynamics to the battle system
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat June 2 2007 12:00:45
-// Copyright: ©2007 Nerdy Productions
-// Licence:
-// 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
-// MERCHANTStatus 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include "Status.h"
-
-PokeGen::PokeMod::Status::Status(const Pokemod* par, const unsigned _id) :
- Object(_id, par),
- name(""),
- abbreviation(""),
- verb(""),
- afterSwitch(UINT_MAX),
- afterBattle(UINT_MAX),
- maxTurns(0),
- catchBonus(0)
-{
-}
-
-PokeGen::PokeMod::Status::Status(const Pokemod* par, Ini& ini, const unsigned _id) :
- Object(_id, par)
-{
- ImportIni(ini, _id);
-}
-
-bool PokeGen::PokeMod::Status::Validate()
-{
- pokemod->ValidationMsg(QString("---Status \"%1\" with id %2---").arg(name).arg(id), Pokemod::V_Msg);
- if (name == "")
- {
- pokemod->ValidationMsg("Name is not defined");
- isValid = false;
- }
- else if ((name == "Clear") || (name == "Any"))
- {
- pokemod->ValidationMsg("Invalid name");
- isValid = false;
- }
- if (abbreviation == "")
- pokemod->ValidationMsg("Abbreviation is not defined");
- else if (4 <= abbreviation.length())
- {
- pokemod->ValidationMsg("Abbreviation too long");
- isValid = false;
- }
- if (verb == "")
- pokemod->ValidationMsg("Verb is not defined", Pokemod::V_Warn);
- if (afterSwitch == UINT_MAX)
- pokemod->ValidationMsg("After switch status is not defined", Pokemod::V_Warn);
- else if (pokemod->GetStatusByID(afterSwitch) == UINT_MAX)
- {
- pokemod->ValidationMsg("Invalid after switch status");
- isValid = false;
- }
- if (afterBattle == UINT_MAX)
- pokemod->ValidationMsg("After battle status is not defined", Pokemod::V_Warn);
- else if (pokemod->GetStatusByID(afterBattle) == UINT_MAX)
- {
- pokemod->ValidationMsg("Invalid after battle abbreviation");
- isValid = false;
- }
- if (GetEffectCount())
- {
- QMap<unsigned, unsigned> idChecker;
- for (QList<StatusEffect>::Iterator i = effects.begin(); i != effects.end(); ++i)
- {
- if (!i->IsValid())
- isValid = false;
- ++idChecker[i->GetId()];
- }
- for (QMap<unsigned, unsigned>::ConstIterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i.value())
- {
- pokemod->ValidationMsg(QString("There are %1 effects with id %2").arg(i.value()).arg(i.key()));
- isValid = false;
- }
- }
- }
- else
- {
- pokemod->ValidationMsg("There are no effects");
- isValid = false;
- }
- return isValid;
-}
-
-void PokeGen::PokeMod::Status::ImportIni(Ini& ini, const unsigned _id)
-{
- if (_id == UINT_MAX)
- ini.GetValue("id", id);
- else
- id = _id;
- ini.GetValue("name", name);
- ini.GetValue("abbreviation", abbreviation);
- ini.GetValue("verb", verb);
- ini.GetValue("afterSwitch", afterSwitch);
- ini.GetValue("afterBattle", afterBattle);
- ini.GetValue("maxTurns", maxTurns, 0);
- ini.GetValue("catchBonus", catchBonus, 0);
- effects.clear();
-}
-
-void PokeGen::PokeMod::Status::ExportIni(QFile& fout) const
-{
- Ini exStatus("Status");
- exStatus.AddField("id", id);
- exStatus.AddField("name", name);
- exStatus.AddField("abbreviation", abbreviation);
- exStatus.AddField("verb", verb);
- exStatus.AddField("afterSwitch", afterSwitch);
- exStatus.AddField("afterBattle", afterBattle);
- exStatus.AddField("maxTurns", maxTurns);
- exStatus.AddField("catchBonus", catchBonus);
- exStatus.Export(fout);
- for (QList<StatusEffect>::ConstIterator i = effects.begin(); i != effects.end(); ++i)
- i->ExportIni(fout, name);
-}
-
-void PokeGen::PokeMod::Status::SetName(const QString& n)
-{
- name = n;
-}
-
-bool PokeGen::PokeMod::Status::SetAbbreviation(const QString& a)
-{
- if (a.length() < 4)
- abbreviation = a;
- return (abbreviation == a);
-}
-
-void PokeGen::PokeMod::Status::SetVerb(const QString& v)
-{
- verb = v;
-}
-
-bool PokeGen::PokeMod::Status::SetAfterSwitch(const unsigned a)
-{
- if ((a == UINT_MAX) || (pokemod->GetStatusByID(a) != UINT_MAX))
- afterSwitch = a;
- return (afterSwitch == a);
-}
-
-bool PokeGen::PokeMod::Status::SetAfterBattle(const unsigned a)
-{
- if ((a == UINT_MAX) || (pokemod->GetStatusByID(a) != UINT_MAX))
- afterBattle = a;
- return (afterBattle == a);
-}
-
-void PokeGen::PokeMod::Status::SetMaxTurns(const unsigned m)
-{
- maxTurns = m;
-}
-
-void PokeGen::PokeMod::Status::SetCatchBonus(const unsigned c)
-{
- catchBonus = c;
-}
-
-QString PokeGen::PokeMod::Status::GetName() const
-{
- return name;
-}
-
-QString PokeGen::PokeMod::Status::GetAbbreviation() const
-{
- return abbreviation;
-}
-
-QString PokeGen::PokeMod::Status::GetVerb() const
-{
- return verb;
-}
-
-unsigned PokeGen::PokeMod::Status::GetAfterSwitch() const
-{
- return afterSwitch;
-}
-
-unsigned PokeGen::PokeMod::Status::GetAfterBattle() const
-{
- return afterBattle;
-}
-
-unsigned PokeGen::PokeMod::Status::GetMaxTurns() const
-{
- return maxTurns;
-}
-
-unsigned PokeGen::PokeMod::Status::GetCatchBonus() const
-{
- return catchBonus;
-}
-
-const PokeGen::PokeMod::StatusEffect* PokeGen::PokeMod::Status::GetEffect(const unsigned i) const
-{
- if (i < GetEffectCount())
- return &effects[i];
- return NULL;
-}
-
-unsigned PokeGen::PokeMod::Status::GetEffectByID(const unsigned _id) const
-{
- for (unsigned i = 0; i < GetEffectCount(); ++i)
- {
- if (effects[i].GetId() == _id)
- return i;
- }
- return UINT_MAX;
-}
-
-unsigned PokeGen::PokeMod::Status::GetEffectCount() const
-{
- return effects.size();
-}
-
-const PokeGen::PokeMod::StatusEffect* PokeGen::PokeMod::Status::NewEffect(Ini* const ini)
-{
- unsigned i = 0;
- for (; i < GetEffectCount(); ++i)
- {
- if (GetEffectByID(i) != UINT_MAX)
- break;
- }
- StatusEffect newEffect(pokemod, i);
- if (ini)
- newEffect.ImportIni(*ini);
- effects.append(newEffect);
- return &effects[GetEffectCount() - 1];
-}
-
-bool PokeGen::PokeMod::Status::DeleteEffect(const unsigned i)
-{
- if (i < GetEffectCount())
- {
- effects.erase(effects.begin() + i);
- return true;
- }
- return false;
-}