-
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
Add "forbidden traits" to professions #36074
Merged
ZhilkinSerg
merged 7 commits into
CleverRaven:dev
from
np-vortex:professions-forbidden-traits
Mar 16, 2020
Merged
Add "forbidden traits" to professions #36074
ZhilkinSerg
merged 7 commits into
CleverRaven:dev
from
np-vortex:professions-forbidden-traits
Mar 16, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BevapDin
reviewed
Dec 13, 2019
Co-Authored-By: BevapDin <[email protected]>
np-vortex
changed the title
[WIP] Add "forbidden traits" to professions
Add "forbidden traits" to professions
Dec 14, 2019
Co-Authored-By: anothersimulacrum <[email protected]>
I-am-Erk
added
0.E Feature Freeze
[C++]
Changes (can be) made in C++. Previously named `Code`
Mutations / Traits / Professions/ Hobbies
Mutations / Traits / Professions/ Hobbies
labels
Dec 18, 2019
Needs astyling. |
This was referenced Feb 16, 2020
Needs some json example - maybe add some trait restrictions to a challenge? |
ZhilkinSerg
pushed a commit
that referenced
this pull request
Mar 17, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Mar 17, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Mar 18, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Mar 29, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 1, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 1, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 2, 2020
ZhilkinSerg
pushed a commit
that referenced
this pull request
Apr 2, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[C++]
Changes (can be) made in C++. Previously named `Code`
Mutations / Traits / Professions/ Hobbies
Mutations / Traits / Professions/ Hobbies
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Features "Enable defining forbidden traits in profession .json configuration"
Purpose of change
To allow for more complex combination of scenario and professions configuration in regards to locked and forbidden traits.
Describe the solution
Adds handling of "forbidden_traits" in professions json config.
Adds logic to filter out professions whose traits conflict with traits for the scenario.
Adds a debug message on scenario select if scenario has an explicitly configured profession but there is a conflict in trait configuration between the scenario and a profession.
Debug message would appear if:
I have added the extra checks. Should I attempt to refactor player::has_conflicting_trait to use more generic code to check for conflicts in traits?
Describe alternatives you've considered
Do not throw a debug message in game.
Do not check for conflicting traits at the moment of scenario selection or anywhere else in game, but do it outside of game by parsing json files and detecting conflicting configuration, maybe even during running of tests.
Instead of removing a profession from menu in game, make it greyed out and display a message if it is clicked on with an explanation of why the player can not choose this profession. This is more complex.
Testing
Chose a scenario Y that has profession profession Z enabled. Added a trait X as a locked trait to a scenario Y, added trait X as a forbidden trait to a profession Z, started a new game, picked scenario Y, observed debug message about conflict in trait configuration between scenario Y and profession Z.
Additional context
Even before this change it was possible that scenario and profession trait configuration was conflicting, as a scenario could have had a forbidden trait that was a locked trait for a profession for that scenario. I assume this was avoided by paying attention to not create such conflicts in the first place. Because I see no checks in the code that look for such conflicts, I am not sure If I should even attempt to create them.
This feature was probably suggested before, but I first observed it in #34808 (comment)