From d8296fd10f595bf5491acdcee1bfe05441c73744 Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Sun, 1 Feb 2026 15:45:09 +0100 Subject: [PATCH] Correct Twilight cape behavior And fix clamp --- scripts/enum/mod.lua | 49 +++++++++---------- scripts/globals/spells/damage_spell.lua | 17 +++++-- sql/item_mods.sql | 8 ++-- src/map/modifier.h | 63 +++++++++++++------------ 4 files changed, 75 insertions(+), 62 deletions(-) diff --git a/scripts/enum/mod.lua b/scripts/enum/mod.lua index 795c0ba7100..b3a4431b1ff 100644 --- a/scripts/enum/mod.lua +++ b/scripts/enum/mod.lua @@ -842,30 +842,31 @@ xi.mod = PHANTOM_DURATION = 882, -- Phantom Roll Duration +. PHANTOM_RECAST = 1076, -- Phantom Roll Recast -. - ENHANCES_REFRESH = 529, -- "Enhances Refresh" adds +1 per modifier to spell's tick result. - NO_SPELL_MP_DEPLETION = 530, -- % to not deplete MP on spellcast. - STONESKIN_BONUS_HP = 539, -- Bonus "HP" granted to Stoneskin spell. - ENHANCES_ELEMENTAL_SIPHON = 540, -- Bonus Base MP added to Elemental Siphon skill. - BP_DELAY_II = 541, -- Blood Pact Delay Reduction II - JOB_BONUS_CHANCE = 542, -- Chance to apply job bonus to COR roll without having the job in the party. - DAY_NUKE_BONUS = 565, -- Bonus damage from "Elemental magic affected by day" (Sorc. Tonban) - IRIDESCENCE = 566, -- Iridescence trait (additional weather damage/penalty) - BARSPELL_AMOUNT = 567, -- Additional elemental resistance granted by bar- spells - RANDOM_DEAL_BONUS = 220, -- % chance to reset 2 abilities - BARSPELL_MDEF_BONUS = 827, -- Extra magic defense bonus granted to the bar- spell effect - RAPTURE_AMOUNT = 568, -- Bonus amount added to Rapture effect - EBULLIENCE_AMOUNT = 569, -- Bonus amount added to Ebullience effect - WYVERN_EFFECTIVE_BREATH = 829, -- Increases the threshold for triggering healing breath - ENHANCE_DEEP_BREATHING = 283, -- Add 5/256 to deep breathing bonus per merit level when calculating healing breath - AQUAVEIL_COUNT = 832, -- Modifies the amount of hits that Aquaveil absorbs before being removed - SONG_RECAST_DELAY = 833, -- Reduces song recast time in seconds. - ENH_MAGIC_DURATION = 890, -- Enhancing Magic Duration increase % - ENHANCES_COURSERS_ROLL = 891, -- Courser's Roll Bonus % chance - ENHANCES_CASTERS_ROLL = 892, -- Caster's Roll Bonus % chance - ENHANCES_BLITZERS_ROLL = 893, -- Blitzer's Roll Bonus % chance - ENHANCES_ALLIES_ROLL = 894, -- Allies' Roll Bonus % chance - ENHANCES_TACTICIANS_ROLL = 895, -- Tactician's Roll Bonus % chance - OCCULT_ACUMEN = 902, -- Grants bonus TP when dealing damage with elemental or dark magic + ENHANCES_REFRESH = 529, -- "Enhances Refresh" adds +1 per modifier to spell's tick result. + NO_SPELL_MP_DEPLETION = 530, -- % to not deplete MP on spellcast. + STONESKIN_BONUS_HP = 539, -- Bonus "HP" granted to Stoneskin spell. + ENHANCES_ELEMENTAL_SIPHON = 540, -- Bonus Base MP added to Elemental Siphon skill. + BP_DELAY_II = 541, -- Blood Pact Delay Reduction II + JOB_BONUS_CHANCE = 542, -- Chance to apply job bonus to COR roll without having the job in the party. + DAY_NUKE_BONUS = 565, -- Bonus damage from "Elemental magic affected by day" (Sorc. Tonban) + DAY_WEATHER_PROC_BONUS = 1787, -- Bonus damage from Twilight cape which works with both day OR weather procs. + IRIDESCENCE = 566, -- Iridescence trait (additional weather damage/penalty) + BARSPELL_AMOUNT = 567, -- Additional elemental resistance granted by bar- spells + RANDOM_DEAL_BONUS = 220, -- % chance to reset 2 abilities + BARSPELL_MDEF_BONUS = 827, -- Extra magic defense bonus granted to the bar- spell effect + RAPTURE_AMOUNT = 568, -- Bonus amount added to Rapture effect + EBULLIENCE_AMOUNT = 569, -- Bonus amount added to Ebullience effect + WYVERN_EFFECTIVE_BREATH = 829, -- Increases the threshold for triggering healing breath + ENHANCE_DEEP_BREATHING = 283, -- Add 5/256 to deep breathing bonus per merit level when calculating healing breath + AQUAVEIL_COUNT = 832, -- Modifies the amount of hits that Aquaveil absorbs before being removed + SONG_RECAST_DELAY = 833, -- Reduces song recast time in seconds. + ENH_MAGIC_DURATION = 890, -- Enhancing Magic Duration increase % + ENHANCES_COURSERS_ROLL = 891, -- Courser's Roll Bonus % chance + ENHANCES_CASTERS_ROLL = 892, -- Caster's Roll Bonus % chance + ENHANCES_BLITZERS_ROLL = 893, -- Blitzer's Roll Bonus % chance + ENHANCES_ALLIES_ROLL = 894, -- Allies' Roll Bonus % chance + ENHANCES_TACTICIANS_ROLL = 895, -- Tactician's Roll Bonus % chance + OCCULT_ACUMEN = 902, -- Grants bonus TP when dealing damage with elemental or dark magic QUICK_MAGIC = 909, -- Percent chance spells cast instantly (also reduces recast to 0, similar to Chainspell) diff --git a/scripts/globals/spells/damage_spell.lua b/scripts/globals/spells/damage_spell.lua index 3907632480b..fdf8f25db5e 100644 --- a/scripts/globals/spells/damage_spell.lua +++ b/scripts/globals/spells/damage_spell.lua @@ -534,10 +534,12 @@ xi.spells.damage.calculateDayAndWeather = function(caster, spellElement, alwaysA -- Calculate bonuses. if applyBonuses then + local singleWeather = xi.data.element.getAssociatedSingleWeather(spellElement) + local doubleWeather = xi.data.element.getAssociatedDoubleWeather(spellElement) -- Strong weathers. - if weather == xi.data.element.getAssociatedSingleWeather(spellElement) then + if weather == singleWeather then dayAndWeather = dayAndWeather + 0.1 + caster:getMod(xi.mod.IRIDESCENCE) * 0.05 - elseif weather == xi.data.element.getAssociatedDoubleWeather(spellElement) then + elseif weather == doubleWeather then dayAndWeather = dayAndWeather + 0.25 + caster:getMod(xi.mod.IRIDESCENCE) * 0.05 end @@ -545,6 +547,15 @@ xi.spells.damage.calculateDayAndWeather = function(caster, spellElement, alwaysA if dayElement == spellElement then dayAndWeather = dayAndWeather + 0.1 end + + -- Twilight cape. + if + weather == singleWeather or + weather == doubleWeather or + dayElement == spellElement + then + dayAndWeather = dayAndWeather + caster:getMod(xi.mod.DAY_WEATHER_PROC_BONUS) / 100 + end end -- Calculate penalties. @@ -571,7 +582,7 @@ xi.spells.damage.calculateDayAndWeather = function(caster, spellElement, alwaysA end -- Cap bonuses. - dayAndWeather = utils.clamp(dayAndWeather, 0, 2) + dayAndWeather = utils.clamp(dayAndWeather, 0, 1.4) return dayAndWeather end diff --git a/sql/item_mods.sql b/sql/item_mods.sql index 3c390c54dc1..cbef42f8609 100644 --- a/sql/item_mods.sql +++ b/sql/item_mods.sql @@ -31297,10 +31297,10 @@ INSERT INTO `item_mods` VALUES (16256,1,3); -- DEF: 3 INSERT INTO `item_mods` VALUES (16258,114,2); -- ENFEEBLE: 2 -- Twilight Cape -INSERT INTO `item_mods` VALUES (16259,1,7); -- DEF: 7 -INSERT INTO `item_mods` VALUES (16259,2,25); -- HP: 25 -INSERT INTO `item_mods` VALUES (16259,5,25); -- MP: 25 -INSERT INTO `item_mods` VALUES (16259,565,5); -- DAY_NUKE_BONUS: 5 +INSERT INTO `item_mods` VALUES (16259,1,7); -- DEF: 7 +INSERT INTO `item_mods` VALUES (16259,2,25); -- HP: 25 +INSERT INTO `item_mods` VALUES (16259,5,25); -- MP: 25 +INSERT INTO `item_mods` VALUES (16259,1787,5); -- DAY_WEATHER_PROC_BONUS: 5 -- Atheling Mantle INSERT INTO `item_mods` VALUES (16260,1,15); -- DEF: 15 diff --git a/src/map/modifier.h b/src/map/modifier.h index 394d7e71d94..4f4cb18da9b 100644 --- a/src/map/modifier.h +++ b/src/map/modifier.h @@ -966,36 +966,37 @@ enum class Mod EGGHELM = 517, - SHIELDBLOCKRATE = 518, // Affects shield block rate, percent based - DIA_DOT = 313, // Increases the DoT damage of Dia - ENH_DRAIN_ASPIR = 315, // % damage boost to Drain and Aspir - AUGMENTS_ABSORB_LIBERATOR = 521, // Direct Absorb spell increase while Liberator is equipped (percentage based) (Augments "Absorb" spells) - AMMO_SWING = 523, // Follow-up swing rate w/ virtue stone ammo (Jailer weapons). Does nothing for non-players. - AUGMENTS_CONVERT = 525, // Convert HP to MP Ratio Multiplier. Value = MP multiplier rate. - AUGMENTS_SA = 526, // Adds Critical Attack Bonus to Sneak Attack, percentage based. - AUGMENTS_TA = 527, // Adds Critical Attack Bonus to Trick Attack, percentage based. - AUGMENTS_FEINT = 502, // Feint will give another -10 Evasion per merit level - AUGMENTS_ASSASSINS_CHARGE = 886, // Gives Assassin's Charge +1% Critical Hit Rate per merit level - AUGMENTS_AMBUSH = 887, // Gives +1% Triple Attack per merit level when Ambush conditions are met - AUGMENTS_AURA_STEAL = 889, // 20% chance of 2 effects to be dispelled or stolen per merit level - AUGMENTS_CONSPIRATOR = 912, // Applies Conspirator benefits to player at the top of the hate list - ENHANCES_REFRESH = 529, // "Enhances Refresh" adds +1 per modifier to spell's tick result. - NO_SPELL_MP_DEPLETION = 530, // % to not deplete MP on spellcast. - STONESKIN_BONUS_HP = 539, // Bonus "HP" granted to Stoneskin spell. - DAY_NUKE_BONUS = 565, // Bonus damage from "Elemental magic affected by day" (Sorc. Tonban) - IRIDESCENCE = 566, // Iridescence trait (additional weather damage/penalty) - BARSPELL_AMOUNT = 567, // Additional elemental resistance granted by bar- spells - BARSPELL_MDEF_BONUS = 827, // Extra magic defense bonus granted to the bar- spell effect - RAPTURE_AMOUNT = 568, // Bonus amount added to Rapture effect - EBULLIENCE_AMOUNT = 569, // Bonus amount added to Ebullience effect - AQUAVEIL_COUNT = 832, // Modifies the amount of hits that Aquaveil absorbs before being removed - ENH_MAGIC_DURATION = 890, // Enhancing Magic Duration increase % - ENHANCES_COURSERS_ROLL = 891, // Courser's Roll Bonus % chance - ENHANCES_CASTERS_ROLL = 892, // Caster's Roll Bonus % chance - ENHANCES_BLITZERS_ROLL = 893, // Blitzer's Roll Bonus % chance - ENHANCES_ALLIES_ROLL = 894, // Allies' Roll Bonus % chance - ENHANCES_TACTICIANS_ROLL = 895, // Tactician's Roll Bonus % chance - OCCULT_ACUMEN = 902, // Grants bonus TP when dealing damage with elemental or dark magic + SHIELDBLOCKRATE = 518, // Affects shield block rate, percent based + DIA_DOT = 313, // Increases the DoT damage of Dia + ENH_DRAIN_ASPIR = 315, // % damage boost to Drain and Aspir + AUGMENTS_ABSORB_LIBERATOR = 521, // Direct Absorb spell increase while Liberator is equipped (percentage based) (Augments "Absorb" spells) + AMMO_SWING = 523, // Follow-up swing rate w/ virtue stone ammo (Jailer weapons). Does nothing for non-players. + AUGMENTS_CONVERT = 525, // Convert HP to MP Ratio Multiplier. Value = MP multiplier rate. + AUGMENTS_SA = 526, // Adds Critical Attack Bonus to Sneak Attack, percentage based. + AUGMENTS_TA = 527, // Adds Critical Attack Bonus to Trick Attack, percentage based. + AUGMENTS_FEINT = 502, // Feint will give another -10 Evasion per merit level + AUGMENTS_ASSASSINS_CHARGE = 886, // Gives Assassin's Charge +1% Critical Hit Rate per merit level + AUGMENTS_AMBUSH = 887, // Gives +1% Triple Attack per merit level when Ambush conditions are met + AUGMENTS_AURA_STEAL = 889, // 20% chance of 2 effects to be dispelled or stolen per merit level + AUGMENTS_CONSPIRATOR = 912, // Applies Conspirator benefits to player at the top of the hate list + ENHANCES_REFRESH = 529, // "Enhances Refresh" adds +1 per modifier to spell's tick result. + NO_SPELL_MP_DEPLETION = 530, // % to not deplete MP on spellcast. + STONESKIN_BONUS_HP = 539, // Bonus "HP" granted to Stoneskin spell. + DAY_NUKE_BONUS = 565, // Bonus damage from "Elemental magic affected by day" (Sorc. Tonban) + DAY_WEATHER_PROC_BONUS = 1787, // Bonus damage from Twilight cape which works with both day OR weather procs. + IRIDESCENCE = 566, // Iridescence trait (additional weather damage/penalty) + BARSPELL_AMOUNT = 567, // Additional elemental resistance granted by bar- spells + BARSPELL_MDEF_BONUS = 827, // Extra magic defense bonus granted to the bar- spell effect + RAPTURE_AMOUNT = 568, // Bonus amount added to Rapture effect + EBULLIENCE_AMOUNT = 569, // Bonus amount added to Ebullience effect + AQUAVEIL_COUNT = 832, // Modifies the amount of hits that Aquaveil absorbs before being removed + ENH_MAGIC_DURATION = 890, // Enhancing Magic Duration increase % + ENHANCES_COURSERS_ROLL = 891, // Courser's Roll Bonus % chance + ENHANCES_CASTERS_ROLL = 892, // Caster's Roll Bonus % chance + ENHANCES_BLITZERS_ROLL = 893, // Blitzer's Roll Bonus % chance + ENHANCES_ALLIES_ROLL = 894, // Allies' Roll Bonus % chance + ENHANCES_TACTICIANS_ROLL = 895, // Tactician's Roll Bonus % chance + OCCULT_ACUMEN = 902, // Grants bonus TP when dealing damage with elemental or dark magic QUICK_MAGIC = 909, // Percent chance spells cast instantly (also reduces recast to 0, similar to Chainspell) @@ -1140,7 +1141,7 @@ enum class Mod // The spares take care of finding the next ID to use so long as we don't forget to list IDs that have been freed up by refactoring. // 570 through 825 used by WS DMG mods these are not spares. // - // SPARE IDs: 1187 and onward + // SPARE IDs: 1188 and onward }; // temporary workaround for using enum class as unordered_map key until compilers support it