v0.9.4: fixed various specific effects not respecting lost inventory
This commit is contained in:
parent
a1f590b52d
commit
4c1300aa21
|
@ -104,11 +104,13 @@ public class Burning extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
ArrayList<Item> burnable = new ArrayList<>();
|
ArrayList<Item> burnable = new ArrayList<>();
|
||||||
//does not reach inside of containers
|
//does not reach inside of containers
|
||||||
|
if (hero.buff(LostInventory.class) != null) {
|
||||||
for (Item i : hero.belongings.backpack.items) {
|
for (Item i : hero.belongings.backpack.items) {
|
||||||
if (!i.unique && (i instanceof Scroll || i instanceof MysteryMeat || i instanceof FrozenCarpaccio)) {
|
if (!i.unique && (i instanceof Scroll || i instanceof MysteryMeat || i instanceof FrozenCarpaccio)) {
|
||||||
burnable.add(i);
|
burnable.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!burnable.isEmpty()){
|
if (!burnable.isEmpty()){
|
||||||
Item toBurn = Random.element(burnable).detach(hero.belongings.backpack);
|
Item toBurn = Random.element(burnable).detach(hero.belongings.backpack);
|
||||||
|
|
|
@ -61,11 +61,13 @@ public class Frost extends FlavourBuff {
|
||||||
Hero hero = (Hero)target;
|
Hero hero = (Hero)target;
|
||||||
ArrayList<Item> freezable = new ArrayList<>();
|
ArrayList<Item> freezable = new ArrayList<>();
|
||||||
//does not reach inside of containers
|
//does not reach inside of containers
|
||||||
|
if (hero.buff(LostInventory.class) != null) {
|
||||||
for (Item i : hero.belongings.backpack.items) {
|
for (Item i : hero.belongings.backpack.items) {
|
||||||
if (!i.unique && (i instanceof Potion || i instanceof MysteryMeat)) {
|
if (!i.unique && (i instanceof Potion || i instanceof MysteryMeat)) {
|
||||||
freezable.add(i);
|
freezable.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!freezable.isEmpty()){
|
if (!freezable.isEmpty()){
|
||||||
Item toFreeze = Random.element(freezable).detach( hero.belongings.backpack );
|
Item toFreeze = Random.element(freezable).detach( hero.belongings.backpack );
|
||||||
|
|
|
@ -300,6 +300,7 @@ public class Belongings implements Iterable<Item> {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//triggers when a run ends, so ignores lost inventory effects
|
||||||
public void identify() {
|
public void identify() {
|
||||||
for (Item item : this) {
|
for (Item item : this) {
|
||||||
item.identify();
|
item.identify();
|
||||||
|
@ -307,25 +308,25 @@ public class Belongings implements Iterable<Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void observe() {
|
public void observe() {
|
||||||
if (weapon != null) {
|
if (weapon() != null) {
|
||||||
weapon.identify();
|
weapon().identify();
|
||||||
Badges.validateItemLevelAquired( weapon );
|
Badges.validateItemLevelAquired(weapon());
|
||||||
}
|
}
|
||||||
if (armor != null) {
|
if (armor() != null) {
|
||||||
armor.identify();
|
armor().identify();
|
||||||
Badges.validateItemLevelAquired( armor );
|
Badges.validateItemLevelAquired(armor());
|
||||||
}
|
}
|
||||||
if (artifact != null) {
|
if (artifact() != null) {
|
||||||
artifact.identify();
|
artifact().identify();
|
||||||
Badges.validateItemLevelAquired(artifact);
|
Badges.validateItemLevelAquired(artifact());
|
||||||
}
|
}
|
||||||
if (misc != null) {
|
if (misc() != null) {
|
||||||
misc.identify();
|
misc().identify();
|
||||||
Badges.validateItemLevelAquired(misc);
|
Badges.validateItemLevelAquired(misc());
|
||||||
}
|
}
|
||||||
if (ring != null) {
|
if (ring() != null) {
|
||||||
ring.identify();
|
ring().identify();
|
||||||
Badges.validateItemLevelAquired(ring);
|
Badges.validateItemLevelAquired(ring());
|
||||||
}
|
}
|
||||||
for (Item item : backpack) {
|
for (Item item : backpack) {
|
||||||
if (item instanceof EquipableItem || item instanceof Wand) {
|
if (item instanceof EquipableItem || item instanceof Wand) {
|
||||||
|
@ -335,10 +336,12 @@ public class Belongings implements Iterable<Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uncurseEquipped() {
|
public void uncurseEquipped() {
|
||||||
ScrollOfRemoveCurse.uncurse( owner, armor, weapon, artifact, misc, ring);
|
ScrollOfRemoveCurse.uncurse( owner, armor(), weapon(), artifact(), misc(), ring());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item randomUnequipped() {
|
public Item randomUnequipped() {
|
||||||
|
if (owner.buff(LostInventory.class) != null) return null;
|
||||||
|
|
||||||
return Random.element( backpack.items );
|
return Random.element( backpack.items );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user