diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 855595ac0..ae9deb2d5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -153,6 +152,7 @@ public class UnstableSpellbook extends Artifact { || (scroll instanceof ScrollOfTransmutation)); scroll.anonymize(); + scroll.talentChance = 0; //spellbook does not trigger on-scroll talents curItem = scroll; curUser = hero; @@ -176,14 +176,13 @@ public class UnstableSpellbook extends Artifact { curItem = scroll; charge--; scroll.anonymize(); + scroll.talentChance = 0; checkForArtifactProc(curUser, scroll); scroll.doRead(); - Invisibility.dispel(); Talent.onArtifactUsed(Dungeon.hero); } else { checkForArtifactProc(curUser, fScroll); fScroll.doRead(); - Invisibility.dispel(); Talent.onArtifactUsed(Dungeon.hero); } updateQuickslot(); @@ -197,7 +196,6 @@ public class UnstableSpellbook extends Artifact { } else { checkForArtifactProc(curUser, scroll); scroll.doRead(); - Invisibility.dispel(); Talent.onArtifactUsed(Dungeon.hero); } @@ -232,11 +230,11 @@ public class UnstableSpellbook extends Artifact { curUser = Dungeon.hero; curItem = scroll; scroll.anonymize(); + scroll.talentChance = 0; Game.runOnRenderThread(new Callback() { @Override public void call() { scroll.doRead(); - Invisibility.dispel(); Item.updateQuickslot(); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index 0b8f2aa32..56e31affb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -92,9 +92,9 @@ public abstract class Scroll extends Item { protected String rune; //affects how strongly on-scroll talents trigger from this scroll - protected float talentFactor = 1; + public float talentFactor = 1; //the chance (0-1) of whether on-scroll talents trigger from this potion - protected float talentChance = 1; + public float talentChance = 1; { stackable = true; @@ -194,17 +194,16 @@ public abstract class Scroll extends Item { public abstract void doRead(); public void readAnimation() { - //if scroll is being created for its effect, depend on creating item to dispel - if (!anonymous) Invisibility.dispel(); + Invisibility.dispel(); curUser.spend( TIME_TO_READ ); curUser.busy(); ((HeroSprite)curUser.sprite).read(); if (!anonymous) { Catalog.countUse(getClass()); - if (Random.Float() < talentChance) { - Talent.onScrollUsed(curUser, curUser.pos, talentFactor, getClass()); - } + } + if (Random.Float() < talentChance) { + Talent.onScrollUsed(curUser, curUser.pos, talentFactor, getClass()); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java index 289913f9a..885e4adda 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java @@ -21,9 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.spells; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify; @@ -111,14 +109,12 @@ public class UnstableSpell extends Spell { } s.anonymize(); + s.talentChance = s.talentFactor = 1; curItem = s; s.doRead(); - Invisibility.dispel(); Catalog.countUse(getClass()); - if (Random.Float() < talentChance){ - Talent.onScrollUsed(curUser, curUser.pos, talentFactor, getClass()); - } + //don't trigger talents, as they'll be triggered by the scroll } //lower values, as it's cheaper to make