Getting more UI elements sorted out in the boss fight.
This commit is contained in:
parent
d4d8d8ca99
commit
a8863cf687
4 changed files with 28 additions and 44 deletions
|
|
@ -30,7 +30,6 @@ namespace boss {
|
|||
switch($state) {
|
||||
FSM_STATE(State, START, ev, data);
|
||||
FSM_STATE(State, PLAYER_REQUESTS, ev, data);
|
||||
FSM_STATE(State, PLAN_BATTLE, ev, data);
|
||||
FSM_STATE(State, EXEC_PLAN, ev, data);
|
||||
FSM_STATE(State, END, ev, data);
|
||||
}
|
||||
|
|
@ -43,7 +42,7 @@ namespace boss {
|
|||
// this is only if using the debug X key to skip it
|
||||
case TICK:
|
||||
case BOSS_START:
|
||||
$ui.status(L"PLAYER REQUESTS");
|
||||
$ui.status(L"PLAYER REQUESTS", L"COMMIT");
|
||||
$battle.ap_refresh();
|
||||
state(State::PLAYER_REQUESTS);
|
||||
break;
|
||||
|
|
@ -62,8 +61,8 @@ namespace boss {
|
|||
break;
|
||||
case COMBAT_START:
|
||||
System::plan_battle($battle, $world, $boss_id);
|
||||
$ui.status(L"PLANNING BATTLE");
|
||||
state(State::PLAN_BATTLE);
|
||||
$ui.status(L"EXEC PLAN", L"START");
|
||||
state(State::EXEC_PLAN);
|
||||
break;
|
||||
case ATTACK:
|
||||
if($battle.player_request("kill_enemy")) {
|
||||
|
|
@ -80,7 +79,7 @@ namespace boss {
|
|||
}
|
||||
}
|
||||
|
||||
void Fight::PLAN_BATTLE(game::Event ev, std::any data) {
|
||||
void Fight::EXEC_PLAN(game::Event ev, std::any data) {
|
||||
using enum game::Event;
|
||||
|
||||
switch(ev) {
|
||||
|
|
@ -89,23 +88,27 @@ namespace boss {
|
|||
state(State::END);
|
||||
break;
|
||||
case COMBAT_START:
|
||||
$ui.status(L"EXEC PLAN");
|
||||
state(State::EXEC_PLAN);
|
||||
$ui.status(L"X TURN", L"STEP");
|
||||
next_combat_dumb_name();
|
||||
break;
|
||||
case COMBAT:
|
||||
do_combat(data);
|
||||
break;
|
||||
case TICK:
|
||||
break; // ignore tick
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Fight::next_combat_dumb_name() {
|
||||
if(auto action = $battle.next()) {
|
||||
System::combat(*action, $world, $boss_id, 0);
|
||||
} else if(player_dead()) {
|
||||
$ui.status(L"YOU DIED", L"DEAD");
|
||||
state(State::END);
|
||||
} else {
|
||||
$ui.status(L"PLAYER REQUESTS");
|
||||
$ui.zoom("", 1.0);
|
||||
$ui.status(L"PLAYER REQUESTS", L"COMMIT");
|
||||
$battle.ap_refresh();
|
||||
$battle.clear_requests();
|
||||
state(State::PLAYER_REQUESTS);
|
||||
|
|
@ -124,35 +127,8 @@ namespace boss {
|
|||
$ui.move_actor("player", player_move);
|
||||
$ui.move_actor("boss", boss_move);
|
||||
|
||||
if(result.enemy_did > 0) {
|
||||
// make boss move
|
||||
$ui.animate_actor("boss");
|
||||
}
|
||||
|
||||
if(result.player_did > 0) {
|
||||
// make player move
|
||||
$ui.animate_actor("player");
|
||||
$ui.zoom(player_move, 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
void Fight::EXEC_PLAN(game::Event ev, std::any data) {
|
||||
using enum game::Event;
|
||||
|
||||
switch(ev) {
|
||||
// this is only if using the debug X key to skip it
|
||||
case BOSS_START:
|
||||
state(State::END);
|
||||
break;
|
||||
case COMBAT_START:
|
||||
next_combat_dumb_name();
|
||||
break;
|
||||
case COMBAT:
|
||||
do_combat(data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$ui.damage("player", result.enemy_did);
|
||||
$ui.damage("boss", result.player_did);
|
||||
}
|
||||
|
||||
void Fight::END(game::Event ev, std::any) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue