Added in a new art for a 'gold savior' and refined the battle engine more but it's not quite what I want.
This commit is contained in:
parent
ca328e10dc
commit
0e2f213871
7 changed files with 88 additions and 32 deletions
|
@ -13,31 +13,45 @@ TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
|||
|
||||
auto ai_start = ai::load_state("Enemy::initial_state");
|
||||
auto ai_goal = ai::load_state("Enemy::final_state");
|
||||
auto host_start = ai::load_state("Host::initial_state");
|
||||
auto host_goal = ai::load_state("Host::final_state");
|
||||
BattleEngine battle;
|
||||
|
||||
DinkyECS::Entity axe_ranger = 0;
|
||||
DinkyECS::Entity player = 0;
|
||||
ai::EntityAI player_ai("Host::actions", host_start, host_goal);
|
||||
components::Combat player_combat{100, 100, 20};
|
||||
battle.add_enemy({player, player_ai, player_combat});
|
||||
|
||||
DinkyECS::Entity axe_ranger = 1;
|
||||
ai::EntityAI axe_ai("Enemy::actions", ai_start, ai_goal);
|
||||
axe_ai.set_state("tough_personality", true);
|
||||
axe_ai.set_state("health_good", true);
|
||||
components::Combat axe_combat{100, 100, 20};
|
||||
battle.add_enemy({axe_ranger, axe_ai, axe_combat});
|
||||
|
||||
DinkyECS::Entity rat = 1;
|
||||
DinkyECS::Entity rat = 2;
|
||||
ai::EntityAI rat_ai("Enemy::actions", ai_start, ai_goal);
|
||||
rat_ai.set_state("tough_personality", false);
|
||||
rat_ai.set_state("health_good", true);
|
||||
components::Combat rat_combat{10, 10, 2};
|
||||
battle.add_enemy({rat, rat_ai, rat_combat});
|
||||
|
||||
battle.set_all("enemy_found", true);
|
||||
battle.set_all("in_combat", true);
|
||||
battle.set_all("tough_personality", true);
|
||||
battle.set_all("health_good", true);
|
||||
battle.set(rat, "tough_personality", false);
|
||||
|
||||
battle.queue(player, BattleAction::ATTACK);
|
||||
battle.queue(player, BattleAction::BLOCK);
|
||||
|
||||
battle.queue(player, BattleAction::ESCAPE);
|
||||
|
||||
battle.plan();
|
||||
|
||||
while(auto act = battle.next()) {
|
||||
auto& [entity, enemy_ai, combat] = *act;
|
||||
auto& [enemy, action] = *act;
|
||||
|
||||
fmt::println("entity: {} wants to {} and has {} HP and {} damage",
|
||||
entity,
|
||||
enemy_ai.wants_to(),
|
||||
combat.hp, combat.damage);
|
||||
fmt::println("entity: {} wants to {} action={} and has {} HP and {} damage",
|
||||
enemy.entity, enemy.ai.wants_to(),
|
||||
int(action), enemy.combat.hp,
|
||||
enemy.combat.damage);
|
||||
}
|
||||
|
||||
REQUIRE(!battle.next());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue