mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[Bug Fix] Mob scaling issue with min dmg set to zero while max dmg is not (#3351)
* fix for mob scaling issue with min dmg set to zero while max dmg is not. * Cleanup --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
parent
cd82bd8472
commit
b8c91cf4f9
16
zone/npc.cpp
16
zone/npc.cpp
@ -2612,14 +2612,30 @@ void NPC::ModifyNPCStat(const std::string& stat, const std::string& value)
|
||||
}
|
||||
else if (stat_lower == "min_hit") {
|
||||
min_dmg = Strings::ToInt(value);
|
||||
|
||||
// TODO: fix DB
|
||||
|
||||
if (min_dmg > max_dmg) {
|
||||
const auto temporary_damage = max_dmg;
|
||||
max_dmg = min_dmg;
|
||||
min_dmg = temporary_damage;
|
||||
}
|
||||
|
||||
base_damage = round((max_dmg - min_dmg) / 1.9);
|
||||
min_damage = min_dmg - round(base_damage / 10.0);
|
||||
return;
|
||||
}
|
||||
else if (stat_lower == "max_hit") {
|
||||
max_dmg = Strings::ToInt(value);
|
||||
|
||||
// TODO: fix DB
|
||||
|
||||
if (max_dmg < min_dmg) {
|
||||
const auto temporary_damage = min_dmg;
|
||||
min_dmg = max_dmg;
|
||||
max_dmg = temporary_damage;
|
||||
}
|
||||
|
||||
base_damage = round((max_dmg - min_dmg) / 1.9);
|
||||
min_damage = min_dmg - round(base_damage / 10.0);
|
||||
return;
|
||||
|
||||
@ -135,6 +135,8 @@ void NpcScaleManager::ScaleNPC(
|
||||
npc->ModifyNPCStat("phr", std::to_string(scale_data.physical_resist));
|
||||
}
|
||||
|
||||
auto min_damage_set = false;
|
||||
|
||||
if (always_scale || npc->GetMinDMG() == 0) {
|
||||
int64 min_dmg = scale_data.min_dmg;
|
||||
if (RuleB(Combat, UseNPCDamageClassLevelMods)) {
|
||||
@ -145,9 +147,10 @@ void NpcScaleManager::ScaleNPC(
|
||||
}
|
||||
|
||||
npc->ModifyNPCStat("min_hit", std::to_string(min_dmg));
|
||||
min_damage_set = true;
|
||||
}
|
||||
|
||||
if (always_scale || npc->GetMaxDMG() == 0) {
|
||||
if (always_scale || npc->GetMaxDMG() == 0 || min_damage_set) {
|
||||
int64 max_dmg = scale_data.max_dmg;
|
||||
if (RuleB(Combat, UseNPCDamageClassLevelMods)) {
|
||||
uint32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user