aboutsummaryrefslogtreecommitdiff
path: root/src/magic.hh
blob: 0525ad2db7127ff6d4ab7eac57ea3317b943b9b1 (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#ifndef TIBIA_MAGIC_HH_
#define TIBIA_MAGIC_HH_ 1

#include "common.hh"
#include "creature.hh"

struct TImpact{
	// VIRTUAL FUNCTIONS
	// =========================================================================
	virtual void handleField(int x, int y, int z);										// VTABLE[0]
	virtual void handleCreature(TCreature *Victim);										// VTABLE[1]
	virtual bool isAggressive(void);													// VTABLE[2]

	// DATA
	// =========================================================================
	//void *VTABLE;	// IMPLICIT
};

struct TDamageImpact: TImpact {
	TDamageImpact(TCreature *Actor, int DamageType, int Power, bool AllowDefense);
	void handleCreature(TCreature *Victim) override;

	TCreature *Actor;
	int DamageType;
	int Power;
	bool AllowDefense;
};

struct TFieldImpact: TImpact {
	TFieldImpact(TCreature *Actor, int FieldType);
	void handleField(int x, int y, int z) override;

	TCreature *Actor;
	int FieldType;
};

struct THealingImpact: TImpact {
	THealingImpact(TCreature *Actor, int Power);
	void handleCreature(TCreature *Victim) override;
	bool isAggressive(void) override;

	TCreature *Actor;
	int Power;
};

struct TSpeedImpact: TImpact {
	TSpeedImpact(TCreature *Actor, int Percent, int Duration);
	void handleCreature(TCreature *Victim) override;

	TCreature *Actor;
	int Percent;
	int Duration;
};

struct TDrunkenImpact: TImpact {
	TDrunkenImpact(TCreature *Actor, int Power, int Duration);
	void handleCreature(TCreature *Victim) override;

	TCreature *Actor;
	int Power;
	int Duration;
};

struct TStrengthImpact: TImpact {
	TStrengthImpact(TCreature *Actor, int Skills, int Percent, int Duration);
	void handleCreature(TCreature *Victim) override;

	TCreature *Actor;
	int Skills;
	int Percent;
	int Duration;
};

struct TOutfitImpact: TImpact {
	TOutfitImpact(TCreature *Actor, TOutfit Outfit, int Duration);
	void handleCreature(TCreature *Victim) override;

	TCreature *Actor;
	TOutfit Outfit;
	int Duration;
};

struct TSummonImpact: TImpact {
	TSummonImpact(TCreature *Actor, int Race, int Maximum);
	void handleField(int x, int y, int z) override;

	TCreature *Actor;
	int Race;
	int Maximum;
};

struct TCircle {
	int x[32];
	int y[32];
	int Count;
};

struct TSpellList {
	uint8 Syllable[10];
	uint8 RuneGr;
	uint8 RuneNr;
	const char *Comment;
	uint16 Level;
	uint16 RuneLevel;
	uint16 Flags;
	int Mana;
	int SoulPoints;
	int Amount;
};

void CheckMana(TCreature *Creature, int ManaPoints, int SoulPoints, int Delay);

#endif //TIBIA_MAGIC_HH_