v0.7.0: adjusted "owned by X" variable in pots/scrolls, now 'anonymized'
This commit is contained in:
+1
-1
@@ -123,7 +123,7 @@ public class UnstableSpellbook extends Artifact {
|
|||||||
|| (scroll instanceof ScrollOfTeleportation && Dungeon.bossLevel())
|
|| (scroll instanceof ScrollOfTeleportation && Dungeon.bossLevel())
|
||||||
|| (scroll instanceof ScrollOfTransmutation));
|
|| (scroll instanceof ScrollOfTransmutation));
|
||||||
|
|
||||||
scroll.ownedByBook = true;
|
scroll.anonymize();
|
||||||
curItem = scroll;
|
curItem = scroll;
|
||||||
curUser = hero;
|
curUser = hero;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -137,7 +137,7 @@ public class Blandfruit extends Food {
|
|||||||
public Item imbuePotion(Potion potion){
|
public Item imbuePotion(Potion potion){
|
||||||
|
|
||||||
potionAttrib = potion;
|
potionAttrib = potion;
|
||||||
potionAttrib.ownedByFruit = true;
|
potionAttrib.anonymize();
|
||||||
|
|
||||||
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;
|
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;
|
||||||
|
|
||||||
|
|||||||
+11
-4
@@ -153,8 +153,6 @@ public class Potion extends Item {
|
|||||||
|
|
||||||
protected String color;
|
protected String color;
|
||||||
|
|
||||||
public boolean ownedByFruit = false;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
stackable = true;
|
stackable = true;
|
||||||
defaultAction = AC_DRINK;
|
defaultAction = AC_DRINK;
|
||||||
@@ -183,6 +181,15 @@ public class Potion extends Item {
|
|||||||
reset();
|
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
|
@Override
|
||||||
public void reset(){
|
public void reset(){
|
||||||
super.reset();
|
super.reset();
|
||||||
@@ -323,11 +330,11 @@ public class Potion extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 (!ownedByFruit) {
|
if (!anonymous) {
|
||||||
if (!isKnown()) {
|
if (!isKnown()) {
|
||||||
handler.know(this);
|
handler.know(this);
|
||||||
updateQuickslot();
|
updateQuickslot();
|
||||||
|
|||||||
+1
-1
@@ -91,7 +91,7 @@ public class ExoticPotion extends Potion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isKnown() {
|
public boolean isKnown() {
|
||||||
return handler != null && handler.isKnown( exoToReg.get(this.getClass()) );
|
return anonymous || (handler != null && handler.isKnown( exoToReg.get(this.getClass()) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -88,11 +88,11 @@ public abstract class InventoryScroll extends Scroll {
|
|||||||
Sample.INSTANCE.play( Assets.SND_READ );
|
Sample.INSTANCE.play( Assets.SND_READ );
|
||||||
Invisibility.dispel();
|
Invisibility.dispel();
|
||||||
|
|
||||||
} else if (identifiedByUse && !((Scroll)curItem).ownedByBook) {
|
} else if (identifiedByUse && !((Scroll)curItem).anonymous) {
|
||||||
|
|
||||||
((InventoryScroll)curItem).confirmCancelation();
|
((InventoryScroll)curItem).confirmCancelation();
|
||||||
|
|
||||||
} else if (!((Scroll)curItem).ownedByBook) {
|
} else if (!((Scroll)curItem).anonymous) {
|
||||||
|
|
||||||
curItem.collect( curUser.belongings.backpack );
|
curItem.collect( curUser.belongings.backpack );
|
||||||
|
|
||||||
|
|||||||
+12
-4
@@ -99,8 +99,6 @@ public abstract class Scroll extends Item {
|
|||||||
|
|
||||||
protected String rune;
|
protected String rune;
|
||||||
|
|
||||||
public boolean ownedByBook = false;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
stackable = true;
|
stackable = true;
|
||||||
defaultAction = AC_READ;
|
defaultAction = AC_READ;
|
||||||
@@ -129,6 +127,16 @@ public abstract class Scroll extends Item {
|
|||||||
reset();
|
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
|
@Override
|
||||||
public void reset(){
|
public void reset(){
|
||||||
super.reset();
|
super.reset();
|
||||||
@@ -181,11 +189,11 @@ public abstract class Scroll extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 (!ownedByBook) {
|
if (!anonymous) {
|
||||||
if (!isKnown()) {
|
if (!isKnown()) {
|
||||||
handler.know(this);
|
handler.know(this);
|
||||||
updateQuickslot();
|
updateQuickslot();
|
||||||
|
|||||||
+2
-2
@@ -90,12 +90,12 @@ public abstract class ExoticScroll extends Scroll {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isKnown() {
|
public boolean isKnown() {
|
||||||
return handler != null && handler.isKnown( exoToReg.get(this.getClass()) );
|
return anonymous || (handler != null && handler.isKnown( exoToReg.get(this.getClass()) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setKnown() {
|
public void setKnown() {
|
||||||
if (!ownedByBook && !isKnown()) {
|
if (isKnown()) {
|
||||||
handler.know(exoToReg.get(this.getClass()));
|
handler.know(exoToReg.get(this.getClass()));
|
||||||
updateQuickslot();
|
updateQuickslot();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user