diff options
Diffstat (limited to 'pokemod/ItemEffect.cpp')
| -rw-r--r-- | pokemod/ItemEffect.cpp | 532 |
1 files changed, 231 insertions, 301 deletions
diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp index d2e5b2d2..5d663cf3 100644 --- a/pokemod/ItemEffect.cpp +++ b/pokemod/ItemEffect.cpp @@ -1,27 +1,26 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokemod/ItemEffect.cpp -// Purpose: Define an effect of an item -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Tue Mar 20 18:25:26 2007 -// Copyright: ©2007-2008 Ben Boeckel and 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 -// 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/>. -///////////////////////////////////////////////////////////////////////////// +/* + * Copyright 2007-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/>. + */ + +// Pokemod includes #include "Pokemod.h" #include "MapWildList.h" + +// Header include #include "ItemEffect.h" const QStringList ItemEffect::EffectStr = QStringList() << "HP Cure" << "Revive" << "Cure Status" << "Level Boost" << "Stat Boost" << "Flinch" << "Go First" << "Keep Alive" << "Modify Stat (Battle Only)" << "Shield (Battle Only)" << "Run (Battle Only)" << "PP Boost" << "Type Boost" << "PP Restore" << "Experience Share" << "Fishing Rod" << "Repel" << "Escape" << "TM" << "HM" << "Map" << "Ball" << "Itemfinder" << "Bike" << "Scope" << "Coin" << "Coin Case" << "Berry" << "Acorn"; @@ -33,36 +32,36 @@ const QStringList ItemEffect::SpecialPhysicalStr = QStringList() << "Special" << const QStringList ItemEffect::BallTypeStr = QStringList() << "Regular" << "Master" << "Level" << "Love" << "Area" << "Time" << "Battle" << "Friend" << "Stat" << "Type" << "Weight"; const QStringList ItemEffect::BerryTypeStr = QStringList() << "HP Cure" << "Status Cure"; -ItemEffect::ItemEffect(const Pokemod* par, const int _id) : - Object("ItemEffect", par, _id), - overworld(false), - battle(false), - held(false), - effect(-1), - val1(-1), - val2(-1), - val3(-1), - val4(1, 1) +ItemEffect::ItemEffect(const Pokemod* pokemod, const int id) : + Object("ItemEffect", pokemod, id), + m_overworld(false), + m_battle(false), + m_held(false), + m_effect(INT_MAX), + m_value1(INT_MAX), + m_value2(INT_MAX), + m_value3(INT_MAX), + m_value4(1, 1) { } -ItemEffect::ItemEffect(const Pokemod* par, const ItemEffect& e, const int _id) : - Object("ItemEffect", par, _id) +ItemEffect::ItemEffect(const Pokemod* pokemod, const ItemEffect& effect, const int id) : + Object("ItemEffect", pokemod, id) { - *this = e; + *this = effect; } -ItemEffect::ItemEffect(const Pokemod* par, const QString& fname, const int _id) : - Object("ItemEffect", par, _id) +ItemEffect::ItemEffect(const Pokemod* pokemod, const QString& fileName, const int id) : + Object("ItemEffect", pokemod, id) { - load(fname, _id); + load(fileName, id); } bool ItemEffect::validate() const { bool valid = true; - pokemod->validationMsg(QString("------Effect with id %1---").arg(id), Pokemod::V_Msg); - switch (effect) + pokemod()->validationMsg(QString("------Effect with id %1---").arg(id()), Pokemod::V_Msg); + switch (m_effect) { case E_Revive: case E_LevelBoost: @@ -81,9 +80,9 @@ bool ItemEffect::validate() const case E_CoinCase: case E_Acorn: case E_Evolution: - if (!overworld) + if (!m_overworld) { - pokemod->validationMsg("Effect only works in the overworld"); + pokemod()->validationMsg("Effect only works in the overworld"); valid = false; } break; @@ -97,48 +96,48 @@ bool ItemEffect::validate() const case E_ExpShare: case E_Ball: case E_Berry: - if (overworld) + if (m_overworld) { valid = false; - pokemod->validationMsg("Effect cannot work in the overworld"); + pokemod()->validationMsg("Effect cannot work in the overworld"); } break; } - if (effect < E_End) + if (m_effect < E_End) { bool ok = true; - switch (effect) + switch (m_effect) { case E_HPCure: case E_Revive: - if ((val4 != R_Absolute) || !val1) + if ((m_value4 != R_Absolute) || !m_value1) ok = false; break; case E_LevelBoost: case E_ShieldBattle: case E_PPBoost: case E_Repel: - if (!val1) + if (!m_value1) ok = false; break; case E_StatBoost: case E_Acorn: - if ((val1 < 0) || (65536 <= val1)) + if ((m_value1 < 0) || (65536 <= m_value1)) ok = false; break; case E_ModifyStatBattle: - if ((val1 < -12) || (12 < val1)) + if ((m_value1 < -12) || (12 < m_value1)) ok = false; break; case E_Ball: - switch (val2) + switch (m_value2) { case B_Regular: - if (256 <= val1) + if (256 <= m_value1) ok = false; break; case B_Level: - if (pokemod->getRules()->getMaxLevel() < val1) + if (pokemod()->rules()->maxLevel() < m_value1) ok = false; break; case B_Master: @@ -159,86 +158,86 @@ bool ItemEffect::validate() const } if (!ok) { - pokemod->validationMsg("Invalid val1"); + pokemod()->validationMsg("Invalid value 1"); valid = false; ok = true; } - switch (effect) + switch (m_effect) { case E_HPCure: case E_Revive: - if (R_End <= val2) + if (R_End <= m_value2) ok = false; break; case E_CureStatus: - if (Pokemod::STS_End <= val2) + if (Pokemod::STS_End <= m_value2) ok = false; break; case E_StatBoost: - if ((val2 <= 0) || (65536 <= val2)) + if ((m_value2 <= 0) || (65536 <= m_value2)) ok = false; break; case E_ModifyStatBattle: - if (Pokemod::ST_End_Battle <= val2) + if (Pokemod::ST_End_Battle <= m_value2) ok = false; break; case E_ShieldBattle: - if (SP_End <= val2) + if (SP_End <= m_value2) ok = false; break; case E_TypeBoost: - if (pokemod->getTypeIndex(val2) == -1) + if (pokemod()->typeIndex(m_value2) == INT_MAX) ok = false; break; case E_PPRestore: - if (A_End <= val2) + if (A_End <= m_value2) ok = false; break; case E_Repel: - if (RP_End <= val2) + if (RP_End <= m_value2) ok = false; break; case E_Escape: - if (ES_End <= val2) + if (ES_End <= m_value2) ok = false; break; case E_TM: case E_HM: - if (pokemod->getMoveIndex(val2) == -1) + if (pokemod()->moveIndex(m_value2) == INT_MAX) ok = false; break; case E_Ball: - if (B_End <= val2) + if (B_End <= m_value2) ok = false; break; case E_Berry: - if (B2_End <= val2) + if (B2_End <= m_value2) ok = false; break; case E_Coin: case E_CoinCase: - if (val2 <= 0) + if (m_value2 <= 0) ok = false; break; case E_Acorn: - if (pokemod->getItemIndex(val2) == -1) + if (pokemod()->itemIndex(m_value2) == INT_MAX) ok = false; break; } if (!ok) { - pokemod->validationMsg("Invalid val2"); + pokemod()->validationMsg("Invalid value 2"); valid = false; ok = true; } - switch (effect) + switch (m_effect) { case E_StatBoost: - if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3) + if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= m_value3) ok = false; break; case E_Ball: - switch (val2) + switch (m_value2) { case B_Regular: case B_Master: @@ -249,32 +248,32 @@ bool ItemEffect::validate() const case B_Weight: break; case B_Area: - if (MapWildList::End <= val3) + if (MapWildList::End <= m_value3) ok = false; break; case B_Time: - if (pokemod->getTimeIndex(val3) == -1) + if (pokemod()->timeIndex(m_value3) == INT_MAX) ok = false; break; case B_Stat: - if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3) + if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= m_value3) ok = false; break; case B_Type: - if (pokemod->getTypeIndex(val3) == -1) + if (pokemod()->typeIndex(m_value3) == INT_MAX) ok = false; break; } break; case E_Berry: - switch (val2) + switch (m_value2) { case B2_HPCure: - if (Pokemod::REL_End <= val3) + if (Pokemod::REL_End <= m_value3) ok = false; break; case B2_StatusCure: - if (Pokemod::STS_End <= val3) + if (Pokemod::STS_End <= m_value3) ok = false; break; default: @@ -285,58 +284,57 @@ bool ItemEffect::validate() const } if (!ok) { - pokemod->validationMsg("Invalid val3"); + pokemod()->validationMsg("Invalid value 3"); valid = false; } } else { - pokemod->validationMsg("Invalid effect"); + pokemod()->validationMsg("Invalid effect"); valid = false; } return valid; } -void ItemEffect::load(const QString& fname, const int _id) throw(Exception) +void ItemEffect::load(const QString& fileName, int id) throw(Exception) { - Ini ini(fname); - if (_id == -1) + Ini ini(fileName); + if (id == INT_MAX) ini.getValue("id", id); - else - id = _id; + setId(id); int i; int j; - ini.getValue("overworld", overworld, false); - ini.getValue("battle", battle, false); - ini.getValue("held", held, false); - ini.getValue("effect", effect); - ini.getValue("val1", val1); - ini.getValue("val2", val2); - ini.getValue("val3", val3); - ini.getValue("val4-n", i, 1); - ini.getValue("val4-n", j, 1); - val4.set(i, j); + ini.getValue("overworld", m_overworld, false); + ini.getValue("battle", m_battle, false); + ini.getValue("held", m_held, false); + ini.getValue("effect", m_effect); + ini.getValue("value1", m_value1); + ini.getValue("value2", m_value2); + ini.getValue("value3", m_value3); + ini.getValue("value4-n", i, 1); + ini.getValue("value4-n", j, 1); + m_value4.set(i, j); } void ItemEffect::save(const QString& item) const throw(Exception) { Ini ini; - ini.addField("id", id); - ini.addField("overworld", overworld); - ini.addField("battle", battle); - ini.addField("held", held); - ini.addField("effect", effect); - ini.addField("val1", val1); - ini.addField("val2", val2); - ini.addField("val3", val3); - ini.addField("val4-n", val4.getNum()); - ini.addField("val4-d", val4.getDenom()); - ini.save(QString("%1/item/%2/effect/%3.pini").arg(pokemod->getPath()).arg(item).arg(id)); + ini.addField("id", id()); + ini.addField("overworld", m_overworld); + ini.addField("battle", m_battle); + ini.addField("held", m_held); + ini.addField("effect", m_effect); + ini.addField("value1", m_value1); + ini.addField("value2", m_value2); + ini.addField("value3", m_value3); + ini.addField("value4-n", m_value4.numerator()); + ini.addField("value4-d", m_value4.denominator()); + ini.save(QString("%1/item/%2/effect/%3.pini").arg(pokemod()->path()).arg(item).arg(id())); } -void ItemEffect::setOverworld(const bool o) throw(Exception) +void ItemEffect::setOverworld(const bool overworld) throw(Exception) { - switch (effect) + switch (m_effect) { case E_Revive: case E_LevelBoost: @@ -355,8 +353,8 @@ void ItemEffect::setOverworld(const bool o) throw(Exception) case E_CoinCase: case E_Acorn: case E_Evolution: - if (!o) - throw(Exception(className, "overworld mismatch")); + if (!overworld) + throw(Exception(className(), "overworld mismatch")); break; case E_Flinch: case E_First: @@ -368,28 +366,28 @@ void ItemEffect::setOverworld(const bool o) throw(Exception) case E_ExpShare: case E_Ball: case E_Berry: - if (o) - throw(Exception(className, "overworld mismatch")); + if (overworld) + throw(Exception(className(), "overworld mismatch")); break; } - overworld = o; + m_overworld = overworld; } -void ItemEffect::setBattle(const bool b) +void ItemEffect::setBattle(const bool battle) { - battle = b; + m_battle = battle; } -void ItemEffect::setHeld(const bool h) +void ItemEffect::setHeld(const bool held) { - held = h; + m_held = held; } -void ItemEffect::setEffect(const int e) throw(Exception) +void ItemEffect::setEffect(const int effect) throw(Exception) { - if (E_End <= e) - throw(BoundsException(className, "effect out-of-bounds")); - switch (e) + if (E_End <= effect) + throw(BoundsException(className(), "effect out-of-bounds")); + switch (effect) { case E_Revive: case E_LevelBoost: @@ -408,8 +406,7 @@ void ItemEffect::setEffect(const int e) throw(Exception) case E_CoinCase: case E_Acorn: case E_Evolution: - if (!overworld) - throw(Exception(className, "overworld mismatch")); + m_overworld = true; break; case E_Flinch: case E_First: @@ -421,56 +418,55 @@ void ItemEffect::setEffect(const int e) throw(Exception) case E_ExpShare: case E_Ball: case E_Berry: - if (overworld) - throw(Exception(className, "overworld mismatch")); + m_overworld = false; break; } - effect = e; - val1 = 0; - val2 = -1; - val3 = -1; - val4.set(1, 1, ((e == E_TypeBoost) || (e == E_PPBoost)) ? Frac::Over1 : Frac::Proper); + m_effect = effect; + m_value1 = 0; + m_value2 = INT_MAX; + m_value3 = INT_MAX; + m_value4.set(1, 1, ((E_TypeBoost == effect) || (E_PPBoost == effect)) ? Frac::Over1 : Frac::Proper); } -void ItemEffect::setVal1(const int v1) throw(Exception) +void ItemEffect::setValue1(const int value1) throw(Exception) { - switch (effect) + switch (m_effect) { case E_HPCure: case E_Revive: - if ((val4 != R_Absolute) || !val1) - throw(BoundsException(className, "val1")); + if ((m_value4 != R_Absolute) || !value1) + throw(BoundsException(className(), "value1")); break; case E_LevelBoost: case E_ShieldBattle: case E_PPBoost: case E_Repel: - if (!val1) - throw(BoundsException(className, "val1")); + if (!value1) + throw(BoundsException(className(), "value1")); break; case E_StatBoost: case E_Acorn: - if ((val1 < 0) || (65536 <= val1)) - throw(BoundsException(className, "val1")); + if ((value1 < 0) || (65536 <= value1)) + throw(BoundsException(className(), "value1")); break; case E_ModifyStatBattle: - if ((val1 < -12) || (12 < val1)) - throw(BoundsException(className, "val1")); + if ((value1 < -12) || (12 < value1)) + throw(BoundsException(className(), "value1")); break; case E_Fish: case E_Coin: case E_CoinCase: break; case E_Ball: - switch (val2) + switch (m_value2) { case B_Regular: - if (256 <= val1) - throw(BoundsException(className, "val1")); + if (256 <= value1) + throw(BoundsException(className(), "value1")); break; case B_Level: - if (pokemod->getRules()->getMaxLevel() < val1) - throw(BoundsException(className, "val1")); + if (pokemod()->rules()->maxLevel() < value1) + throw(BoundsException(className(), "value1")); break; case B_Master: case B_Love: @@ -483,219 +479,153 @@ void ItemEffect::setVal1(const int v1) throw(Exception) case B_Weight: break; default: - throw(BoundsException(className, "val1")); + throw(BoundsException(className(), "value1")); } break; default: - throw(UnusedException(className, "val1")); + throw(UnusedException(className(), "value1")); break; } - val1 = v1; + m_value1 = value1; } -void ItemEffect::setVal2(const int v2) throw(Exception) +void ItemEffect::setValue2(const int value2) throw(Exception) { - switch (effect) + switch (m_effect) { case E_HPCure: case E_Revive: - if (R_End <= val2) - throw(BoundsException(className, "val2")); + if (R_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_CureStatus: - if (Pokemod::STS_End <= val2) - throw(BoundsException(className, "val2")); + if (Pokemod::STS_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_StatBoost: - if ((val2 <= 0) || (65536 <= val2)) - throw(BoundsException(className, "val2")); + if ((value2 <= 0) || (65536 <= value2)) + throw(BoundsException(className(), "value2")); break; case E_ModifyStatBattle: - if (Pokemod::ST_End_Battle <= val2) - throw(BoundsException(className, "val2")); + if (Pokemod::ST_End_Battle <= value2) + throw(BoundsException(className(), "value2")); break; case E_ShieldBattle: - if (SP_End <= val2) - throw(BoundsException(className, "val2")); + if (SP_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_TypeBoost: - if (pokemod->getTypeIndex(val2) == -1) - throw(BoundsException(className, "val2")); + if (pokemod()->typeIndex(value2) == INT_MAX) + throw(BoundsException(className(), "value2")); break; case E_PPRestore: - if (A_End <= val2) - throw(BoundsException(className, "val2")); + if (A_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_Repel: - if (RP_End <= val2) - throw(BoundsException(className, "val2")); + if (RP_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_Escape: - if (ES_End <= val2) - throw(BoundsException(className, "val2")); + if (ES_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_TM: case E_HM: - if (pokemod->getMoveIndex(val2) == -1) - throw(BoundsException(className, "val2")); + if (pokemod()->moveIndex(value2) == INT_MAX) + throw(BoundsException(className(), "value2")); break; case E_Ball: - if (B_End <= val2) - throw(BoundsException(className, "val2")); + if (B_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_Scope: break; case E_Berry: - if (B2_End <= val2) - throw(BoundsException(className, "val2")); + if (B2_End <= value2) + throw(BoundsException(className(), "value2")); break; case E_Coin: case E_CoinCase: - if (val2 <= 0) - throw(BoundsException(className, "val2")); + if (value2 <= 0) + throw(BoundsException(className(), "value2")); break; case E_Acorn: - if (pokemod->getItemIndex(val2) == -1) - throw(BoundsException(className, "val2")); + if (pokemod()->itemIndex(value2) == INT_MAX) + throw(BoundsException(className(), "value2")); break; default: - throw(UnusedException(className, "val2")); + throw(UnusedException(className(), "value2")); break; } - val2 = v2; + m_value2 = value2; } -void ItemEffect::setVal3(const int v3) throw(Exception) +void ItemEffect::setValue3(const int value3) throw(Exception) { - switch (effect) + switch (m_effect) { case E_StatBoost: - if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3) - throw(BoundsException(className, "val3")); + if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= value3) + throw(BoundsException(className(), "value3")); break; case E_Ball: - switch (val2) + switch (m_value2) { case B_Level: case B_Friend: case B_Weight: break; case B_Area: - if (MapWildList::End <= val3) - throw(BoundsException(className, "val3")); + if (MapWildList::End <= value3) + throw(BoundsException(className(), "value3")); break; case B_Time: - if (pokemod->getTimeIndex(val3) == -1) - throw(BoundsException(className, "val3")); + if (pokemod()->timeIndex(value3) == INT_MAX) + throw(BoundsException(className(), "value3")); break; case B_Stat: - if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3) - throw(BoundsException(className, "val3")); + if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= value3) + throw(BoundsException(className(), "value3")); break; case B_Type: - if (pokemod->getTypeIndex(val3) == -1) - throw(BoundsException(className, "val3")); + if (pokemod()->typeIndex(value3) == INT_MAX) + throw(BoundsException(className(), "value3")); break; case B_Regular: case B_Master: case B_Love: case B_Battle: - throw(UnusedException(className, "val3")); + throw(UnusedException(className(), "value3")); break; } break; case E_Berry: - switch (val2) + switch (m_value2) { case B2_HPCure: - if (Pokemod::REL_End <= val3) - throw(BoundsException(className, "val3")); + if (Pokemod::REL_End <= value3) + throw(BoundsException(className(), "value3")); break; case B2_StatusCure: - if (Pokemod::STS_End <= val3) - throw(BoundsException(className, "val3")); + if (Pokemod::STS_End <= value3) + throw(BoundsException(className(), "value3")); break; default: - throw(UnusedException(className, "val3")); + throw(UnusedException(className(), "value3")); break; } break; default: - throw(UnusedException(className, "val3")); - break; - } - val3 = v3; -} - -void ItemEffect::setVal4(const int n, const int d) throw(Exception) -{ - switch (effect) - { - case E_CureStatus: - case E_LevelBoost: - case E_StatBoost: - case E_ModifyStatBattle: - case E_Fish: - case E_Escape: - case E_TM: - case E_HM: - case E_Map: - case E_Itemfinder: - case E_Bike: - case E_Scope: - case E_Coin: - case E_CoinCase: - case E_Acorn: - case E_Evolution: - throw(UnusedException(className, "val4")); - case E_Ball: - if (val2 == B_Master) - throw(UnusedException(className, "val4")); - break; - case E_Berry: - if (val2 != B2_HPCure) - throw(UnusedException(className, "val4")); - break; - } - val4.set(n, d); -} - -void ItemEffect::setVal4Num(const int n) throw(Exception) -{ - switch (effect) - { - case E_CureStatus: - case E_LevelBoost: - case E_StatBoost: - case E_ModifyStatBattle: - case E_Fish: - case E_Escape: - case E_TM: - case E_HM: - case E_Map: - case E_Itemfinder: - case E_Bike: - case E_Scope: - case E_Coin: - case E_CoinCase: - case E_Acorn: - case E_Evolution: - throw(UnusedException(className, "val4")); - case E_Ball: - if (val2 == B_Master) - throw(UnusedException(className, "val4")); - break; - case E_Berry: - if (val2 != B2_HPCure) - throw(UnusedException(className, "val4")); + throw(UnusedException(className(), "value3")); break; } - val4.setNum(n); + m_value3 = value3; } -void ItemEffect::setVal4Denom(const int d) throw(Exception) +void ItemEffect::setValue4(const int numerator, const int denominator) throw(Exception) { - switch (effect) + switch (m_effect) { case E_CureStatus: case E_LevelBoost: @@ -713,70 +643,70 @@ void ItemEffect::setVal4Denom(const int d) throw(Exception) case E_CoinCase: case E_Acorn: case E_Evolution: - throw(UnusedException(className, "val4")); + throw(UnusedException(className(), "value4")); case E_Ball: - if (val2 == B_Master) - throw(UnusedException(className, "val4")); + if (m_value2 == B_Master) + throw(UnusedException(className(), "value4")); break; case E_Berry: - if (val2 != B2_HPCure) - throw(UnusedException(className, "val4")); + if (m_value2 != B2_HPCure) + throw(UnusedException(className(), "value4")); break; } - val4.setDenom(d); + m_value4.set(numerator, denominator); } -bool ItemEffect::getOverworld() const +bool ItemEffect::overworld() const { - return overworld; + return m_overworld; } -bool ItemEffect::getBattle() const +bool ItemEffect::battle() const { - return battle; + return m_battle; } -bool ItemEffect::getHeld() const +bool ItemEffect::held() const { - return held; + return m_held; } -int ItemEffect::getEffect() const +int ItemEffect::effect() const { - return effect; + return m_effect; } -int ItemEffect::getVal1() const +int ItemEffect::value1() const { - return val1; + return m_value1; } -int ItemEffect::getVal2() const +int ItemEffect::value2() const { - return val2; + return m_value2; } -int ItemEffect::getVal3() const +int ItemEffect::value3() const { - return val3; + return m_value3; } -Frac ItemEffect::getVal4() const +Frac ItemEffect::value4() const { - return val4; + return m_value4; } ItemEffect& ItemEffect::operator=(const ItemEffect& rhs) { if (this == &rhs) return *this; - overworld = rhs.overworld; - battle = rhs.battle; - held = rhs.battle; - effect = rhs.effect; - val1 = rhs.val1; - val2 = rhs.val2; - val3 = rhs.val3; - val4 = rhs.val4; + m_overworld = rhs.m_overworld; + m_battle = rhs.m_battle; + m_held = rhs.m_held; + m_effect = rhs.m_effect; + m_value1 = rhs.m_value1; + m_value2 = rhs.m_value2; + m_value3 = rhs.m_value3; + m_value4 = rhs.m_value4; return *this; } |
