Boss and Host now move around the arena based on what happened to them.

This commit is contained in:
Zed A. Shaw 2025-12-18 00:50:05 -05:00
parent c618a4828f
commit 72d51f9558
2 changed files with 21 additions and 18 deletions

View file

@ -93,17 +93,17 @@
},
"peasant_girl_rear_view": {
"_type": "Animation",
"easing": 3,
"motion": 0,
"ease_rate": 0.2,
"min_x": 0.5,
"min_y": 0.5,
"max_x": 0.5,
"max_y": 0.5,
"easing": 6,
"motion": 1,
"ease_rate": 0.05,
"min_x": -20.0,
"min_y": -20.0,
"max_x": 20.0,
"max_y": 20.0,
"simple": true,
"frames": 1,
"speed": 0.03,
"scaled": true,
"speed": 0.01,
"scaled": false,
"stationary": true,
"toggled": false,
"flipped": false,

View file

@ -3,6 +3,7 @@
#include "animation.hpp"
#include "game_level.hpp"
#include <iostream>
#include "rand.hpp"
namespace boss {
Fight::Fight(shared_ptr<World> world, Entity boss_id, Entity player_id) :
@ -114,24 +115,27 @@ namespace boss {
}
void Fight::do_combat(std::any data) {
if(data.type() != typeid(components::CombatResult)) {
std::cout << "!!!!!! INVALID thing do_combat received: {}" << data.type().name() << std::endl;
return;
}
dbc::check(data.type() == typeid(components::CombatResult),
fmt::format("Boss Fight received any data={}", data.type().name()));
auto result = std::any_cast<components::CombatResult>(data);
$ui.zoom("", 1.0);
std::string boss_move = Random::uniform(0, 1) == 0 ? "boss5" : "boss6";
std::string player_move = Random::uniform(0, 1) == 0 ? "player1" : "player3";
$ui.move_actor("player", player_move);
$ui.move_actor("boss", boss_move);
if(result.enemy_did > 0) {
// make boss move
fmt::println("!!!! BOSS MOVE!");
$ui.animate_actor("boss");
}
if(result.player_did > 0) {
// make player move
fmt::println("!!!! PLAYER MOVE!");
$ui.animate_actor("player");
$ui.zoom(player_move, 2.0);
}
}
void Fight::EXEC_PLAN(game::Event ev, std::any data) {
@ -147,7 +151,6 @@ namespace boss {
break;
case COMBAT:
do_combat(data);
next_combat_dumb_name();
break;
default:
break;