Now have enough state to show what's going on in the fight, next is to use graphics and stuff to make it better.
This commit is contained in:
parent
a8863cf687
commit
f50e713179
9 changed files with 55 additions and 16 deletions
|
|
@ -116,19 +116,29 @@ namespace boss {
|
|||
}
|
||||
|
||||
void Fight::do_combat(std::any data) {
|
||||
using combat::BattleHostState;
|
||||
|
||||
dbc::check(data.type() == typeid(components::CombatResult),
|
||||
fmt::format("Boss Fight received any data={}", data.type().name()));
|
||||
fmt::format("Boss Fight wrong 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);
|
||||
switch(result.host_state) {
|
||||
case BattleHostState::agree:
|
||||
case BattleHostState::disagree: {
|
||||
std::string player_move = Random::uniform(0, 1) == 0 ? "player1" : "player3";
|
||||
$ui.move_actor("player", player_move);
|
||||
$ui.damage("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);
|
||||
$ui.damage("player", result.enemy_did);
|
||||
} break;
|
||||
case BattleHostState::out_of_ap:
|
||||
break;
|
||||
}
|
||||
|
||||
$ui.damage("player", result.enemy_did);
|
||||
$ui.damage("boss", result.player_did);
|
||||
}
|
||||
|
||||
void Fight::END(game::Event ev, std::any) {
|
||||
|
|
|
|||
|
|
@ -94,13 +94,21 @@ namespace boss {
|
|||
|
||||
void System::combat(BattleResult& action, std::shared_ptr<DinkyECS::World> world, DinkyECS::Entity boss_id, int attack_id) {
|
||||
|
||||
fmt::println("COMBAT >>> enemy={}, wants_to={}, cost={}, host_state={}",
|
||||
int(action.enemy.entity), action.wants_to, action.cost, int(action.host_state));
|
||||
|
||||
auto& level = GameDB::current_level();
|
||||
auto& player_combat = world->get<Combat>(level.player);
|
||||
auto& boss_combat = world->get<Combat>(boss_id);
|
||||
|
||||
auto& [enemy, wants_to, cost, host_state] = action;
|
||||
|
||||
components::CombatResult result{};
|
||||
components::CombatResult result {
|
||||
.attacker=enemy.entity,
|
||||
.host_state=host_state,
|
||||
.player_did=0,
|
||||
.enemy_did=0
|
||||
};
|
||||
|
||||
switch(host_state) {
|
||||
case BattleHostState::agree:
|
||||
|
|
|
|||
|
|
@ -105,11 +105,16 @@ namespace boss {
|
|||
}
|
||||
|
||||
void UI::damage(const std::string& actor, int amount) {
|
||||
auto& config = $arena.actor_config(actor);
|
||||
|
||||
if(amount == 0) {
|
||||
$arena.$ui.show_text("boss7", fmt::format(L"{} MISSED!", guecs::to_wstring(actor)));
|
||||
$arena.$ui.show_text(config.cell,
|
||||
fmt::format(L"{} MISSED!", guecs::to_wstring(actor)));
|
||||
} else {
|
||||
$arena.$ui.show_text("boss7", fmt::format(L"{} HIT {}!", guecs::to_wstring(actor), amount));
|
||||
$arena.$ui.show_text(config.cell,
|
||||
fmt::format(L"{} HIT {}!", guecs::to_wstring(actor), amount));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UI::zoom(const std::string &cell_name, double ratio) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue