From 206c245d8b3f84ae4633ee610c7f20e9a452b793 Mon Sep 17 00:00:00 2001 From: WinterSolstice8 <60417494+wintersolstice8@users.noreply.github.com> Date: Mon, 16 Feb 2026 21:49:24 -0700 Subject: [PATCH 1/2] [core] Remove "big" mobmod --- src/map/ai/controllers/mob_controller.cpp | 32 +++++++++++------------ src/map/entities/mobentity.cpp | 5 ---- src/map/entities/mobentity.h | 1 - 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/map/ai/controllers/mob_controller.cpp b/src/map/ai/controllers/mob_controller.cpp index facd9337e41..8d6ca404e65 100644 --- a/src/map/ai/controllers/mob_controller.cpp +++ b/src/map/ai/controllers/mob_controller.cpp @@ -814,7 +814,7 @@ void CMobController::Move() // attempt to teleport (type 1) if target is out of melee range but within 30 distance if (PMob->getMobMod(MOBMOD_TELEPORT_TYPE) == 1 && currentDistance > attack_range && currentDistance <= 30.0f) { - if (m_Tick >= m_LastSpecialTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_TELEPORT_CD))) + if (m_Tick >= m_LastSpecialTime + std::chrono::seconds(PMob->getMobMod(MOBMOD_TELEPORT_CD))) { if (const CMobSkill* teleportBegin = battleutils::GetMobSkill(PMob->getMobMod(MOBMOD_TELEPORT_START))) { @@ -1077,7 +1077,7 @@ void CMobController::DoRoamTick(timer::time_point tick) PMob->PAI->PathFind->ResumePatrol(); FollowRoamPath(); } - else if (m_Tick >= m_LastActionTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_ROAM_COOL))) + else if (m_Tick >= m_LastActionTime + std::chrono::seconds(PMob->getMobMod(MOBMOD_ROAM_COOL))) { // lets buff up or move around if (PMob->GetCallForHelpFlag()) @@ -1105,7 +1105,7 @@ void CMobController::DoRoamTick(timer::time_point tick) FollowRoamPath(); // move back every 5 seconds - m_LastActionTime = m_Tick - (std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_ROAM_COOL)) + 10s); + m_LastActionTime = m_Tick - (std::chrono::seconds(PMob->getMobMod(MOBMOD_ROAM_COOL)) + 10s); } else if (!(PMob->getMobMod(MOBMOD_NO_DESPAWN) != 0) && !settings::get("map.MOB_NO_DESPAWN")) { @@ -1243,7 +1243,7 @@ void CMobController::FollowRoamPath() // if I just finished reset my last action time if (!PMob->PAI->PathFind->IsFollowingPath()) { - const uint16 roamRandomness = static_cast(PMob->getBigMobMod(MOBMOD_ROAM_COOL) / PMob->GetRoamRate()); + const uint16 roamRandomness = static_cast(PMob->getMobMod(MOBMOD_ROAM_COOL) * 1000 / PMob->GetRoamRate()); m_LastActionTime = m_Tick - std::chrono::milliseconds(xirand::GetRandomNumber(roamRandomness)); // i'm a worm pop back up @@ -1296,7 +1296,7 @@ void CMobController::Reset() { TracyZoneScoped; // Wait a little before roaming / casting spell / spawning pet - m_LastActionTime = m_Tick - std::chrono::milliseconds(xirand::GetRandomNumber(PMob->getBigMobMod(MOBMOD_ROAM_COOL))); + m_LastActionTime = m_Tick - std::chrono::seconds(xirand::GetRandomNumber(PMob->getMobMod(MOBMOD_ROAM_COOL))); // Don't attack player right off of spawn PMob->m_neutral = true; @@ -1323,7 +1323,7 @@ auto CMobController::Disengage() -> bool { TracyZoneScoped; // this will let me decide to walk home or despawn - m_LastActionTime = m_Tick - std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_ROAM_COOL)) + 10s; + m_LastActionTime = m_Tick - std::chrono::seconds(PMob->getMobMod(MOBMOD_ROAM_COOL)) + 10s; PMob->m_neutral = true; m_NeutralTime = m_Tick; @@ -1360,16 +1360,16 @@ auto CMobController::Engage(const uint16 targid) -> bool } // Don't cast magic or use special ability right away - if (PMob->getBigMobMod(MOBMOD_MAGIC_DELAY) != 0) + if (PMob->getMobMod(MOBMOD_MAGIC_DELAY) != 0) { m_nextMagicTime = - m_Tick + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_MAGIC_COOL) + xirand::GetRandomNumber(PMob->getBigMobMod(MOBMOD_MAGIC_DELAY))); + m_Tick + std::chrono::seconds(PMob->getMobMod(MOBMOD_MAGIC_COOL) + xirand::GetRandomNumber(PMob->getMobMod(MOBMOD_MAGIC_DELAY))); } - if (PMob->getBigMobMod(MOBMOD_SPECIAL_DELAY) != 0) + if (PMob->getMobMod(MOBMOD_SPECIAL_DELAY) != 0) { - m_LastSpecialTime = m_Tick - std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_SPECIAL_COOL) + - xirand::GetRandomNumber(PMob->getBigMobMod(MOBMOD_SPECIAL_DELAY))); + m_LastSpecialTime = m_Tick - std::chrono::seconds(PMob->getMobMod(MOBMOD_SPECIAL_COOL) + + xirand::GetRandomNumber(PMob->getMobMod(MOBMOD_SPECIAL_DELAY))); } m_tpThreshold = xirand::GetRandomNumber(1000, 3000); @@ -1503,8 +1503,8 @@ void CMobController::ClearFollowTarget() void CMobController::OnCastStopped(CMagicState& state, action_t& action) { - int32 magicCool = PMob->getBigMobMod(MOBMOD_MAGIC_COOL); - m_nextMagicTime = m_Tick + std::chrono::milliseconds(xirand::GetRandomNumber(magicCool / 2, magicCool)); + int32 magicCool = PMob->getMobMod(MOBMOD_MAGIC_COOL); + m_nextMagicTime = m_Tick + std::chrono::seconds(xirand::GetRandomNumber(magicCool / 2, magicCool)); } auto CMobController::CanMoveForward(const float currentDistance) -> bool @@ -1564,10 +1564,10 @@ auto CMobController::IsSpecialSkillReady(const float currentDistance) const -> b if (currentDistance > 5) { // Mobs use ranged attacks quicker when standing back - bonusTime = PMob->getBigMobMod(MOBMOD_STANDBACK_COOL); + bonusTime = PMob->getMobMod(MOBMOD_STANDBACK_COOL); } - return m_Tick >= m_LastSpecialTime + std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_SPECIAL_COOL) - bonusTime); + return m_Tick >= m_LastSpecialTime + std::chrono::seconds(PMob->getMobMod(MOBMOD_SPECIAL_COOL) - bonusTime); } auto CMobController::IsSpellReady(const float currentDistance) const -> bool @@ -1582,7 +1582,7 @@ auto CMobController::IsSpellReady(const float currentDistance) const -> bool if (currentDistance > 5) { // Mobs use magic quicker when standing back - return m_Tick >= (m_nextMagicTime - std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_STANDBACK_COOL))); + return m_Tick >= (m_nextMagicTime - std::chrono::seconds(PMob->getMobMod(MOBMOD_STANDBACK_COOL))); } return m_Tick >= m_nextMagicTime; diff --git a/src/map/entities/mobentity.cpp b/src/map/entities/mobentity.cpp index b8a3cd1a599..cdb08196d46 100644 --- a/src/map/entities/mobentity.cpp +++ b/src/map/entities/mobentity.cpp @@ -517,11 +517,6 @@ void CMobEntity::resetMobMod(uint16 type) m_mobModStat[type] = m_mobModStatSave[type]; } -int32 CMobEntity::getBigMobMod(uint16 type) -{ - return getMobMod(type) * 1000; -} - void CMobEntity::saveMobModifiers() { m_mobModStatSave = m_mobModStat; diff --git a/src/map/entities/mobentity.h b/src/map/entities/mobentity.h index fbcd7e62049..d72f19b3afc 100644 --- a/src/map/entities/mobentity.h +++ b/src/map/entities/mobentity.h @@ -153,7 +153,6 @@ class CMobEntity : public CBattleEntity void addMobMod(uint16 type, int16 value); void defaultMobMod(uint16 type, int16 value); // set value if value has not been already set void resetMobMod(uint16 type); // resets mob mod to original value - int32 getBigMobMod(uint16 type); // multiplies mod by 1000 void saveMobModifiers(); // save current state of modifiers void restoreMobModifiers(); // restore to saved state From 34a5fe2f8e8558ba14bf7d6fbea9e972592afd85 Mon Sep 17 00:00:00 2001 From: WinterSolstice8 <60417494+wintersolstice8@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:02:22 -0700 Subject: [PATCH 2/2] [core] Boost roam randomness to uint32 --- src/map/ai/controllers/mob_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/ai/controllers/mob_controller.cpp b/src/map/ai/controllers/mob_controller.cpp index 8d6ca404e65..1d77caa5aaf 100644 --- a/src/map/ai/controllers/mob_controller.cpp +++ b/src/map/ai/controllers/mob_controller.cpp @@ -1243,7 +1243,7 @@ void CMobController::FollowRoamPath() // if I just finished reset my last action time if (!PMob->PAI->PathFind->IsFollowingPath()) { - const uint16 roamRandomness = static_cast(PMob->getMobMod(MOBMOD_ROAM_COOL) * 1000 / PMob->GetRoamRate()); + const uint32 roamRandomness = std::clamp(static_cast(PMob->getMobMod(MOBMOD_ROAM_COOL) * 1000 / PMob->GetRoamRate()), 0, 120 * 1000); m_LastActionTime = m_Tick - std::chrono::milliseconds(xirand::GetRandomNumber(roamRandomness)); // i'm a worm pop back up