diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 1308c4e47..b48b2c1b3 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1076,7 +1076,7 @@ items.stones.inventorystone.ac_use=USE items.stones.runestone$placeholder.name=runestone items.stones.stoneofaggression.name=stone of aggression -items.stones.stoneofaggression.desc=When this stone is thrown at an ally or enemy, all nearby enemies will be forced to attack that character for a short time.\n\nWhen used on enemies, the magic will only last for a few moments, but when used on yourself or allies it will last significantly longer. Powerful enemies will resist the effect as well. +items.stones.stoneofaggression.desc=When this stone is thrown at an ally or enemy, all nearby enemies will be forced to attack that character for a short time.\n\nWhen used on enemies, the magic will only last for a few turns, but when used on yourself or allies it will last significantly longer. items.stones.stoneofaggression$aggression.name=Targeted items.stones.stoneofaugmentation.name=stone of augmentation @@ -1090,9 +1090,6 @@ items.stones.stoneofaugmentation$wndaugment.defense=Defense items.stones.stoneofaugmentation$wndaugment.none=Remove Augmentation items.stones.stoneofaugmentation$wndaugment.cancel=Never mind -items.stones.stoneofaffection.name=stone of affection -items.stones.stoneofaffection.desc=When this stone is thrown on or next to an enemy they will be temporarily charmed, and will attempt to target your allies instead of you. - items.stones.stoneofblast.name=stone of blast items.stones.stoneofblast.desc=This runestone will instantly explode at the location it is thrown to. Just like a bomb, the explosion will deal damage to anything nearby. @@ -1102,8 +1099,8 @@ items.stones.stoneofblink.desc=This runestone will teleport the user to the loca items.stones.stoneofclairvoyance.name=stone of clairvoyance items.stones.stoneofclairvoyance.desc=This stone will instantly reveal all tiles in a very wide area around where it is thrown. Its effect will even reach through walls. -items.stones.stoneofdeepenedsleep.name=stone of deepened sleep -items.stones.stoneofdeepenedsleep.desc=When this stone is thrown near a sleeping enemy, it will magically deepen their sleep. Magically slept enemies will sleep forever until disturbed. +items.stones.stoneofdeepsleep.name=stone of deep sleep +items.stones.stoneofdeepsleep.desc=When this stone is thrown at an enemy, it will put them into a deep magical sleep. Magically slept enemies will sleep forever until disturbed. items.stones.stoneofdisarming.name=stone of disarming items.stones.stoneofdisarming.desc=This runestone holds magic that can disable malicious traps hidden throughout the dungeon. It will disarm up to 9 traps around the area it is thrown at. @@ -1114,14 +1111,18 @@ items.stones.stoneofenchantment.weapon=Your weapon glows in the darkness! items.stones.stoneofenchantment.armor=Your armor glows in the darkness! items.stones.stoneofenchantment.desc=This runestone possesses enchanting magic. Unlike a scroll of upgrade, it will not increase the direct power of an item, but will instead imbue a weapon or armor with an enchantment, granting it a new power. +items.stones.stoneoffear.name=stone of fear +items.stones.stoneoffear.desc=When this stone is thrown onto a character they will be overwhelmed with terror, and will turn and flee. Attacking a fleeing character will shorten the effect. + items.stones.stoneofflock.name=stone of flock items.stones.stoneofflock.desc=This runestone summons magical sheep for a short time around the location it is thrown to. items.stones.stoneofintuition.name=stone of intuition items.stones.stoneofintuition.inv_title=Select an item -items.stones.stoneofintuition.desc=This runestone holds a weaker version of the magic found in scrolls of identification. Rather than directly identifying an item, it will work on your intuition, allowing you to attempt to identify the type of a potion, scroll, or ring by guessing. +items.stones.stoneofintuition.desc=This runestone holds a weaker version of the magic found in scrolls of identification. Rather than directly identifying an item, it will work on your intuition, allowing you to attempt to identify the type of a potion, scroll, or ring by guessing. A correct guess will also preserve the magic in the stone, allowing it to be used a second time! items.stones.stoneofintuition$wndguess.text=Guess what the type of the unidentified item is. If you guess correctly, the type will be identified! items.stones.stoneofintuition$wndguess.correct=Correct. The item's type has been identified! +items.stones.stoneofintuition$wndguess.preserved=Your stone of intuition has been preserved! items.stones.stoneofintuition$wndguess.incorrect=Your guess was incorrect. items.stones.stoneofshock.name=stone of shock diff --git a/core/src/main/assets/sprites/items.png b/core/src/main/assets/sprites/items.png index 8262cf905..6245d8879 100644 Binary files a/core/src/main/assets/sprites/items.png and b/core/src/main/assets/sprites/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 957ee81f9..d811db33a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -46,6 +46,14 @@ public class ShatteredPixelDungeon extends Game { public ShatteredPixelDungeon( PlatformSupport platform ) { super( sceneClass == null ? WelcomeScene.class : sceneClass, platform ); + //v0.9.4 + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFear.class, + "com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAffection" ); + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepSleep.class, + "com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepenedSleep" ); + //v0.9.3 com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Tengu.class, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 06c28443c..00919d7ec 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -875,7 +875,7 @@ public abstract class Char extends Actor { public enum Property{ BOSS ( new HashSet( Arrays.asList(Grim.class, GrimTrap.class, ScrollOfRetribution.class, ScrollOfPsionicBlast.class)), - new HashSet( Arrays.asList(Corruption.class, StoneOfAggression.Aggression.class) )), + new HashSet( Arrays.asList(Corruption.class) )), MINIBOSS ( new HashSet(), new HashSet( Arrays.asList(Corruption.class) )), UNDEAD, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 7ac2f99cb..b675f5df5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -212,13 +212,16 @@ public abstract class Mob extends Char { } } - //if we are an enemy, and have no target or current target isn't affected by aggression - //then auto-prioritize a target that is affected by aggression, even another enemy - if (alignment == Alignment.ENEMY - && (enemy == null || enemy.buff(StoneOfAggression.Aggression.class) == null)) { + //if we are an alert enemy, auto-hunt a target that is affected by aggression, even another enemy + if (alignment == Alignment.ENEMY && state != PASSIVE && state != SLEEPING) { + if (enemy != null && enemy.buff(StoneOfAggression.Aggression.class) != null){ + state = HUNTING; + return enemy; + } for (Char ch : Actor.chars()) { if (ch != this && fieldOfView[ch.pos] && ch.buff(StoneOfAggression.Aggression.class) != null) { + state = HUNTING; return ch; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index e28fb06b9..919e01304 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -42,7 +42,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook; -import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat; import com.shatteredpixel.shatteredpixeldungeon.items.food.Pasty; @@ -85,13 +84,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; -import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAffection; +import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFear; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAugmentation; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlast; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlink; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfClairvoyance; -import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepenedSleep; +import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepSleep; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFlock; @@ -297,11 +296,11 @@ public class Generator { StoneOfFlock.class, StoneOfShock.class, StoneOfBlink.class, - StoneOfDeepenedSleep.class, + StoneOfDeepSleep.class, StoneOfClairvoyance.class, StoneOfAggression.class, StoneOfBlast.class, - StoneOfAffection.class, + StoneOfFear.class, StoneOfAugmentation.class //1 is sold in each shop }; STONE.defaultProbs = new float[]{ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0 }; 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 e915e6f3b..15221b021 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 @@ -37,13 +37,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellboo import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfAntiMagic; import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; -import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAffection; +import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFear; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAugmentation; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlast; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlink; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfClairvoyance; -import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepenedSleep; +import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepSleep; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFlock; @@ -285,7 +285,7 @@ public abstract class Scroll extends Item { private static HashMap, Class> stones = new HashMap<>(); static { stones.put(ScrollOfIdentify.class, StoneOfIntuition.class); - stones.put(ScrollOfLullaby.class, StoneOfDeepenedSleep.class); + stones.put(ScrollOfLullaby.class, StoneOfDeepSleep.class); stones.put(ScrollOfMagicMapping.class, StoneOfClairvoyance.class); stones.put(ScrollOfMirrorImage.class, StoneOfFlock.class); stones.put(ScrollOfRetribution.class, StoneOfBlast.class); @@ -293,7 +293,7 @@ public abstract class Scroll extends Item { stones.put(ScrollOfRecharging.class, StoneOfShock.class); stones.put(ScrollOfRemoveCurse.class, StoneOfDisarming.class); stones.put(ScrollOfTeleportation.class, StoneOfBlink.class); - stones.put(ScrollOfTerror.class, StoneOfAffection.class); + stones.put(ScrollOfTerror.class, StoneOfFear.class); stones.put(ScrollOfTransmutation.class, StoneOfAugmentation.class); stones.put(ScrollOfUpgrade.class, StoneOfEnchantment.class); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAggression.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAggression.java index 129cb1726..baca46888 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAggression.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAggression.java @@ -49,7 +49,7 @@ public class StoneOfAggression extends Runestone { if (ch != null) { if (ch.alignment == Char.Alignment.ENEMY) { - Buff.prolong(ch, Aggression.class, Aggression.DURATION / 5f); + Buff.prolong(ch, Aggression.class, Aggression.DURATION / 4f); } else { Buff.prolong(ch, Aggression.class, Aggression.DURATION); } @@ -64,7 +64,7 @@ public class StoneOfAggression extends Runestone { } } - + public static class Aggression extends FlavourBuff { public static final float DURATION = 20f; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfClairvoyance.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfClairvoyance.java index 02468dbbb..e1c1bf5c8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfClairvoyance.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfClairvoyance.java @@ -33,7 +33,7 @@ import com.watabou.utils.Point; public class StoneOfClairvoyance extends Runestone { - private static final int DIST = 12; + private static final int DIST = 20; { image = ItemSpriteSheet.STONE_CLAIRVOYANCE; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDeepenedSleep.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDeepSleep.java similarity index 80% rename from core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDeepenedSleep.java rename to core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDeepSleep.java index 3ca6eaf77..190d59b5d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDeepenedSleep.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDeepSleep.java @@ -33,7 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; -public class StoneOfDeepenedSleep extends Runestone { +public class StoneOfDeepSleep extends Runestone { { image = ItemSpriteSheet.STONE_SLEEP; @@ -41,22 +41,17 @@ public class StoneOfDeepenedSleep extends Runestone { @Override protected void activate(int cell) { - - for (int i : PathFinder.NEIGHBOURS9){ - - CellEmitter.get(cell + i).start( Speck.factory( Speck.NOTE ), 0.1f, 2 ); - - if (Actor.findChar(cell + i) != null) { - - Char c = Actor.findChar(cell + i); - - if ((c instanceof Mob && ((Mob) c).state == ((Mob) c).SLEEPING)){ - - Buff.affect(c, MagicalSleep.class); - - } - + + if (Actor.findChar(cell) != null) { + + Char c = Actor.findChar(cell); + + if (c instanceof Mob){ + + Buff.affect(c, MagicalSleep.class); + } + } Sample.INSTANCE.play( Assets.Sounds.LULLABY ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAffection.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFear.java similarity index 71% rename from core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAffection.java rename to core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFear.java index 9b82bcf1d..86b62e9d2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAffection.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFear.java @@ -22,17 +22,21 @@ package com.shatteredpixel.shatteredpixeldungeon.items.stones; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; -public class StoneOfAffection extends Runestone { +public class StoneOfFear extends Runestone { { image = ItemSpriteSheet.STONE_AFFECTION; @@ -40,20 +44,15 @@ public class StoneOfAffection extends Runestone { @Override protected void activate(int cell) { - - for (int i : PathFinder.NEIGHBOURS9){ - - CellEmitter.center(cell + i).start( Speck.factory( Speck.HEART ), 0.2f, 5 ); - - - Char ch = Actor.findChar( cell + i ); - - if (ch != null && ch.alignment == Char.Alignment.ENEMY){ - Buff.prolong(ch, Charm.class, Charm.DURATION).object = curUser.id(); - } + + Char ch = Actor.findChar( cell ); + + if (ch != null){ + Buff.affect( ch, Terror.class, Terror.DURATION ).object = curUser.id(); } - - Sample.INSTANCE.play( Assets.Sounds.CHARMS ); + + new Flare( 5, 16 ).color( 0xFF0000, true ).show(Dungeon.hero.sprite.parent, DungeonTilemap.tileCenterToWorld(cell), 2f ); + Sample.INSTANCE.play( Assets.Sounds.READ ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java index d60e2c6b4..b4ad4aa26 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfFlock.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; import com.watabou.utils.Random; @@ -44,20 +45,20 @@ public class StoneOfFlock extends Runestone { @Override protected void activate(int cell) { - - for (int i : PathFinder.NEIGHBOURS9){ - - if (!Dungeon.level.solid[cell + i] - && !Dungeon.level.pit[cell + i] - && Actor.findChar(cell + i) == null) { - - Sheep sheep = new Sheep(); - sheep.lifespan = Random.IntRange(5, 8); - sheep.pos = cell + i; - GameScene.add(sheep); - Dungeon.level.occupyCell(sheep); - - CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4); + + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + if (Dungeon.level.insideMap(i) + && Actor.findChar(i) == null + && !(Dungeon.level.pit[i])) { + Sheep sheep = new Sheep(); + sheep.lifespan = Random.NormalIntRange( 6, 8 ); + sheep.pos = i; + Dungeon.level.occupyCell(sheep); + GameScene.add(sheep); + CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4); + } } } CellEmitter.get(cell).burst(Speck.factory(Speck.WOOL), 4); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java index 9567e396a..f354ffa05 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.stones; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.effects.Identification; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; @@ -69,6 +70,8 @@ public class StoneOfIntuition extends InventoryStone { GameScene.show( new WndGuess(item)); } + + public static class IntuitionUseTracker extends Buff {{ revivePersists = true; }}; private static Class curGuess = null; @@ -104,7 +107,18 @@ public class StoneOfIntuition extends InventoryStone { } GLog.p( Messages.get(WndGuess.class, "correct") ); curUser.sprite.parent.add( new Identification( curUser.sprite.center().offset( 0, -16 ) ) ); + + if (curUser.buff(IntuitionUseTracker.class) == null){ + GLog.h( Messages.get(WndGuess.class, "preserved") ); + new StoneOfIntuition().collect(); + Buff.affect(curUser, IntuitionUseTracker.class); + } else { + curUser.buff(IntuitionUseTracker.class).detach(); + } } else { + if (curUser.buff(IntuitionUseTracker.class) != null) { + curUser.buff(IntuitionUseTracker.class).detach(); + } GLog.n( Messages.get(WndGuess.class, "incorrect") ); } curGuess = null;