4 * Created on: Aug 9, 2012
8 #include "TargetSelection.h"
10 #include "BattleState.h"
14 TargetSelection::TargetSelection(BattleState *battle, bool multiple, bool atEnemy)
16 , selected(battle ? ((int)battle->MonsterPositions().size() > battle->NumHeroes() ? (int)battle->MonsterPositions().size() : battle->NumHeroes()) : 0, false)
21 if (battle && enemy) {
26 void TargetSelection::SelectEnemies() {
27 if (TargetsEnemies()) return;
34 void TargetSelection::SelectHeroes() {
35 if (TargetsHeroes()) return;
42 void TargetSelection::Reset() {
45 if (TargetsEnemies()) {
51 void TargetSelection::MoveUp() {
52 if (TargetsEnemies()) return;
60 void TargetSelection::MoveRight() {
61 if (TargetsEnemies()) {
62 cursor = (cursor + 1) % battle->MonsterPositions().size();
63 while (!battle->MonsterPositionOccupied(cursor)) {
64 cursor = (cursor + 1) % battle->MonsterPositions().size();
67 cursor = (cursor + 1) % battle->NumHeroes();
71 void TargetSelection::MoveDown() {
72 if (TargetsEnemies()) {
76 int newCursor((cursor + 2) % 4);
77 if (newCursor < battle->NumHeroes()) {
82 void TargetSelection::MoveLeft() {
83 if (TargetsEnemies()) {
84 cursor = (cursor + battle->MonsterPositions().size() - 1) % battle->MonsterPositions().size();
87 cursor = (cursor + battle->NumHeroes() - 1) % battle->NumHeroes();
91 void TargetSelection::FindNextEnemy() {
92 while (!battle->MonsterPositionOccupied(cursor)) {
93 cursor = (cursor + battle->MonsterPositions().size() - 1) % battle->MonsterPositions().size();