v1.2.2: fixed items spawning as IDed counting as being IDed by the hero

This commit is contained in:
Evan Debenham 2022-04-07 19:19:56 -04:00
parent f6d30c05d8
commit 9c92ab8154
11 changed files with 32 additions and 25 deletions

View File

@ -133,7 +133,7 @@ public class ArmoredStatue extends Statue {
@Override @Override
public void die( Object cause ) { public void die( Object cause ) {
armor.identify(); armor.identify(false);
Dungeon.level.drop( armor, pos ).sprite.drop(); Dungeon.level.drop( armor, pos ).sprite.drop();
super.die( cause ); super.die( cause );
} }

View File

@ -145,7 +145,7 @@ public class Statue extends Mob {
@Override @Override
public void die( Object cause ) { public void die( Object cause ) {
weapon.identify(); weapon.identify(false);
Dungeon.level.drop( weapon, pos ).sprite.drop(); Dungeon.level.drop( weapon, pos ).sprite.drop();
super.die( cause ); super.die( cause );
} }

View File

@ -214,7 +214,9 @@ public class Item implements Bundlable {
item.merge( this ); item.merge( this );
item.updateQuickslot(); item.updateQuickslot();
if (Dungeon.hero != null && Dungeon.hero.isAlive()) { if (Dungeon.hero != null && Dungeon.hero.isAlive()) {
Badges.validateItemLevelAquired( this );
Talent.onItemCollected(Dungeon.hero, item); Talent.onItemCollected(Dungeon.hero, item);
if (isIdentified()) Catalog.setSeen(getClass());
} }
return true; return true;
} }
@ -224,6 +226,7 @@ public class Item implements Bundlable {
if (Dungeon.hero != null && Dungeon.hero.isAlive()) { if (Dungeon.hero != null && Dungeon.hero.isAlive()) {
Badges.validateItemLevelAquired( this ); Badges.validateItemLevelAquired( this );
Talent.onItemCollected( Dungeon.hero, this ); Talent.onItemCollected( Dungeon.hero, this );
if (isIdentified()) Catalog.setSeen(getClass());
} }
items.add( this ); items.add( this );
@ -395,10 +398,14 @@ public class Item implements Bundlable {
public boolean isEquipped( Hero hero ) { public boolean isEquipped( Hero hero ) {
return false; return false;
} }
public Item identify() {
if (Dungeon.hero != null && Dungeon.hero.isAlive()){ public final Item identify(){
return identify(true);
}
public Item identify( boolean byHero ) {
if (byHero && Dungeon.hero != null && Dungeon.hero.isAlive()){
Catalog.setSeen(getClass()); Catalog.setSeen(getClass());
if (!isIdentified()) Talent.onItemIdentified(Dungeon.hero, this); if (!isIdentified()) Talent.onItemIdentified(Dungeon.hero, this);
} }

View File

@ -352,8 +352,8 @@ public class Potion extends Item {
} }
@Override @Override
public Item identify() { public Item identify( boolean byHero ) {
super.identify(); super.identify(byHero);
if (!isKnown()) { if (!isKnown()) {
setKnown(); setKnown();

View File

@ -198,10 +198,10 @@ public class Ring extends KindofMisc {
} }
@Override @Override
public Item identify() { public Item identify( boolean byHero ) {
setKnown(); setKnown();
levelsToID = 0; levelsToID = 0;
return super.identify(); return super.identify(byHero);
} }
@Override @Override

View File

@ -211,8 +211,8 @@ public abstract class Scroll extends Item {
} }
@Override @Override
public Item identify() { public Item identify( boolean byHero ) {
super.identify(); super.identify(byHero);
if (!isKnown()) { if (!isKnown()) {
setKnown(); setKnown();

View File

@ -215,10 +215,10 @@ public abstract class Wand extends Item {
} }
@Override @Override
public Item identify() { public Item identify( boolean byHero ) {
curChargeKnown = true; curChargeKnown = true;
super.identify(); super.identify(byHero);
updateQuickslot(); updateQuickslot();

View File

@ -156,26 +156,26 @@ public class ShopRoom extends SpecialRoom {
switch (Dungeon.depth) { switch (Dungeon.depth) {
case 6: default: case 6: default:
w = (MeleeWeapon) Generator.random(Generator.wepTiers[1]); w = (MeleeWeapon) Generator.random(Generator.wepTiers[1]);
itemsToSpawn.add( Generator.random(Generator.misTiers[1]).quantity(2).identify() ); itemsToSpawn.add( Generator.random(Generator.misTiers[1]).quantity(2).identify(false) );
itemsToSpawn.add( new LeatherArmor().identify() ); itemsToSpawn.add( new LeatherArmor().identify(false) );
break; break;
case 11: case 11:
w = (MeleeWeapon) Generator.random(Generator.wepTiers[2]); w = (MeleeWeapon) Generator.random(Generator.wepTiers[2]);
itemsToSpawn.add( Generator.random(Generator.misTiers[2]).quantity(2).identify() ); itemsToSpawn.add( Generator.random(Generator.misTiers[2]).quantity(2).identify(false) );
itemsToSpawn.add( new MailArmor().identify() ); itemsToSpawn.add( new MailArmor().identify(false) );
break; break;
case 16: case 16:
w = (MeleeWeapon) Generator.random(Generator.wepTiers[3]); w = (MeleeWeapon) Generator.random(Generator.wepTiers[3]);
itemsToSpawn.add( Generator.random(Generator.misTiers[3]).quantity(2).identify() ); itemsToSpawn.add( Generator.random(Generator.misTiers[3]).quantity(2).identify(false) );
itemsToSpawn.add( new ScaleArmor().identify() ); itemsToSpawn.add( new ScaleArmor().identify(false) );
break; break;
case 20: case 21: case 20: case 21:
w = (MeleeWeapon) Generator.random(Generator.wepTiers[4]); w = (MeleeWeapon) Generator.random(Generator.wepTiers[4]);
itemsToSpawn.add( Generator.random(Generator.misTiers[4]).quantity(2).identify() ); itemsToSpawn.add( Generator.random(Generator.misTiers[4]).quantity(2).identify(false) );
itemsToSpawn.add( new PlateArmor().identify() ); itemsToSpawn.add( new PlateArmor().identify(false) );
itemsToSpawn.add( new Torch() ); itemsToSpawn.add( new Torch() );
itemsToSpawn.add( new Torch() ); itemsToSpawn.add( new Torch() );
itemsToSpawn.add( new Torch() ); itemsToSpawn.add( new Torch() );
@ -184,7 +184,7 @@ public class ShopRoom extends SpecialRoom {
w.enchant(null); w.enchant(null);
w.cursed = false; w.cursed = false;
w.level(0); w.level(0);
w.identify(); w.identify(false);
itemsToSpawn.add(w); itemsToSpawn.add(w);
itemsToSpawn.add( TippedDart.randomTipped(2) ); itemsToSpawn.add( TippedDart.randomTipped(2) );

View File

@ -73,7 +73,7 @@ public class WndImp extends Window {
tokens.detachAll( Dungeon.hero.belongings.backpack ); tokens.detachAll( Dungeon.hero.belongings.backpack );
if (reward == null) return; if (reward == null) return;
reward.identify(); reward.identify(false);
if (reward.doPickUp( Dungeon.hero )) { if (reward.doPickUp( Dungeon.hero )) {
GLog.i( Messages.get(Dungeon.hero, "you_now_have", reward.name()) ); GLog.i( Messages.get(Dungeon.hero, "you_now_have", reward.name()) );
} else { } else {

View File

@ -110,7 +110,7 @@ public class WndSadGhost extends Window {
((Armor) reward).inscribe(Ghost.Quest.glyph); ((Armor) reward).inscribe(Ghost.Quest.glyph);
} }
reward.identify(); reward.identify(false);
if (reward.doPickUp( Dungeon.hero )) { if (reward.doPickUp( Dungeon.hero )) {
GLog.i( Messages.get(Dungeon.hero, "you_now_have", reward.name()) ); GLog.i( Messages.get(Dungeon.hero, "you_now_have", reward.name()) );
} else { } else {

View File

@ -101,7 +101,7 @@ public class WndWandmaker extends Window {
questItem.detach( Dungeon.hero.belongings.backpack ); questItem.detach( Dungeon.hero.belongings.backpack );
reward.identify(); reward.identify(false);
if (reward.doPickUp( Dungeon.hero )) { if (reward.doPickUp( Dungeon.hero )) {
GLog.i( Messages.get(Dungeon.hero, "you_now_have", reward.name()) ); GLog.i( Messages.get(Dungeon.hero, "you_now_have", reward.name()) );
} else { } else {