diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-11-27 05:50:14 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-11-27 05:50:14 +0000 |
| commit | b2ec6250bb96e7a96898b35ee7271eb1a7b700ad (patch) | |
| tree | 615ef5c23019361c48eb937b296101853f358c80 | |
| parent | 4cc4d62d084bc3002e35f6bd15a73f22157114e4 (diff) | |
[ADD] Known MoveEffects
[FIX] pokegen.pro error in rpm build target
[FIX] EggSpecies not needed (generic species will be used instead)
[FIX] StruggleMove not needed (generic will be used instead)
[FIX] TypeChart moved back to Pokemod so that Rules are completely Pokemod-neutral
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@29 6ecfd1a5-f3ed-3746-8530-beee90d26b22
| -rw-r--r-- | Changelog | 11 | ||||
| -rwxr-xr-x | pokegen.pro | 2 | ||||
| -rw-r--r-- | pokemod/MoveEffect.cpp | 66 | ||||
| -rw-r--r-- | pokemod/MoveEffect.h | 253 | ||||
| -rw-r--r-- | pokemod/Pokemod.cpp | 94 | ||||
| -rw-r--r-- | pokemod/Pokemod.h | 15 | ||||
| -rw-r--r-- | pokemod/Rules.cpp | 86 | ||||
| -rw-r--r-- | pokemod/Rules.h | 18 |
8 files changed, 353 insertions, 192 deletions
@@ -1,4 +1,15 @@ ----------------- +Rev: 29 +Date: 27 November 2007 +User: MathStuf +----------------- +[ADD] Known MoveEffects +[FIX] pokegen.pro error in rpm build target +[FIX] EggSpecies not needed (generic species will be used instead) +[FIX] StruggleMove not needed (generic will be used instead) +[FIX] TypeChart moved back to Pokemod so that Rules are completely Pokemod-neutral + +----------------- Rev: 28 Date: 22 November 2007 User: MathStuf diff --git a/pokegen.pro b/pokegen.pro index 7197514f..319270fe 100755 --- a/pokegen.pro +++ b/pokegen.pro @@ -14,7 +14,7 @@ distsrc.commands = tar -c . | bzip2 --best -c > ../releases/pokegen-$${VERSION}. rpm.target = rpm rpm.commands = rpmbuild -bt ../releases/pokegen-$${VERSION}.tar.bz2 \ - cp /usr/src/redhat/RPMS/x86_64/pokegen-$${VERSION}.$${ARCH}.rpm ../pkg/ + cp /usr/src/redhat/RPMS/$${ARCH}/pokegen-$${VERSION}.$${ARCH}.rpm ../pkg/ rpm.depends = distsrc QMAKE_EXTRA_UNIX_TARGETS += distsrc \ diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp index aff43ea7..957202c4 100644 --- a/pokemod/MoveEffect.cpp +++ b/pokemod/MoveEffect.cpp @@ -28,8 +28,10 @@ PokeGen::PokeMod::MoveEffect::MoveEffect(const Pokemod& par, const unsigned _id) Object(par, _id), chance(1, 1), effect(UINT_MAX), - val1(INT_MAX), - val2(UINT_MAX) + val1(UINT_MAX), + val2(UINT_MAX), + val3(INT_MIN), + val4(1, 1) { } @@ -62,12 +64,18 @@ void PokeGen::PokeMod::MoveEffect::load(const QString& fname, const unsigned _id id = _id; unsigned i; unsigned j; + unsigned k; ini.getValue("chance-n", i, 1); ini.getValue("chance-d", j, 1); chance.set(i, j); ini.getValue("effect", effect); ini.getValue("val1", val1); ini.getValue("val2", val2); + ini.getValue("val3", val3); + ini.getValue("val4-n", i); + ini.getValue("val4-d", j); + ini.getValue("val4-t", k); + val4.set(i, j, k); } void PokeGen::PokeMod::MoveEffect::save(const QString& move) const @@ -79,6 +87,10 @@ void PokeGen::PokeMod::MoveEffect::save(const QString& move) const 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.addField("val4-t", val4.getType()); ini.save(QString("%1/move/%2/effect/%3.pini").arg(pokemod.getPath()).arg(move).arg(id)); } @@ -102,8 +114,10 @@ void PokeGen::PokeMod::MoveEffect::setEffect(const unsigned e) if (E_End <= e) throw("MoveEffect: effect out-of-bounds"); effect = e; - val1 = INT_MAX; + val1 = UINT_MAX; val2 = UINT_MAX; + val3 = INT_MIN; + val4.set(1, 1/*, */); } void PokeGen::PokeMod::MoveEffect::setVal1(const unsigned v1) @@ -111,11 +125,31 @@ void PokeGen::PokeMod::MoveEffect::setVal1(const unsigned v1) val1 = v1; } -void PokeGen::PokeMod::MoveEffect::setVal2(const int v2) +void PokeGen::PokeMod::MoveEffect::setVal2(const unsigned v2) { val2 = v2; } +void PokeGen::PokeMod::MoveEffect::setVal3(const int v3) +{ + val3 = v3; +} + +void PokeGen::PokeMod::MoveEffect::setVal4(const unsigned n, const unsigned d) +{ + val4.set(n, d); +} + +void PokeGen::PokeMod::MoveEffect::setVal4Num(const unsigned n) +{ + val4.setNum(n); +} + +void PokeGen::PokeMod::MoveEffect::setVal4Denom(const unsigned d) +{ + val4.setDenom(d); +} + PokeGen::Frac PokeGen::PokeMod::MoveEffect::getChance() const { return chance; @@ -141,11 +175,31 @@ unsigned PokeGen::PokeMod::MoveEffect::getVal1() const return val1; } -int PokeGen::PokeMod::MoveEffect::getVal2() const +unsigned PokeGen::PokeMod::MoveEffect::getVal2() const { return val2; } +int PokeGen::PokeMod::MoveEffect::getVal3() const +{ + return val3; +} + +PokeGen::Frac PokeGen::PokeMod::MoveEffect::getVal4() const +{ + return val4; +} + +unsigned PokeGen::PokeMod::MoveEffect::getVal4Num() const +{ + return val4.getNum(); +} + +unsigned PokeGen::PokeMod::MoveEffect::getVal4Denom() const +{ + return val4.getDenom(); +} + PokeGen::PokeMod::MoveEffect& PokeGen::PokeMod::MoveEffect::operator=(const MoveEffect& rhs) { if (this == &rhs) @@ -154,5 +208,7 @@ PokeGen::PokeMod::MoveEffect& PokeGen::PokeMod::MoveEffect::operator=(const Move effect = rhs.effect; val1 = rhs.val1; val2 = rhs.val2; + val3 = rhs.val3; + val4 = rhs.val4; return *this; } diff --git a/pokemod/MoveEffect.h b/pokemod/MoveEffect.h index 0927689a..6b5607ee 100644 --- a/pokemod/MoveEffect.h +++ b/pokemod/MoveEffect.h @@ -38,60 +38,183 @@ namespace PokeGen public: enum Effect { - Damage = 0, - Critical = 1, - Counter = 2, - Status = 3, - Heal = 4, - Selfdestruct = 5, - WhenSleeping = 6, - Mirror = 7, - Stat = 8, - Money = 9, - NeverMiss = 10, - InheritOpponentTypes = 11, - ClearBattleState = 12, - Bide = 13, - MultipleAttack = 14, - MultipleHit = 15, - Run = 16, - Flinch = 17, - OneHitKO = 18, - WaitTurn = 19, - DigUnderground = 20, - FixedDamage = 21, - RelativeDamage = 22, - RangeDamage = 23, - Trap = 24, - FlyUp = 25, - DoubleHit = 26, - Recoil = 27, - PreventStatChange = 28, - IncreaseCritical = 29, - Struggle = 30, - Confuse = 31, - ConfuseAfterUse = 32, - Recover = 33, - HealBySleep = 34, - Transform = 35, - DefensiveBarrier = 36, - IgnoreImmune = 37, - Substitute = 38, - Recharge = 39, - Berzerker = 40, - Mimic = 41, - Metronome = 42, - Leech = 43, - Disable = 44, - GoFirst = 45, - GoSecond = 46, - - SetAsMinimized = 45, - NeverMissIfThere = 46, - + Damage = 0, // Normal, Fixed, Relative, Level + Status = 1, + RecoverByDamage = 2, + Selfdestruct = 3, + Stat = 4, + NeverMiss = 5, + ResetStats = 6, + WaitAndReturn = 7, + SelfConfuse = 8, + ForceSwitch = 9, + HitMultiple = 10, // Multi-hit attack. Attacks two to five times in a row. 37.5% for 2 or 3 times; 12.5% for 4 or 5 times. + TypeToEnemyMove = 11, + Flinch = 12, + Recover = 13, + Money = 14, + Rest = 15, + OneHitKO = 16, + WaitTurn = 17, + CriticalHitBonus = 18, + TrapAttack = 19, + Recoil = 20, + PreventStatDecrease = 21, + IncreaseCriticalChance = 22, + Confuse = 23, + // Nasty Plot +/* Transform = , + Deflect = , + Substitute = , + NeedsRecharge = , + // Rage + Mimic = , + Metronome = , + NoMetronome = , + Seed = , + Disable = , + Encore = , + ShareHP = , + MustHaveStatus = , + TargetMustHaveStatus = , + TypeToResistLastMove = , + Target = , + LearnLastMove = , + UseOtherMove = , + NoChooseOnOtherMove = , + ReducePP = , + NeverFaint = , + HealParty = , + GoFirst = , + GoSecond = , + GoLast = , + Steal = , + PreventSwitch = , + SetState = , + StateMultiplier = , + Curse = , + PreventNextMove = , + LaySpikes = , + // Foresight, Odor Sleuth + LinkDeath = , + Weather = , + Endure = , + PowerBuilder = , + ExponentialBuilder = , + Attract = , + Loyalty = , + Present = , + CureStatus = , + // Magnitude + SwitchSelf = , + // Pursuit: When opponent switches, if user chose this attack for use and opponent is one of user's opposing Pokemon, and if user is not prevented from using this attack, user uses this attack with effectiveness doubled, and user skips its attack this round. (No confusion checks, etc. Truant counts as "prevented") + ClearOfSpikes = , + BreakTraps = , + WeatherBoost = , + TimeOfDayBoost = , + // Hidden Power + ReduceHP = , + StealStatModifiers = , + Reflect = , + Flee = , + TeamAttack = , + FailIfNotFirstTurn = , + PreventStatus = , + Stockpile = , + AttackWithStockPile = , + UseStockPile = , + NoRepeatMove = , + LoseAttackIfHit = , + Bullseye = , + // Nature Power: + // In caves, uses Shadow Ball. + // In tall grass, uses Razor Leaf. + // In sand, uses Earthquake. + // In moving water (rivers, sea), uses Surf. + // Underwater, uses Hydro Pump. + // In still water, uses Bubblebeam. + // In short grass, uses Stun Spore. + // On rocks, uses Rock Slide. + // Elsewhere, uses Swift. + BoostType = , + DisableNondamagingMoves = , + // Helping Hand: Effectiveness of attacks by user's partner this round is multiplied by 1.5. Fails if user doesn't have a partner or if user struck after its partner. + SwapItems = , + StealAbility = , + DelayEffect = , + // Assist: Uses a random move from a random Pokemon in user's party, other than the user and eggs. Does not use the following attacks: Sleep Talk, Assist, Mirror Move, Metronome, Struggle, Sketch, Mimic, Counter, Mirror Coat, Protect, Detect, Endure, Destiny Bond, Thief, Follow Me, Snatch, Helping Hand, Covet, Trick, or Focus Punch. + StayOnField = , + // Magic Coat: The next time this round, certain attacks by non-users that target user are directed to that non-user instead of to the user. Effect ends when user faints. + RecycleItem = , + Revenge = , + BrickShields = , + KnockAwayItem = , + DamageByDamageDifference = , + // Eruption, Water Spout: Base damage is min(1,int(user's current HP * 150 / user's total HP)). Minimum 1, maximum 150. + TradeAbility = , + BlockKnownMoves = , + // Snatch: The next time this round, user, instead of the non-user, uses certain attacks if they are used by non-users. + // Secret Power + // In moving water (rivers, sea), may decrease opponent's Attack by one stage. + // In still water, may decrease opponent's Speed by one stage. + // Underwater, may decrease opponent's Defense by one stage. + // In sand, may decrease opponent's Accuracy by one stage. + // In a cave, opponent may flinch if this attack strikes first. + // On rocks, may confuse opponent. + // In short grass, may poison opponent. + // In tall grass, may put opponent to sleep. + // Elsewhere, may paralyze opponent. + BreventType = , + WeatherTypeLink = , + // Camouflage: On and under water, user's type becomes Water. In caves and on rocks, user's type becomes Rock. On short and tall grass, user's type becomes Grass. In sand, user's type becomes Ground. Elsewhere, user's type becomes Normal. Fails if determined type is the same as one of the user's types. + // Roost: Recovers to user half of total HP. Until the end of the round, attacks against user always have normal effectiveness against the Flying type. [Does it actually lose Flying type?] + // Gravity: During effect, Fly, Bounce, Hi Jump Kick, Splash, and Jump Kick are disabled for all active Pokemon. During effect, Ground-type moves are effective to each active Pokemon, and each active Pokemon can lose HP because of Spikes, Toxic Spikes, [or Stealth Rock], as though it did not have Levitate and as though its current type did not include Flying. When this attack is used, the effects of Fly and Bounce end for all active Pokemon. (Presumably increases accuracy of moves.) + // Miracle Eye: During effect, evasion modifications are ignored for attacks by the user. During effect, normal- and fighting-type attacks by the user have normal effectiveness against the Ghost type. Effect ends when user is switched/replaced. + Status Multiplier = , + // Gyro Ball This attack's base damage is equal to int((opponent's current Speed*25)/max(user's current Speed,1))+1. Maximum 150. + Sacrifice = , + // Brine: Base damage/Effectiveness] is doubled if user's HP is less than [or equal to] half of total HP. + // Natural Gift: This attack's type and base damage depend on the Berry the user is holding. If this attack is successful, the item is consumed. Fails if user isn't holding a Berry. (Klutz? What if ineffective?) + // Feint: Fails unless Protect or Detect is in effect for opponent this round. + // Pluck, Bug Bite: If this attack is successful and opponent is holding a Berry, user uses that item and that item is consumed. (Klutz?) + // Tailwind + // Acupressure: If any of user's stat stages can be increased, increases one of those stat stages chosen at random by 2. + // Metal Burst: Returns X times 2 to the last non-user who hit the user with an attack this round, where X is the amount of HP lost by user due to that attack. + // U-turn: If this attack is successful, this attack switches Pokemon even if an effect prevents the user from switching.[Pursuit behavior to be clarified.] + // Close Combat + // Payback: [Base damage/Effectiveness] is doubled if opponent lost HP this round. (Pain Split? Substitute?) + // Embargo: Effect lasts for -- rounds, including the current round. During effect, opponent cannot use its held item and items cannot be used on opponent. + // Fling: User throws its item at opponent. This attack's base damage depends on the item the user is holding. More information. [What if ineffective?] Opponent uses the thrown item if it could do so; then the item is lost. + GiveStatus = , + // Trump Card: If this attack has 0 PP, this attack's base damage is 200. If this attack has 1 PP, this attack's base damage is 80. If this attack has 2 PP, this attack's base damage is 60. If this attack has 3 PP, this attack's base damage is 50. If this attack has 4 or more PP, this attack's base damage is 40. + HealBlock = , + // Wring Out, Crush Grip: This attack's base damage is equal to int((opponent's current HP)*120/max(1,opponent's total HP))+1. + SwitchStats = , + TradeStats = , + IgnoreAbility = , + PreventCriticalHits = , + // Me First + CopyLastMoveUsed = , + SwapStatStages = , + TradeStatStages = , + // Punishment: This attack's base damage is equal to min(200,60+(20*X)), where X is the total of all of opponent's current stat stages that are greater than 0. + // Last Resort: Fails unless user had previously used all its other moves at least once [this battle/since the last time user became active]. [Probably: Fails if user has no other moves.] + ForceEnemyAbility = , + // Sucker Punch: Fails if opponent did not choose a move for use this round. + // Aqua Ring + // Magnet Rise: For five rounds, including the current round, user is immune to Ground-type moves as though it had Levitate. [Spikes/Gravity?] Effect ends when user is switched/replaced. + // Flare Blitz + // Defog + // Trick Room: Effect lasts for five rounds, starting with the next round. During effect, the priority is reversed for each priority level among all attacks used during each round. [Effect ends when any active Pokemon uses this attack.] + // Volt Tackle + // Bounce + // Captivate: Decreases user's Special Attack by 2 stages. Fails if opponent's gender is the same as the user's or if either is genderless. + // Stealth Rock: During effect, whenever an opposing Pokemon becomes active, that Pokemon, unless it has Flying [or it has the Levitate ability,] loses X/8 of total HP, where X is the type effectiveness of the Rock type against that Pokemon's types. Effect ends when any opposing Pokemon uses Rapid Spin. + // Judgement: If user is holding a Plate, this attack's type depends on the Plate held. + // Seed Flare: May decrease opponent's Special Defense by -- stage(s). */ - E_End,/* = , - CutHM = , + E_End,// = , +/* CutHM = , FlyHM = , SurfHM = , StrengthHM = , @@ -104,7 +227,6 @@ namespace PokeGen EscapeHM = ,*/ E_End_Overworld// = }; - // TODO (Ben#1#): Move Effects static const char* EffectStr[E_End_Overworld]; MoveEffect(const Pokemod& par, const unsigned _id); @@ -119,20 +241,22 @@ namespace PokeGen void setChanceDenom(const unsigned d); void setEffect(const unsigned e); void setVal1(const unsigned v1); - void setVal2(const int v2); - void setVal3(const unsigned n, const unsigned d); - void setVal3Num(const unsigned n); - void setVal3Denom(const unsigned d); + void setVal2(const unsigned v2); + void setVal3(const int v3); + void setVal4(const unsigned n, const unsigned d); + void setVal4Num(const unsigned n); + void setVal4Denom(const unsigned d); Frac getChance() const; unsigned getChanceNum() const; unsigned getChanceDenom() const; unsigned getEffect() const; unsigned getVal1() const; - int getVal2() const; - Frac getVal3() const; - unsigned getVal3Num() const; - unsigned getVal3Denom() const; + unsigned getVal2() const; + int getVal3() const; + Frac getVal4() const; + unsigned getVal4Num() const; + unsigned getVal4Denom() const; MoveEffect& operator=(const MoveEffect& rhs); private: @@ -141,8 +265,9 @@ namespace PokeGen Frac chance; unsigned effect; unsigned val1; - int val2; - Frac val3; + unsigned val2; + int val3; + Frac val4; }; } } diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index 538acecb..9882d330 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -35,7 +35,7 @@ PokeGen::PokeMod::Pokemod::Pokemod(const QString& fname) : startDialog(UINT_MAX), superPCUname(""), superPCPasswd(""), - struggleMove(UINT_MAX), + typeChart(1, 1, Frac(1, 1, Frac::Improper)), rules(*this) { load(fname); @@ -119,9 +119,9 @@ bool PokeGen::PokeMod::Pokemod::validate() const validationMsg("Super PC username not defined", V_Warn); if (superPCPasswd == "") validationMsg("Super PC password not defined", V_Warn); - if (getMoveByID(struggleMove) == UINT_MAX) + if ((typeChart.getWidth() != getTypeCount()) || (typeChart.getHeight() != getTypeCount())) { - validationMsg("Invalid struggle move"); + validationMsg("TypeChart is invalid"); valid = false; } if (!rules.isValid()) @@ -635,7 +635,17 @@ void PokeGen::PokeMod::Pokemod::load(const QString& fname) ini.getValue("startDialog", startDialog); ini.getValue("superPCUname", superPCUname); ini.getValue("superPCPasswd", superPCPasswd); - ini.getValue("struggleMove", struggleMove); + for (unsigned i = 0; i < pokemod.getTypeCount(); ++i) + { + for (unsigned j = 0; j < pokemod.getTypeCount(); ++j) + { + unsigned k; + unsigned l; + ini.getValue(QString("typeChart-%1-%2-n").arg(i).arg(j), k, 1); + ini.getValue(QString("typeChart-%1-%2-d").arg(i).arg(j), l, 1); + setTypeChart(i, j, k, l); + } + } QDir fdir(path); if (QFile::exists(QString("%1/rules.pini").arg(path))) rules.load(QString("%1/rules.pini").arg(path)); @@ -766,7 +776,14 @@ void PokeGen::PokeMod::Pokemod::save() const ini.addField("startDialog", startDialog); ini.addField("superPCUname", superPCUname); ini.addField("superPCPasswd", superPCPasswd); - ini.addField("struggleMove", struggleMove); + for (unsigned i = 1; i < typeChart.getWidth(); ++i) + { + for (unsigned j = 1; j < typeChart.getHeight(); ++j) + { + ini.addField(QString("typeChart-%1-%2-n").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getNum()); + ini.addField(QString("typeChart-%1-%2-d").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getDenom()); + } + } ini.save(QString("%1/data.pini").arg(getPath())); rules.save(); for (QListIterator<Ability> i(abilities); i.hasNext(); ) @@ -942,11 +959,29 @@ void PokeGen::PokeMod::Pokemod::setSuperPCPasswd(const QString& p) superPCPasswd = p; } -void PokeGen::PokeMod::Pokemod::setStruggleMove(const unsigned s) +void PokeGen::PokeMod::Pokemod::setTypeChart(const unsigned att, const unsigned def, const unsigned n, const unsigned d) +{ + typeChart(att, def).set(n, d); +} + +void PokeGen::PokeMod::Pokemod::setTypeChartNum(const unsigned att, const unsigned def, const unsigned n) +{ + typeChart(att, def).setNum(n); +} + +void PokeGen::PokeMod::Pokemod::setTypeChartDenom(const unsigned att, const unsigned def, const unsigned d) +{ + typeChart(att, def).setDenom(d); +} + +void PokeGen::PokeMod::Pokemod::setRules(const Rules& r) +{ + rules = r; +} + +void PokeGen::PokeMod::Pokemod::setRules(const QString& fname) { - if (getMoveByID(s) == UINT_MAX) - throw("Pokemod: struggleMove out-of-bounds"); - struggleMove = s; + rules.load(fname); } QString PokeGen::PokeMod::Pokemod::getTitle() const @@ -1009,9 +1044,39 @@ QString PokeGen::PokeMod::Pokemod::getSuperPCPasswd() const return superPCPasswd; } -unsigned PokeGen::PokeMod::Pokemod::getStruggleMove() const +const PokeGen::FracMatrix& PokeGen::PokeMod::Pokemod::getTypeChart() const +{ + return typeChart; +} + +PokeGen::FracMatrix& PokeGen::PokeMod::Pokemod::getTypeChart() +{ + return typeChart; +} + +PokeGen::Frac PokeGen::PokeMod::Pokemod::getTypeChart(const unsigned att, const unsigned def) const +{ + return typeChart(att, def); +} + +unsigned PokeGen::PokeMod::Pokemod::getTypeChartNum(const unsigned att, const unsigned def) const +{ + return getTypeChart(att, def).getNum(); +} + +unsigned PokeGen::PokeMod::Pokemod::getTypeChartDenom(const unsigned att, const unsigned def) const +{ + return getTypeChart(att, def).getDenom(); +} + +const PokeGen::PokeMod::Rules& PokeGen::PokeMod::Pokemod::getRules() const +{ + return rules; +} + +PokeGen::PokeMod::Rules& PokeGen::PokeMod::Pokemod::getRules() { - return struggleMove; + return rules; } const PokeGen::PokeMod::Ability& PokeGen::PokeMod::Pokemod::getAbility(const unsigned i) const @@ -1843,7 +1908,6 @@ unsigned PokeGen::PokeMod::Pokemod::getTypeCount() const PokeGen::PokeMod::Type& PokeGen::PokeMod::Pokemod::newType() { - FracMatrix& typeChart = rules.getTypeChart(); unsigned i; types.append(Type(*this, i = getNewTypeId())); typeChart.addCol(Frac(1, 1)); @@ -1853,7 +1917,6 @@ PokeGen::PokeMod::Type& PokeGen::PokeMod::Pokemod::newType() PokeGen::PokeMod::Type& PokeGen::PokeMod::Pokemod::newType(const QString& fname) { - FracMatrix& typeChart = rules.getTypeChart(); unsigned i; types.append(Type(*this, fname, i = getNewTypeId())); typeChart.addCol(Frac(1, 1)); @@ -1863,7 +1926,6 @@ PokeGen::PokeMod::Type& PokeGen::PokeMod::Pokemod::newType(const QString& fname) PokeGen::PokeMod::Type& PokeGen::PokeMod::Pokemod::newType(const Type& t) { - FracMatrix& typeChart = rules.getTypeChart(); unsigned i; types.append(Type(*this, t, i = getNewTypeId())); typeChart.addCol(Frac(1, 1)); @@ -1875,6 +1937,6 @@ void PokeGen::PokeMod::Pokemod::deleteType(const unsigned i) { if (getTypeCount() <= i) throw("Pokemod: out-of-bounds"); - rules.getTypeChart().deleteCol(i); - rules.getTypeChart().deleteRow(i); + typeChart.deleteCol(i); + typeChart.deleteRow(i); } diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index b10269b8..c6754d2a 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -32,6 +32,8 @@ #include <QString> #include <QStringList> #include <QStringListIterator> +#include "../general/FracMatrix.h" +#include "../general/Point.h" #include "../general/Ref.h" #include "pokemod_inc.h" #include "Object.h" @@ -97,8 +99,11 @@ namespace PokeGen void setSurfFishSkin(const QString& fname); void setSuperPCUname(const QString& u); void setSuperPCPasswd(const QString& p); - void setStruggleMove(const unsigned s); + void setTypeChart(const unsigned att, const unsigned def, const unsigned n, const unsigned d); + void setTypeChartNum(const unsigned att, const unsigned def, const unsigned n); + void setTypeChartDenom(const unsigned att, const unsigned def, const unsigned d); void setRules(const Rules& r); + void setRules(const QString& fname); QString getTitle() const; QString getVersion() const; @@ -112,7 +117,11 @@ namespace PokeGen unsigned getStartDialog() const; QString getSuperPCUname() const; QString getSuperPCPasswd() const; - unsigned getStruggleMove() const; + const FracMatrix& getTypeChart() const; + FracMatrix& getTypeChart(); + Frac getTypeChart(const unsigned att, const unsigned def) const; + unsigned getTypeChartNum(const unsigned att, const unsigned def) const; + unsigned getTypeChartDenom(const unsigned att, const unsigned def) const; const Rules& getRules() const; Rules& getRules(); @@ -290,7 +299,7 @@ namespace PokeGen unsigned startDialog; QString superPCUname; QString superPCPasswd; - unsigned struggleMove; + FracMatrix typeChart; Rules rules; QList<Ability> abilities; diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp index 0daede2a..92ce05f5 100644 --- a/pokemod/Rules.cpp +++ b/pokemod/Rules.cpp @@ -26,7 +26,6 @@ PokeGen::PokeMod::Rules::Rules(const Pokemod& par) : Object(par, 0), genderAllowed(false), breedingAllowed(false), - eggSpecies(UINT_MAX), holdItems(0), criticalDomains(false), abilityAllowed(false), @@ -49,8 +48,7 @@ PokeGen::PokeMod::Rules::Rules(const Pokemod& par) : effortValuesAllowed(false), maxTotalEV(0), maxEVPerStat(0), - pokerusChance(1, 1), - typeChart(1, 1, Frac(1, 1, Frac::Improper)) + pokerusChance(1, 1) { } @@ -64,11 +62,6 @@ bool PokeGen::PokeMod::Rules::validate() const { bool valid = true; pokemod.validationMsg("---Rules", Pokemod::V_Msg); - if (genderAllowed && breedingAllowed || (pokemod.getSpeciesByID(eggSpecies) == UINT_MAX)) - { - pokemod.validationMsg("Invalid egg species"); - valid = false; - } if (!numPokemonBoxes) pokemod.validationMsg("Invalid number of Pokémon boxes", Pokemod::V_Warn); else if (!numPokemonPerBox) @@ -118,7 +111,6 @@ void PokeGen::PokeMod::Rules::load(const QString& fname) unsigned j; ini.getValue("genderAllowed", genderAllowed, false); ini.getValue("breedingAllowed", breedingAllowed, false); - ini.getValue("eggSpecies", eggSpecies); ini.getValue("holdItems", holdItems, 0); ini.getValue("criticalDomains", criticalDomains, false); ini.getValue("abilityAllowed", abilityAllowed, false); @@ -144,17 +136,6 @@ void PokeGen::PokeMod::Rules::load(const QString& fname) ini.getValue("pokerusChance-n", i, 1); ini.getValue("pokerusChance-d", j, 1); pokerusChance.set(i, j); - for (unsigned i = 0; i < pokemod.getTypeCount(); ++i) - { - for (unsigned j = 0; j < pokemod.getTypeCount(); ++j) - { - unsigned k; - unsigned l; - ini.getValue(QString("typeChart-%1-%2-n").arg(i).arg(j), k, 1); - ini.getValue(QString("typeChart-%1-%2-d").arg(i).arg(j), l, 1); - setTypeChart(i, j, k, l); - } - } } void PokeGen::PokeMod::Rules::save() const @@ -162,7 +143,6 @@ void PokeGen::PokeMod::Rules::save() const Ini ini; ini.addField("genderAllowed", genderAllowed); ini.addField("breedingAllowed", breedingAllowed); - ini.addField("eggSpecies", eggSpecies); ini.addField("holdItems", holdItems); ini.addField("criticalDomains", criticalDomains); ini.addField("abilityAllowed", abilityAllowed); @@ -187,14 +167,6 @@ void PokeGen::PokeMod::Rules::save() const ini.addField("maxEVPerStat", maxEVPerStat); ini.addField("pokerusChance-n", pokerusChance.getNum()); ini.addField("pokerusChance-d", pokerusChance.getDenom()); - for (unsigned i = 1; i < typeChart.getWidth(); ++i) - { - for (unsigned j = 1; j < typeChart.getHeight(); ++j) - { - ini.addField(QString("typeChart-%1-%2-n").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getNum()); - ini.addField(QString("typeChart-%1-%2-d").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getDenom()); - } - } ini.save(QString("%1/rules.pini").arg(pokemod.getPath())); } @@ -212,15 +184,6 @@ void PokeGen::PokeMod::Rules::setBreedingAllowed(const bool b) breedingAllowed = b; } -void PokeGen::PokeMod::Rules::setEggSpecies(const unsigned e) -{ - if (!breedingAllowed) - throw("Rules: ne eggs without breeding"); - if (pokemod.getSpeciesByID(e) == UINT_MAX) - throw("Rules: eggSpecies out-of-bounds"); - eggSpecies = e; -} - void PokeGen::PokeMod::Rules::setHoldItems(const unsigned h) { holdItems = h; @@ -372,11 +335,6 @@ bool PokeGen::PokeMod::Rules::getBreedingAllowed() const return breedingAllowed; } -unsigned PokeGen::PokeMod::Rules::getEggSpecies() const -{ - return eggSpecies; -} - unsigned PokeGen::PokeMod::Rules::getHoldItems() const { return holdItems; @@ -502,53 +460,12 @@ unsigned PokeGen::PokeMod::Rules::getPokerusChanceDenom() const return pokerusChance.getDenom(); } -void PokeGen::PokeMod::Rules::setTypeChart(const unsigned att, const unsigned def, const unsigned n, const unsigned d) -{ - typeChart(att, def).set(n, d); -} - -void PokeGen::PokeMod::Rules::setTypeChartNum(const unsigned att, const unsigned def, const unsigned n) -{ - typeChart(att, def).setNum(n); -} - -void PokeGen::PokeMod::Rules::setTypeChartDenom(const unsigned att, const unsigned def, const unsigned d) -{ - typeChart(att, def).setDenom(d); -} - -const PokeGen::FracMatrix& PokeGen::PokeMod::Rules::getTypeChart() const -{ - return typeChart; -} - -PokeGen::FracMatrix& PokeGen::PokeMod::Rules::getTypeChart() -{ - return typeChart; -} - -PokeGen::Frac PokeGen::PokeMod::Rules::getTypeChart(const unsigned att, const unsigned def) const -{ - return typeChart(att, def); -} - -unsigned PokeGen::PokeMod::Rules::getTypeChartNum(const unsigned att, const unsigned def) const -{ - return getTypeChart(att, def).getNum(); -} - -unsigned PokeGen::PokeMod::Rules::getTypeChartDenom(const unsigned att, const unsigned def) const -{ - return getTypeChart(att, def).getDenom(); -} - PokeGen::PokeMod::Rules& PokeGen::PokeMod::Rules::operator=(const Rules& rhs) { if (this == &rhs) return *this; genderAllowed = rhs.genderAllowed; breedingAllowed = rhs.breedingAllowed; - eggSpecies = rhs.eggSpecies; holdItems = rhs.holdItems; criticalDomains = rhs.criticalDomains; abilityAllowed = rhs.abilityAllowed; @@ -572,6 +489,5 @@ PokeGen::PokeMod::Rules& PokeGen::PokeMod::Rules::operator=(const Rules& rhs) maxTotalEV = rhs.maxTotalEV; maxEVPerStat = rhs.maxEVPerStat; pokerusChance = rhs.pokerusChance; - typeChart = rhs.typeChart; return *this; } diff --git a/pokemod/Rules.h b/pokemod/Rules.h index 118a4610..deaa3138 100644 --- a/pokemod/Rules.h +++ b/pokemod/Rules.h @@ -25,12 +25,8 @@ #include <QString> #include "../general/Frac.h" -#include "../general/FracMatrix.h" -#include "../general/Point.h" #include "Object.h" #include "Pokemod.h" -#include "Species.h" -#include "Type.h" namespace PokeGen { @@ -48,7 +44,6 @@ namespace PokeGen void setGenderAllowed(const bool g); void setBreedingAllowed(const bool b); - void setEggSpecies(const unsigned e); void setHoldItems(const unsigned h); void setCriticalDomains(const bool c); void setAbilityAllowed(const bool a); @@ -77,7 +72,6 @@ namespace PokeGen bool getGenderAllowed() const; bool getBreedingAllowed() const; - unsigned getEggSpecies() const; unsigned getHoldItems() const; bool getCriticalDomains() const; bool getAbilityAllowed() const; @@ -104,22 +98,12 @@ namespace PokeGen unsigned getPokerusChanceNum() const; unsigned getPokerusChanceDenom() const; - void setTypeChart(const unsigned att, const unsigned def, const unsigned n, const unsigned d); - void setTypeChartNum(const unsigned att, const unsigned def, const unsigned n); - void setTypeChartDenom(const unsigned att, const unsigned def, const unsigned d); - const FracMatrix& getTypeChart() const; - FracMatrix& getTypeChart(); - Frac getTypeChart(const unsigned att, const unsigned def) const; - unsigned getTypeChartNum(const unsigned att, const unsigned def) const; - unsigned getTypeChartDenom(const unsigned att, const unsigned def) const; - Rules& operator=(const Rules& rhs); private: bool validate() const; bool genderAllowed; bool breedingAllowed; - unsigned eggSpecies; unsigned holdItems; bool criticalDomains; bool abilityAllowed; @@ -143,8 +127,6 @@ namespace PokeGen unsigned maxTotalEV; unsigned maxEVPerStat; Frac pokerusChance; - - FracMatrix typeChart; }; } } |
