v0.7.1: added item stats into the journal
This commit is contained in:
parent
a7f1174bb9
commit
5c77c0feee
|
@ -105,6 +105,15 @@ public class Ring extends KindofMisc {
|
|||
super();
|
||||
reset();
|
||||
}
|
||||
|
||||
//anonymous rings are always IDed, do not affect ID status,
|
||||
//and their sprite is replaced by a placeholder if they are not known,
|
||||
//useful for items that appear in UIs, or which are only spawned for their effects
|
||||
protected boolean anonymous = false;
|
||||
public void anonymize(){
|
||||
if (!isKnown()) image = ItemSpriteSheet.RING_HOLDER;
|
||||
anonymous = true;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
@ -136,16 +145,18 @@ public class Ring extends KindofMisc {
|
|||
}
|
||||
|
||||
public boolean isKnown() {
|
||||
return handler != null && handler.isKnown( this );
|
||||
return anonymous || (handler != null && handler.isKnown( this ));
|
||||
}
|
||||
|
||||
public void setKnown() {
|
||||
if (!isKnown()) {
|
||||
handler.know( this );
|
||||
}
|
||||
|
||||
if (Dungeon.hero.isAlive()) {
|
||||
Catalog.setSeen(getClass());
|
||||
if (!anonymous) {
|
||||
if (!isKnown()) {
|
||||
handler.know(this);
|
||||
}
|
||||
|
||||
if (Dungeon.hero.isAlive()) {
|
||||
Catalog.setSeen(getClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,9 @@ public class MagesStaff extends MeleeWeapon {
|
|||
String info = super.info();
|
||||
|
||||
if (wand == null){
|
||||
info += "\n\n" + Messages.get(this, "no_wand");
|
||||
//FIXME this is removed because of journal stuff, and is generally unused.
|
||||
//perhaps reword to fit in journal better
|
||||
//info += "\n\n" + Messages.get(this, "no_wand");
|
||||
} else {
|
||||
info += "\n\n" + Messages.get(this, "has_wand", Messages.get(wand, "name")) + " " + wand.statsDesc();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
|
@ -680,6 +681,16 @@ public class WndJournal extends WndTabbed {
|
|||
|
||||
this.item = item;
|
||||
this.seen = seen;
|
||||
|
||||
if ( seen && !IDed ){
|
||||
if (item instanceof Ring){
|
||||
((Ring) item).anonymize();
|
||||
} else if (item instanceof Potion){
|
||||
((Potion) item).anonymize();
|
||||
} else if (item instanceof Scroll){
|
||||
((Scroll) item).anonymize();
|
||||
}
|
||||
}
|
||||
|
||||
if (!seen) {
|
||||
icon.copy( new ItemSprite( ItemSpriteSheet.SOMETHING + spriteIndexes[currentItemIdx], null) );
|
||||
|
@ -694,8 +705,13 @@ public class WndJournal extends WndTabbed {
|
|||
|
||||
public boolean onClick( float x, float y ) {
|
||||
if (inside( x, y ) && seen) {
|
||||
GameScene.show(new WndTitledMessage( new Image(icon),
|
||||
Messages.titleCase(item.trueName()), item.desc() ));
|
||||
if (item instanceof ClassArmor){
|
||||
GameScene.show(new WndTitledMessage(new Image(icon),
|
||||
Messages.titleCase(item.trueName()), item.desc()));
|
||||
} else {
|
||||
GameScene.show(new WndTitledMessage(new Image(icon),
|
||||
Messages.titleCase(item.trueName()), item.info()));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user