-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMagic.h
43 lines (35 loc) · 913 Bytes
/
Magic.h
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
#pragma once
#include "Actor.h"
#include "Vec2i.h"
class FireBall;
class Magic : public Actor
{
public:
Magic(Vec2i coords, char symb, int power) :
Actor(coords, symb),
_power(power)
{
}
void act(Map *map) override {};
void collide(Map *map, Actor *target) override { target->collide(map, this); }
void collide(Map *map, Character *target) override {};
void collide(Map *map, Magic *target) override {}
protected:
int _power;
};
class FireBall : public Magic
{
public:
FireBall(Vec2i coords, Vec2i direction, int damage) :
Magic(coords, getSymbolFromDir(direction), damage),
_direction(direction)
{
}
char getSymbolFromDir(Vec2i direction);
void act(Map *map) override;
void collide(Map *map, Actor *target) override { target->collide(map, this); }
void collide(Map *map, Character *target) override;
void collide(Map *map, Magic *target) override;
private:
Vec2i _direction;
};