Exploring raycasters and possibly make a little "doom like" game based on it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
raycaster/rituals.hpp

87 lines
1.9 KiB

#pragma once
#include "goap.hpp"
#include "ai.hpp"
#include "config.hpp"
#include "dinkyecs.hpp"
namespace ritual {
enum class Element {
NONE=0, FIRE=1, LIGHTNING=2
};
enum class Kind {
NONE=0, PHYSICAL=1, MAGICK=2
};
struct CraftingState {
std::string script;
ai::State start;
ai::State original;
ai::State goal;
ai::ActionPlan plan;
CraftingState(std::string script, ai::State start, ai::State goal) :
script(script), start(start), original(start), goal(goal)
{
}
CraftingState() {};
bool will_do(std::string name);
void dump();
ai::Action pop();
bool is_combined();
void reset();
};
struct Action {
float probability = 1.0f;
int damage = 0;
Kind kind{Kind::NONE};
Element element{Element::NONE};
std::vector<std::string> names;
void dump();
};
struct Engine {
Config $config;
ai::AIProfile $profile;
std::unordered_map<std::string, ai::Action> $actions;
std::unordered_map<std::string, ai::State> $states;
std::unordered_map<std::string, std::vector<ai::Action>> $scripts;
Engine(std::string config_path="assets/rituals.json");
ai::State load_state(std::string name);
ai::Action load_action(std::string name);
CraftingState start();
void set_state(CraftingState& ritual, std::string name, bool setting);
void plan(CraftingState& ritual);
Action finalize(CraftingState& ritual);
};
struct Belt {
std::unordered_map<int, Action> equipped;
Action& get(int index);
void equip(int index, Action& action);
bool has(int index);
void unequip(int index);
};
using JunkItem = std::string;
struct JunkPile {
std::vector<JunkItem> contents;
};
struct Blanket {
DinkyECS::World contents;
DinkyECS::Entity add(JunkItem name);
JunkItem& get(DinkyECS::Entity ent);
bool has(DinkyECS::Entity ent);
void remove(DinkyECS::Entity ent);
};
}