X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FTargetSelection.h;h=52b0d00bcb519bbc7d1819a31708261a1099ca5e;hb=8f4e771181491f1d83ce0c907b8dda0fbbe0ce93;hp=64500b0b02aca225a117e2005d60f881f63fae11;hpb=a01c2f05b5a6493d7fe097eb15e5337a095992ae;p=l2e.git diff --git a/src/battle/TargetSelection.h b/src/battle/TargetSelection.h index 64500b0..52b0d00 100644 --- a/src/battle/TargetSelection.h +++ b/src/battle/TargetSelection.h @@ -1,27 +1,27 @@ -/* - * TargetSelection.h - * - * Created on: Aug 9, 2012 - * Author: holy - */ - #ifndef BATTLE_TARGETSELECTION_H_ #define BATTLE_TARGETSELECTION_H_ +namespace battle { + class Battle; +} +namespace common { + class TargetingMode; +} + #include -namespace battle { -class BattleState; +namespace battle { class TargetSelection { public: - explicit TargetSelection(BattleState *battle = 0, bool multiple = false, bool atEnemy = true); + TargetSelection(); + explicit TargetSelection(Battle *battle, bool multiple = false, bool atEnemy = true); public: - bool TargetsEnemies() const { return enemy; } - bool TargetsHeroes() const { return !TargetsEnemies(); } + bool TargetsMonsters() const { return enemy; } + bool TargetsHeroes() const { return !TargetsMonsters(); } bool IsSelected(int index) const { return index >= 0 && index < int(selected.size()) && selected[index].type != State::IGNORE; } bool HasSelected() const { return selection >= 0; } int SingleSelection() const { return selection; } @@ -31,7 +31,9 @@ public: bool SelectSingle() const { return !SelectMultiple(); } void SetSingle() { multiple = false; } - void SelectEnemies(); + void ReadMode(const common::TargetingMode &); + + void SelectMonsters(); void SelectHeroes(); void Select(int index) { selected[index].type = State::SELECTED; selection = index; } void Unselect(int index) { selected[index].type = State::IGNORE; } @@ -54,6 +56,9 @@ public: void SetGood(int index, int amount) { selected[index].type = State::GOOD; selected[index].number = amount; } void SetBad(int index, int amount) { selected[index].type = State::BAD; selected[index].number = amount; } int GetAmount(int index) const { return selected[index].number; } + bool Missed(int index) const { return selected[index].type == State::MISS; } + bool IsGood(int index) const { return selected[index].type == State::GOOD; } + bool IsBad(int index) const { return selected[index].type == State::BAD; } private: void FindNextEnemy(); @@ -71,7 +76,7 @@ private: int number; explicit State(Type type = IGNORE, int num = 0) : type(type), number(num) { } }; - BattleState *battle; + Battle *battle; std::vector selected; int selection; int cursor; @@ -82,4 +87,4 @@ private: } -#endif /* BATTLE_TARGETSELECTION_H_ */ +#endif