Commit without knowing what was changed
This commit is contained in:
		
					parent
					
						
							
								92575d7d08
							
						
					
				
			
			
				commit
				
					
						20bfb96171
					
				
			
		
					 2 changed files with 57 additions and 51 deletions
				
			
		| 
						 | 
					@ -17,6 +17,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace character {
 | 
					namespace character {
 | 
				
			||||||
    class CharacterSheet;
 | 
					    class CharacterSheet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    namespace characteristic {
 | 
					    namespace characteristic {
 | 
				
			||||||
        class Characteristic;
 | 
					        class Characteristic;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -61,9 +62,7 @@ namespace character {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [[nodiscard]] const std::minus<std::uint32_t> &get_minus_operation() const { return minus; }
 | 
					        [[nodiscard]] const std::minus<std::uint32_t> &get_minus_operation() const { return minus; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        static void check_dagger_conditions(const CharacterSheet &sheet,
 | 
					        static void check_dagger_conditions(CharacterSheet &sheet);
 | 
				
			||||||
                characteristic::Characteristic &localHabilete,
 | 
					 | 
				
			||||||
                const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
        std::plus<std::uint32_t> plus;
 | 
					        std::plus<std::uint32_t> plus;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,11 +17,17 @@ namespace character {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool BillyObjects::insert_object(CharacterSheet &sheet, const billyEnums objType) noexcept {
 | 
					    bool BillyObjects::insert_object(CharacterSheet &sheet, const billyEnums objType) noexcept {
 | 
				
			||||||
        if (sheet.objects.size() < 3) {
 | 
					        if (sheet.objects.size() < 3) {
 | 
				
			||||||
            sheet.objects.emplace(objType, std::visit(overloaded{
 | 
					            sheet.objects.emplace(objType,
 | 
				
			||||||
                    [](const weapons &arg) { return std::unique_ptr<GenericObject>(std::make_unique<Weapons>(arg)); },
 | 
					                std::visit(overloaded{
 | 
				
			||||||
                    [](const equipments &arg) { return std::unique_ptr<GenericObject>(std::make_unique<Equipments>(arg)); },
 | 
					                        [](const weapons &arg) {
 | 
				
			||||||
 | 
					                            return std::unique_ptr<GenericObject>(std::make_unique<Weapons>(arg));
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
 | 
					                        [](const equipments &arg) {
 | 
				
			||||||
 | 
					                            return std::unique_ptr<GenericObject>(std::make_unique<Equipments>(arg));
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
                        [](const tools &arg) { return std::unique_ptr<GenericObject>(std::make_unique<Tools>(arg)); },
 | 
					                        [](const tools &arg) { return std::unique_ptr<GenericObject>(std::make_unique<Tools>(arg)); },
 | 
				
			||||||
            }, objType));
 | 
					                    },
 | 
				
			||||||
 | 
					                    objType));
 | 
				
			||||||
            const auto &object = sheet.objects[objType];
 | 
					            const auto &object = sheet.objects[objType];
 | 
				
			||||||
            sheet.available_objects.erase(objType);
 | 
					            sheet.available_objects.erase(objType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +40,8 @@ namespace character {
 | 
				
			||||||
                    [&](const weapons &arg) { ++sheet.nb_weapons; },
 | 
					                    [&](const weapons &arg) { ++sheet.nb_weapons; },
 | 
				
			||||||
                    [&](const equipments &arg) { ++sheet.nb_equipments; },
 | 
					                    [&](const equipments &arg) { ++sheet.nb_equipments; },
 | 
				
			||||||
                    [&](const tools &arg) { ++sheet.nb_tools; },
 | 
					                    [&](const tools &arg) { ++sheet.nb_tools; },
 | 
				
			||||||
            }, objType);
 | 
					                },
 | 
				
			||||||
 | 
					                objType);
 | 
				
			||||||
            change_carac(object, sheet, local_habilete, local_adresse, local_endurance, local_chance, plus);
 | 
					            change_carac(object, sheet, local_habilete, local_adresse, local_endurance, local_chance, plus);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -56,7 +63,8 @@ namespace character {
 | 
				
			||||||
                    [&](const weapons &arg) { --sheet.nb_weapons; },
 | 
					                    [&](const weapons &arg) { --sheet.nb_weapons; },
 | 
				
			||||||
                    [&](const equipments &arg) { --sheet.nb_equipments; },
 | 
					                    [&](const equipments &arg) { --sheet.nb_equipments; },
 | 
				
			||||||
                    [&](const tools &arg) { --sheet.nb_tools; }
 | 
					                    [&](const tools &arg) { --sheet.nb_tools; }
 | 
				
			||||||
            }, objToErase);
 | 
					                },
 | 
				
			||||||
 | 
					                objToErase);
 | 
				
			||||||
            change_carac(obj, sheet, local_habilete, local_adresse, local_endurance, local_chance, minus);
 | 
					            change_carac(obj, sheet, local_habilete, local_adresse, local_endurance, local_chance, minus);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -77,19 +85,17 @@ namespace character {
 | 
				
			||||||
        sheet.critique = operation(sheet.critique, arg->add_critique());
 | 
					        sheet.critique = operation(sheet.critique, arg->add_critique());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void BillyObjects::check_dagger_conditions(const CharacterSheet &sheet,
 | 
					    void BillyObjects::check_dagger_conditions(CharacterSheet &sheet) {
 | 
				
			||||||
            Characteristic &localHabilete,
 | 
					        if (const auto it_dagger = sheet.get_objects().find(tools::Dagger); it_dagger != sheet.get_objects().cend()) {
 | 
				
			||||||
            const std::function<std::uint32_t(std::uint32_t, std::uint32_t)> &operation) {
 | 
					            const std::size_t count_weapons = std::count_if(sheet.get_objects().cbegin(),
 | 
				
			||||||
        if (const auto it_dagger = sheet.objects.find(tools::Dagger); it_dagger != sheet.objects.cend()) {
 | 
					                sheet.get_objects().cend(),
 | 
				
			||||||
            const std::size_t count_weapons = std::count_if(sheet.objects.cbegin(),
 | 
					 | 
				
			||||||
                    sheet.objects.cend(),
 | 
					 | 
				
			||||||
                [](container::const_reference node) {
 | 
					                [](container::const_reference node) {
 | 
				
			||||||
                    return std::get_if<weapons>(&node.first) != nullptr;
 | 
					                    return std::get_if<weapons>(&node.first) != nullptr;
 | 
				
			||||||
                    });
 | 
					                }
 | 
				
			||||||
            const bool is_there_bow = sheet.objects.find(weapons::Bow) != sheet.objects.cend();
 | 
					            );
 | 
				
			||||||
            if (count_weapons > 1 || is_there_bow) {
 | 
					            if (const bool is_there_bow = sheet.get_objects().find(weapons::Bow) != sheet.get_objects().cend();
 | 
				
			||||||
                localHabilete.materiel = operation(localHabilete.materiel,
 | 
					                count_weapons > 1 || is_there_bow) {
 | 
				
			||||||
                        -it_dagger->second->add_materiel(localHabilete.type));
 | 
					                sheet.habilete.materiel -= it_dagger->second->add_materiel(sheet.get_habilete().type);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -129,7 +135,8 @@ namespace character {
 | 
				
			||||||
                    [&j](const tools tool) {
 | 
					                    [&j](const tools tool) {
 | 
				
			||||||
                        j.emplace_back(std::pair{ toolsHash, static_cast<std::uint8_t>(tool) });
 | 
					                        j.emplace_back(std::pair{ toolsHash, static_cast<std::uint8_t>(tool) });
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
            }, object_type);
 | 
					                },
 | 
				
			||||||
 | 
					                object_type);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue