-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Make the base_type
of classed draconians their corresponding colors instead of randomly chosen. (Fix #4001)
#4181
base: master
Are you sure you want to change the base?
Conversation
base_type
of classed draconians their corresponding colors instead of randomly chosen.base_type
of classed draconians their corresponding colors instead of randomly chosen. (Fix #4001)
@@ -1059,7 +1059,32 @@ static int _describe_monster(const string &key, const string &suffix, | |||
// Might be better to show all possible combinations rather than picking | |||
// one at random as this does? | |||
if (mons_is_draconian_job(mon_num)) | |||
base_type = random_draconian_monster_species(); | |||
{ | |||
// Classed draconians have fixed colours since 0.28 |
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.
Might be nice to have a dictionary instead of a case statement.
And the bit in the comment about 0.28 doesn't quite make sense to me?
But overall, looks reasonable to me.
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.
Thanks for your review!
About the comment, The 0.28 release notes said that "Classed draconians have a fixed colour per job." so I figured that it might be good to note here since this is where the issue rose.
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.
I wonder if it looks good now.
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.
Better, but this is now assigning a base_type to non-draconians by mistake. It also does a double lookup in the success case.
I think it should probably be something like this:
monster_type base_type = MONS_NO_MONSTER;
if (mons_is_draconian_job(mon_num))
{
// Classed draconians have fixed colours since 0.28
const auto colour_it = draconian_job_to_color.find(mon_num);
if (colour_it != draconian_job_to_colour.end())
base_type = colour_it->second;
else
// Might be better to show all possible combinations rather than
// picking one at random as this does?
base_type = random_draconian_monster_species();
}
nit: this codebase afaik uses the British spelling of colour
In #4001, when you lookup information about draconian stormcaller, the color is randomly generated instead of white. This is because of lines lookup-help.cc:1061-1062. This commit attempts to fix that by assigning colors to them using a switch-case statement. Info about which color should be which is grabbed from lines mon-util.cc:2723-2728.
Should resolve #4001.