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
public void die( Object cause ) {
armor.identify();
armor.identify(false);
Dungeon.level.drop( armor, pos ).sprite.drop();
super.die( cause );
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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