From 4958f24c1d154ab6058a0eb22857e0d11e264162 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Thu, 18 Dec 2025 11:01:40 -0500 Subject: [PATCH] A quick fix for the dungeon combat. --- assets/enemies.json | 2 +- components.hpp | 4 ++-- systems.cpp | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/enemies.json b/assets/enemies.json index 10f8c6b..34817f5 100644 --- a/assets/enemies.json +++ b/assets/enemies.json @@ -6,7 +6,7 @@ "foreground": "enemies/fg:player", "background": "color:transparent" }, - {"_type": "Combat", "hp": 200, "max_hp": 200, "ap": 0, "max_ap": 12, "ap_delta": 6, "damage": 10, "dead": false}, + {"_type": "Combat", "hp": 200, "max_hp": 200, "ap": 0, "max_ap": 12, "ap_delta": 6, "damage": 1000, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "Collision", "has": true}, {"_type": "EnemyConfig", "ai_script": "Host::actions", "ai_start_name": "Host::initial_state", "ai_goal_name": "Host::final_state"}, diff --git a/components.hpp b/components.hpp index 6232463..e40fb0a 100644 --- a/components.hpp +++ b/components.hpp @@ -19,8 +19,8 @@ namespace components { using namespace nlohmann; struct CombatResult { - int player_did; - int enemy_did; + int player_did = 0; + int enemy_did = 0; }; struct InventoryItem { diff --git a/systems.cpp b/systems.cpp index cc98b78..f6820e2 100644 --- a/systems.cpp +++ b/systems.cpp @@ -22,6 +22,7 @@ using std::string; using namespace fmt; +using namespace combat; using namespace components; using namespace DinkyECS; using lighting::LightSource; @@ -261,6 +262,7 @@ void System::combat(int attack_id) { while(auto act = battle.next()) { auto [enemy, enemy_action, cost, host_state] = *act; + if(host_state != BattleHostState::not_host) continue; components::CombatResult result { player_combat.attack(*enemy.combat), 0