ScummVM API documentation
spell.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
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 3 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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA_ULTIMA1_U1DIALOGS_SPELL_H
23 #define ULTIMA_ULTIMA1_U1DIALOGS_SPELL_H
24 
25 #include "ultima/shared/core/party.h"
26 #include "ultima/ultima1/maps/map_base.h"
27 #include "ultima/ultima1/maps/map_dungeon.h"
28 
29 namespace Ultima {
30 namespace Ultima1 {
31 
32 class Ultima1Game;
33 class Character;
34 
35 namespace Spells {
36 
37 enum SpellId {
38  SPELL_PRAYER = 0, SPELL_OPEN = 1, SPELL_UNLOCK = 2, SPELL_MAGIC_MISSILE = 3, SPELL_STEAL = 4,
39  SPELL_LADDER_DOWN = 5, SPELL_LADDER_UP = 6, SPELL_BLINK = 7, SPELL_CREATE = 8,
40  SPELL_DESTROY = 9, SPELL_KILL = 10
41 };
42 
46 class Spell : public Shared::Spell {
47 protected:
48  Ultima1Game *_game;
49  Character *_character;
50  SpellId _spellId;
51 protected:
57  void addInfoMsg(const Common::String &text, bool newLine = true, bool replaceLine = false);
58 protected:
62  Spell(Ultima1Game *game, Character *c, SpellId spellId);
63 public:
67  void changeQuantity(int delta) override {
68  _quantity = (uint)CLIP((int)_quantity + delta, 0, 255);
69  }
70 
74  virtual void cast(Maps::MapBase *map);
75 
79  virtual void dungeonCast(Maps::MapDungeon *map);
80 
84  uint getBuyCost() const;
85 };
86 
87 } // End of namespace U1Dialogs
88 } // End of namespace Ultima1
89 } // End of namespace Ultima
90 
91 #endif
Definition: str.h:59
Definition: map_dungeon.h:48
T CLIP(T v, T amin, T amax)
Definition: util.h:65
Definition: map_base.h:39
Definition: detection.h:27
Definition: party.h:129
Definition: character.h:110
Spell(Ultima1Game *game, Character *c, SpellId spellId)
void changeQuantity(int delta) override
Definition: spell.h:67
Definition: game.h:42
virtual void dungeonCast(Maps::MapDungeon *map)
Definition: spell.h:46
void addInfoMsg(const Common::String &text, bool newLine=true, bool replaceLine=false)
virtual void cast(Maps::MapBase *map)