/* * Copyright 2007-2008 Ben Boeckel * * 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 . */ #ifndef __POKEMOD_ABILITYEFFECT__ #define __POKEMOD_ABILITYEFFECT__ // Pokemod includes #include "Object.h" // General includes #include "../general/Fraction.h" // Qt includes #include // 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