v0.9.3b: added quick-use actions for some items that needed them

This commit is contained in:
Evan Debenham 2021-06-16 20:57:00 -04:00
parent d1d1a2cae9
commit 73ca7b5354
6 changed files with 27 additions and 4 deletions

View File

@ -90,7 +90,7 @@ public class Item implements Bundlable {
// whether an item can be included in heroes remains
public boolean bones = false;
private static Comparator<Item> itemComparator = new Comparator<Item>() {
public static final Comparator<Item> itemComparator = new Comparator<Item>() {
@Override
public int compare( Item lhs, Item rhs ) {
return Generator.Category.order( lhs ) - Generator.Category.order( rhs );

View File

@ -46,7 +46,9 @@ public class KingsCrown extends Item {
{
image = ItemSpriteSheet.CROWN;
defaultAction = AC_WEAR;
unique = true;
}

View File

@ -46,6 +46,8 @@ public class Stylus extends Item {
stackable = true;
defaultAction = AC_INSCRIBE;
bones = true;
}

View File

@ -40,12 +40,14 @@ import java.util.ArrayList;
public class TengusMask extends Item {
public static final String AC_WEAR = "WEAR";
private static final String AC_WEAR = "WEAR";
{
stackable = false;
image = ItemSpriteSheet.MASK;
defaultAction = AC_WEAR;
unique = true;
}

View File

@ -44,9 +44,11 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndUseItem;
import com.watabou.utils.Bundle;
import com.watabou.utils.Reflection;
@ -84,6 +86,13 @@ public class Blandfruit extends Food {
@Override
public void execute( Hero hero, String action ) {
if (action.equals( Potion.AC_CHOOSE )){
GameScene.show(new WndUseItem(null, this) );
return;
}
if (action.equals( AC_EAT ) && potionAttrib == null) {
GLog.w( Messages.get(this, "raw"));
@ -164,6 +173,12 @@ public class Blandfruit extends Food {
if (potionAttrib instanceof PotionOfExperience) potionGlow = new ItemSprite.Glowing( 0x404040 );
if (potionAttrib instanceof PotionOfHaste) potionGlow = new ItemSprite.Glowing( 0xCCBB00 );
potionAttrib.setAction();
defaultAction = potionAttrib.defaultAction;
if (defaultAction.equals(Potion.AC_DRINK)){
defaultAction = AC_EAT;
}
return this;
}

View File

@ -51,6 +51,8 @@ public class Food extends Item {
stackable = true;
image = ItemSpriteSheet.RATION;
defaultAction = AC_EAT;
bones = true;
}