v0.7.0: adjusted base identification mechanics for exotics
This commit is contained in:
parent
7e30247c09
commit
e3ec860e18
|
@ -182,6 +182,10 @@ public class ItemStatusHandler<T extends Item> {
|
|||
known.add( (Class<? extends T>)item.getClass() );
|
||||
}
|
||||
|
||||
public void know( Class<?extends T> itemCls ){
|
||||
known.add( itemCls );
|
||||
}
|
||||
|
||||
public HashSet<Class<? extends T>> known() {
|
||||
return known;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
|
@ -168,12 +170,26 @@ public class Potion extends Item {
|
|||
image = handler.image(this);
|
||||
color = handler.label(this);
|
||||
}
|
||||
if (isKnown()){
|
||||
if (mustThrowPots.contains(this.getClass())) {
|
||||
defaultAction = AC_THROW;
|
||||
} else if (canThrowPots.contains(this.getClass())){
|
||||
defaultAction = AC_CHOOSE;
|
||||
}
|
||||
setAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collect( Bag container ) {
|
||||
if (super.collect( container )){
|
||||
setAction();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setAction(){
|
||||
if (isKnown() && mustThrowPots.contains(this.getClass())) {
|
||||
defaultAction = AC_THROW;
|
||||
} else if (isKnown() &&canThrowPots.contains(this.getClass())){
|
||||
defaultAction = AC_CHOOSE;
|
||||
} else {
|
||||
defaultAction = AC_DRINK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,11 +311,10 @@ public class Potion extends Item {
|
|||
if (!isKnown()) {
|
||||
handler.know(this);
|
||||
updateQuickslot();
|
||||
if (mustThrowPots.contains(this.getClass())){
|
||||
defaultAction = AC_THROW;
|
||||
} else if (canThrowPots.contains(this.getClass())){
|
||||
defaultAction = AC_CHOOSE;
|
||||
}
|
||||
Potion p = Dungeon.hero.belongings.getItem(getClass());
|
||||
if (p != null) p.setAction();
|
||||
p = Dungeon.hero.belongings.getItem(ExoticPotion.regToExo.get(getClass()));
|
||||
if (p != null) p.setAction();
|
||||
}
|
||||
|
||||
if (Dungeon.hero.isAlive()) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
|
||||
|
@ -46,17 +47,35 @@ public class ExoticPotion extends Potion {
|
|||
|
||||
@Override
|
||||
public boolean isKnown() {
|
||||
//assume it is IDed as ided potions are needed for alchemy
|
||||
return true;
|
||||
return handler != null && handler.isKnown( exoToReg.get(this.getClass()) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKnown() {
|
||||
if (!isKnown()) {
|
||||
handler.know(exoToReg.get(this.getClass()));
|
||||
updateQuickslot();
|
||||
Potion p = Dungeon.hero.belongings.getItem(getClass());
|
||||
if (p != null) p.setAction();
|
||||
p = Dungeon.hero.belongings.getItem(exoToReg.get(this.getClass()));
|
||||
if (p != null) p.setAction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
if (handler != null && handler.contains(exoToReg.get(this.getClass()))) {
|
||||
image = handler.image(exoToReg.get(this.getClass())) + 16;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Override
|
||||
public int price() {
|
||||
return super.price();
|
||||
}
|
||||
|
||||
public static class PotionToExotic extends Recipe{
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,12 +43,20 @@ public abstract class ExoticScroll extends Scroll {
|
|||
|
||||
@Override
|
||||
public boolean isKnown() {
|
||||
//assume it is IDed as ided scrolls are needed for alchemy
|
||||
return true;
|
||||
return handler != null && handler.isKnown( exoToReg.get(this.getClass()) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKnown() {
|
||||
if (!isKnown()) {
|
||||
handler.know(exoToReg.get(this.getClass()));
|
||||
updateQuickslot();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
if (handler != null && handler.contains(exoToReg.get(this.getClass()))) {
|
||||
image = handler.image(exoToReg.get(this.getClass())) + 16;
|
||||
}
|
||||
|
@ -59,6 +67,12 @@ public abstract class ExoticScroll extends Scroll {
|
|||
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Override
|
||||
public int price() {
|
||||
return super.price();
|
||||
}
|
||||
|
||||
public static class ScrollToExotic extends Recipe {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user