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.
This commit is contained in:
parent
00c28f47eb
commit
ebb69dd589
6 changed files with 27 additions and 19 deletions
4
Makefile
4
Makefile
|
@ -22,7 +22,7 @@ tracy_build:
|
||||||
meson compile -j 10 -C builddir
|
meson compile -j 10 -C builddir
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
./builddir/runtests "[rituals-belt]"
|
./builddir/runtests
|
||||||
|
|
||||||
run: build test
|
run: build test
|
||||||
powershell "cp ./builddir/zedcaster.exe ."
|
powershell "cp ./builddir/zedcaster.exe ."
|
||||||
|
@ -41,7 +41,7 @@ clean:
|
||||||
meson compile --clean -C builddir
|
meson compile --clean -C builddir
|
||||||
|
|
||||||
debug_test: build
|
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:
|
win_installer:
|
||||||
powershell 'start "C:\Program Files (x86)\solicus\InstallForge\bin\ifbuilderenvx86.exe" win_installer.ifp'
|
powershell 'start "C:\Program Files (x86)\solicus\InstallForge\bin\ifbuilderenvx86.exe" win_installer.ifp'
|
||||||
|
|
|
@ -145,7 +145,6 @@
|
||||||
"pierce_type": {
|
"pierce_type": {
|
||||||
"damage": 11,
|
"damage": 11,
|
||||||
"kind": 1,
|
"kind": 1,
|
||||||
"element": 0,
|
|
||||||
"probability": 1.0
|
"probability": 1.0
|
||||||
},
|
},
|
||||||
"magick_type": {
|
"magick_type": {
|
||||||
|
@ -156,26 +155,18 @@
|
||||||
},
|
},
|
||||||
"heals_user": {
|
"heals_user": {
|
||||||
"damage": 13,
|
"damage": 13,
|
||||||
"kind": 0,
|
|
||||||
"element": 0,
|
|
||||||
"probability": 1.0
|
"probability": 1.0
|
||||||
},
|
},
|
||||||
"curses_user": {
|
"curses_user": {
|
||||||
"damage": 14,
|
"damage": 14,
|
||||||
"kind": 0,
|
|
||||||
"element": 0,
|
|
||||||
"probability": 0.5
|
"probability": 0.5
|
||||||
},
|
},
|
||||||
"boost_damage_large": {
|
"boost_damage_large": {
|
||||||
"damage": 15,
|
"damage": 15,
|
||||||
"kind": 0,
|
|
||||||
"element": 0,
|
|
||||||
"probability": 1.0
|
"probability": 1.0
|
||||||
},
|
},
|
||||||
"combined": {
|
"combined": {
|
||||||
"damage": 16,
|
"damage": 16,
|
||||||
"kind": 0,
|
|
||||||
"element": 0,
|
|
||||||
"probability": 1.0
|
"probability": 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "combat_ui.hpp"
|
#include "combat_ui.hpp"
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "color.hpp"
|
#include "color.hpp"
|
||||||
|
#include "rituals.hpp"
|
||||||
|
#include <fmt/xchar.h>
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
|
@ -10,7 +12,7 @@ namespace gui {
|
||||||
{
|
{
|
||||||
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
|
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
|
||||||
$gui.layout(
|
$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) {
|
void CombatUI::make_button(std::string name, std::wstring label, Events::GUI event, int action) {
|
||||||
|
@ -26,10 +28,16 @@ namespace gui {
|
||||||
|
|
||||||
void CombatUI::init() {
|
void CombatUI::init() {
|
||||||
$gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
|
$gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
|
||||||
make_button("button_attack", L"Attack", Events::GUI::ATTACK, 1);
|
auto& the_belt = $level.world->get<combat::RitualBelt>($level.player);
|
||||||
make_button("button_block", L"Block", Events::GUI::ATTACK, 2);
|
|
||||||
make_button("button_evade", L"Evade", Events::GUI::EVADE, 0);
|
for(int slot = 0; slot < 4; slot++) {
|
||||||
make_button("button_heal", L"Heal", Events::GUI::HEAL, 0);
|
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();
|
$gui.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ void LevelManager::temp_create_player_rituals() {
|
||||||
re.set_state(blanket, "has_spikes", true);
|
re.set_state(blanket, "has_spikes", true);
|
||||||
re.plan(blanket);
|
re.plan(blanket);
|
||||||
ritual = re.finalize(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);
|
the_belt.equip(1, ritual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,8 @@ namespace combat {
|
||||||
auto& effect = effects[action.name];
|
auto& effect = effects[action.name];
|
||||||
result.damage += int(effect["damage"]);
|
result.damage += int(effect["damage"]);
|
||||||
result.probability *= float(effect["probability"]);
|
result.probability *= float(effect["probability"]);
|
||||||
result.kind = RitualKind(int(effect["kind"]));
|
if(effect.contains("kind")) result.kind = RitualKind(int(effect["kind"]));
|
||||||
result.element = RitualElement(int(effect["element"]));
|
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 &collider = *level.collision;
|
||||||
auto &world = *level.world;
|
auto &world = *level.world;
|
||||||
auto player = world.get_the<Player>();
|
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);
|
const auto& player_position = world.get<Position>(player.entity);
|
||||||
auto& player_combat = world.get<Combat>(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) {
|
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});
|
world.set<SpriteEffect>(enemy.entity, {100, effect});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue