From e547aa32ca698da6191e7dd2f022d164b079c5de Mon Sep 17 00:00:00 2001 From: ipdnaeip <89097082+ipdnaeip@users.noreply.github.com> Date: Mon, 29 Dec 2025 22:16:24 +0100 Subject: [PATCH] Fix: Modifiers persist in continuous spells cast by scrolls (#895) (ipdnaeip) * ItemScroll Modifier Fix Modifiers persist in continuous spells cast by scrolls. Added check for tick 0 as to not reapply SpellModifier changes * Fix comment formatting in ItemScroll.java --------- Co-authored-by: WinDanesz <31292708+WinDanesz@users.noreply.github.com> --- .../java/electroblob/wizardry/item/ItemScroll.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/electroblob/wizardry/item/ItemScroll.java b/src/main/java/electroblob/wizardry/item/ItemScroll.java index c1cb51f2..f0088bde 100644 --- a/src/main/java/electroblob/wizardry/item/ItemScroll.java +++ b/src/main/java/electroblob/wizardry/item/ItemScroll.java @@ -160,12 +160,21 @@ public class ItemScroll extends Item implements ISpellCastingItem, IWorkbenchIte Spell spell = Spell.byMetadata(stack.getItemDamage()); // By default, scrolls have no modifiers - but with the event system, they could be added. - SpellModifiers modifiers = new SpellModifiers(); + + SpellModifiers modifiers; + + if(WizardData.get(player) != null){ + modifiers = WizardData.get(player).itemCastingModifiers; + }else{ + modifiers = new SpellModifiers(); + } + int castingTick = stack.getMaxItemUseDuration() - count; // Continuous spells (these must check if they can be cast each tick since the mana changes) // In theory the spell is always continuous here but just in case it isn't... - if(spell.isContinuous && canCast(stack, spell, player, player.getActiveHand(), castingTick, modifiers)){ + // Do not check canCast() on tick 0 as it is already done in onItemRightClick() and would duplicate modifiers + if(spell.isContinuous && (castingTick == 0 || canCast(stack, spell, player, player.getActiveHand(), castingTick, modifiers))){ cast(stack, spell, player, player.getActiveHand(), castingTick, modifiers); }else{ // Scrolls normally work on the max use duration so this isn't ever reached by wizardry, but if the