diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-08-05 17:44:25 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-08-05 17:44:25 +0000 |
| commit | fa4764c9e4d86fdfa976bb9fa9f6976e82c496d5 (patch) | |
| tree | 3137a434b832ddf321723297f5b4b1ed75bc4fc0 /pokebattle/TeamMember.cpp | |
| parent | cf49a16b29ac412cfea125f7216a0e51e79aa4de (diff) | |
| download | sigen-fa4764c9e4d86fdfa976bb9fa9f6976e82c496d5.tar.gz sigen-fa4764c9e4d86fdfa976bb9fa9f6976e82c496d5.tar.xz sigen-fa4764c9e4d86fdfa976bb9fa9f6976e82c496d5.zip | |
[FIX] ScriptWidget editing now works a lot better
[FIX] Kate settings saved
[FIX] Assertions within TeamMember removed
[FIX] Arenas inherit from Config now
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@238 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokebattle/TeamMember.cpp')
| -rw-r--r-- | pokebattle/TeamMember.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/pokebattle/TeamMember.cpp b/pokebattle/TeamMember.cpp index a8e58fc3..595f338d 100644 --- a/pokebattle/TeamMember.cpp +++ b/pokebattle/TeamMember.cpp @@ -90,9 +90,28 @@ Pokebattle::TeamMember::TeamMember(Pokescripting::MapTrainerTeamMemberWrapper* t Pokescripting::SpeciesWrapper* species = pokemod()->species(m_species); setName(species->name()); setLevel(teamMember->level()); - teamMember->items(); - // TODO: grab information from the class - // TODO: fill in anything else + QList<Pokescripting::ItemWrapper*> items = teamMember->items(); + foreach (Pokescripting::ItemWrapper* item, items) + m_items.append(item->id()); + QList<Pokescripting::AbilityWrapper*> abilities = teamMember->abilities(); + foreach (Pokescripting::AbilityWrapper* ability, abilities) + m_abilities.append(ability->id()); + initAbilities(); + QList<Pokescripting::MoveWrapper*> moves = teamMember->moves(); + foreach (Pokescripting::MoveWrapper* move, moves) + m_moves.append(move->id()); + initMoves(); + QList<Pokescripting::NatureWrapper*> natures = teamMember->natures(); + foreach (Pokescripting::NatureWrapper* nature, natures) + m_natures.append(nature->id()); + initNatures(); + initStats(); + if (species->genderFactor() <= 1) + m_gender = species->genderFactor().poll(); + else + m_gender = -1; + for (int i = 0; i < Pokemod::ST_End_GSC; ++i) + m_statExp[i] = 0; } QString Pokebattle::TeamMember::name() const @@ -112,7 +131,6 @@ int Pokebattle::TeamMember::level() const int Pokebattle::TeamMember::statValue(const int stat, const int exp) const { - Q_ASSERT(stat < (pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY)); int statValue; if (exp < 0) statValue = m_statExp[stat]; @@ -191,7 +209,6 @@ int Pokebattle::TeamMember::calcExp(int level) const default: break; } - Q_ASSERT(false); return -1; } @@ -361,14 +378,12 @@ Pokescripting::PokemodWrapper* Pokebattle::TeamMember::pokemod() const void Pokebattle::TeamMember::setSpecies(const int species) { - Q_ASSERT(pokemod()->speciesIndex(species) != INT_MAX); m_species = species; emit(speciesChanged(m_species)); } void Pokebattle::TeamMember::setLevel(const int level) { - Q_ASSERT(level <= pokemod()->rules()->maxLevel()); m_level = level; m_levelExp = calcExp(); } @@ -401,7 +416,11 @@ void Pokebattle::TeamMember::initAbilities() Pokemod::Hat<Pokescripting::AbilityWrapper*> hat = pokemod()->species(m_species)->abilityHat(); m_abilities.clear(); while (m_abilities.size() < pokemod()->rules()->maxAbilities()) - m_abilities.append(hat.takeAndClear()->id()); + { + int ability = hat.takeAndClear()->id(); + if (!m_abilities.contains(ability)) + m_abilities.append(ability); + } } void Pokebattle::TeamMember::initMoves() @@ -414,15 +433,18 @@ void Pokebattle::TeamMember::initMoves() if (!m_moves.contains(move->move()->id()) && (((move->level() < m_level) && move->level()) || (!m_containment->isMutable() && (move->wild() < m_level)))) m_moves.append(move->move()->id()); } - Q_ASSERT(m_moves.size()); } void Pokebattle::TeamMember::initNatures() { - m_natures.clear(); Pokemod::Hat<Pokescripting::NatureWrapper*> hat = pokemod()->natureHat(); + m_natures.clear(); while (m_natures.size() < pokemod()->rules()->maxNatures()) - m_natures.append(hat.takeAndClear()->id()); + { + int nature = hat.takeAndClear()->id(); + if (!m_natures.contains(nature)) + m_natures.append(nature); + } } void Pokebattle::TeamMember::initStats() |
