From 7a189911ad786741016fc9263f2c3144d7aed813 Mon Sep 17 00:00:00 2001 From: lefneer311 Date: Tue, 5 May 2026 13:34:27 -0500 Subject: [PATCH] [cpp] fixes ranged job abilities - Removes shadow bug for double and triple shot (+40% activation rate over what's shown on mod::double_shot_rate and mod::triple_shot_rate - Existing bug is due to base power applied both in src/map/entities/charentity.cpp:2104 ("40 +") and scripts/globals/job_utils/ranger.lua:294 (power = 40) for double shot and scripts/actions/abilities/triple_shot.lua:16 for triple shot (power = 40); both cases result in mod power of 40, but activation rate of 80 due to charentity calculation. - Adds barrage logic for trusts, which scales with player level, and prevents overlap of barrage/double shot/triple shot --- src/map/entities/charentity.cpp | 8 ++++---- src/map/entities/trustentity.cpp | 14 ++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/map/entities/charentity.cpp b/src/map/entities/charentity.cpp index ed9cd89000e..6a511004e23 100644 --- a/src/map/entities/charentity.cpp +++ b/src/map/entities/charentity.cpp @@ -2101,13 +2101,13 @@ void CCharEntity::OnRangedAttack(CRangeState& state, action_t& action) hitCount = PAmmo->getQuantity(); } } - else if (this->StatusEffectContainer->HasStatusEffect(EFFECT_DOUBLE_SHOT) && xirand::GetRandomNumber(100) < (40 + this->getMod(Mod::DOUBLE_SHOT_RATE))) + else if (this->StatusEffectContainer->HasStatusEffect(EFFECT_TRIPLE_SHOT) && xirand::GetRandomNumber(100) < this->getMod(Mod::TRIPLE_SHOT_RATE)) { - hitCount = 2; + hitCount = 3; } - else if (this->StatusEffectContainer->HasStatusEffect(EFFECT_TRIPLE_SHOT) && xirand::GetRandomNumber(100) < (40 + this->getMod(Mod::TRIPLE_SHOT_RATE))) + else if (this->StatusEffectContainer->HasStatusEffect(EFFECT_DOUBLE_SHOT) && xirand::GetRandomNumber(100) < this->getMod(Mod::DOUBLE_SHOT_RATE)) { - hitCount = 3; + hitCount = 2; } // loop for barrage hits, if a miss occurs, the loop will end diff --git a/src/map/entities/trustentity.cpp b/src/map/entities/trustentity.cpp index 6c75345a6e9..68ebe77711a 100644 --- a/src/map/entities/trustentity.cpp +++ b/src/map/entities/trustentity.cpp @@ -168,13 +168,19 @@ void CTrustEntity::OnRangedAttack(CRangeState& state, action_t& action) bool hitOccured = false; // track if player hit mob at all bool isBarrage = StatusEffectContainer->HasStatusEffect(EFFECT_BARRAGE, 0); - /* - // if barrage is detected, getBarrageShotCount also checks for ammo count - if (!ammoThrowing && !rangedThrowing && isBarrage) + // Barrage does not stack with Double/Triple Shot. + if (isBarrage) { hitCount += battleutils::getBarrageShotCount(this); } - */ + else if (this->StatusEffectContainer->HasStatusEffect(EFFECT_TRIPLE_SHOT) && xirand::GetRandomNumber(100) < this->getMod(Mod::TRIPLE_SHOT_RATE)) + { + hitCount = 3; + } + else if (this->StatusEffectContainer->HasStatusEffect(EFFECT_DOUBLE_SHOT) && xirand::GetRandomNumber(100) < this->getMod(Mod::DOUBLE_SHOT_RATE)) + { + hitCount = 2; + } // loop for barrage hits, if a miss occurs, the loop will end // TODO: do trusts need barrage racc & ratt bonus mods?