From 73f06a800f720bc411926ad7e4647b9f50f68827 Mon Sep 17 00:00:00 2001 From: Frankie-hz <105882754+Frankie-hz@users.noreply.github.com> Date: Wed, 6 May 2026 00:24:42 -0400 Subject: [PATCH] [cpp, lua] Change delay to have the in-game input instead of milliseonds For whatever reason we were converting to the in-game delay in every single delay call instead of just changing the base function --- scripts/enum/mod.lua | 2 +- .../Castle_Oztroja_[S]/mobs/Asterion.lua | 2 +- .../Grand_Palace_of_HuXzoi/mobs/Ixghrah.lua | 8 ++--- .../Hazhalm_Testing_Grounds/mobs/Balrahn.lua | 2 +- .../mobs/Himinrjot.lua | 2 +- .../Monarch_Linn/mobs/Mammet-19_Epsilon.lua | 8 ++--- .../zones/Monarch_Linn/mobs/Mammet-800.lua | 8 ++--- .../Phomiuna_Aqueducts/mobs/Tres_Duendes.lua | 8 ++--- .../Sealions_Den/mobs/Mammet-22_Zeta.lua | 8 ++--- scripts/zones/Sealions_Den/mobs/Omega.lua | 4 +-- scripts/zones/Sealions_Den/mobs/Tenzen.lua | 8 ++--- .../Temple_of_Uggalepih/mobs/Manipulator.lua | 4 +-- src/map/entities/battleentity.cpp | 2 +- src/map/instance_loader.cpp | 4 +-- src/map/items/item_weapon.cpp | 21 ++++++------- src/map/lua/lua_baseentity.cpp | 30 +++++++++---------- src/map/modifier.h | 2 +- src/map/utils/battleutils.cpp | 4 +-- src/map/utils/itemutils.cpp | 2 +- src/map/utils/mobutils.cpp | 12 ++++---- src/map/utils/petutils.cpp | 20 ++++++------- src/map/utils/trustutils.cpp | 16 +++++----- src/map/utils/zoneutils.cpp | 4 +-- 23 files changed, 88 insertions(+), 93 deletions(-) diff --git a/scripts/enum/mod.lua b/scripts/enum/mod.lua index e8a806f461f..a21ce237907 100644 --- a/scripts/enum/mod.lua +++ b/scripts/enum/mod.lua @@ -308,7 +308,7 @@ xi.mod = ENFEEBLING_MAGIC_RECAST = 1184, -- Recast delay (percent, usually negative) ENHANCING_MAGIC_RECAST = 1185, -- Recast delay (percent, usually negative) DELAY = 171, - RANGED_DELAY = 172, + RANGED_DELAY = 172, -- This is in-game delay not milliseconds MARTIAL_ARTS = 173, SKILLCHAINBONUS = 174, -- Damage bonus applied to skill chain damage (/100). Modifier from effects/traits SKILLCHAINDMG = 175, -- Damage bonus applied to skill chain damage (/10000). Modifier from gear (multiplicative after effect/traits) diff --git a/scripts/zones/Castle_Oztroja_[S]/mobs/Asterion.lua b/scripts/zones/Castle_Oztroja_[S]/mobs/Asterion.lua index bfdbe572f68..72f743d5cf8 100644 --- a/scripts/zones/Castle_Oztroja_[S]/mobs/Asterion.lua +++ b/scripts/zones/Castle_Oztroja_[S]/mobs/Asterion.lua @@ -22,7 +22,7 @@ entity.onMobFight = function(mob, target) -- As it gets low, its attack speed increases to near perma-hundred fists. -- hundred fists is 1700 delay. this formula will range between 4500 and 1700. - mob:setDelay(1700 + hpp * 28) + mob:setDelay(170 + hpp * 2.8) -- Favors Back Swish when higher HP and at around 50% it starts using Mow and Mortal Ray. if hpp < 50 then diff --git a/scripts/zones/Grand_Palace_of_HuXzoi/mobs/Ixghrah.lua b/scripts/zones/Grand_Palace_of_HuXzoi/mobs/Ixghrah.lua index 227ded6ca7a..56c97ed866d 100644 --- a/scripts/zones/Grand_Palace_of_HuXzoi/mobs/Ixghrah.lua +++ b/scripts/zones/Grand_Palace_of_HuXzoi/mobs/Ixghrah.lua @@ -18,10 +18,10 @@ local forms = local formConfig = { -- [form] = { mobskill, 2-hour, castingEnabled, damageMultiplier, delay, tripleAttack, attBonus, evaBonus, defBonus, defMultiplier } - [forms.BALL ] = { xi.mobSkill.HEXIDISCS, xi.mobSkill.MANAFONT_1, true, 2200, 100, 0, 0, 0, 0, 1 }, - [forms.HUMAN ] = { xi.mobSkill.VORPAL_BLADE_GHRAH, xi.mobSkill.INVINCIBLE_1, false, 2200, 100, 0, 0, 0, 60, 1 }, - [forms.SPIDER] = { xi.mobSkill.SICKLE_SLASH, xi.mobSkill.MIGHTY_STRIKES_1, false, 2700, 200, 0, 11, 0, 11, 2 }, - [forms.BIRD ] = { xi.mobSkill.DAMNATION_DIVE_GHRAH, xi.mobSkill.PERFECT_DODGE_1, false, 1600, 100, 5, 0, 48, 0, 1 }, + [forms.BALL ] = { xi.mobSkill.HEXIDISCS, xi.mobSkill.MANAFONT_1, true, 220, 100, 0, 0, 0, 0, 1 }, + [forms.HUMAN ] = { xi.mobSkill.VORPAL_BLADE_GHRAH, xi.mobSkill.INVINCIBLE_1, false, 220, 100, 0, 0, 0, 60, 1 }, + [forms.SPIDER] = { xi.mobSkill.SICKLE_SLASH, xi.mobSkill.MIGHTY_STRIKES_1, false, 270, 200, 0, 11, 0, 11, 2 }, + [forms.BIRD ] = { xi.mobSkill.DAMNATION_DIVE_GHRAH, xi.mobSkill.PERFECT_DODGE_1, false, 160, 100, 5, 0, 48, 0, 1 }, } local function setupForm(mob, chosenForm) diff --git a/scripts/zones/Hazhalm_Testing_Grounds/mobs/Balrahn.lua b/scripts/zones/Hazhalm_Testing_Grounds/mobs/Balrahn.lua index c63a7128d1c..65ca00e6d6c 100644 --- a/scripts/zones/Hazhalm_Testing_Grounds/mobs/Balrahn.lua +++ b/scripts/zones/Hazhalm_Testing_Grounds/mobs/Balrahn.lua @@ -32,7 +32,7 @@ end entity.onMobWeaponSkill = function(mob, target, skill, action) if skill:getID() == xi.mobSkill.IMMORTAL_SHIELD then mob:setMagicCastingEnabled(true) - mob:setDelay(10 * 1000) + mob:setDelay(600) end end diff --git a/scripts/zones/Hazhalm_Testing_Grounds/mobs/Himinrjot.lua b/scripts/zones/Hazhalm_Testing_Grounds/mobs/Himinrjot.lua index 02a2366bc84..bfe4610c3e9 100644 --- a/scripts/zones/Hazhalm_Testing_Grounds/mobs/Himinrjot.lua +++ b/scripts/zones/Hazhalm_Testing_Grounds/mobs/Himinrjot.lua @@ -23,7 +23,7 @@ end entity.onMobSpawn = function(mob) -- Snort about every 5 seconds - mob:setDelay(2000) + mob:setDelay(300) end return entity diff --git a/scripts/zones/Monarch_Linn/mobs/Mammet-19_Epsilon.lua b/scripts/zones/Monarch_Linn/mobs/Mammet-19_Epsilon.lua index 9ad3cab7684..1bd850166db 100644 --- a/scripts/zones/Monarch_Linn/mobs/Mammet-19_Epsilon.lua +++ b/scripts/zones/Monarch_Linn/mobs/Mammet-19_Epsilon.lua @@ -68,26 +68,26 @@ entity.onMobFight = function(mob, target) { [forms.UNARMED] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(2400) + mob:setDelay(240) mob:setDamage(40) end, [forms.SWORD] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(1500) + mob:setDelay(120) mob:setDamage(40) end, [forms.POLEARM] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(3250) + mob:setDelay(300) mob:setDamage(75) end, [forms.STAFF] = function() mob:setMobMod(xi.mobMod.MAGIC_COOL, 20) mob:setMagicCastingEnabled(true) - mob:setDelay(3700) + mob:setDelay(240) mob:setDamage(40) end, } diff --git a/scripts/zones/Monarch_Linn/mobs/Mammet-800.lua b/scripts/zones/Monarch_Linn/mobs/Mammet-800.lua index 8027016f849..a91d15198d3 100644 --- a/scripts/zones/Monarch_Linn/mobs/Mammet-800.lua +++ b/scripts/zones/Monarch_Linn/mobs/Mammet-800.lua @@ -139,26 +139,26 @@ entity.onMobFight = function(mob, target) { [forms.UNARMED] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(2400) + mob:setDelay(240) mob:setMobMod(xi.mobMod.BASE_DAMAGE_MULTIPLIER, 150) end, [forms.SWORD] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(1200) + mob:setDelay(120) mob:setMobMod(xi.mobMod.BASE_DAMAGE_MULTIPLIER, 150) end, [forms.POLEARM] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(3000) + mob:setDelay(300) mob:setMobMod(xi.mobMod.BASE_DAMAGE_MULTIPLIER, 200) end, [forms.STAFF] = function() mob:setMobMod(xi.mobMod.MAGIC_COOL, 20) mob:setMagicCastingEnabled(true) - mob:setDelay(2400) + mob:setDelay(240) mob:setMobMod(xi.mobMod.BASE_DAMAGE_MULTIPLIER, 100) end, } diff --git a/scripts/zones/Phomiuna_Aqueducts/mobs/Tres_Duendes.lua b/scripts/zones/Phomiuna_Aqueducts/mobs/Tres_Duendes.lua index db258c6f86e..fd2168c3bb5 100644 --- a/scripts/zones/Phomiuna_Aqueducts/mobs/Tres_Duendes.lua +++ b/scripts/zones/Phomiuna_Aqueducts/mobs/Tres_Duendes.lua @@ -30,9 +30,9 @@ entity.onMobFight = function(mob, target) local formConfigs = { - vertical = { bonus = 0, delay = 4750, animSub = 15, tripleAtk = 100 }, -- 100% Triple Attack - horizontal = { bonus = 22, delay = 4600, animSub = 14, tripleAtk = 0 }, -- Slow delay, Strong mob weapon bonus (level * 1.5) - normal = { bonus = 0, delay = 2400, animSub = 13, tripleAtk = 0 }, -- Normal bats + vertical = { bonus = 0, delay = 475, animSub = 15, tripleAtk = 100 }, -- 100% Triple Attack + horizontal = { bonus = 22, delay = 460, animSub = 14, tripleAtk = 0 }, -- Slow delay, Strong mob weapon bonus (level * 1.5) + normal = { bonus = 0, delay = 240, animSub = 13, tripleAtk = 0 }, -- Normal bats } local selectedForm @@ -78,7 +78,7 @@ entity.onMobDisengage = function(mob) -- Reset to normal form with normal mode stats mob:setAnimationSub(13) mob:setMobMod(xi.mobMod.WEAPON_BONUS, 0) - mob:setDelay(2400) + mob:setDelay(240) mob:setMod(xi.mod.TRIPLE_ATTACK, 0) end diff --git a/scripts/zones/Sealions_Den/mobs/Mammet-22_Zeta.lua b/scripts/zones/Sealions_Den/mobs/Mammet-22_Zeta.lua index 8721e368fe3..56d8c983e8f 100644 --- a/scripts/zones/Sealions_Den/mobs/Mammet-22_Zeta.lua +++ b/scripts/zones/Sealions_Den/mobs/Mammet-22_Zeta.lua @@ -72,26 +72,26 @@ entity.onMobFight = function(mob, target) { [forms.UNARMED] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(2400) + mob:setDelay(240) mob:setDamage(40) end, [forms.SWORD] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(1500) + mob:setDelay(120) mob:setDamage(40) end, [forms.POLEARM] = function() mob:setMagicCastingEnabled(false) - mob:setDelay(3250) + mob:setDelay(300) mob:setDamage(75) end, [forms.STAFF] = function() mob:setMobMod(xi.mobMod.MAGIC_COOL, 10) mob:setMagicCastingEnabled(true) - mob:setDelay(3700) + mob:setDelay(240) mob:setDamage(40) end, } diff --git a/scripts/zones/Sealions_Den/mobs/Omega.lua b/scripts/zones/Sealions_Den/mobs/Omega.lua index 20675dabffc..05e9502355e 100644 --- a/scripts/zones/Sealions_Den/mobs/Omega.lua +++ b/scripts/zones/Sealions_Den/mobs/Omega.lua @@ -22,10 +22,10 @@ entity.onMobFight = function(mob, target) local hpp = mob:getHPP() if hpp < 20 then - mob:setDelay(1100) + mob:setDelay(110) mob:setMod(xi.mod.ATTP, 100) elseif hpp < 60 then - mob:setDelay(2100) + mob:setDelay(210) end end diff --git a/scripts/zones/Sealions_Den/mobs/Tenzen.lua b/scripts/zones/Sealions_Den/mobs/Tenzen.lua index 3c011d25063..97ae4cec0f7 100644 --- a/scripts/zones/Sealions_Den/mobs/Tenzen.lua +++ b/scripts/zones/Sealions_Den/mobs/Tenzen.lua @@ -25,10 +25,10 @@ local bowPhases = local formTable = { - [forms.SHEATHED] = { skill = 0, delay = 2000, standback = xi.behavior.NONE }, - [forms.MELEE ] = { skill = 0, delay = 2000, standback = xi.behavior.NONE }, - [forms.BOW_LOW ] = { skill = 2056, delay = 2400, standback = xi.behavior.STANDBACK }, - [forms.BOW_HIGH] = { skill = 2055, delay = 1500, standback = xi.behavior.STANDBACK }, + [forms.SHEATHED] = { skill = 0, delay = 200, standback = xi.behavior.NONE }, + [forms.MELEE ] = { skill = 0, delay = 200, standback = xi.behavior.NONE }, + [forms.BOW_LOW ] = { skill = 2056, delay = 240, standback = xi.behavior.STANDBACK }, + [forms.BOW_HIGH] = { skill = 2055, delay = 150, standback = xi.behavior.STANDBACK }, } local bowSequence = diff --git a/scripts/zones/Temple_of_Uggalepih/mobs/Manipulator.lua b/scripts/zones/Temple_of_Uggalepih/mobs/Manipulator.lua index f29a0746c35..3004839336f 100644 --- a/scripts/zones/Temple_of_Uggalepih/mobs/Manipulator.lua +++ b/scripts/zones/Temple_of_Uggalepih/mobs/Manipulator.lua @@ -76,7 +76,7 @@ entity.onMobInitialize = function(mob) mob:setMobMod(xi.mobMod.GIL_MAX, 6000) mob:addListener('ITEM_STOLEN', 'DOLL_GIZMO_STOLEN', function(mobArg, player, itemId) - mobArg:setDelay(2400) + mobArg:setDelay(240) end) end @@ -87,7 +87,7 @@ entity.onMobSpawn = function(mob) mob:setMod(xi.mod.IMPACT_SDT, -5000) mob:setMod(xi.mod.HTH_SDT, -5000) mob:setMobMod(xi.mobMod.BASE_DAMAGE_MULTIPLIER, 150) - mob:setDelay(2250) + mob:setDelay(225) mob:pathThrough(pathNodes, xi.path.flag.PATROL) end diff --git a/src/map/entities/battleentity.cpp b/src/map/entities/battleentity.cpp index 46f7453659d..2a62278f449 100644 --- a/src/map/entities/battleentity.cpp +++ b/src/map/entities/battleentity.cpp @@ -454,7 +454,7 @@ bool CBattleEntity::Rest(float rate) uint32 CBattleEntity::GetWeaponDelay(bool tp) { TracyZoneScoped; - uint32 finalDelay = 8000; // 480 (base) * 1000 / 60 (milisecond conversion) + uint32 finalDelay = 8000; // 480 (base) * 1000 / 60 (millisecond conversion) if (auto* weapon = dynamic_cast(m_Weapons[SLOT_MAIN])) { diff --git a/src/map/instance_loader.cpp b/src/map/instance_loader.cpp index 221977ebf21..cf67f6218f7 100644 --- a/src/map/instance_loader.cpp +++ b/src/map/instance_loader.cpp @@ -123,8 +123,8 @@ CInstance* CInstanceLoader::LoadInstance() const static_cast(PMob->m_Weapons[SLOT_MAIN])->setMaxHit(1); static_cast(PMob->m_Weapons[SLOT_MAIN])->setSkillType(rset->get("cmbSkill")); PMob->m_dmgMult = rset->get("cmbDmgMult"); - static_cast(PMob->m_Weapons[SLOT_MAIN])->setDelay((rset->get("cmbDelay") * 1000) / 60); - static_cast(PMob->m_Weapons[SLOT_MAIN])->setBaseDelay((rset->get("cmbDelay") * 1000) / 60); + static_cast(PMob->m_Weapons[SLOT_MAIN])->setDelay(rset->get("cmbDelay")); + static_cast(PMob->m_Weapons[SLOT_MAIN])->setBaseDelay(rset->get("cmbDelay")); PMob->m_Behavior = rset->get("behavior"); PMob->m_Link = rset->get("links"); diff --git a/src/map/items/item_weapon.cpp b/src/map/items/item_weapon.cpp index e5721bad5e5..788b32bcf11 100644 --- a/src/map/items/item_weapon.cpp +++ b/src/map/items/item_weapon.cpp @@ -83,7 +83,7 @@ CItemWeapon::~CItemWeapon() = default; void CItemWeapon::resetDelay() { - setDelay(getBaseDelay()); + m_delay = m_baseDelay; } /************************************************************************ @@ -318,15 +318,14 @@ uint16 CItemWeapon::getILvlMacc() const /************************************************************************ * * - * Set the weapon delay time. Value in milliseconds. * - * All math operations are performed with integers which is why * - * the order of operations is important * + * Set the weapon delay time. Value in raw game delay units. * + * Converts to milliseconds: delay * 1000 / 60. * * * ************************************************************************/ void CItemWeapon::setDelay(uint16 delay) { - m_delay = delay; + m_delay = uint16(delay * 1000.0f / 60.0f); } /************************************************************************ @@ -344,27 +343,25 @@ uint16 CItemWeapon::getDelay() const /************************************************************************ * * - * Set the un-adjusted delay of the weapon * - * This is to fix delay adjustments of mobs and is not intended for * - * use outside of zoneutils/mobutils * + * Set the un-adjusted delay of the weapon. Value in raw game units. * + * Converts to milliseconds: delay * 1000 / 60. * * * ************************************************************************/ void CItemWeapon::setBaseDelay(uint16 delay) { - m_baseDelay = delay; + m_baseDelay = uint16(delay * 1000.0f / 60.0f); } /************************************************************************ * * - * get un-adjusted or adjusted base delay of weapon. * - * Player weapons are unadjusted, "fake" mob/trust weapons are adjusted. * + * Get the un-adjusted base delay of the weapon. Value in raw game units.* * * ************************************************************************/ uint16 CItemWeapon::getBaseDelay() const { - return m_baseDelay; + return uint16(m_baseDelay * 60.0f / 1000.0f); } /************************************************************************ diff --git a/src/map/lua/lua_baseentity.cpp b/src/map/lua/lua_baseentity.cpp index 4495c20f166..4172d527f19 100644 --- a/src/map/lua/lua_baseentity.cpp +++ b/src/map/lua/lua_baseentity.cpp @@ -6708,16 +6708,16 @@ void CLuaBaseEntity::changeJob(uint8 newJob) // Change weapon type based on new job CItemWeapon* PWeapon = std::make_unique(0).release(); - PWeapon->setDelay(4000); - PWeapon->setBaseDelay(4000); + PWeapon->setDelay(240); + PWeapon->setBaseDelay(240); switch (newJob) { case JOB_MNK: case JOB_PUP: PWeapon->setSkillType(SKILL_HAND_TO_HAND); - PWeapon->setBaseDelay(8000); - PWeapon->setDelay(8000); + PWeapon->setBaseDelay(480); + PWeapon->setDelay(480); break; case JOB_THF: case JOB_BRD: @@ -6732,8 +6732,8 @@ void CLuaBaseEntity::changeJob(uint8 newJob) break; case JOB_RUN: PWeapon->setSkillType(SKILL_GREAT_SWORD); - PWeapon->setDelay(8000); - PWeapon->setBaseDelay(8000); + PWeapon->setDelay(480); + PWeapon->setBaseDelay(480); break; case JOB_WAR: case JOB_BST: @@ -6741,21 +6741,21 @@ void CLuaBaseEntity::changeJob(uint8 newJob) break; case JOB_DRK: PWeapon->setSkillType(SKILL_SCYTHE); - PWeapon->setDelay(8000); - PWeapon->setBaseDelay(8000); + PWeapon->setDelay(480); + PWeapon->setBaseDelay(480); break; case JOB_DRG: PWeapon->setSkillType(SKILL_POLEARM); - PWeapon->setDelay(8000); - PWeapon->setBaseDelay(8000); + PWeapon->setDelay(480); + PWeapon->setBaseDelay(480); break; case JOB_NIN: PWeapon->setSkillType(SKILL_KATANA); break; case JOB_SAM: PWeapon->setSkillType(SKILL_GREAT_KATANA); - PWeapon->setDelay(8000); - PWeapon->setBaseDelay(8000); + PWeapon->setDelay(480); + PWeapon->setBaseDelay(480); break; case JOB_WHM: case JOB_BLM: @@ -6764,8 +6764,8 @@ void CLuaBaseEntity::changeJob(uint8 newJob) break; case JOB_SMN: PWeapon->setSkillType(SKILL_STAFF); - PWeapon->setDelay(8000); - PWeapon->setBaseDelay(8000); + PWeapon->setDelay(480); + PWeapon->setBaseDelay(480); break; default: break; @@ -17717,7 +17717,7 @@ bool CLuaBaseEntity::isAggroable() /************************************************************************ * Function: setDelay() * Purpose : Override default delay settings for a Mob - * Example : mob:setDelay(2400) + * Example : mob:setDelay(240) -- 240 raw game delay units ************************************************************************/ void CLuaBaseEntity::setDelay(uint16 delay) diff --git a/src/map/modifier.h b/src/map/modifier.h index fb7b962ee23..0454519e375 100644 --- a/src/map/modifier.h +++ b/src/map/modifier.h @@ -319,7 +319,7 @@ enum class Mod ENFEEBLING_MAGIC_RECAST = 1184, // Recast delay (percent, usually negative) ENHANCING_MAGIC_RECAST = 1185, // Recast delay (percent, usually negative) DELAY = 171, // Increase/Decrease Delay - RANGED_DELAY = 172, // Increase/Decrease Ranged Delay + RANGED_DELAY = 172, // Increase/Decrease Ranged Delay. This is in-game delay not milliseconds MARTIAL_ARTS = 173, // The integer amount of delay to reduce from H2H weapons' base delay. (TRAIT) SKILLCHAINBONUS = 174, // Damage bonus applied to skill chain damage. Modifier from effects/traits SKILLCHAINDMG = 175, // Damage bonus applied to skill chain damage. Modifier from gear (multiplicative after effect/traits) diff --git a/src/map/utils/battleutils.cpp b/src/map/utils/battleutils.cpp index d5a63111823..b3dcbd299b9 100644 --- a/src/map/utils/battleutils.cpp +++ b/src/map/utils/battleutils.cpp @@ -1815,7 +1815,7 @@ auto GetBaseDelay(CBattleEntity* PEntity) -> uint16 CItemWeapon* PWeapon = dynamic_cast(PMobEntity->m_Weapons[SLOT_MAIN]); if (PWeapon) { - baseDelay = std::round(PWeapon->getBaseDelay() * 60.0 / 1000.0); // there is some precision loss that results in delays of 319.98 instead of 320, etc, so round to nearest. + baseDelay = PWeapon->getBaseDelay(); // there is some precision loss that results in delays of 319.98 instead of 320, etc, so round to nearest. } } @@ -1855,7 +1855,7 @@ auto GetBaseRangedDelay(CBattleEntity* PEntity) -> uint16 CItemWeapon* PWeapon = dynamic_cast(PMobEntity->m_Weapons[SLOT_MAIN]); if (PWeapon) { - baseDelay = std::round(PWeapon->getBaseDelay() * 60.0 / 1000.0); // there is some precision loss that results in delays of 319.98 instead of 320, etc, so round to nearest. + baseDelay = PWeapon->getBaseDelay(); // there is some precision loss that results in delays of 319.98 instead of 320, etc, so round to nearest. } } diff --git a/src/map/utils/itemutils.cpp b/src/map/utils/itemutils.cpp index dfdb0d25d4e..7ba7c565413 100644 --- a/src/map/utils/itemutils.cpp +++ b/src/map/utils/itemutils.cpp @@ -344,7 +344,7 @@ void LoadItemList() static_cast(PItem)->setILvlParry(rset->get("ilvl_parry")); static_cast(PItem)->setILvlMacc(rset->get("ilvl_macc")); static_cast(PItem)->setBaseDelay(rset->get("delay")); - static_cast(PItem)->setDelay((rset->get("delay") * 1000) / 60); + static_cast(PItem)->setDelay(rset->get("delay")); static_cast(PItem)->setDamage(rset->get("dmg")); static_cast(PItem)->setDmgType(rset->get("dmgType")); static_cast(PItem)->setMaxHit(rset->get("hit")); diff --git a/src/map/utils/mobutils.cpp b/src/map/utils/mobutils.cpp index a88db72f182..84d2f2b0164 100644 --- a/src/map/utils/mobutils.cpp +++ b/src/map/utils/mobutils.cpp @@ -1073,9 +1073,7 @@ void SetupRangedAttack(CMobEntity* PMob) PMob->defaultMobMod(MOBMOD_RANGED_ATTACK_RANGE, 14); PMob->PAI->GetController()->SetRangedAttackEnabled(true); - // auto* rangedWeapon = static_cast(PMob->m_Weapons[SLOT_RANGED]); - // rangedWeapon->setDamage(GetWeaponDamage(PMob, SLOT_RANGED)); - static_cast(PMob->m_Weapons[SLOT_RANGED])->setBaseDelay(290); + static_cast(PMob->m_Weapons[SLOT_RANGED])->setBaseDelay(300); } void SetupJob(CMobEntity* PMob) @@ -1772,8 +1770,8 @@ auto InstantiateAlly(uint32 groupid, uint16 zoneID, CInstance* instance) -> CMob static_cast(PMob->m_Weapons[SLOT_MAIN])->setMaxHit(1); static_cast(PMob->m_Weapons[SLOT_MAIN])->setSkillType(rset->get("cmbSkill")); PMob->m_dmgMult = rset->get("cmbDmgMult"); - static_cast(PMob->m_Weapons[SLOT_MAIN])->setDelay((rset->get("cmbDelay") * 1000) / 60); - static_cast(PMob->m_Weapons[SLOT_MAIN])->setBaseDelay((rset->get("cmbDelay") * 1000) / 60); + static_cast(PMob->m_Weapons[SLOT_MAIN])->setDelay(rset->get("cmbDelay")); + static_cast(PMob->m_Weapons[SLOT_MAIN])->setBaseDelay(rset->get("cmbDelay")); PMob->m_Behavior = rset->get("behavior"); PMob->m_Link = rset->get("links"); @@ -1942,8 +1940,8 @@ auto InstantiateDynamicMob(uint32 groupid, uint16 groupZoneId, uint16 targetZone static_cast(PMob->m_Weapons[SLOT_MAIN])->setMaxHit(1); static_cast(PMob->m_Weapons[SLOT_MAIN])->setSkillType(rset->get("cmbSkill")); PMob->m_dmgMult = rset->get("cmbDmgMult"); - static_cast(PMob->m_Weapons[SLOT_MAIN])->setDelay((rset->get("cmbDelay") * 1000) / 60); - static_cast(PMob->m_Weapons[SLOT_MAIN])->setBaseDelay((rset->get("cmbDelay") * 1000) / 60); + static_cast(PMob->m_Weapons[SLOT_MAIN])->setDelay(rset->get("cmbDelay")); + static_cast(PMob->m_Weapons[SLOT_MAIN])->setBaseDelay(rset->get("cmbDelay")); PMob->m_Behavior = rset->get("behavior"); PMob->m_Link = rset->get("links"); diff --git a/src/map/utils/petutils.cpp b/src/map/utils/petutils.cpp index 545c0342591..44a7454003b 100644 --- a/src/map/utils/petutils.cpp +++ b/src/map/utils/petutils.cpp @@ -580,8 +580,8 @@ void LoadAutomatonStats(CCharEntity* PMaster, CPetEntity* PPet, Pet_t* petStats, PPet->look.size = MODEL_AUTOMATON; static_cast(PPet->m_Weapons[SLOT_MAIN])->setSkillType(SKILL_AUTOMATON_MELEE); - static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay((uint16)(floor(1000.0f * (petStats->cmbDelay / 60.0f)))); // every pet should use this eventually - static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay((uint16)(floor(1000.0f * (petStats->cmbDelay / 60.0f)))); + static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay(petStats->cmbDelay); // every pet should use this eventually + static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay(petStats->cmbDelay); static_cast(PPet->m_Weapons[SLOT_MAIN])->setDamage((PPet->GetSkill(SKILL_AUTOMATON_MELEE) / 9) * 2 + 3); static_cast(PPet->m_Weapons[SLOT_RANGED])->setSkillType(SKILL_AUTOMATON_RANGED); @@ -830,11 +830,11 @@ void CalculateAvatarStats(CBattleEntity* PMaster, CPetEntity* PPet) { PPet->setModifier(Mod::MATT, 20); } - static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay((uint16)(floor(1000.0f * (320.0f / 60.0f)))); + static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay(320); if (petID == PETID_FENRIR) { - static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay((uint16)(floor(1000.0 * (280.0f / 60.0f)))); + static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay(280); } // In a 2014 update SE updated Avatar base damage @@ -846,7 +846,7 @@ void CalculateAvatarStats(CBattleEntity* PMaster, CPetEntity* PPet) } static_cast(PPet->m_Weapons[SLOT_MAIN])->setDamage(weaponDamage); - static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay((uint16)(floor(1000.0f * (PPetData->cmbDelay / 60.0f)))); + static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay(PPetData->cmbDelay); // Set B+ weapon skill (assumed capped for level derp) // attack is madly high for avatars (roughly x2) PPet->setModifier(Mod::ATT, 2 * battleutils::GetMaxSkill(SKILL_CLUB, JOB_WHM, mLvl > 99 ? 99 : mLvl)); @@ -923,9 +923,9 @@ void CalculateWyvernStats(CBattleEntity* PMaster, CPetEntity* PPet) PPet->SetMLevel(mLvl + iLvl + PMaster->getMod(Mod::WYVERN_LVL_BONUS)); - LoadAvatarStats(PMaster, PPet); // follows PC calcs (w/o SJ) - static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay((uint16)(floor(1000.0f * (320.0f / 60.0f)))); // 320 delay - static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay((uint16)(floor(1000.0f * (320.0f / 60.0f)))); + LoadAvatarStats(PMaster, PPet); // follows PC calcs (w/o SJ) + static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay(320); // 320 delay + static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay(320); static_cast(PPet->m_Weapons[SLOT_MAIN])->setDamage((uint16)(floor(mLvl / 2) + 3)); // Set A+ weapon skill PPet->setModifier(Mod::ATT, battleutils::GetMaxSkill(SKILL_GREAT_AXE, JOB_WAR, mLvl > 99 ? 99 : mLvl)); @@ -985,8 +985,8 @@ void CalculateJugPetStats(CBattleEntity* PMaster, CPetEntity* PPet) auto* PPetData = *maybePetData; - static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay((uint16)(floor(1000.0f * (240.0f / 60.0f)))); - static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay((uint16)(floor(1000.0f * (240.0f / 60.0f)))); + static_cast(PPet->m_Weapons[SLOT_MAIN])->setDelay(240); + static_cast(PPet->m_Weapons[SLOT_MAIN])->setBaseDelay(240); // Get the Jug pet cap level uint8 highestLvl = PPetData->maxLevel; diff --git a/src/map/utils/trustutils.cpp b/src/map/utils/trustutils.cpp index a3b01608987..59e92e4b059 100644 --- a/src/map/utils/trustutils.cpp +++ b/src/map/utils/trustutils.cpp @@ -393,8 +393,8 @@ auto LoadTrust(CCharEntity* PMaster, uint32 TrustID) -> CTrustEntity* mainWeapon->setSkillType(trustData->cmbSkill); mainWeapon->setDamage(finalDamage); - mainWeapon->setDelay((trustData->cmbDelay * 1000) / 60); - mainWeapon->setBaseDelay((trustData->cmbDelay * 1000) / 60); + mainWeapon->setDelay(trustData->cmbDelay); + mainWeapon->setBaseDelay(trustData->cmbDelay); // Compute DPS so rune/enchantment calculations that rely on getDPS() return meaningful values for trusts. // Use damage per second: damage / (delay_seconds). Delay is stored in ms. @@ -408,8 +408,8 @@ auto LoadTrust(CCharEntity* PMaster, uint32 TrustID) -> CTrustEntity* if (auto* subWeapon = dynamic_cast(PTrust->m_Weapons[SLOT_SUB])) { subWeapon->setDamage(finalDamage); - subWeapon->setDelay((trustData->cmbDelay * 1000) / 60); - subWeapon->setBaseDelay((trustData->cmbDelay * 1000) / 60); + subWeapon->setDelay(trustData->cmbDelay); + subWeapon->setBaseDelay(trustData->cmbDelay); if (subWeapon->getDelay() > 0) { @@ -421,8 +421,8 @@ auto LoadTrust(CCharEntity* PMaster, uint32 TrustID) -> CTrustEntity* if (auto* rangedWeapon = dynamic_cast(PTrust->m_Weapons[SLOT_RANGED])) { rangedWeapon->setDamage(finalDamage); - rangedWeapon->setDelay((trustData->cmbDelay * 1000) / 60); - rangedWeapon->setBaseDelay((trustData->cmbDelay * 1000) / 60); + rangedWeapon->setDelay(trustData->cmbDelay); + rangedWeapon->setBaseDelay(trustData->cmbDelay); if (rangedWeapon->getDelay() > 0) { @@ -434,8 +434,8 @@ auto LoadTrust(CCharEntity* PMaster, uint32 TrustID) -> CTrustEntity* if (auto* ammoWeapon = dynamic_cast(PTrust->m_Weapons[SLOT_AMMO])) { ammoWeapon->setDamage(finalDamage); - ammoWeapon->setDelay((trustData->cmbDelay * 1000) / 60); - ammoWeapon->setBaseDelay((trustData->cmbDelay * 1000) / 60); + ammoWeapon->setDelay(trustData->cmbDelay); + ammoWeapon->setBaseDelay(trustData->cmbDelay); if (ammoWeapon->getDelay() > 0) { diff --git a/src/map/utils/zoneutils.cpp b/src/map/utils/zoneutils.cpp index 75a9874756b..0a114afa1ce 100644 --- a/src/map/utils/zoneutils.cpp +++ b/src/map/utils/zoneutils.cpp @@ -494,8 +494,8 @@ auto LoadMOBList(Scheduler& scheduler, const std::vector& zoneIds) -> Ta PMob->m_dmgMult = rset->get("cmbDmgMult"); - mainWeapon->setDelay((rset->get("cmbDelay") * 1000) / 60); - mainWeapon->setBaseDelay((rset->get("cmbDelay") * 1000) / 60); + mainWeapon->setDelay(rset->get("cmbDelay")); + mainWeapon->setBaseDelay(rset->get("cmbDelay")); PMob->m_Behavior = rset->get("behavior"); PMob->m_Link = rset->get("links");