diff --git a/boss/fight.cpp b/boss/fight.cpp index 2224fd6..18dadfb 100644 --- a/boss/fight.cpp +++ b/boss/fight.cpp @@ -127,14 +127,14 @@ namespace boss { std::string player_move = Random::uniform(0, 1) == 0 ? "player1" : "player3"; $ui.move_actor("player", player_move); if(result.player_did > 0) $ui.animate_actor("player"); - $ui.damage("player", result.player_did); + $ui.damage("player", "boss", result.player_did); } break; case BattleHostState::not_host: { std::string boss_move = Random::uniform(0, 1) == 0 ? "boss5" : "boss6"; $ui.move_actor("boss", boss_move); if(result.enemy_did > 0) $ui.animate_actor("boss"); - $ui.damage("boss", result.enemy_did); + $ui.damage("boss", "player", result.enemy_did); } break; case BattleHostState::out_of_ap: break; diff --git a/boss/ui.cpp b/boss/ui.cpp index 0c244fa..11cf2f9 100644 --- a/boss/ui.cpp +++ b/boss/ui.cpp @@ -106,11 +106,12 @@ namespace boss { $arena.play_animations(); } - void UI::damage(const std::string& actor, int amount) { - $arena.attach_text(actor, fmt::format("{}", amount)); - + void UI::damage(const std::string& actor, const std::string& target, int amount) { if(amount > 0) { + $arena.attach_text(target, fmt::format("{}", amount)); $arena.apply_effect(actor, "flame"); + } else { + $arena.attach_text(actor, "MISSED"); } } } diff --git a/boss/ui.hpp b/boss/ui.hpp index 48a177a..6ab2881 100644 --- a/boss/ui.hpp +++ b/boss/ui.hpp @@ -38,6 +38,6 @@ namespace boss { void animate_actor(const std::string& actor); void update_stats(); void play_animations(); - void damage(const std::string& actor, int amount); + void damage(const std::string& actor, const std::string& target, int amount); }; } diff --git a/scene.cpp b/scene.cpp index d9f5ca3..b5371e1 100644 --- a/scene.cpp +++ b/scene.cpp @@ -2,6 +2,8 @@ #include "animation.hpp" #include #include "shaders.hpp" +#include +#include "dbc.hpp" const bool DEBUG=false; @@ -109,6 +111,7 @@ namespace scene { } Element& Engine::actor_config(const std::string& actor) { + dbc::check($actor_name_ids.contains(actor), fmt::format("scene does not contain actor {}", actor)); return $actors.at($actor_name_ids.at(actor)); } @@ -119,7 +122,7 @@ namespace scene { } void Engine::animate_actor(const std::string& actor) { - auto& config = $actors.at($actor_name_ids.at(actor)); + auto& config = actor_config(actor); config.anim.play(); }