]> git.localhorst.tv Git - l2e.git/blob - src/battle/AttackChoice.h
extracted battle logic into a class
[l2e.git] / src / battle / AttackChoice.h
1 #ifndef BATTLE_ATTACKCHOICE_H_
2 #define BATTLE_ATTACKCHOICE_H_
3
4 namespace battle {
5         class Battle;
6 }
7 namespace common {
8         class Item;
9         class Spell;
10 }
11
12 #include "TargetSelection.h"
13
14 namespace battle {
15
16 class AttackChoice {
17
18 public:
19         enum Type {
20                 SWORD,
21                 MAGIC,
22                 DEFEND,
23                 IKARI,
24                 ITEM,
25                 UNDECIDED
26         };
27
28 public:
29         AttackChoice()
30         : thing(0), selection(), type(UNDECIDED) { }
31         explicit AttackChoice(Battle *b)
32         : thing(0), selection(b), type(UNDECIDED) { }
33         ~AttackChoice() { }
34
35 public:
36         Type GetType() const { return type; }
37         void SetType(Type t) { type = t; }
38         const common::Item *GetItem() const { return (const common::Item *)thing; }
39         void SetItem(const common::Item *i) { thing = i; }
40         const common::Spell *GetSpell() const { return (const common::Spell *)thing; }
41         void SetSpell(const common::Spell *s) { thing = s; }
42         TargetSelection &Selection() { return selection; }
43         const TargetSelection &Selection() const { return selection; }
44
45         void Reset();
46
47 private:
48         const void *thing;
49         TargetSelection selection;
50         Type type;
51
52 };
53
54 }
55
56 #endif