summaryrefslogtreecommitdiffstats
path: root/pokemod/MoveEffect.h
blob: 4eb28a686d7f966f0e6a9c34062e3c6e22cdbbb3 (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
/////////////////////////////////////////////////////////////////////////////
// Name:        pokemod/MoveEffect.h
// Purpose:     Define an effect of a move
// Author:      Ben Boeckel
// Modified by: Ben Boeckel
// Created:     Tue Mar 20 18:29:40 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_MOVEEFFECT__
#define __POKEMOD_MOVEEFFECT__

#include <QString>
#include <QStringList>

#include <Exception.h>
#include <Frac.h>

#include "Object.h"

class Pokemod;

class MoveEffect : public Object
{
    public:
        enum Effect
        {
            E_Damage = 0,
            E_Status = 1,
            E_Confuse = 2,
            E_Stat = 3,
            E_StealHP = 4,
            E_Counter = 5,
            E_Selfdestruct = 6,
            E_NeedStatus = 7,
            E_Mirror = 8,
            E_GetMoney = 9,
            E_NeverMiss = 10,
            E_StealTypes = 11,
            E_ClearEffects = 12,
            E_WaitAndReturn = 13,
            E_SelfConfuse = 14,
            E_ForceSwitch = 15,
            E_HitMultiple = 16,
            E_HitMultipleTurns = 17,
            E_Flinch = 18,
            E_OneHitKO = 19,
            E_Recoil = 20,
            E_Recover = 21,
            E_Rest = 22,
            E_Shield = 23,
            E_Substitute = 24,
            E_Recharge = 25,
            E_Rage = 26,
            E_Mimic = 27,
            E_RandomMove = 28,
            E_Seed = 29,
            E_Disable = 30,
            // TODO: GSC, RSEFrLg, DP effects
            E_End,// = ,
            E_CutHM = E_End,
            E_FlyHM,// = ,
            E_SurfHM,// = ,
            E_StrengthHM,// = ,
            E_FlashHM,// = ,
            E_RockSmashHM,// = ,
            E_RockClimbHM,// = ,
            E_WhirlpoolHM,// = ,
            E_WaterfallHM,// = ,
            E_ShareHPHM,// = ,
            E_EscapeHM,// = ,
            E_End_Overworld// = 
        };
        static const QStringList EffectStr;
        
        enum Damage
        {
            D_Fixed = 0,
            D_FixedRange = 1,
            D_Relative = 2,
            D_RelativeRange = 3,
            D_Level = 4,
            D_End = 5
        };
        static const QStringList DamageStr;
        
        enum MoveType
        {
            MT_Physical = 0,
            MT_Special = 1,
            MT_End = 2
        };
        static const QStringList MoveTypeStr;
        
        enum Recoil
        {
            R_Hit = 0,
            R_Miss = 1,
            R_End = 2
        };
        static const QStringList RecoilStr;
        
        MoveEffect(const Pokemod* par, const int _id);
        MoveEffect(const Pokemod* par, const MoveEffect& e, const int _id);
        MoveEffect(const Pokemod* par, const QString& fname, const int _id = -1);
        
        void load(const QString& fname, const int _id = -1) throw(Exception);
        void save(const QString& move) const throw(Exception);
        
        void setChance(const int n, const int d) throw(Exception);
        void setChanceNum(const int n) throw(Exception);
        void setChanceDenom(const int d) throw(Exception);
        void setEffect(const int e) throw(BoundsException);
        void setVal1(const int v1) throw(Exception);
        void setVal2(const int v2) throw(Exception);
        void setVal3(const int v3);
        void setVal4(const int n, const int d) throw(Exception);
        void setVal4Num(const int n) throw(Exception);
        void setVal4Denom(const int d) throw(Exception);
        
        Frac getChance() const;
        int getEffect() const;
        int getVal1() const;
        int getVal2() const;
        int getVal3() const;
        Frac getVal4() const;
        
        MoveEffect& operator=(const MoveEffect& rhs);
    private:
        bool validate() const;
        
        Frac chance;
        int effect;
        int val1;
        int val2;
        int val3;
        Frac val4;
};

#endif