Compare commits
3 commits
c6c3d941ea
...
d610ba3762
| Author | SHA1 | Date | |
|---|---|---|---|
|
d610ba3762 |
|||
|
f245f84601 |
|||
|
e575a51284 |
2 changed files with 5 additions and 9 deletions
|
|
@ -45,6 +45,8 @@ namespace character {
|
|||
|
||||
static constexpr std::string_view json_key{ "billy_objects" };
|
||||
|
||||
static constexpr std::uint32_t max_obj{ 3 };
|
||||
|
||||
static std::string_view billy_object_to_string(const billyObjects &object) noexcept;
|
||||
|
||||
static void to_json(json &j, const container &billy);
|
||||
|
|
@ -53,7 +55,7 @@ namespace character {
|
|||
|
||||
[[nodiscard]] bool insert_object(CharacterSheet &sheet, const billyEnums objType) noexcept;
|
||||
|
||||
bool erase_object(CharacterSheet &sheet, const billyEnums objToErase) noexcept;
|
||||
[[nodiscard]] bool erase_object(CharacterSheet &sheet, const billyEnums objToErase) noexcept;
|
||||
|
||||
[[nodiscard]] const std::plus<std::uint32_t> &get_plus_operation() const { return plus; }
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace character {
|
|||
|
||||
|
||||
bool BillyObjects::insert_object(CharacterSheet &sheet, const billyEnums objType) noexcept {
|
||||
if (sheet.objects.size() < 3) {
|
||||
if (sheet.objects.size() < max_obj) {
|
||||
sheet.objects.emplace(objType,
|
||||
std::visit(overloaded{
|
||||
[](const weapons &arg) {
|
||||
|
|
@ -99,13 +99,7 @@ namespace character {
|
|||
|
||||
void BillyObjects::check_dagger_conditions(CharacterSheet &sheet) {
|
||||
if (const auto it_dagger = sheet.get_objects().find(tools::Dagger); it_dagger != sheet.get_objects().cend()) {
|
||||
const std::size_t count_weapons = std::ranges::count_if(sheet.get_objects(),
|
||||
[](container::const_reference node) {
|
||||
return std::get_if<weapons>(&node.first) !=
|
||||
nullptr;
|
||||
}
|
||||
);
|
||||
if (count_weapons > 1 || sheet.get_objects().contains(weapons::Bow)) {
|
||||
if (sheet.get_nb_weapons() > 1 || sheet.get_objects().contains(weapons::Bow)) {
|
||||
sheet.habilete.materiel -= it_dagger->second->add_materiel(sheet.get_habilete().type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue