Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5312632
feat(wip): cover first testcase
Oct 8, 2024
4b83202
fix: include broken tests
Oct 8, 2024
030e83f
fix: struct init
Oct 8, 2024
59ac6e2
fix: working build and ecs.
Oct 9, 2024
03974b3
feat: merge
Oct 9, 2024
dffd347
feat: I can't believe it's working. Kinda.
Oct 10, 2024
0ef5105
feat: clean up
Oct 10, 2024
00f4491
feat: transform in ecs
Oct 11, 2024
825ab8d
feat: remove unused class
Oct 11, 2024
5949af7
feat: move ascii comp to ecs
Oct 11, 2024
01d2a7f
feat: id and physique components
Oct 11, 2024
bef854d
feat: formatting
Oct 11, 2024
c5d6754
feat: remove old file
Oct 12, 2024
da9f5c8
fix: hover text
Oct 12, 2024
9b8d70d
feat:(wip): building systems
Oct 14, 2024
3b76eb6
feat: remove log
Oct 14, 2024
b058c99
feat(wip): Apply a status condition
Oct 15, 2024
d77635e
feat(wip): move defence component
Oct 16, 2024
9d63480
feat(wip): messenger system
Oct 16, 2024
8c28411
feat(ecs): combat messages
Oct 17, 2024
ea7f8f0
feat(defence): move defence comps out
Oct 18, 2024
2179c7e
feat(ecs): remove old code
Oct 19, 2024
28f26b4
fix(ecs): typoo
Oct 19, 2024
280d7c8
feat(ecs): remove ref attack defense
Oct 20, 2024
8332ac8
fix: typo
Oct 21, 2024
903d233
feat(ecs): remove deleted gets
Oct 21, 2024
fdbc24e
fix: remove const
Oct 21, 2024
cf9bf2d
feat: remove comment
Oct 21, 2024
6149f17
feat(ecs); it builds!!! :tada:
Oct 22, 2024
05d1425
feat(ecs): broke build. Ai component.
Oct 22, 2024
69c8a5f
feat(ai): [wip] extract to system
Oct 23, 2024
af26f93
feat(ecs): add conversion to commands
Oct 23, 2024
d1e2212
feat(ecs): removing old ai comp
Oct 24, 2024
8f5d106
feat(ecs): remove refs to old ai comp
Oct 24, 2024
c67f506
feat(ecs): remove get ai comp from world
Oct 25, 2024
b817133
feat(ecs): Setup ai system
Oct 25, 2024
7ca4dbb
feat(ecs): pass expected params
Oct 26, 2024
b3a793f
fix(engine): remove get()
Oct 26, 2024
eead35c
feat(ecs): try to remove ref to world
Oct 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DerivePointerAlignment: false
PointerAlignment: Left

# Less-compact, but more Git friendly style options.
AlignAfterOpenBracket: AlwaysBreak
AlignAfterOpenBracket: AldestinationwaysBreak
BinPackArguments: false
BinPackParameters: false
AlignTrailingComments: false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ saves/
game.sav
build_web/
docs/

# clang
.cache/
78 changes: 0 additions & 78 deletions CMakeLists.txt.old

This file was deleted.

1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ target_include_directories(${PROJECT_NAME}

# Ensure the C++20 standard is available.
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

# Enforce UTF-8 encoding on MSVC.
if (MSVC)
Expand Down
65 changes: 0 additions & 65 deletions app/include/basic_ai_component.hpp

This file was deleted.

39 changes: 19 additions & 20 deletions app/include/colours.hpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@

#pragma once

#include <libtcod.hpp>

namespace cpprl {
static constexpr auto WHITE = tcod::ColorRGB{200, 200, 200};
static constexpr auto RED = tcod::ColorRGB{255, 0, 0};
static constexpr auto DARK_RED = tcod::ColorRGB{191, 0, 0};
static constexpr auto BLACK = tcod::ColorRGB{40, 42, 54};
static constexpr auto BLACK_DARK = tcod::ColorRGB{18, 19, 18};
static constexpr auto GREY = tcod::ColorRGB{128, 128, 128};
static constexpr auto GREEN = tcod::ColorRGB{0, 255, 0};
static constexpr auto DARK_GREEN = tcod::ColorRGB{0, 191, 0};
static constexpr auto BLUE = tcod::ColorRGB{0, 0, 255};
static constexpr auto DARK_BLUE = tcod::ColorRGB{0, 0, 191};
static constexpr auto TEAL = tcod::ColorRGB{0, 128, 128};
static constexpr auto DARK_GREY = tcod::ColorRGB{64, 64, 64};
static constexpr auto LIGHT_BLUE = tcod::ColorRGB{0, 128, 255};
static constexpr auto WHITE = tcod::ColorRGB{200, 200, 200};
static constexpr auto RED = tcod::ColorRGB{255, 0, 0};
static constexpr auto DARK_RED = tcod::ColorRGB{191, 0, 0};
static constexpr auto BLACK = tcod::ColorRGB{40, 42, 54};
static constexpr auto BLACK_DARK = tcod::ColorRGB{18, 19, 18};
static constexpr auto GREY = tcod::ColorRGB{128, 128, 128};
static constexpr auto GREEN = tcod::ColorRGB{0, 255, 0};
static constexpr auto DARK_GREEN = tcod::ColorRGB{0, 191, 0};
static constexpr auto BLUE = tcod::ColorRGB{0, 0, 255};
static constexpr auto DARK_BLUE = tcod::ColorRGB{0, 0, 191};
static constexpr auto TEAL = tcod::ColorRGB{0, 128, 128};
static constexpr auto DARK_GREY = tcod::ColorRGB{64, 64, 64};
static constexpr auto LIGHT_BLUE = tcod::ColorRGB{0, 128, 255};

static constexpr auto BAR_TEXT = WHITE;
static constexpr auto INVALID = tcod::ColorRGB{0xFF, 0xFF, 0x00};
static constexpr auto IMPOSSIBLE = tcod::ColorRGB(0x80, 0x80, 0x80);
static constexpr auto ERROR = tcod::ColorRGB(0xFF, 0x40, 0x40);
static constexpr auto HEALTH_RECOVERED = tcod::ColorRGB(0x0, 0xFF, 0x0);
static constexpr auto BAR_TEXT = WHITE;
static constexpr auto INVALID = tcod::ColorRGB{0xFF, 0xFF, 0x00};
static constexpr auto IMPOSSIBLE = tcod::ColorRGB(0x80, 0x80, 0x80);
static constexpr auto ERROR = tcod::ColorRGB(0xFF, 0x40, 0x40);
static constexpr auto HEALTH_RECOVERED = tcod::ColorRGB(0x0, 0xFF, 0x0);

} // namespace cpprl
}
43 changes: 22 additions & 21 deletions app/include/combat_system.hpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
#ifndef INCLUDE_COMBAT_SYSTEM_HPP_
#define INCLUDE_COMBAT_SYSTEM_HPP_
#pragma once

#include "components.hpp"
#include <components/status_condition.hpp>
#include <components/identity.hpp>
#include <core/types.hpp>
#include <core/event.hpp>
#include "game_entity.hpp"
#include "libtcod.hpp"

extern SupaRL::Coordinator g_coordinator;

namespace cpprl::combat_system {
inline auto handle_attack = [](Entity& attacker, Entity& target) -> int {
int damage = attacker.get_attack_component().get_damage() -
target.get_defense_component().get_defense();
if (damage > 0) {
target.get_defense_component().take_damage(damage);
return damage;
}
return 0;
};
inline auto handle_attack = [](Entity& attacker, Entity& target) -> void {
auto attack_event = SupaRL::Event(SupaRL::Events::Combat::ATTACK);
attack_event.set_param<>(SupaRL::Events::Combat::ATTACKER, attacker.get_id());
attack_event.set_param<>(SupaRL::Events::Combat::DEFENDER, target.get_id());
g_coordinator.send_event(attack_event);
};

inline auto handle_spell = [](int power, Entity& target) -> int {
int damage = power - target.get_defense_component().get_defense();
if (damage > 0) {
target.get_defense_component().take_damage(damage);
return damage;
}
return 0;
};
inline auto handle_spell = [](int power, Entity& target) -> void {
auto spell_event = SupaRL::Event(SupaRL::Events::Combat::SPELL);
spell_event.set_param<>(SupaRL::Events::Combat::Spell::TARGET, target.get_id());
spell_event.set_param<>(SupaRL::Events::Combat::Spell::POWER, power);
g_coordinator.send_event(spell_event);
};
}

#endif // INCLUDE_COMBAT_SYSTEM_HPP_


Loading