From f11a2727bc2549e3dbe0d8e3421aa21efe404864 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 25 Jul 2018 23:04:09 -0400 Subject: [PATCH] v0.7.0: fixes: - teleportation working on floor 5 - glitches in tranfusion shield calculation - incorrect boolean logic on magic immune - dragon's breath and enchantment being lost when they shouldn't be - typo in potion of shielding --- .../shatteredpixeldungeon/items/armor/Armor.java | 4 ++-- .../items/potions/exotic/PotionOfDragonsBreath.java | 5 +++-- .../items/scrolls/ScrollOfTeleportation.java | 2 +- .../items/scrolls/exotic/ExoticScroll.java | 4 ++-- .../items/scrolls/exotic/ScrollOfEnchantment.java | 7 ++++--- .../items/wands/WandOfTransfusion.java | 7 ++++--- .../shatteredpixeldungeon/items/weapon/Weapon.java | 4 ++-- .../items/weapon/missiles/darts/Dart.java | 2 +- .../shatteredpixeldungeon/messages/items/items.properties | 2 +- 9 files changed, 20 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index f17b8c45a..8a713f8b3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -354,7 +354,7 @@ public class Armor extends EquipableItem { public int proc( Char attacker, Char defender, int damage ) { - if (glyph != null && defender.buff(MagicImmune.class) != null) { + if (glyph != null && defender.buff(MagicImmune.class) == null) { damage = glyph.proc( this, attacker, defender, damage ); } @@ -504,7 +504,7 @@ public class Armor extends EquipableItem { } public boolean hasGlyph(Class type, Char owner) { - return glyph != null && glyph.getClass() == type && owner.buff(MagicImmune.class) == null; + return glyph != null && glyph.getClass() == type && owner.buff(MagicImmune.class) == null; } //these are not used to process specific glyph effects, so magic immune doesn't affect them diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java index bca87b761..cb8f3fb3d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java @@ -59,7 +59,7 @@ public class PotionOfDragonsBreath extends ExoticPotion { @Override //need to override drink so that time isn't spent right away protected void drink(final Hero hero) { - detach( hero.belongings.backpack ); + curItem = detach( hero.belongings.backpack ); setKnown(); GameScene.selectCell(targeter); @@ -70,7 +70,8 @@ public class PotionOfDragonsBreath extends ExoticPotion { public void onSelect(final Integer cell) { if (cell == null){ - return; + //TODO if this can ever be found un-IDed, need logic for that + curItem.collect(); } else { Sample.INSTANCE.play( Assets.SND_DRINK ); curUser.sprite.operate(curUser.pos, new Callback() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java index a5f264fe2..507ed677b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java @@ -135,7 +135,7 @@ public class ScrollOfTeleportation extends Scroll { public static void teleportPreferringUnseen( Hero hero ){ - if (!(Dungeon.level instanceof RegularLevel)){ + if (Dungeon.bossLevel() || !(Dungeon.level instanceof RegularLevel)){ teleportHero( hero ); return; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java index e974e7640..638a2b4d5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java @@ -84,10 +84,10 @@ public abstract class ExoticScroll extends Scroll { //TODO regToExo.put(ScrollOfMirrorImage.class, ScrollOfDivination.class); - exoToReg.put(ScrollOfDivination.class, ScrollOfMirrorImage.class); + //exoToReg.put(ScrollOfDivination.class, ScrollOfMirrorImage.class); regToExo.put(ScrollOfTransmutation.class, ScrollOfDivination.class); - exoToReg.put(ScrollOfDivination.class, ScrollOfTransmutation.class); + //exoToReg.put(ScrollOfDivination.class, ScrollOfTransmutation.class); } @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 d01e5ae40..7789e7fed 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 @@ -43,8 +43,6 @@ public class ScrollOfEnchantment extends ExoticScroll { public void doRead() { setKnown(); - curItem = this; - GameScene.selectItem( itemSelector, WndBag.Mode.ENCHANTABLE, Messages.get(this, "inv_title")); } @@ -82,7 +80,7 @@ public class ScrollOfEnchantment extends ExoticScroll { } }); - } else { + } else if (item instanceof Armor) { final Armor.Glyph glyphs[] = new Armor.Glyph[3]; @@ -111,6 +109,9 @@ public class ScrollOfEnchantment extends ExoticScroll { } } }); + } else { + //TODO if this can ever be found un-IDed, need logic for that + curItem.collect(); } } }; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java index 255cd3c4d..2466dbd34 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java @@ -80,15 +80,16 @@ public class WandOfTransfusion extends Wand { if (ch.alignment == Char.Alignment.ALLY || ch.buff(Charm.class) != null){ int healing = selfDmg + 3*level(); - int shielding = -(ch.HT - ch.HP - healing); + int shielding = (ch.HP + healing) - ch.HT; if (shielding > 0){ healing -= shielding; + Buff.affect(ch, Barrier.class).set(shielding); + } else { + shielding = 0; } ch.HP += healing; - Buff.affect(ch, Barrier.class).set(shielding); - ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 2 + level() / 2); ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing + shielding); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 2bced42cd..b3634e8c7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -100,7 +100,7 @@ abstract public class Weapon extends KindOfWeapon { @Override public int proc( Char attacker, Char defender, int damage ) { - if (enchantment != null && attacker.buff(MagicImmune.class) != null) { + if (enchantment != null && attacker.buff(MagicImmune.class) == null) { damage = enchantment.proc( this, attacker, defender, damage ); } @@ -251,7 +251,7 @@ abstract public class Weapon extends KindOfWeapon { } public boolean hasEnchant(Class type, Char owner) { - return enchantment != null && enchantment.getClass() == type && owner.buff(MagicImmune.class) != null; + return enchantment != null && enchantment.getClass() == type && owner.buff(MagicImmune.class) == null; } //these are not used to process specific enchant effects, so magic immune doesn't affect them diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java index f1f684bce..cbb4c061f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java @@ -78,7 +78,7 @@ public class Dart extends MissileWeapon { @Override public int proc(Char attacker, Char defender, int damage) { - if (bow != null && bow.enchantment != null && attacker.buff(MagicImmune.class) != null){ + if (bow != null && bow.enchantment != null && attacker.buff(MagicImmune.class) == null){ damage = bow.enchantment.proc(bow, attacker, defender, damage); } return super.proc(attacker, defender, damage); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index fbc48357b..f85089ef4 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -581,7 +581,7 @@ items.potions.exotic.potionofmagicalsight.name=potion of magical sight items.potions.exotic.potionofmagicalsight.desc=After drinking this, your senses will be breifly heightened to incredible levels, allowing you to see through walls! items.potions.exotic.potionofshielding.name=potion of shielding -items.potions.exotic.potionofshielding.desc=Rather than heal, this potion will instead project a durable shield around the users body, blocking a considerable amount of damage. +items.potions.exotic.potionofshielding.desc=Rather than heal, this potion will instead project a durable shield around the user's body, blocking a considerable amount of damage. items.potions.exotic.potionofshroudingfog.name=potion of shrouding fog items.potions.exotic.potionofshroudingfog.desc=When exposed to air, the liquid in this flask will produce a thick smoky fog which completely blocks vision.