v0.7.0: adjusted "owned by X" variable in pots/scrolls, now 'anonymized'

This commit is contained in:
Evan Debenham
2018-09-25 20:19:01 -04:00
parent 68831ed406
commit 8c1fa0b0ff
7 changed files with 31 additions and 16 deletions

View File

@@ -123,7 +123,7 @@ public class UnstableSpellbook extends Artifact {
|| (scroll instanceof ScrollOfTeleportation && Dungeon.bossLevel())
|| (scroll instanceof ScrollOfTransmutation));
scroll.ownedByBook = true;
scroll.anonymize();
curItem = scroll;
curUser = hero;

View File

@@ -137,7 +137,7 @@ public class Blandfruit extends Food {
public Item imbuePotion(Potion potion){
potionAttrib = potion;
potionAttrib.ownedByFruit = true;
potionAttrib.anonymize();
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;

View File

@@ -152,8 +152,6 @@ public class Potion extends Item {
protected static ItemStatusHandler<Potion> handler;
protected String color;
public boolean ownedByFruit = false;
{
stackable = true;
@@ -182,6 +180,15 @@ public class Potion extends Item {
super();
reset();
}
//anonymous potions 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.POTION_HOLDER;
anonymous = true;
}
@Override
public void reset(){
@@ -323,11 +330,11 @@ public class Potion extends Item {
}
public boolean isKnown() {
return handler != null && handler.isKnown( this );
return anonymous || (handler != null && handler.isKnown( this ));
}
public void setKnown() {
if (!ownedByFruit) {
if (!anonymous) {
if (!isKnown()) {
handler.know(this);
updateQuickslot();

View File

@@ -91,7 +91,7 @@ public class ExoticPotion extends Potion {
@Override
public boolean isKnown() {
return handler != null && handler.isKnown( exoToReg.get(this.getClass()) );
return anonymous || (handler != null && handler.isKnown( exoToReg.get(this.getClass()) ));
}
@Override

View File

@@ -88,11 +88,11 @@ public abstract class InventoryScroll extends Scroll {
Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel();
} else if (identifiedByUse && !((Scroll)curItem).ownedByBook) {
} else if (identifiedByUse && !((Scroll)curItem).anonymous) {
((InventoryScroll)curItem).confirmCancelation();
} else if (!((Scroll)curItem).ownedByBook) {
} else if (!((Scroll)curItem).anonymous) {
curItem.collect( curUser.belongings.backpack );

View File

@@ -98,8 +98,6 @@ public abstract class Scroll extends Item {
protected static ItemStatusHandler<Scroll> handler;
protected String rune;
public boolean ownedByBook = false;
{
stackable = true;
@@ -128,7 +126,17 @@ public abstract class Scroll extends Item {
super();
reset();
}
//anonymous scrolls 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.SCROLL_HOLDER;
anonymous = true;
}
@Override
public void reset(){
super.reset();
@@ -181,11 +189,11 @@ public abstract class Scroll extends Item {
}
public boolean isKnown() {
return handler != null && handler.isKnown( this );
return anonymous || (handler != null && handler.isKnown( this ));
}
public void setKnown() {
if (!ownedByBook) {
if (!anonymous) {
if (!isKnown()) {
handler.know(this);
updateQuickslot();

View File

@@ -90,12 +90,12 @@ public abstract class ExoticScroll extends Scroll {
@Override
public boolean isKnown() {
return handler != null && handler.isKnown( exoToReg.get(this.getClass()) );
return anonymous || (handler != null && handler.isKnown( exoToReg.get(this.getClass()) ));
}
@Override
public void setKnown() {
if (!ownedByBook && !isKnown()) {
if (isKnown()) {
handler.know(exoToReg.get(this.getClass()));
updateQuickslot();
}