Skip to content
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

Merged
merged 4 commits into from
Dec 31, 2019

Conversation

Fris0uman
Copy link
Contributor

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

Co-Authored-By: Anton Burmistrov <[email protected]>
@kevingranade kevingranade merged commit 528f49b into CleverRaven:master Dec 31, 2019
fengjixuchui added a commit to fengjixuchui/Cataclysm-DDA that referenced this pull request Dec 31, 2019
Jsonize crafting skill penalty from mutations (CleverRaven#36565)
@Fris0uman Fris0uman deleted the paw branch December 31, 2019 08:45
@@ -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() ) {
Copy link
Contributor

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 ) {
Copy link
Contributor

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.

@Fris0uman
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paws mutation makes low-level crafting impossible.
4 participants