summaryrefslogtreecommitdiffstats
path: root/pokemod/AbilityEffect.h
blob: 17b6d02746c34775bf1621b9fdac7ec2fed32fc6 (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
/*
 * 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_ABILITYEFFECT__
#define __POKEMOD_ABILITYEFFECT__

// Pokemod includes
#include "Object.h"

// General includes
#include "../general/Fraction.h"

// Qt includes
#include <QStringList>

// Forward declarations
class Ability;

class AbilityEffect : public Object
{
    Q_OBJECT
    
    public:
        enum Effect
        {
            E_DamageToHP = 0,
            E_PreventDamage = 1,
            E_AutoHeal = 2,
            E_DealDamage = 3,
            E_Wilds = 4,
            E_Stats = 5,
            E_Status = 6,
            E_Ability = 7,
            E_AccuracyPowerTrade = 8,
            E_Bullseye = 9,
            E_ItemEffect = 10,
            E_Type = 11,
            E_FastHatch = 12,
            E_Weather = 13,
            E_End = 14
        };
        static const QStringList EffectStr;
        
        enum Trigger
        {
            T_Anything = 0,
            T_Contact = 1,
            T_Weather = 2,
            T_Damage = 3,
            T_Type = 4,
            T_HPBoundary = 5,
            T_StatChange = 6,
            T_Status = 7,
            T_End = 8
        };
        static const QStringList TriggerStr;
        
        enum Interact
        {
            I_Trade = 0,
            I_Shadow = 1,
            I_Block = 2,
            I_End = 3
        };
        static const QStringList InteractStr;
        
        enum PowerAccuracy
        {
            PA_Power = 0,
            PA_Accuracy = 1,
            PA_End = 2
        };
        static const QStringList PowerAccuracyStr;
        
        enum Item
        {
            IT_Stat = 0,
            IT_TypeBoost = 1,
            IT_Flinch = 2,
            IT_Quick = 3,
            IT_End = 4
        };
        static const QStringList ItemStr;
        
        enum Cause
        {
            C_Prevent = 0,
            C_Inflict = 1,
            C_End = 2
        };
        static const QStringList CauseStr;
        
        enum Boost
        {
            B_Boost = 0,
            B_Hinder = 1,
            B_End = 2
        };
        static const QStringList BoostStr;
        
        enum Side
        {
            S_Above = 0,
            S_Below = 1,
            S_End = 2
        };
        static const QStringList SideStr;
        
        AbilityEffect(const AbilityEffect& effect);
        AbilityEffect(const Ability* parent, const int id);
        AbilityEffect(const AbilityEffect& effect, const Ability* parent, const int id);
        AbilityEffect(const QDomElement& xml, const Ability* parent, const int id = INT_MAX);
        
        void validate();
        
        void load(const QDomElement& xml, int id = INT_MAX);
        QDomElement save() const;
        
        void setChance(const Fraction& chance);
        void setEffect(const int effect);
        void setValue1(const int value1);
        void setValue2(const int value2);
        void setValue3(const int value3);
        void setTrigger(const int trigger);
        void setTriggerValue1(const int triggerValue1);
        void setTriggerValue2(const Fraction& triggerValue2);
        
        Fraction chance() const;
        int effect() const;
        int value1() const;
        int value2() const;
        int value3() const;
        int trigger() const;
        int triggerValue1() const;
        Fraction triggerValue2() const;
        
        AbilityEffect& operator=(const AbilityEffect& rhs);
    private:
        Fraction m_chance;
        int m_effect;
        int m_value1;
        int m_value2;
        int m_value3;
        int m_trigger;
        int m_triggerValue1;
        Fraction m_triggerValue2;
};

#endif