summaryrefslogtreecommitdiffstats
path: root/pokemod/ItemEffect.h
blob: 88851d7014eb213ad32df798c44f9c5dfae3a666 (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
/////////////////////////////////////////////////////////////////////////////
// Name:        pokemod/ItemEffect.h
// Purpose:     Define an effect of an item
// Author:      Ben Boeckel
// Modified by: Ben Boeckel
// Created:     Tue Mar 20 18:25:26 2007
// Copyright:   ©2007 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/>.
/////////////////////////////////////////////////////////////////////////////

#ifndef __POKEMOD_ITEMEFFECT__
#define __POKEMOD_ITEMEFFECT__

#include <QFile>
#include <QString>
#include "Object.h"
#include "Pokemod.h"
#include "MapWildList.h"

namespace PokeGen
{
    namespace PokeMod
    {
        class ItemEffect : public Object
        {
            public:
                enum Effect
                {
                    E_HPCure = 0,
                    E_Revive = 1,
                    E_CureStatus = 2,
                    E_LevelBoost = 3,
                    E_StatBoost = 4,
                    E_Flinch = 5,
                    E_First = 6,
                    E_KeepAlive = 7,
                    E_ModifyStatBattle = 8,
                    E_ShieldBattle = 9,
                    E_RunBattle = 10,
                    E_PPBoost = 11,
                    E_TypeBoost = 12,
                    E_PPRestore = 13,
                    E_ExpShare = 14,
                    E_Fish = 15,
                    E_Repel = 16,
                    E_Escape = 17,
                    E_TM = 18,
                    E_HM = 19,
                    E_Map = 20,
                    E_Ball = 21,
                    E_Itemfinder = 22,
                    E_Bike = 23,
                    E_Scope = 24,
                    E_Coin = 25,
                    E_CoinCase = 26,
                    E_Berry = 27,
                    E_Acorn = 28,
                    E_Evolution = 29,
                    E_End = 30
                };
                static const char* EffectStr[E_End];
                
                enum Relative
                {
                    R_Absolute = 0,
                    R_Relative = 1,
                    R_End = 2
                };
                static const char* RelativeStr[R_End];
                
                enum Escape
                {
                    ES_Anywhere = 0,
                    ES_Dungeon = 1,
                    ES_End = 2
                };
                static const char* EscapeStr[ES_End];
                
                enum Repel
                {
                    RP_First = 0,
                    RP_Max = 1,
                    RP_All = 2,
                    RP_End = 3
                };
                static const char* RepelStr[RP_End];
                
                enum Amount
                {
                    A_All = 0,
                    A_One = 1,
                    A_End = 2
                };
                static const char* AmountStr[A_End];
                
                enum SpecialPhysical
                {
                    SP_Special = 0,
                    SP_Physical = 1,
                    SP_End = 2
                };
                static const char* SpecialPhysicalStr[SP_End];
                
                enum BallType
                {
                    B_Regular = 0,
                    B_Master = 1,
                    B_Level = 2,
                    B_Love = 3,
                    B_Area = 4,
                    B_Time = 5,
                    B_Battle = 6,
                    B_Friend = 7,
                    B_Stat = 8,
                    B_Type = 9,
                    B_Weight = 10,
                    B_End = 11
                };
                static const char* BallTypeStr[B_End];
                
                enum BerryType
                {
                    B2_HPCure = 0,
                    B2_StatusCure = 1,
                    B2_End = 2
                };
                static const char* BerryTypeStr[B2_End];
                
                ItemEffect(const Pokemod* par, const unsigned _id);
                ItemEffect(const Pokemod* par, Ini& ini, const unsigned _id = UINT_MAX);
                
                void ImportIni(Ini& ini, const unsigned _id = UINT_MAX);
                void ExportIni(QFile& fout, const QString& item) const;
                
                bool SetOverworld(const bool o);
                void SetBattle(const bool b);
                void SetHeld(const bool h);
                bool SetEffect(const unsigned e);
                bool SetVal1(const int v1);
                bool SetVal2(const unsigned v2);
                bool SetVal3(const unsigned v3);
                bool SetVal4(const unsigned n, const unsigned d);
                bool SetVal4Num(const unsigned n);
                bool SetVal4Denom(const unsigned d);
                
                bool GetOverworld() const;
                bool GetBattle() const;
                bool GetHeld() const;
                unsigned GetEffect() const;
                int GetVal1() const;
                unsigned GetVal2() const;
                unsigned GetVal3() const;
                Frac GetVal4() const;
                unsigned GetVal4Num() const;
                unsigned GetVal4Denom() const;
            private:
                bool Validate();
                
                bool overworld;
                bool battle;
                bool held;
                unsigned effect;
                int val1;
                unsigned val2;
                unsigned val3;
                Frac val4;
        };
    }
}

#endif