v0.8.2: added a temp reference to equipped weps when using thrown weps

This commit is contained in:
Evan Debenham 2020-07-25 14:34:44 -04:00
parent a298053118
commit 666e009334
3 changed files with 7 additions and 3 deletions

View File

@ -53,6 +53,9 @@ public class Belongings implements Iterable<Item> {
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;

View File

@ -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) {

View File

@ -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