diff --git a/boss/ui.cpp b/boss/ui.cpp index e37f83c..8790141 100644 --- a/boss/ui.cpp +++ b/boss/ui.cpp @@ -53,7 +53,6 @@ namespace boss { auto stats = $actions.entity("stats"); $actions.set(stats, {}); $actions.set(stats, {L"stats"}); - $actions.set(stats, {}); $actions.init(); @@ -95,4 +94,8 @@ namespace boss { void UI::run_systems() { // does nothing yet } + + void UI::attack(int attack_id) { + fmt::println("boss attacked with {}", attack_id); + } } diff --git a/boss/ui.hpp b/boss/ui.hpp index faf84ab..5cd4072 100644 --- a/boss/ui.hpp +++ b/boss/ui.hpp @@ -34,5 +34,6 @@ namespace boss { void position_sprite(SpriteTexture& st, const std::string& name, float scale, bool at_mid=false); bool boss_dead(); void run_systems(); + void attack(int attack_id); }; } diff --git a/gui/fsm.cpp b/gui/fsm.cpp index be11acf..708d334 100644 --- a/gui/fsm.cpp +++ b/gui/fsm.cpp @@ -37,7 +37,7 @@ namespace gui { FSM_STATE(State, IDLE, ev, data); FSM_STATE(State, IN_COMBAT, ev); FSM_STATE(State, COMBAT_ROTATE, ev); - FSM_STATE(State, BOSS_FIGHT, ev); + FSM_STATE(State, BOSS_FIGHT, ev, data); FSM_STATE(State, END, ev); FSM_STATE(State, LOOTING, ev, data); } @@ -206,9 +206,10 @@ namespace gui { } } - void FSM::BOSS_FIGHT(Event ev) { + void FSM::BOSS_FIGHT(Event ev, std::any data) { dbc::check($boss_fight_ui != nullptr, "$boss_fight_ui not initialized"); using enum Event; + (void)data; ///// !!!!!!!!!!!!!!!!!!!!!!! DIE this sucks switch(ev) { // this is only if using the debug X key to skip it @@ -226,9 +227,10 @@ namespace gui { event(Event::BOSS_END); } } break; - case ATTACK: - fmt::println("ATTACK THE BOSS!"); - break; + case ATTACK: { + // BUG: get rid of temp attack id and pass the data + $boss_fight_ui->attack($temp_attack_id); + } break; case MOUSE_MOVE: { sf::Vector2f pos = mouse_position(); $boss_fight_ui->mouse(pos.x, pos.y, {1 << guecs::ModBit::hover}); diff --git a/gui/fsm.hpp b/gui/fsm.hpp index 22c3bd4..d0db3a7 100644 --- a/gui/fsm.hpp +++ b/gui/fsm.hpp @@ -59,7 +59,7 @@ namespace gui { void IDLE(Event ev, std::any data); void IN_COMBAT(Event ev); void COMBAT_ROTATE(Event ev); - void BOSS_FIGHT(Event ev); + void BOSS_FIGHT(Event ev, std::any data); void LOOTING(Event ev, std::any data); void END(Event ev);