summaryrefslogtreecommitdiffstats
path: root/pokemod/Species.h
blob: c0d934608d40b6164951abf7412bb8f54c055c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/*
 * 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/>.
 */

#ifndef __POKEMOD_SPECIES__
#define __POKEMOD_SPECIES__

// Pokemod includes
#include "Fraction.h"
#include "Object.h"
#include "Pokemod.h"

// Qt includes
#include <QList>

// Forward declarations
class SpeciesAbility;
class SpeciesEvolution;
class SpeciesItem;
class SpeciesMove;

class Species : public Object
{
    Q_OBJECT
    
    public:
        enum
        {
            Fluctuating = 0,
            Fading = 1,
            Slow = 2,
            Normal = 3,
            Fast = 5,
            Erratic = 6,
            End = 7
        };
        static const QStringList StyleStr;
        
        Species(const Species& species);
        Species(const Pokemod* parent, const int id);
        Species(const Species& species, const Pokemod* parent, const int id);
        Species(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX);
        ~Species();
        
        void validate();
        
        void load(const QDomElement& xml, int id = INT_MAX);
        QDomElement save() const;
        
        void setName(const QString& name);
        void setBaseStat(const int stat, const int base);
        void setEffortValue(const int stat, const int effortPoints);
        void setGrowth(const int growth);
        void setExperienceValue(const int experienceValue);
        void setCatchValue(const int catchValue);
        void setRunChance(const Fraction& runChance);
        void setFleeChance(const Fraction& fleeChance);
        void setItemChance(const Fraction& itemChance);
        void setPokedexNumber(const int pokedexNumber);
        void setWeight(const int weight);
        void setHeightFeet(const int feet);
        void setHeightInches(const int inches);
        void setPokedexEntry(const QString& pokedexEntry);
        void setFrontMaleSprite(const QPixmap& frontMaleSprite);
        void setBackMaleSprite(const QPixmap& backMaleSprite);
        void setFrontFemaleSprite(const QPixmap& frontFemaleSprite);
        void setBackFemaleSprite(const QPixmap& backFemaleSprite);
        void setListSprite(const QPixmap& listSprite);
        void setGenderFactor(const Fraction& genderFactor);
        void setEggSpecies(const int eggSpecies);
        void setEggSteps(const int eggSteps);
        void setNidoranGroup(const int nidoranGroup);
        void setType(const int type, const bool state);
        void setEggGroup(const int eggGroup, const bool state);
        
        QString name() const;
        int baseStat(const int stat) const;
        int effortValue(const int stat) const;
        int growth() const;
        int experienceValue() const;
        int catchValue() const;
        Fraction runChance() const;
        Fraction fleeChance() const;
        Fraction itemChance() const;
        int pokedexNumber() const;
        int weight() const;
        int heightFeet() const;
        int heightInches() const;
        QString pokedexEntry() const;
        QPixmap frontMaleSprite() const;
        QPixmap backMaleSprite() const;
        QPixmap frontFemaleSprite() const;
        QPixmap backFemaleSprite() const;
        QPixmap listSprite() const;
        Fraction genderFactor() const;
        int eggSpecies() const;
        int eggSteps() const;
        int nidoranGroup() const;
        bool type(const int type) const;
        bool eggGroup(const int eggGroup) const;
        
        const SpeciesAbility* ability(const int index) const;
        SpeciesAbility* ability(const int index);
        const SpeciesAbility* abilityById(const int id) const;
        SpeciesAbility* abilityById(const int id);
        int abilityIndex(const int id) const;
        int abilityCount() const;
        SpeciesAbility* newAbility();
        SpeciesAbility* newAbility(const QDomElement& xml);
        SpeciesAbility* newAbility(const SpeciesAbility& ability);
        void deleteAbility(const int index);
        void deleteAbilityById(const int id);
        
        const SpeciesEvolution* evolution(const int index) const;
        SpeciesEvolution* evolution(const int index);
        const SpeciesEvolution* evolutionById(const int id) const;
        SpeciesEvolution* evolutionById(const int id);
        int evolutionIndex(const int id) const;
        int evolutionCount() const;
        SpeciesEvolution* newEvolution();
        SpeciesEvolution* newEvolution(const QDomElement& xml);
        SpeciesEvolution* newEvolution(const SpeciesEvolution& evolution);
        void deleteEvolution(const int index);
        void deleteEvolutionById(const int id);
        
        const SpeciesItem* item(const int index) const;
        SpeciesItem* item(const int index);
        const SpeciesItem* itemById(const int i) const;
        SpeciesItem* itemById(const int i);
        int itemIndex(const int id) const;
        int itemCount() const;
        SpeciesItem* newItem();
        SpeciesItem* newItem(const QDomElement& xml);
        SpeciesItem* newItem(const SpeciesItem& item);
        void deleteItem(const int index);
        void deleteItemById(const int id);
        
        const SpeciesMove* move(const int index) const;
        SpeciesMove* move(const int index);
        const SpeciesMove* moveById(const int id) const;
        SpeciesMove* moveById(const int id);
        int moveIndex(const int id) const;
        int moveCount() const;
        SpeciesMove* newMove();
        SpeciesMove* newMove(const QDomElement& xml);
        SpeciesMove* newMove(const SpeciesMove& move);
        void deleteMove(const int index);
        void deleteMoveById(const int id);
        
        Species& operator=(const Species& rhs);
    private:
        int newAbilityId() const;
        SpeciesAbility* newAbility(SpeciesAbility* ability);
        
        int newEvolutionId() const;
        SpeciesEvolution* newEvolution(SpeciesEvolution* evolution);
        
        int newItemId() const;
        SpeciesItem* newItem(SpeciesItem* item);
        
        int newMoveId() const;
        SpeciesMove* newMove(SpeciesMove* move);
        
        void clear();
        
        QString m_name;
        bool m_baseStat[Pokemod::ST_End_GSC];
        bool m_effortValue[Pokemod::ST_End_GSC];
        int m_growth;
        int m_experienceValue;
        int m_catchValue;
        Fraction m_runChance;
        Fraction m_fleeChance;
        Fraction m_itemChance;
        int m_pokedexNumber;
        int m_weight;
        int m_heightFeet;
        int m_heightInches;
        QPixmap m_frontMaleSprite;
        QPixmap m_backMaleSprite;
        QPixmap m_frontFemaleSprite;
        QPixmap m_backFemaleSprite;
        QPixmap m_listSprite;
        QString m_pokedexEntry;
        Fraction m_genderFactor;
        int m_eggSpecies;
        int m_eggSteps;
        int m_nidoranGroup;
        QList<int> m_type;
        QList<int> m_eggGroup;
        QList<SpeciesAbility*> m_abilities;
        QList<SpeciesEvolution*> m_evolutions;
        QList<SpeciesItem*> m_items;
        QList<SpeciesMove*> m_moves;
};

#endif