-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jsonize crafting skill penalty from mutations #36565
Conversation
Co-Authored-By: Anton Burmistrov <[email protected]>
Jsonize crafting skill penalty from mutations (CleverRaven#36565)
@@ -411,6 +411,15 @@ void mutation_branch::load( const JsonObject &jo, const std::string & ) | |||
spells_learned.emplace( sp, ja.next_int() ); | |||
} | |||
|
|||
for( JsonArray ja : jo.get_array( "craft_skill_bonus" ) ) { | |||
const skill_id skid( ja.next_string() ); | |||
if( skid.is_valid() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the skill definition is loaded after the mutation is loaded? This will report that skill id as invalid. Id checking should be done after everything has been loaded.
paws_rank_penalty += 1; | ||
for( const std::pair< trait_id, trait_data > &mut : my_mutations ) { | ||
for( const std::pair<skill_id, int> &skib : mut.first->craft_skill_bonus ) { | ||
if( making.skill_used == skib.first ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
craft_skill_bonus
is a std::map
. You can lookup keys in a map, there is a function for that. You do not need to iterate over all entries of the map.
Right, I can't work on it right now, but I'll fix it next tuesday if no one else has done it by then. |
Summary
SUMMARY: Infrastructure "Jsonize crafting skill penalty from mutations"
Purpose of change
Jsonize crafting skill penalty from mutations
Halve penalty from Paws, and Broad Paws to fix #36439
Describe the solution
Describe alternatives you've considered
Testing
Start game without error
Debug paw mutation
Get supply for level 1 tailor craft
Try crafting
Immedialty fail
Halve penalty
Try again
Mess up craft several times
Eventually succeed to craft the gloves and get 33% toward the next tailoring level
Additional context