|
|
|
@ -4,6 +4,7 @@ |
|
|
|
|
#include "rand.hpp" |
|
|
|
|
#include "animation.hpp" |
|
|
|
|
#include "rand.hpp" |
|
|
|
|
#include "sound.hpp" |
|
|
|
|
|
|
|
|
|
namespace gui { |
|
|
|
|
using namespace guecs; |
|
|
|
@ -90,7 +91,7 @@ namespace gui { |
|
|
|
|
bs.sprite->setPosition({float(x), float(y)}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// this is where we add the junk to the engine
|
|
|
|
|
$engine.set_state($blanket, "has_magick", true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RitualUI::reset_inv_positions() { |
|
|
|
@ -115,7 +116,19 @@ namespace gui { |
|
|
|
|
animation::rotate(*bs.sprite, 20.0); |
|
|
|
|
|
|
|
|
|
// finalize here ritual here
|
|
|
|
|
$engine.plan($blanket); |
|
|
|
|
|
|
|
|
|
if($blanket.is_combined()) { |
|
|
|
|
// add it to the belt
|
|
|
|
|
auto ritual = $engine.finalize($blanket); |
|
|
|
|
auto& the_belt = $level.world->get<combat::RitualBelt>($level.player); |
|
|
|
|
the_belt.equip(0, ritual); |
|
|
|
|
$level.world->send<Events::GUI>(Events::GUI::NEW_RITUAL, $level.player, {}); |
|
|
|
|
reset_inv_positions(); |
|
|
|
|
} else { |
|
|
|
|
fmt::println("Failed to combine!"); |
|
|
|
|
sound::play("ui_click"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool RitualUI::mouse(float x, float y, bool hover) { |
|
|
|
@ -128,6 +141,7 @@ namespace gui { |
|
|
|
|
if($ritual_state == OPEN) { |
|
|
|
|
$ritual_state = CLOSING; |
|
|
|
|
} else if($ritual_state == CLOSED) { |
|
|
|
|
$blanket = $engine.start(); |
|
|
|
|
$ritual_state = OPENING; |
|
|
|
|
$ritual_anim.play(); |
|
|
|
|
} |
|
|
|
|