-
Notifications
You must be signed in to change notification settings - Fork 792
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
Hp cleanup #6400
base: master
Are you sure you want to change the base?
Hp cleanup #6400
Conversation
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.
Generally looks good (for a 1.6 version).
Crazy how inconsistent hp is checked.
if (!monster.IsAlive()) | ||
M_StartKill(monster, player); | ||
else | ||
M_StartHit(monster, player, mdam); |
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.
Question should we change the condition to avoid the negation?
(Same for other places)
if (!monster.IsAlive()) | |
M_StartKill(monster, player); | |
else | |
M_StartHit(monster, player, mdam); | |
if (monster.IsAlive()) | |
M_StartHit(monster, player, mdam); | |
else | |
M_StartKill(monster, player); |
@@ -316,6 +316,11 @@ struct Monster { // note: missing field _mAFNum | |||
return *type().data; | |||
} | |||
|
|||
bool IsAlive() const |
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.
bool IsAlive() const | |
bool isAlive() const |
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.
Guess I looked at player functions first, they start with uppercase letters :D any idea why?
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 think it was because Source/.clang-tidy initially didn't define a style for MethodCase (class functions), so the fallback was FunctionCase. #4502 and #4493 (comment) for the history
@@ -656,6 +656,11 @@ struct Player { | |||
return _pManaPer; | |||
} | |||
|
|||
bool IsAlive() const |
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.
bool IsAlive() const | |
bool isAlive() const |
@@ -316,6 +316,11 @@ struct Monster { // note: missing field _mAFNum | |||
return *type().data; | |||
} | |||
|
|||
bool IsAlive() const | |||
{ | |||
return hitPoints > 0; |
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.
Should we ignore the hp fractions for monster and players or allow monsters and player with hp "0" (and some fraction) to be alive? 🤔
return hitPoints > 0; | |
return (hitPoints >> 6) > 0; |
Hm test is crashing it seems, maybe a good thing to rebase it on development and then see if you can identify why. |
Unifies checking if a monster/player is alive - before this change I've set monster hp to 63 and disabled regen - they were unselectable and unkillable but other than that 100% alive - killed my char 😢