Rituals are now taken from the belt and shown in th combat_ui and in the system::combat. They aren't used in combat calcs yet though.

master
Zed A. Shaw 2 days ago
parent 00c28f47eb
commit ebb69dd589
  1. 4
      Makefile
  2. 9
      assets/rituals.json
  3. 18
      combat_ui.cpp
  4. 3
      levelmanager.cpp
  5. 4
      rituals.cpp
  6. 8
      systems.cpp

@ -22,7 +22,7 @@ tracy_build:
meson compile -j 10 -C builddir
test: build
./builddir/runtests "[rituals-belt]"
./builddir/runtests
run: build test
powershell "cp ./builddir/zedcaster.exe ."
@ -41,7 +41,7 @@ clean:
meson compile --clean -C builddir
debug_test: build
gdb --nx -x .gdbinit --ex run --args builddir/runtests.exe -e "[rituals-belt]"
gdb --nx -x .gdbinit --ex run --args builddir/runtests.exe -e
win_installer:
powershell 'start "C:\Program Files (x86)\solicus\InstallForge\bin\ifbuilderenvx86.exe" win_installer.ifp'

@ -145,7 +145,6 @@
"pierce_type": {
"damage": 11,
"kind": 1,
"element": 0,
"probability": 1.0
},
"magick_type": {
@ -156,26 +155,18 @@
},
"heals_user": {
"damage": 13,
"kind": 0,
"element": 0,
"probability": 1.0
},
"curses_user": {
"damage": 14,
"kind": 0,
"element": 0,
"probability": 0.5
},
"boost_damage_large": {
"damage": 15,
"kind": 0,
"element": 0,
"probability": 1.0
},
"combined": {
"damage": 16,
"kind": 0,
"element": 0,
"probability": 1.0
}
}

@ -1,6 +1,8 @@
#include "combat_ui.hpp"
#include "constants.hpp"
#include "color.hpp"
#include "rituals.hpp"
#include <fmt/xchar.h>
namespace gui {
using namespace guecs;
@ -10,7 +12,7 @@ namespace gui {
{
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
$gui.layout(
"[*%(100,150)button_attack | *%(100,150)button_block | *%(100,150)button_evade | *%(100,150)button_heal]");
"[*%(100,150)button_0 | *%(100,150)button_1 | *%(100,150)button_2 | *%(100,150)button_3]");
}
void CombatUI::make_button(std::string name, std::wstring label, Events::GUI event, int action) {
@ -26,10 +28,16 @@ namespace gui {
void CombatUI::init() {
$gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
make_button("button_attack", L"Attack", Events::GUI::ATTACK, 1);
make_button("button_block", L"Block", Events::GUI::ATTACK, 2);
make_button("button_evade", L"Evade", Events::GUI::EVADE, 0);
make_button("button_heal", L"Heal", Events::GUI::HEAL, 0);
auto& the_belt = $level.world->get<combat::RitualBelt>($level.player);
for(int slot = 0; slot < 4; slot++) {
if(the_belt.has(slot)) {
std::string name = fmt::format("button_{}", slot);
std::wstring label = fmt::format(L"Attack {}", slot+1);
make_button(name, label, Events::GUI::ATTACK, slot);
}
}
$gui.init();
}

@ -38,6 +38,9 @@ void LevelManager::temp_create_player_rituals() {
re.set_state(blanket, "has_spikes", true);
re.plan(blanket);
ritual = re.finalize(blanket);
dbc::check(ritual.kind == combat::RitualKind::PHYSICAL,
fmt::format("second attack is not physical but is {}",
int(ritual.kind)));
the_belt.equip(1, ritual);
}

@ -95,8 +95,8 @@ namespace combat {
auto& effect = effects[action.name];
result.damage += int(effect["damage"]);
result.probability *= float(effect["probability"]);
result.kind = RitualKind(int(effect["kind"]));
result.element = RitualElement(int(effect["element"]));
if(effect.contains("kind")) result.kind = RitualKind(int(effect["kind"]));
if(effect.contains("element")) result.element = RitualElement(int(effect["element"]));
}
}

@ -208,7 +208,12 @@ void System::combat(GameLevel &level, int attack_id) {
auto &collider = *level.collision;
auto &world = *level.world;
auto player = world.get_the<Player>();
auto& the_belt = world.get<combat::RitualBelt>(player.entity);
dbc::check(the_belt.has(attack_id),
fmt::format("the_belt does not have an attack with id={}", attack_id));
auto& ritual = the_belt.get(attack_id);
const auto& player_position = world.get<Position>(player.entity);
auto& player_combat = world.get<Combat>(player.entity);
@ -238,7 +243,8 @@ void System::combat(GameLevel &level, int attack_id) {
};
if(result.player_did > 0) {
auto effect = shaders::get(attack_id == 1 ? "flame" : "lightning");
auto effect = shaders::get(
ritual.kind == combat::RitualKind::PHYSICAL ? "flame" : "lightning");
world.set<SpriteEffect>(enemy.entity, {100, effect});
}

Loading…
Cancel
Save