Better UI for the ritual crafting that almost works, but need to get the selected items to move down. Might need some state machine love soon.
This commit is contained in:
parent
9d55b2954a
commit
14619558fa
9 changed files with 99 additions and 48 deletions
21
rituals.cpp
21
rituals.cpp
|
@ -35,6 +35,19 @@ namespace ritual {
|
|||
return $states.at(name);
|
||||
}
|
||||
|
||||
void Engine::load_junk(CraftingState& ritual, const JunkItem& item) {
|
||||
Config config("assets/rituals.json");
|
||||
auto& junk = config["junk"];
|
||||
auto& item_desc = junk[item];
|
||||
|
||||
fmt::print("Item {} provides: ", item);
|
||||
for(auto& effect : item_desc["provides"]) {
|
||||
fmt::print("{} ", (std::string)effect);
|
||||
set_state(ritual, effect, true);
|
||||
}
|
||||
fmt::print("\n");
|
||||
}
|
||||
|
||||
ai::Action Engine::load_action(std::string name) {
|
||||
return $actions.at(name);
|
||||
}
|
||||
|
@ -55,6 +68,8 @@ namespace ritual {
|
|||
|
||||
void CraftingState::reset() {
|
||||
start = original;
|
||||
plan.complete = false;
|
||||
plan.script.clear();
|
||||
}
|
||||
|
||||
void Engine::plan(CraftingState& ritual) {
|
||||
|
@ -79,9 +94,11 @@ namespace ritual {
|
|||
}
|
||||
|
||||
bool CraftingState::is_combined() {
|
||||
dbc::check(!plan.script.empty(), "you are attempting to check an empty plan");
|
||||
// it's only combined if it has > 1 and last is combined
|
||||
if(plan.script.size() <= 1) return false;
|
||||
|
||||
auto& last = plan.script.back();
|
||||
return plan.script.size() > 1 && last.name == "combined";
|
||||
return last.name == "combined";
|
||||
}
|
||||
|
||||
Action Engine::finalize(CraftingState& ritual) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue