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": { "peasant_girl_rear_view": {
"_type": "Animation", "_type": "Animation",
"easing": 3, "easing": 6,
"motion": 0, "motion": 1,
"ease_rate": 0.2, "ease_rate": 0.05,
"min_x": 0.5, "min_x": -20.0,
"min_y": 0.5, "min_y": -20.0,
"max_x": 0.5, "max_x": 20.0,
"max_y": 0.5, "max_y": 20.0,
"simple": true, "simple": true,
"frames": 1, "frames": 1,
"speed": 0.03, "speed": 0.01,
"scaled": true, "scaled": false,
"stationary": true, "stationary": true,
"toggled": false, "toggled": false,
"flipped": false, "flipped": false,

View file

@ -3,6 +3,7 @@
#include "animation.hpp" #include "animation.hpp"
#include "game_level.hpp" #include "game_level.hpp"
#include <iostream> #include <iostream>
#include "rand.hpp"
namespace boss { namespace boss {
Fight::Fight(shared_ptr<World> world, Entity boss_id, Entity player_id) : 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) { void Fight::do_combat(std::any data) {
if(data.type() != typeid(components::CombatResult)) { dbc::check(data.type() == typeid(components::CombatResult),
std::cout << "!!!!!! INVALID thing do_combat received: {}" << data.type().name() << std::endl; fmt::format("Boss Fight received any data={}", data.type().name()));
return;
}
auto result = std::any_cast<components::CombatResult>(data); 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) { if(result.enemy_did > 0) {
// make boss move // make boss move
fmt::println("!!!! BOSS MOVE!"); $ui.animate_actor("boss");
} }
if(result.player_did > 0) { if(result.player_did > 0) {
// make player move // 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) { void Fight::EXEC_PLAN(game::Event ev, std::any data) {
@ -147,7 +151,6 @@ namespace boss {
break; break;
case COMBAT: case COMBAT:
do_combat(data); do_combat(data);
next_combat_dumb_name();
break; break;
default: default:
break; break;