From 3db661770a3a7d8f57991ed2690a6de783e75da4 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 17 Jul 2020 19:05:03 -0400 Subject: [PATCH] v0.8.2: POS, SOU, & related items are now unique & immune to burn/freeze --- .../shatteredpixeldungeon/actors/buffs/Burning.java | 6 ++---- .../shatteredpixeldungeon/actors/buffs/Frost.java | 5 ++--- .../shatteredpixeldungeon/actors/hero/Hero.java | 6 +++--- .../shatteredpixel/shatteredpixeldungeon/items/Heap.java | 5 ++--- .../items/potions/PotionOfStrength.java | 2 ++ .../items/potions/elixirs/ElixirOfMight.java | 2 ++ .../items/potions/exotic/PotionOfAdrenalineSurge.java | 2 ++ .../items/scrolls/ScrollOfUpgrade.java | 2 ++ .../items/scrolls/exotic/ScrollOfEnchantment.java | 2 ++ .../shatteredpixeldungeon/items/spells/MagicalInfusion.java | 2 ++ .../items/stones/StoneOfEnchantment.java | 2 ++ .../shatteredpixeldungeon/plants/Rotberry.java | 2 ++ 12 files changed, 25 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java index 4ca4d2188..da5a61ad9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java @@ -98,8 +98,7 @@ public class Burning extends Buff implements Hero.Doom { ArrayList burnable = new ArrayList<>(); //does not reach inside of containers for (Item i : hero.belongings.backpack.items){ - if ((i instanceof Scroll && !(i instanceof ScrollOfUpgrade)) - || i instanceof MysteryMeat){ + if (!i.unique && (i instanceof Scroll || i instanceof MysteryMeat)){ burnable.add(i); } } @@ -125,8 +124,7 @@ public class Burning extends Buff implements Hero.Doom { Item item = ((Thief) target).item; - if (item instanceof Scroll && - !(item instanceof ScrollOfUpgrade)) { + if (!item.unique && item instanceof Scroll) { target.sprite.emitter().burst( ElmoParticle.FACTORY, 6 ); ((Thief)target).item = null; } else if (item instanceof MysteryMeat) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java index 15e57c221..098b9027a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java @@ -62,8 +62,7 @@ public class Frost extends FlavourBuff { ArrayList freezable = new ArrayList<>(); //does not reach inside of containers for (Item i : hero.belongings.backpack.items){ - if ((i instanceof Potion && !(i instanceof PotionOfStrength)) - || i instanceof MysteryMeat){ + if (!i.unique && (i instanceof Potion || i instanceof MysteryMeat)){ freezable.add(i); } } @@ -85,7 +84,7 @@ public class Frost extends FlavourBuff { Item item = ((Thief) target).item; - if (item instanceof Potion && !(item instanceof PotionOfStrength)) { + if (item instanceof Potion && !item.unique) { ((Potion) ((Thief) target).item).shatter(target.pos); ((Thief) target).item = null; } else if (item instanceof MysteryMeat){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 2cf3fd517..5321ebfee 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -745,9 +745,9 @@ public class Hero extends Char { //Do Nothing } else { - boolean important = - (item instanceof ScrollOfUpgrade && ((Scroll)item).isKnown()) || - (item instanceof PotionOfStrength && ((Potion)item).isKnown()); + //TODO make all unique items important? or just POS / SOU? + boolean important = item.unique && item.isIdentified() && + (item instanceof Scroll || item instanceof Potion); if (important) { GLog.p( Messages.get(this, "you_now_have", item.name()) ); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 3577c8464..67e9e7def 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -206,8 +206,7 @@ public class Heap implements Bundlable { boolean evaporated = false; for (Item item : items.toArray( new Item[0] )) { - if (item instanceof Scroll - && !(item instanceof ScrollOfUpgrade)) { + if (item instanceof Scroll && !item.unique) { items.remove( item ); burnt = true; } else if (item instanceof Dewdrop) { @@ -308,7 +307,7 @@ public class Heap implements Bundlable { if (item instanceof MysteryMeat) { replace( item, FrozenCarpaccio.cook( (MysteryMeat)item ) ); frozen = true; - } else if (item instanceof Potion && !(item instanceof PotionOfStrength)) { + } else if (item instanceof Potion && !item.unique) { items.remove(item); ((Potion) item).shatter(pos); frozen = true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java index 75a07e40a..a193a00d8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java @@ -32,6 +32,8 @@ public class PotionOfStrength extends Potion { { icon = ItemSpriteSheet.Icons.POTION_STRENGTH; + + unique = true; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java index 14d551deb..c9dc8e5d4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java @@ -39,6 +39,8 @@ public class ElixirOfMight extends Elixir { { image = ItemSpriteSheet.ELIXIR_MIGHT; + + unique = true; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfAdrenalineSurge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfAdrenalineSurge.java index c0c134eae..31171a0fa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfAdrenalineSurge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfAdrenalineSurge.java @@ -30,6 +30,8 @@ public class PotionOfAdrenalineSurge extends ExoticPotion { { icon = ItemSpriteSheet.Icons.POTION_ARENSURGE; + + unique = true; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java index 4214130bd..98bd604f3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java @@ -43,6 +43,8 @@ public class ScrollOfUpgrade extends InventoryScroll { { icon = ItemSpriteSheet.Icons.SCROLL_UPGRADE; mode = WndBag.Mode.UPGRADEABLE; + + unique = true; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java index bf94e67cd..8b452e06f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java @@ -40,6 +40,8 @@ public class ScrollOfEnchantment extends ExoticScroll { { icon = ItemSpriteSheet.Icons.SCROLL_ENCHANT; + + unique = true; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java index 7e34c1b12..56139ee02 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java @@ -38,6 +38,8 @@ public class MagicalInfusion extends InventorySpell { { mode = WndBag.Mode.UPGRADEABLE; image = ItemSpriteSheet.MAGIC_INFUSE; + + unique = true; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java index 74a7b36d5..cd1027f09 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java @@ -36,6 +36,8 @@ public class StoneOfEnchantment extends InventoryStone { { mode = WndBag.Mode.ENCHANTABLE; image = ItemSpriteSheet.STONE_ENCHANT; + + unique = true; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java index 7c523a6a0..a9dc20bea 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java @@ -63,6 +63,8 @@ public class Rotberry extends Plant { image = ItemSpriteSheet.SEED_ROTBERRY; plantClass = Rotberry.class; + + unique = true; } @Override