Fixed the boss::UI::damage so it says who hit who.
This commit is contained in:
parent
5676382fbb
commit
6dc9d564c6
4 changed files with 11 additions and 7 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
#include "animation.hpp"
|
||||
#include <ranges>
|
||||
#include "shaders.hpp"
|
||||
#include <fmt/core.h>
|
||||
#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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue