[Scaling/Bug Fix] Scaling where min and max damage was bugged #3514
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.
This is a refinement of a fix by @Kinglykrab in the following PR:
#3351
@Kinglykrab addressed an issue where min_dmg was 0 in db and max_dmg was not. This caused the npc_scale_manager to only scale the min_dmg side, which can result in the min_dmg being bigger than the max_dmg.
This PR fixes a side effect of that PR wherein when min_dmg and max_dmg are both 0 in the db, setting min_dmg 1st results in min_dmg getting put into max_dmg (due to his attempts to keep max_dmg greater than min_dmg inside of ModifyNPCStat()) at all times.
My belief is that if _either min or max dmg is 0 in the db, both need to be processed. His earlier PR assures that, so long as min_dmg is 0, but not when min_dmg is non-zero and max_dmg is 0. Admittedly an unlikely case, but it simplifies the code tremendously to simply scale both if either is 0.
This was discovered because several special attacks like bash and kick (for scaled mobs) were saying the opponent was invulnerable. This was due to math from the changes to npc.cpp which left min_damage (GetMinDamage()) negative and sometimes that value was -5 (DMG_INVULNERABLE) or -6 (DMG_RUNE).
eqlog_Ebola_Rolath.txt:[Tue Jun 13 15:14:40 2023] A wan ghoul knight tries to bash YOU, but are INVULNERABLE!
eqlog_Ebola_Rolath.txt:[Tue Jun 13 15:15:12 2023] A wan ghoul knight tries to bash YOU, but are INVULNERABLE!
eqlog_Ebola_Rolath.txt:[Tue Jun 13 15:49:58 2023] A wan ghoul knight tries to bash YOU, but are INVULNERABLE!
eqlog_Ebola_Rolath.txt:[Tue Jun 13 16:06:20 2023] A zol ghoul knight tries to bash YOU, but are INVULNERABLE!