// TODO: this only evaluates SWORD type attacks
if (CurrentAttack().isMonster) {
const Stats &attackerStats(MonsterAt(CurrentAttack().index).GetStats());
- if (ts.TargetsEnemies()) {
+ if (ts.TargetsMonsters()) {
for (int i(0); i < MaxMonsters(); ++i) {
if (ts.IsSelected(i)) {
if (MonsterAt(i).Health() > 0) {
} else {
const Stats &attackerStats(HeroAt(CurrentAttack().index).GetStats());
bool hitSome(false);
- if (ts.TargetsEnemies()) {
+ if (ts.TargetsMonsters()) {
for (int i(0); i < MaxMonsters(); ++i) {
if (ts.IsSelected(i)) {
if (MonsterAt(i).Health() > 0) {
if (attackCursor < 0) return;
AttackChoice &ac(CurrentAttack().isMonster ? MonsterAt(CurrentAttack().index).GetAttackChoice() : HeroAt(CurrentAttack().index).GetAttackChoice());
TargetSelection &ts(ac.Selection());
- if (ts.TargetsEnemies()) {
+ if (ts.TargetsMonsters()) {
for (int i(0); i < MaxMonsters(); ++i) {
Monster &monster(MonsterAt(i));
if (ts.IsBad(i)) {
void TargetSelection::ReadMode(const common::TargetingMode &tm) {
if (tm.TargetsEnemy()) {
- SelectEnemies();
+ SelectMonsters();
} else {
SelectHeroes();
}
}
-void TargetSelection::SelectEnemies() {
- if (TargetsEnemies()) return;
+void TargetSelection::SelectMonsters() {
+ if (TargetsMonsters()) return;
enemy = true;
UnselectAll();
cursor = 0;
void TargetSelection::Reset() {
UnselectAll();
cursor = 0;
- if (TargetsEnemies()) {
+ if (TargetsMonsters()) {
FindNextEnemy();
}
}
void TargetSelection::MoveUp() {
- if (TargetsEnemies()) return;
+ if (TargetsMonsters()) return;
if (cursor < 2) {
- SelectEnemies();
+ SelectMonsters();
} else {
cursor -= 2;
}
}
void TargetSelection::MoveRight() {
- if (TargetsEnemies()) {
+ if (TargetsMonsters()) {
cursor = (cursor + 1) % battle->MaxMonsters();
while (!battle->MonsterPositionOccupied(cursor)) {
cursor = (cursor + 1) % battle->MaxMonsters();
}
void TargetSelection::MoveDown() {
- if (TargetsEnemies()) {
+ if (TargetsMonsters()) {
SelectHeroes();
return;
}
}
void TargetSelection::MoveLeft() {
- if (TargetsEnemies()) {
+ if (TargetsMonsters()) {
cursor = (cursor + battle->MaxMonsters() - 1) % battle->MaxMonsters();
FindNextEnemy();
} else {
explicit TargetSelection(BattleState *battle = 0, 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; }
void ReadMode(const common::TargetingMode &);
- void SelectEnemies();
+ void SelectMonsters();
void SelectHeroes();
void Select(int index) { selected[index].type = State::SELECTED; selection = index; }
void Unselect(int index) { selected[index].type = State::IGNORE; }
}
void PerformAttacks::AddNumberAnimations(const TargetSelection &ts) {
- if (ts.TargetsEnemies()) {
+ if (ts.TargetsMonsters()) {
for (int i(0); i < battle->MaxMonsters(); ++i) {
if (ts.IsBad(i)) {
numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), battle->Res().numberAnimationPrototype, battle->Res().bigNumberSprite));
if (ikari->GetTargetingMode().TargetsAlly()) {
ac.Selection().SelectHeroes();
} else {
- ac.Selection().SelectEnemies();
+ ac.Selection().SelectMonsters();
}
if (ikari->GetTargetingMode().TargetsAll()) {
ac.SetType(AttackChoice::MAGIC);
if (item->GetTargetingMode().TargetsAlly()) {
ac.Selection().SelectHeroes();
} else {
- ac.Selection().SelectEnemies();
+ ac.Selection().SelectMonsters();
}
if (item->GetTargetingMode().TargetsAll()) {
ac.SetType(AttackChoice::ITEM);
if (spell->GetTargetingMode().TargetsAlly()) {
ac.Selection().SelectHeroes();
} else {
- ac.Selection().SelectEnemies();
+ ac.Selection().SelectMonsters();
}
if (spell->GetTargetingMode().TargetsAll()) {
ac.SetType(AttackChoice::MAGIC);
// offset the indicator by 1/8th to the right and top
Vector<int> indicatorOffset(cursorOffset + Vector<int>(cursorIcon->Width() / 8, cursorIcon->Height() / -8));
vector<Point<int> > positions;
- if (selection->TargetsEnemies()) {
+ if (selection->TargetsMonsters()) {
for (int i(0), end(battle->MaxMonsters()); i < end; ++i) {
positions.push_back(battle->MonsterAt(i).Position());
}