Can now run the full AI for all combatants and then sort by the action costs to make the action queue.
This commit is contained in:
parent
d244106981
commit
b48df3f4db
10 changed files with 104 additions and 59 deletions
|
|
@ -244,7 +244,7 @@ void System::combat(int attack_id) {
|
|||
if(world.has<ai::EntityAI>(entity)) {
|
||||
auto& enemy_ai = world.get<ai::EntityAI>(entity);
|
||||
auto& enemy_combat = world.get<Combat>(entity);
|
||||
battle.add_enemy({entity, enemy_ai, enemy_combat});
|
||||
battle.add_enemy({entity, &enemy_ai, &enemy_combat});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -256,10 +256,10 @@ void System::combat(int attack_id) {
|
|||
battle.dump();
|
||||
|
||||
while(auto act = battle.next()) {
|
||||
auto [enemy, enemy_action] = *act;
|
||||
auto [enemy, ai_action, enemy_action] = *act;
|
||||
|
||||
Events::Combat result {
|
||||
player_combat.attack(enemy.combat), 0
|
||||
player_combat.attack(*enemy.combat), 0
|
||||
};
|
||||
|
||||
if(result.player_did > 0) {
|
||||
|
|
@ -267,7 +267,7 @@ void System::combat(int attack_id) {
|
|||
}
|
||||
|
||||
if(enemy_action == combat::BattleAction::ATTACK) {
|
||||
result.enemy_did = enemy.combat.attack(player_combat);
|
||||
result.enemy_did = enemy.combat->attack(player_combat);
|
||||
animation::animate_entity(world, enemy.entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue