+ }
+
+ if (livingEnemy) { // there is at least one enemy alive, proceed with combat
+
+
+ currentCombatantIndex += 1;
+
+ // WARNING: this system does not support the case where agility changes mid-fight. will need to re-sort if that happens
+ if (currentCombatantIndex > combatants.size() - 1) currentCombatantIndex = 0;
+
+ activeCombatant = &combatants.at(currentCombatantIndex);
+
+ if (activeCombatant->alive) { // skip dead characters
+ if (activeCombatant->allied) {
+ // reset combatants actions
+ activeCombatant->canAttack = true;
+ activeCombatant->canMove = true;
+ currentAction = 0;
+ currentCombatState = ACTION_SELECT;
+ }
+ else {
+ //currentCombatState = ENEMY_MOVE;
+ }