From e715e147ff12a41c36c5a84aef1b5c9ea363faea Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 19 Apr 2016 19:34:08 -0400 Subject: [PATCH] v0.3.5: big consistency pass on how items handle execution --- .../shatteredpixeldungeon/items/Amulet.java | 9 ++---- .../shatteredpixeldungeon/items/Ankh.java | 11 +++---- .../shatteredpixeldungeon/items/ArmorKit.java | 16 +++++----- .../shatteredpixeldungeon/items/Bomb.java | 19 ++++++------ .../items/BrokenSeal.java | 5 ++-- .../shatteredpixeldungeon/items/DewVial.java | 7 ++--- .../items/EquipableItem.java | 5 ++-- .../shatteredpixeldungeon/items/Honeypot.java | 17 ++++++----- .../items/MerchantsBeacon.java | 7 +++-- .../shatteredpixeldungeon/items/Stylus.java | 8 ++--- .../items/TomeOfMastery.java | 7 ++--- .../shatteredpixeldungeon/items/Torch.java | 12 ++++---- .../items/Weightstone.java | 9 +++--- .../items/armor/Armor.java | 5 ++-- .../items/armor/ClassArmor.java | 5 ++-- .../items/artifacts/AlchemistsToolkit.java | 5 ++-- .../items/artifacts/ChaliceOfBlood.java | 1 + .../items/artifacts/CloakOfShadows.java | 7 +++-- .../items/artifacts/DriedRose.java | 5 ++-- .../items/artifacts/EtherealChains.java | 6 ++-- .../items/artifacts/HornOfPlenty.java | 2 ++ .../items/artifacts/LloydsBeacon.java | 6 ++-- .../items/artifacts/SandalsOfNature.java | 3 ++ .../items/artifacts/TalismanOfForesight.java | 1 + .../items/artifacts/TimekeepersHourglass.java | 6 ++-- .../items/artifacts/UnstableSpellbook.java | 6 ++-- .../shatteredpixeldungeon/items/bags/Bag.java | 13 ++++---- .../items/food/Blandfruit.java | 18 +++++++++-- .../items/food/Food.java | 7 ++--- .../items/food/Pasty.java | 1 + .../items/potions/Potion.java | 7 ++--- .../items/quest/Pickaxe.java | 16 +++++----- .../items/scrolls/Scroll.java | 7 ++--- .../items/wands/Wand.java | 30 +++++++++---------- .../items/weapon/melee/MagesStaff.java | 6 ++-- .../shatteredpixeldungeon/plants/Plant.java | 19 ++++++------ 36 files changed, 163 insertions(+), 151 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java index 699ee7837..7aba653b6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java @@ -50,14 +50,11 @@ public class Amulet extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals(AC_END)) { - showAmuletScene( false ); - - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java index 801a6e14f..b0c40cf0b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Ankh.java @@ -24,10 +24,9 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; @@ -69,6 +68,9 @@ public class Ankh extends Item { @Override public void execute( final Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_BLESS )) { DewVial vial = hero.belongings.getItem(DewVial.class); @@ -84,12 +86,7 @@ public class Ankh extends Item { CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); hero.sprite.operate( hero.pos ); } - } else { - - super.execute( hero, action ); - } - } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/ArmorKit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/ArmorKit.java index 4f897d9be..4810467c1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/ArmorKit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/ArmorKit.java @@ -20,21 +20,20 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items; -import java.util.ArrayList; - -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; +import com.watabou.noosa.audio.Sample; + +import java.util.ArrayList; public class ArmorKit extends Item { @@ -59,15 +58,14 @@ public class ArmorKit extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action == AC_APPLY) { curUser = hero; GameScene.selectItem( itemSelector, WndBag.Mode.ARMOR, Messages.get(this, "prompt") ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java index 1ce1d6b0b..bf5746b6d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java @@ -20,23 +20,22 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; -import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.noosa.audio.Sample; 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.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; import com.watabou.utils.Random; @@ -74,13 +73,13 @@ public class Bomb extends Item { @Override public void execute(Hero hero, String action) { - if (action.equals( AC_LIGHTTHROW )){ + super.execute(hero, action); + + if (action.equals(AC_LIGHTTHROW)) { lightingFuse = true; action = AC_THROW; } else lightingFuse = false; - - super.execute(hero, action); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java index 090cdb070..7db81409d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java @@ -42,13 +42,14 @@ public class BrokenSeal extends Item { @Override public void execute(Hero hero, String action) { + + super.execute(hero, action); + if (action.equals(AC_AFFIX)){ curItem = this; GameScene.selectItem(armorSelector, WndBag.Mode.ARMOR, Messages.get(this, "prompt")); } else if (action.equals(AC_INFO)) { GameScene.show(new WndItem(null, this, true)); - } else { - super.execute(hero, action); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java index 78ef7f19b..a6a5e4dcb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java @@ -79,6 +79,9 @@ public class DewVial extends Item { @Override public void execute( final Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_DRINK )) { if (volume > 0) { @@ -111,10 +114,6 @@ public class DewVial extends Item { GLog.w( Messages.get(this, "empty") ); } - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java index e0d9b2292..5112a0499 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/EquipableItem.java @@ -49,6 +49,9 @@ public abstract class EquipableItem extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_EQUIP )) { //In addition to equipping itself, item reassigns itself to the quickslot //This is a special case as the item is being removed from inventory, but is staying with the hero. @@ -60,8 +63,6 @@ public abstract class EquipableItem extends Item { } } else if (action.equals( AC_UNEQUIP )) { doUnequip( hero, true ); - } else { - super.execute( hero, action ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java index 97b97a101..e5da77493 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java @@ -20,14 +20,10 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items; -import java.util.ArrayList; - -import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.watabou.noosa.audio.Sample; -import com.watabou.noosa.tweeners.AlphaTweener; 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.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; @@ -35,9 +31,13 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.noosa.audio.Sample; +import com.watabou.noosa.tweeners.AlphaTweener; import com.watabou.utils.Bundle; import com.watabou.utils.Random; +import java.util.ArrayList; + public class Honeypot extends Item { public static final String AC_SHATTER = "SHATTER"; @@ -60,6 +60,9 @@ public class Honeypot extends Item { @Override public void execute( final Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_SHATTER )) { hero.sprite.zap( hero.pos ); @@ -69,9 +72,7 @@ public class Honeypot extends Item { shatter( hero, hero.pos ).collect(); hero.next(); - - } else { - super.execute( hero, action ); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java index c2aad62a9..d6136ad1c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/MerchantsBeacon.java @@ -51,12 +51,15 @@ public class MerchantsBeacon extends Item { @Override public void execute(Hero hero, String action) { + + super.execute(hero, action); + if (action.equals(AC_USE)) { detach( hero.belongings.backpack ); Shopkeeper.sell(); Sample.INSTANCE.play( Assets.SND_BEACON ); - } else - super.execute(hero, action); + } + } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java index 5f88a331d..c80ca7a31 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java @@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.Enchanting; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -58,15 +57,14 @@ public class Stylus extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals(AC_INSCRIBE)) { curUser = hero; GameScene.selectItem( itemSelector, WndBag.Mode.ARMOR, Messages.get(this, "prompt") ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java index 61ab58622..ac5d122f5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/TomeOfMastery.java @@ -59,6 +59,9 @@ public class TomeOfMastery extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_READ )) { curUser = hero; @@ -85,10 +88,6 @@ public class TomeOfMastery extends Item { } GameScene.show( new WndChooseWay( this, way1, way2 ) ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java index 69130e426..6a1ce89fe 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java @@ -20,14 +20,14 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items; -import java.util.ArrayList; - -import com.watabou.noosa.particles.Emitter; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.noosa.particles.Emitter; + +import java.util.ArrayList; public class Torch extends Item { @@ -52,6 +52,8 @@ public class Torch extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); if (action.equals( AC_LIGHT )) { @@ -66,10 +68,6 @@ public class Torch extends Item { Emitter emitter = hero.sprite.centerEmitter(); emitter.start( FlameParticle.FACTORY, 0.2f, 3 ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java index ff0287964..81f32a408 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java @@ -60,15 +60,14 @@ public class Weightstone extends Item { @Override public void execute( Hero hero, String action ) { - if (action == AC_APPLY) { + + super.execute( hero, action ); + + if (action.equals(AC_APPLY)) { curUser = hero; GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, Messages.get(this, "select") ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 69f072175..a0d523e8a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -112,6 +112,9 @@ public class Armor extends EquipableItem { @Override public void execute(Hero hero, String action) { + + super.execute(hero, action); + if (action.equals(AC_DETACH) && seal){ seal = false; BrokenSeal.WarriorShield sigilBuff = hero.buff(BrokenSeal.WarriorShield.class); @@ -127,8 +130,6 @@ public class Armor extends EquipableItem { if (!sigil.collect()){ Dungeon.level.drop(sigil, hero.pos); } - } else { - super.execute(hero, action); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java index f073e071f..1cb4044cc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java @@ -101,6 +101,9 @@ abstract public class ClassArmor extends Armor { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals(AC_SPECIAL)) { if (hero.HP < 3) { @@ -113,8 +116,6 @@ abstract public class ClassArmor extends Armor { doSpecial(); } - } else { - super.execute( hero, action ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java index 0215a4eff..4a5b5b798 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java @@ -84,10 +84,11 @@ public class AlchemistsToolkit extends Artifact { @Override public void execute(Hero hero, String action ) { + + super.execute(hero, action); + if (action.equals(AC_BREW)){ GameScene.selectItem(itemSelector, mode, inventoryTitle); - } else { - super.execute(hero, action); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index bb34ee728..4d7bb51f6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -57,6 +57,7 @@ public class ChaliceOfBlood extends Artifact { @Override public void execute(Hero hero, String action ) { super.execute(hero, action); + if (action.equals(AC_PRICK)){ int damage = 3*(level()*level()); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index c35e33db5..82c3580a8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -72,6 +71,9 @@ public class CloakOfShadows extends Artifact { @Override public void execute( Hero hero, String action ) { + + super.execute(hero, action); + if (action.equals( AC_STEALTH )) { if (!stealthed){ @@ -99,8 +101,7 @@ public class CloakOfShadows extends Artifact { hero.sprite.operate( hero.pos ); } - } else - super.execute(hero, action); + } } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index cda5cdd14..23269d8ce 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -86,6 +86,9 @@ public class DriedRose extends Artifact { @Override public void execute( Hero hero, String action ) { + + super.execute(hero, action); + if (action.equals(AC_SUMMON)) { if (spawned) GLog.i( Messages.get(this, "spawned") ); @@ -128,8 +131,6 @@ public class DriedRose extends Artifact { GLog.i( Messages.get(this, "no_space") ); } - } else{ - super.execute(hero, action); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java index 478e5232e..bcf7d6aa3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java @@ -68,6 +68,9 @@ public class EtherealChains extends Artifact { @Override public void execute(Hero hero, String action) { + + super.execute(hero, action); + if (action.equals(AC_CAST)){ curUser = hero; @@ -88,8 +91,7 @@ public class EtherealChains extends Artifact { GameScene.selectCell(caster); } - } else - super.execute(hero, action); + } } private CellSelector.Listener caster = new CellSelector.Listener(){ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java index bbc205eee..6d409f2cc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java @@ -78,6 +78,7 @@ public class HornOfPlenty extends Artifact { @Override public void execute( Hero hero, String action ) { + super.execute(hero, action); if (action.equals(AC_EAT)){ @@ -128,6 +129,7 @@ public class HornOfPlenty extends Artifact { } else if (action.equals(AC_STORE)){ GameScene.selectItem(itemSelector, mode, Messages.get(this, "prompt")); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java index 0af1f1b2a..e8039a820 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java @@ -105,6 +105,8 @@ public class LloydsBeacon extends Artifact { @Override public void execute( Hero hero, String action ) { + super.execute( hero, action ); + if (action == AC_SET || action == AC_RETURN) { if (Dungeon.bossLevel()) { @@ -172,10 +174,6 @@ public class LloydsBeacon extends Artifact { } - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java index d0ae792a7..3ccca59f0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java @@ -74,8 +74,11 @@ public class SandalsOfNature extends Artifact { @Override public void execute( Hero hero, String action ) { super.execute(hero, action); + if (action.equals(AC_FEED)){ + GameScene.selectItem(itemSelector, mode, Messages.get(this, "prompt")); + } else if (action.equals(AC_ROOT) && level() > 0){ if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java index fd4e1b5fb..3a0cf7ebe 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java @@ -65,6 +65,7 @@ public class TalismanOfForesight extends Artifact { @Override public void execute( Hero hero, String action ) { super.execute(hero, action); + if (action.equals(AC_SCRY)){ if (!isEquipped(hero)) GLog.i( Messages.get(Artifact.class, "need_to_equip") ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index a17319a91..ed15d3053 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -69,6 +69,9 @@ public class TimekeepersHourglass extends Artifact { @Override public void execute( Hero hero, String action ) { + + super.execute(hero, action); + if (action.equals(AC_ACTIVATE)){ if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") ); @@ -100,8 +103,7 @@ public class TimekeepersHourglass extends Artifact { }; } ); - } else - super.execute(hero, action); + } } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 206a325d9..e0bd072c1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -92,6 +92,9 @@ public class UnstableSpellbook extends Artifact { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_READ )) { if (hero.buff( Blindness.class ) != null) GLog.w( Messages.get(this, "blinded") ); @@ -116,8 +119,7 @@ public class UnstableSpellbook extends Artifact { } else if (action.equals( AC_ADD )) { GameScene.selectItem(itemSelector, mode, Messages.get(this, "prompt")); - } else - super.execute( hero, action ); + } } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java index cb7be41e2..940a09fec 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java @@ -20,9 +20,6 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.bags; -import java.util.ArrayList; -import java.util.Iterator; - import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -33,6 +30,9 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; import com.watabou.utils.Bundlable; import com.watabou.utils.Bundle; +import java.util.ArrayList; +import java.util.Iterator; + public class Bag extends Item implements Iterable { public static final String AC_OPEN = "OPEN"; @@ -53,14 +53,13 @@ public class Bag extends Item implements Iterable { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_OPEN )) { GameScene.show( new WndBag( this, null, WndBag.Mode.ALL, null ) ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java index aee43f8f8..5ad9dba02 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java @@ -27,7 +27,18 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ToxicImbue; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.potions.*; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -67,6 +78,9 @@ public class Blandfruit extends Food { @Override public void execute( Hero hero, String action ) { + + super.execute(hero, action); + if (action.equals( AC_EAT )){ if (potionAttrib == null) { @@ -91,8 +105,6 @@ public class Blandfruit extends Food { } else potionAttrib.apply(hero); } - } else { - super.execute(hero, action); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java index 108e67f73..4b14d216c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java @@ -65,6 +65,9 @@ public class Food extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_EAT )) { detach( hero.belongings.backpack ); @@ -99,10 +102,6 @@ public class Food extends Item { Statistics.foodEaten++; Badges.validateFoodEaten(); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java index f3e8d7cc3..0fd4a54b1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java @@ -83,6 +83,7 @@ public class Pasty extends Food { @Override public void execute(Hero hero, String action) { super.execute(hero, action); + if (action.equals(AC_EAT)){ switch(holiday){ case NONE: default: diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index eaaddce9d..910bc106c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -131,6 +131,9 @@ public class Potion extends Item { @Override public void execute( final Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_DRINK )) { if (isKnown() && ( @@ -155,10 +158,6 @@ public class Potion extends Item { drink( hero ); } - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java index e196dc19f..d520827bc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java @@ -20,10 +20,6 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.quest; -import java.util.ArrayList; - -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -35,14 +31,18 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; import com.watabou.utils.Callback; +import java.util.ArrayList; + public class Pickaxe extends Weapon { public static final String AC_MINE = "MINE"; @@ -82,6 +82,8 @@ public class Pickaxe extends Weapon { @Override public void execute( final Hero hero, String action ) { + + super.execute( hero, action ); if (action == AC_MINE) { @@ -132,10 +134,6 @@ public class Pickaxe extends Weapon { GLog.w( Messages.get(this, "no_vein") ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index f8dd258f9..e119d0612 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -119,6 +119,9 @@ public abstract class Scroll extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_READ )) { if (hero.buff( Blindness.class ) != null) { @@ -133,10 +136,6 @@ public abstract class Scroll extends Item { doRead(); } - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 62b2f9e20..2ff7f7ecd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -20,37 +20,36 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; -import java.util.ArrayList; - -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.watabou.noosa.audio.Sample; 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.Invisibility; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; -import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMagic.Magic; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; import com.watabou.utils.Callback; import com.watabou.utils.PointF; import com.watabou.utils.Random; +import java.util.ArrayList; + public abstract class Wand extends Item { private static final int USAGES_TO_KNOW = 20; @@ -88,16 +87,15 @@ public abstract class Wand extends Item { @Override public void execute( Hero hero, String action ) { + + super.execute( hero, action ); + if (action.equals( AC_ZAP )) { curUser = hero; curItem = this; GameScene.selectCell( zapper ); - } else { - - super.execute( hero, action ); - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index ad2390252..907b25567 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -107,6 +107,9 @@ public class MagesStaff extends MeleeWeapon { @Override public void execute(Hero hero, String action) { + + super.execute(hero, action); + if (action.equals(AC_IMBUE)) { curUser = hero; @@ -120,8 +123,7 @@ public class MagesStaff extends MeleeWeapon { } wand.execute(hero, AC_ZAP); - } else - super.execute(hero, action); + } } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index f7e5f6251..29403ea12 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -20,14 +20,9 @@ */ package com.shatteredpixel.shatteredpixeldungeon.plants; -import java.util.ArrayList; - -import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; -import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.watabou.noosa.audio.Sample; 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.Barkskin; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; @@ -38,13 +33,18 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.PlantSprite; +import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundlable; import com.watabou.utils.Bundle; import com.watabou.utils.Random; +import java.util.ArrayList; + public abstract class Plant implements Bundlable { public String plantName = Messages.get(this, "name"); @@ -150,6 +150,9 @@ public abstract class Plant implements Bundlable { @Override public void execute( Hero hero, String action ) { + + super.execute (hero, action ); + if (action.equals( AC_PLANT )) { hero.spend( TIME_TO_PLANT ); @@ -158,10 +161,6 @@ public abstract class Plant implements Bundlable { hero.sprite.operate( hero.pos ); - } else { - - super.execute (hero, action ); - } }