v0.7.1: added item stats into the journal
This commit is contained in:
parent
a7f1174bb9
commit
5c77c0feee
|
@ -106,6 +106,15 @@ public class Ring extends KindofMisc {
|
||||||
reset();
|
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() {
|
public void reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
if (handler != null && handler.contains(this)){
|
if (handler != null && handler.contains(this)){
|
||||||
|
@ -136,18 +145,20 @@ public class Ring extends KindofMisc {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isKnown() {
|
public boolean isKnown() {
|
||||||
return handler != null && handler.isKnown( this );
|
return anonymous || (handler != null && handler.isKnown( this ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKnown() {
|
public void setKnown() {
|
||||||
|
if (!anonymous) {
|
||||||
if (!isKnown()) {
|
if (!isKnown()) {
|
||||||
handler.know( this );
|
handler.know(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dungeon.hero.isAlive()) {
|
if (Dungeon.hero.isAlive()) {
|
||||||
Catalog.setSeen(getClass());
|
Catalog.setSeen(getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
|
|
|
@ -266,7 +266,9 @@ public class MagesStaff extends MeleeWeapon {
|
||||||
String info = super.info();
|
String info = super.info();
|
||||||
|
|
||||||
if (wand == null){
|
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 {
|
} else {
|
||||||
info += "\n\n" + Messages.get(this, "has_wand", Messages.get(wand, "name")) + " " + wand.statsDesc();
|
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.SPDSettings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
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.potions.Potion;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||||
|
@ -681,6 +682,16 @@ public class WndJournal extends WndTabbed {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.seen = seen;
|
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) {
|
if (!seen) {
|
||||||
icon.copy( new ItemSprite( ItemSpriteSheet.SOMETHING + spriteIndexes[currentItemIdx], null) );
|
icon.copy( new ItemSprite( ItemSpriteSheet.SOMETHING + spriteIndexes[currentItemIdx], null) );
|
||||||
label.text("???");
|
label.text("???");
|
||||||
|
@ -694,8 +705,13 @@ public class WndJournal extends WndTabbed {
|
||||||
|
|
||||||
public boolean onClick( float x, float y ) {
|
public boolean onClick( float x, float y ) {
|
||||||
if (inside( x, y ) && seen) {
|
if (inside( x, y ) && seen) {
|
||||||
GameScene.show(new WndTitledMessage( new Image(icon),
|
if (item instanceof ClassArmor){
|
||||||
Messages.titleCase(item.trueName()), item.desc() ));
|
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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user