1 /*************************************************************************** 2 * Copyright (C) 2009 by Andrey Afletdinov <fheroes2@gmail.com> * 3 * * 4 * Part of the Free Heroes2 Engine: * 5 * http://sourceforge.net/projects/fheroes2 * 6 * * 7 * This program is free software; you can redistribute it and/or modify * 8 * it under the terms of the GNU General Public License as published by * 9 * the Free Software Foundation; either version 2 of the License, or * 10 * (at your option) any later version. * 11 * * 12 * This program is distributed in the hope that it will be useful, * 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 * GNU General Public License for more details. * 16 * * 17 * You should have received a copy of the GNU General Public License * 18 * along with this program; if not, write to the * 19 * Free Software Foundation, Inc., * 20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 21 ***************************************************************************/ 22 #ifndef H2SPELL_H 23 #define H2SPELL_H 24 25 #include "payment.h" 26 27 #define DEFAULT_SPELL_DURATION 3 28 29 class HeroBase; 30 class StreamBase; 31 32 class Spell 33 { 34 public: 35 enum type_t 36 { 37 NONE = 0, 38 FIREBALL, 39 FIREBLAST, 40 LIGHTNINGBOLT, 41 CHAINLIGHTNING, 42 TELEPORT, 43 CURE, 44 MASSCURE, 45 RESURRECT, 46 RESURRECTTRUE, 47 HASTE, 48 MASSHASTE, 49 SLOW, 50 MASSSLOW, 51 BLIND, 52 BLESS, 53 MASSBLESS, 54 STONESKIN, 55 STEELSKIN, 56 CURSE, 57 MASSCURSE, 58 HOLYWORD, 59 HOLYSHOUT, 60 ANTIMAGIC, 61 DISPEL, 62 MASSDISPEL, 63 ARROW, 64 BERSERKER, 65 ARMAGEDDON, 66 ELEMENTALSTORM, 67 METEORSHOWER, 68 PARALYZE, 69 HYPNOTIZE, 70 COLDRAY, 71 COLDRING, 72 DISRUPTINGRAY, 73 DEATHRIPPLE, 74 DEATHWAVE, 75 DRAGONSLAYER, 76 BLOODLUST, 77 ANIMATEDEAD, 78 MIRRORIMAGE, 79 SHIELD, 80 MASSSHIELD, 81 SUMMONEELEMENT, 82 SUMMONAELEMENT, 83 SUMMONFELEMENT, 84 SUMMONWELEMENT, 85 EARTHQUAKE, 86 VIEWMINES, 87 VIEWRESOURCES, 88 VIEWARTIFACTS, 89 VIEWTOWNS, 90 VIEWHEROES, 91 VIEWALL, 92 IDENTIFYHERO, 93 SUMMONBOAT, 94 DIMENSIONDOOR, 95 TOWNGATE, 96 TOWNPORTAL, 97 VISIONS, 98 HAUNT, 99 SETEGUARDIAN, 100 SETAGUARDIAN, 101 SETFGUARDIAN, 102 SETWGUARDIAN, 103 104 RANDOM, 105 RANDOM1, 106 RANDOM2, 107 RANDOM3, 108 RANDOM4, 109 RANDOM5, 110 111 STONE 112 }; 113 114 Spell( int = NONE ); 115 116 bool operator<( const Spell & ) const; 117 bool operator==( const Spell & ) const; 118 bool operator!=( const Spell & ) const; 119 120 int GetID( void ) const; 121 122 const char * GetName( void ) const; 123 const char * GetDescription( void ) const; 124 125 u32 SpellPoint( const HeroBase * hero = nullptr ) const; 126 u32 MovePoint( void ) const; 127 int Level( void ) const; 128 u32 Damage( void ) const; 129 u32 Restore( void ) const; 130 u32 Resurrect( void ) const; 131 132 u32 ExtraValue( void ) const; 133 134 bool isValid( void ) const; 135 bool isLevel( int ) const; 136 bool isCombat( void ) const; 137 bool isAdventure( void ) const; 138 bool isDamage( void ) const; 139 bool isSingleTarget() const; 140 bool isRestore( void ) const; 141 bool isResurrect( void ) const; 142 bool isMindInfluence( void ) const; 143 bool isUndeadOnly( void ) const; 144 bool isALiveOnly( void ) const; 145 bool isSummon( void ) const; 146 bool isEffectDispel() const; 147 bool isApplyWithoutFocusObject( void ) const; 148 bool isApplyToAnyTroops( void ) const; 149 bool isApplyToFriends( void ) const; 150 bool isApplyToEnemies( void ) const; 151 bool isMassActions( void ) const; 152 bool isRaceCompatible( int race ) const; 153 bool isFire() const; 154 bool isCold() const; 155 156 bool isGuardianType() const; 157 158 /* return index sprite spells.icn */ 159 u32 IndexSprite( void ) const; 160 161 static Spell RandCombat( int lvl ); 162 static Spell RandAdventure( int lvl ); 163 static Spell Rand( int lvl, bool adv ); 164 165 static int32_t CalculateDimensionDoorDistance(); 166 167 private: 168 friend StreamBase & operator<<( StreamBase &, const Spell & ); 169 friend StreamBase & operator>>( StreamBase &, Spell & ); 170 171 int id; 172 }; 173 174 StreamBase & operator<<( StreamBase &, const Spell & ); 175 StreamBase & operator>>( StreamBase &, Spell & ); 176 177 #endif 178