Feature: adding matériel to Billy.

No conformity is done when adding things (dagger or bow for example)
This commit is contained in:
Pcornat 2024-09-02 12:46:04 +02:00
parent 6ad47b12bf
commit 75f8db9f5a
Signed by: Pcornat
GPG key ID: E0326CC678A00BDD
6 changed files with 124 additions and 37 deletions

View file

@ -17,9 +17,10 @@ constexpr std::uint32_t toolsHash = const_hash("tools");
namespace character {
using characteristic::Characteristic;
void BillyObjects::push_object(const billyObject &object, CharacterSheet &sheet) noexcept {
bool BillyObjects::push_object(const billyObject &object, CharacterSheet &sheet) noexcept {
if (sheet.objects.size() < 3) {
sheet.objects.emplace_back(object);
sheet.available_objects.erase(object);
auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
@ -53,13 +54,16 @@ namespace character {
plus);
},
}, object);
return true;
}
return false;
}
void BillyObjects::pop_object(CharacterSheet &sheet) noexcept {
if (!sheet.objects.empty()) {
const billyObject obj = sheet.objects.back();
sheet.objects.pop_back();
sheet.available_objects.insert(obj);
auto &local_habilete = static_cast<Characteristic &>(sheet.habilete);
auto &local_adresse = static_cast<Characteristic &>(sheet.adresse);
@ -109,6 +113,7 @@ namespace character {
localEndurance.materiel = operation(localEndurance.materiel, 3);
break;
case tools::Dagger:
sheet.critique = operation(sheet.critique, 6);
break;
case tools::RockClimbingKit:
localAdresse.materiel = operation(localAdresse.materiel, 1);