ScummVM API documentation
mondain_logic.h
1
2/* ScummVM - Graphic Adventure Engine
3 *
4 * ScummVM is the legal property of its developers, whose names
5 * are too numerous to list here. Please refer to the COPYRIGHT
6 * file distributed with this source distribution.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef ULTIMA2_LOGIC_MONDAIN_LOGIC_H
24#define ULTIMA2_LOGIC_MONDAIN_LOGIC_H
25
26#include "ultima/ultima1/logic/logic.h"
27
28namespace Ultima {
29namespace Ultima1 {
30namespace Logic {
31
32class MondainLogic : public Logic {
33private:
34 // tick() is called once per game frame, but the original only advanced
35 // Mondain's animations once every few frames - this counts frames
36 // between updates
37 int _tickCounter = 0;
38
39 // Which spell useSelectedItem/cast() started casting - remembered so
40 // castSpellAttack (called back later once a direction's been chosen
41 // via the Direction view) knows which of the 3 direction-needing
42 // spells to resolve
43 int _castSpell = 0;
44
50 bool isAdjacentToGem() const;
51
56 bool isWithinRange7() const;
57
62 bool rollSpellSuccess();
63
70 int getMagicWeaponPower();
71
76 bool castTeleport();
77
83 bool castInterficioNunc();
84
89 bool castPlaceBarrier(Data::Direction dir);
90
95 bool castRemoveBarrier(Data::Direction dir);
96
101 bool castMagicMissile(Data::Direction dir);
102
110 void updateMondainState();
111
117 void mondainTakeTurn();
118
123 void mondainMeleeAttack();
124
130 void mondainSpellAttack();
131
136 void damagePlayer(int amount);
137
142 bool tryMoveMondain(int dx, int dy);
143
148 int randomSign();
149
150protected:
151 bool move(Data::Direction dir) override;
152
156 void updateCreatures() override;
157
166 void endOfTurn() override;
167
174 void damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) override;
175
180 bool cast() override;
181
186 void castSpellAttack(Data::Direction dir) override;
187
188 bool get() override;
189 bool inform() override;
190 bool quit() override;
191 bool steal() override;
192 bool transact() override;
193
194public:
195 MondainLogic();
196 ~MondainLogic() override {
197 }
198
199 void entering() override;
200 bool isPersisted() const override {
201 return true;
202 }
203
208 void tick() override;
209};
210
211} // namespace Logic
212} // namespace Ultima1
213} // namespace Ultima
214
215#endif
Definition: logic.h:40
Definition: mondain_logic.h:32
void damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) override
bool isPersisted() const override
Definition: mondain_logic.h:200
void castSpellAttack(Data::Direction dir) override