v0.9.3b: added quick-use actions for some items that needed them
This commit is contained in:
parent
d1d1a2cae9
commit
73ca7b5354
|
@ -90,7 +90,7 @@ public class Item implements Bundlable {
|
||||||
// whether an item can be included in heroes remains
|
// whether an item can be included in heroes remains
|
||||||
public boolean bones = false;
|
public boolean bones = false;
|
||||||
|
|
||||||
private static Comparator<Item> itemComparator = new Comparator<Item>() {
|
public static final Comparator<Item> itemComparator = new Comparator<Item>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare( Item lhs, Item rhs ) {
|
public int compare( Item lhs, Item rhs ) {
|
||||||
return Generator.Category.order( lhs ) - Generator.Category.order( rhs );
|
return Generator.Category.order( lhs ) - Generator.Category.order( rhs );
|
||||||
|
|
|
@ -46,7 +46,9 @@ public class KingsCrown extends Item {
|
||||||
|
|
||||||
{
|
{
|
||||||
image = ItemSpriteSheet.CROWN;
|
image = ItemSpriteSheet.CROWN;
|
||||||
|
|
||||||
|
defaultAction = AC_WEAR;
|
||||||
|
|
||||||
unique = true;
|
unique = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ public class Stylus extends Item {
|
||||||
|
|
||||||
stackable = true;
|
stackable = true;
|
||||||
|
|
||||||
|
defaultAction = AC_INSCRIBE;
|
||||||
|
|
||||||
bones = true;
|
bones = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,14 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class TengusMask extends Item {
|
public class TengusMask extends Item {
|
||||||
|
|
||||||
public static final String AC_WEAR = "WEAR";
|
private static final String AC_WEAR = "WEAR";
|
||||||
|
|
||||||
{
|
{
|
||||||
stackable = false;
|
stackable = false;
|
||||||
image = ItemSpriteSheet.MASK;
|
image = ItemSpriteSheet.MASK;
|
||||||
|
|
||||||
|
defaultAction = AC_WEAR;
|
||||||
|
|
||||||
unique = true;
|
unique = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,11 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndUseItem;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Reflection;
|
import com.watabou.utils.Reflection;
|
||||||
|
|
||||||
|
@ -84,6 +86,13 @@ public class Blandfruit extends Food {
|
||||||
@Override
|
@Override
|
||||||
public void execute( Hero hero, String action ) {
|
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) {
|
if (action.equals( AC_EAT ) && potionAttrib == null) {
|
||||||
|
|
||||||
GLog.w( Messages.get(this, "raw"));
|
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 PotionOfExperience) potionGlow = new ItemSprite.Glowing( 0x404040 );
|
||||||
if (potionAttrib instanceof PotionOfHaste) potionGlow = new ItemSprite.Glowing( 0xCCBB00 );
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ public class Food extends Item {
|
||||||
stackable = true;
|
stackable = true;
|
||||||
image = ItemSpriteSheet.RATION;
|
image = ItemSpriteSheet.RATION;
|
||||||
|
|
||||||
|
defaultAction = AC_EAT;
|
||||||
|
|
||||||
bones = true;
|
bones = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user