diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java index c422ef10a..22b594be1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java @@ -52,6 +52,9 @@ public class Belongings implements Iterable { public Artifact artifact = null; public KindofMisc misc = null; public Ring ring = null; + + //used when thrown weapons temporary occupy the weapon slot + public KindOfWeapon stashedWeapon = null; public Belongings( Hero owner ) { this.owner = owner; 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 29bee39b6..067bb21a3 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 @@ -323,11 +323,12 @@ public class Hero extends Char { public boolean shoot( Char enemy, MissileWeapon wep ) { //temporarily set the hero's weapon to the missile weapon being used - KindOfWeapon equipped = belongings.weapon; + belongings.stashedWeapon = belongings.weapon; belongings.weapon = wep; boolean hit = attack( enemy ); Invisibility.dispel(); - belongings.weapon = equipped; + belongings.weapon = belongings.stashedWeapon; + belongings.stashedWeapon = null; if (subClass == HeroSubClass.GLADIATOR){ if (hit) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java index d6bde2a0c..7f28929b6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java @@ -42,7 +42,7 @@ abstract public class KindOfWeapon extends EquipableItem { @Override public boolean isEquipped( Hero hero ) { - return hero.belongings.weapon == this; + return hero.belongings.weapon == this || hero.belongings.stashedWeapon == this; } @Override