}
void BattleState::CalculateDamage() {
- AttackChoice &ac(CurrentAttack().isMonster ? monsterAttacks[CurrentAttack().index] : AttackChoiceAt(CurrentAttack().index));
+ AttackChoice &ac(CurrentAttack().isMonster ? monsterAttacks[CurrentAttack().index] : HeroAt(CurrentAttack().index).GetAttackChoice());
if (ac.GetType() == AttackChoice::DEFEND) return;
if (CurrentAttack().isMonster) {
void BattleState::ApplyDamage() {
if (attackCursor < 0) return;
- AttackChoice &ac(CurrentAttack().isMonster ? monsterAttacks[CurrentAttack().index] : AttackChoiceAt(CurrentAttack().index));
+ AttackChoice &ac(CurrentAttack().isMonster ? monsterAttacks[CurrentAttack().index] : HeroAt(CurrentAttack().index).GetAttackChoice());
TargetSelection &ts(ac.Selection());
if (ts.TargetsEnemies()) {
for (int i(0); i < MaxMonsters(); ++i) {
if (CurrentAttack().isMonster) {
return monsterAttacks[CurrentAttack().index];
} else {
- return AttackChoiceAt(CurrentAttack().index);
+ return HeroAt(CurrentAttack().index).GetAttackChoice();
}
}
const geometry::Point<int> &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; }
bool HasChosenAttackType() const { return ActiveHero().GetAttackChoice().GetType() != AttackChoice::UNDECIDED; }
- AttackChoice &AttackChoiceAt(int index) { assert(index >= 0 && index < NumHeroes()); return heroes[index].GetAttackChoice(); }
- const AttackChoice &AttackChoiceAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroes[index].GetAttackChoice(); }
AttackChoice &MonsterAttackChoiceAt(int index) { assert(index >= 0 && index < MaxMonsters()); return monsterAttacks[index]; }
const AttackChoice &MonsterAttackChoiceAt(int index) const { assert(index >= 0 && index < MaxMonsters()); return monsterAttacks[index]; }
bool AttackSelectionDone() const { return activeHero >= numHeroes; }
r.normalFont->DrawString(hero.Name(), screen, position + frameOffset + alignOffset, 5);
// attack icon
- if (battle->AttackChoiceAt(index).GetType() != AttackChoice::UNDECIDED) {
+ if (battle->HeroAt(index).GetAttackChoice().GetType() != AttackChoice::UNDECIDED) {
Vector<int> attackIconOffset(labelX + r.heroTagLabels->Width(), frameOffset.Y() + 3 * r.heroTagFont->CharHeight());
- r.attackChoiceIcons->Draw(screen, position + attackIconOffset, 0, battle->AttackChoiceAt(index).GetType());
+ r.attackChoiceIcons->Draw(screen, position + attackIconOffset, 0, battle->HeroAt(index).GetAttackChoice().GetType());
}
// hero
AddNumberAnimations(battle->MonsterAttackChoiceAt(battle->CurrentAttack().index).Selection());
} else {
Hero &hero(battle->HeroAt(battle->CurrentAttack().index));
- const AttackChoice &ac(battle->AttackChoiceAt(battle->CurrentAttack().index));
+ const AttackChoice &ac(battle->HeroAt(battle->CurrentAttack().index).GetAttackChoice());
switch (ac.GetType()) {
case AttackChoice::SWORD: