Synced the combat from under the dome.
This commit is contained in:
parent
110612c33a
commit
a22564bb58
8 changed files with 106 additions and 27 deletions
|
|
@ -16,7 +16,7 @@ using namespace combat;
|
|||
using namespace boss;
|
||||
using namespace components;
|
||||
|
||||
TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
||||
TEST_CASE("battle operations fantasy", "[fail]") {
|
||||
ai::reset();
|
||||
ai::init("ai");
|
||||
|
||||
|
|
@ -53,7 +53,10 @@ TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
|||
battle.set(host, "have_healing", false);
|
||||
battle.set(host, "tough_personality", false);
|
||||
|
||||
while(host_combat.hp > 0) {
|
||||
int host_combat_loop = 0;
|
||||
for(host_combat_loop = 0; host_combat_loop < 1000; host_combat_loop++) {
|
||||
fmt::println("host HP is {}", host_combat.hp);
|
||||
if(host_combat.is_dead()) break;
|
||||
battle.set(host, "health_good", host_combat.hp > 20);
|
||||
|
||||
battle.player_request("use_healing");
|
||||
|
|
@ -61,8 +64,12 @@ TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
|||
|
||||
battle.ap_refresh();
|
||||
battle.plan();
|
||||
int battle_count = 0;
|
||||
|
||||
for(int battle_count = 0; battle_count < 1000; battle_count++) {
|
||||
auto act = battle.next();
|
||||
if(!act) break;
|
||||
|
||||
while(auto act = battle.next()) {
|
||||
auto& [enemy, wants_to, cost, enemy_state] = *act;
|
||||
|
||||
// fmt::println(">>>>> entity: {} wants to {} cost={}; has {} HP; {} ap",
|
||||
|
|
@ -81,6 +88,7 @@ TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
|||
break;
|
||||
case BattleHostState::not_host:
|
||||
if(wants_to == "kill_enemy") {
|
||||
fmt::println("ATTACK!");
|
||||
enemy.combat->attack(host_combat);
|
||||
}
|
||||
break;
|
||||
|
|
@ -91,9 +99,11 @@ TEST_CASE("battle operations fantasy", "[combat-battle]") {
|
|||
}
|
||||
|
||||
REQUIRE(!battle.next());
|
||||
dbc::check(battle_count < 1000, "infinite battle loop");
|
||||
}
|
||||
}
|
||||
|
||||
dbc::check(host_combat_loop < 1000, "infinite host combat loop, host won't die!");
|
||||
}
|
||||
|
||||
TEST_CASE("boss/systems.cpp works", "[combat-battle]") {
|
||||
components::init();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue