v0.3.4: changed potion/scroll initials into icons

This commit is contained in:
Evan Debenham 2016-01-08 01:52:56 -05:00 committed by Evan Debenham
parent ff31a1f303
commit b29d71d2d8
29 changed files with 116 additions and 24 deletions

BIN
assets/consumable_icons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1020 B

View File

@ -118,6 +118,7 @@ public class Assets {
public static final String BUFFS_SMALL = "buffs.png"; public static final String BUFFS_SMALL = "buffs.png";
public static final String BUFFS_LARGE = "large_buffs.png"; public static final String BUFFS_LARGE = "large_buffs.png";
public static final String SPELL_ICONS = "spell_icons.png"; public static final String SPELL_ICONS = "spell_icons.png";
public static final String CONS_ICONS = "consumable_icons.png";
public static final String PIXELFONT = "pixel_font.png"; public static final String PIXELFONT = "pixel_font.png";
public static final String FONT1X = "font1x.png"; public static final String FONT1X = "font1x.png";

View File

@ -52,7 +52,7 @@ public class Potion extends Item {
private static final float TIME_TO_DRINK = 1f; private static final float TIME_TO_DRINK = 1f;
protected String initials = Messages.get(this, "initials"); protected Integer initials;
private static final Class<?>[] potions = { private static final Class<?>[] potions = {
PotionOfHealing.class, PotionOfHealing.class,
@ -270,7 +270,7 @@ public class Potion extends Item {
Messages.get(Potion.class, "unknown_desc", color()); Messages.get(Potion.class, "unknown_desc", color());
} }
public String initials(){ public Integer initials(){
return isKnown() ? initials : null; return isKnown() ? initials : null;
} }

View File

@ -25,6 +25,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
public class PotionOfExperience extends Potion { public class PotionOfExperience extends Potion {
{ {
initials = 0;
bones = true; bones = true;
} }

View File

@ -33,6 +33,10 @@ public class PotionOfFrost extends Potion {
private static final int DISTANCE = 2; private static final int DISTANCE = 2;
{
initials = 1;
}
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {

View File

@ -34,6 +34,8 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfHealing extends Potion { public class PotionOfHealing extends Potion {
{ {
initials = 2;
bones = true; bones = true;
} }

View File

@ -34,6 +34,10 @@ public class PotionOfInvisibility extends Potion {
private static final float ALPHA = 0.4f; private static final float ALPHA = 0.4f;
{
initials = 3;
}
@Override @Override
public void apply( Hero hero ) { public void apply( Hero hero ) {
setKnown(); setKnown();

View File

@ -34,6 +34,10 @@ import com.watabou.noosa.audio.Sample;
public class PotionOfLevitation extends Potion { public class PotionOfLevitation extends Potion {
{
initials = 4;
}
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {

View File

@ -33,6 +33,10 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfLiquidFlame extends Potion { public class PotionOfLiquidFlame extends Potion {
{
initials = 5;
}
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {

View File

@ -29,6 +29,8 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfMight extends Potion { public class PotionOfMight extends Potion {
{ {
initials = 6;
bones = true; bones = true;
} }

View File

@ -29,6 +29,10 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfMindVision extends Potion { public class PotionOfMindVision extends Potion {
{
initials = 7;
}
@Override @Override
public void apply( Hero hero ) { public void apply( Hero hero ) {
setKnown(); setKnown();

View File

@ -29,6 +29,10 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfParalyticGas extends Potion { public class PotionOfParalyticGas extends Potion {
{
initials = 8;
}
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {

View File

@ -44,6 +44,10 @@ public class PotionOfPurity extends Potion {
private static final int DISTANCE = 5; private static final int DISTANCE = 5;
{
initials = 9;
}
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {

View File

@ -29,6 +29,8 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfStrength extends Potion { public class PotionOfStrength extends Potion {
{ {
initials = 10;
bones = true; bones = true;
} }

View File

@ -29,6 +29,10 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfToxicGas extends Potion { public class PotionOfToxicGas extends Potion {
{
initials = 11;
}
@Override @Override
public void shatter( int cell ) { public void shatter( int cell ) {

View File

@ -41,7 +41,7 @@ public abstract class Scroll extends Item {
protected static final float TIME_TO_READ = 1f; protected static final float TIME_TO_READ = 1f;
protected String initials = Messages.get(this, "initials"); protected int initials;
private static final Class<?>[] scrolls = { private static final Class<?>[] scrolls = {
ScrollOfIdentify.class, ScrollOfIdentify.class,
@ -181,7 +181,7 @@ public abstract class Scroll extends Item {
Messages.get(this, "unknown_desc", rune()); Messages.get(this, "unknown_desc", rune());
} }
public String initials(){ public Integer initials(){
return isKnown() ? initials : null; return isKnown() ? initials : null;
} }

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class ScrollOfIdentify extends InventoryScroll { public class ScrollOfIdentify extends InventoryScroll {
{ {
initials = 0;
mode = WndBag.Mode.UNIDENTIFED; mode = WndBag.Mode.UNIDENTIFED;
bones = true; bones = true;

View File

@ -34,6 +34,10 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfLullaby extends Scroll { public class ScrollOfLullaby extends Scroll {
{
initials = 1;
}
@Override @Override
protected void doRead() { protected void doRead() {

View File

@ -35,6 +35,10 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfMagicMapping extends Scroll { public class ScrollOfMagicMapping extends Scroll {
{
initials = 3;
}
@Override @Override
protected void doRead() { protected void doRead() {

View File

@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class ScrollOfMagicalInfusion extends InventoryScroll { public class ScrollOfMagicalInfusion extends InventoryScroll {
{ {
initials = 2;
mode = WndBag.Mode.ENCHANTABLE; mode = WndBag.Mode.ENCHANTABLE;
bones = true; bones = true;

View File

@ -33,6 +33,10 @@ import com.watabou.utils.Random;
public class ScrollOfMirrorImage extends Scroll { public class ScrollOfMirrorImage extends Scroll {
{
initials = 4;
}
private static final int NIMAGES = 3; private static final int NIMAGES = 3;
@Override @Override

View File

@ -39,6 +39,8 @@ import com.watabou.utils.Random;
public class ScrollOfPsionicBlast extends Scroll { public class ScrollOfPsionicBlast extends Scroll {
{ {
initials = 5;
bones = true; bones = true;
} }

View File

@ -36,6 +36,10 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfRage extends Scroll { public class ScrollOfRage extends Scroll {
{
initials = 6;
}
@Override @Override
protected void doRead() { protected void doRead() {

View File

@ -35,6 +35,10 @@ public class ScrollOfRecharging extends Scroll {
public static final float BUFF_DURATION = 30f; public static final float BUFF_DURATION = 30f;
{
initials = 7;
}
@Override @Override
protected void doRead() { protected void doRead() {

View File

@ -34,6 +34,10 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfRemoveCurse extends Scroll { public class ScrollOfRemoveCurse extends Scroll {
{
initials = 8;
}
@Override @Override
protected void doRead() { protected void doRead() {

View File

@ -33,6 +33,10 @@ import com.watabou.noosa.tweeners.AlphaTweener;
public class ScrollOfTeleportation extends Scroll { public class ScrollOfTeleportation extends Scroll {
{
initials = 9;
}
@Override @Override
protected void doRead() { protected void doRead() {

View File

@ -34,6 +34,10 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfTerror extends Scroll { public class ScrollOfTerror extends Scroll {
{
initials = 10;
}
@Override @Override
protected void doRead() { protected void doRead() {

View File

@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class ScrollOfUpgrade extends InventoryScroll { public class ScrollOfUpgrade extends InventoryScroll {
{ {
initials = 11;
mode = WndBag.Mode.UPGRADEABLE; mode = WndBag.Mode.UPGRADEABLE;
bones = true; bones = true;

View File

@ -20,6 +20,7 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.ui; package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
@ -38,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapText; import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Image;
import com.watabou.noosa.ui.Button; import com.watabou.noosa.ui.Button;
public class ItemSlot extends Button { public class ItemSlot extends Button {
@ -54,6 +56,7 @@ public class ItemSlot extends Button {
protected BitmapText topLeft; protected BitmapText topLeft;
protected BitmapText topRight; protected BitmapText topRight;
protected BitmapText bottomRight; protected BitmapText bottomRight;
protected Image bottomRightIcon;
private static final String TXT_STRENGTH = ":%d"; private static final String TXT_STRENGTH = ":%d";
private static final String TXT_TYPICAL_STR = "%d?"; private static final String TXT_TYPICAL_STR = "%d?";
@ -130,6 +133,11 @@ public class ItemSlot extends Button {
bottomRight.x = x + (width - bottomRight.width()); bottomRight.x = x + (width - bottomRight.width());
bottomRight.y = y + (height - bottomRight.height()); bottomRight.y = y + (height - bottomRight.height());
} }
if (bottomRightIcon != null) {
bottomRightIcon.x = x + (width - bottomRightIcon.width()) -1;
bottomRightIcon.y = y + (height - bottomRightIcon.height());
}
} }
public void item( Item item ) { public void item( Item item ) {
@ -189,16 +197,21 @@ public class ItemSlot extends Button {
bottomRight.measure(); bottomRight.measure();
bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED ); bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED );
} else if (item instanceof Scroll || item instanceof Potion) { } else if (item instanceof Scroll || item instanceof Potion) {
if (item instanceof Scroll) bottomRight.text(((Scroll) item).initials()); bottomRight.text( null );
else bottomRight.text(((Potion) item).initials());
bottomRight.measure(); Integer iconInt;
if (item instanceof Scroll){
if (item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion iconInt = ((Scroll) item).initials();
|| item instanceof PotionOfStrength || item instanceof PotionOfMight) } else {
bottomRight.hardlight( UPGRADED ); iconInt = ((Potion) item).initials();
else }
bottomRight.hardlight( FADED ); if (iconInt != null) {
bottomRightIcon = new Image(Assets.CONS_ICONS);
int left = iconInt*7;
int top = item instanceof Potion ? 0 : 8;
bottomRightIcon.frame(left, top, 7, 8);
add(bottomRightIcon);
}
} else { } else {
bottomRight.text( null ); bottomRight.text( null );
@ -217,6 +230,7 @@ public class ItemSlot extends Button {
topLeft.alpha( alpha ); topLeft.alpha( alpha );
topRight.alpha( alpha ); topRight.alpha( alpha );
bottomRight.alpha( alpha ); bottomRight.alpha( alpha );
if (bottomRightIcon != null) bottomRightIcon.alpha( alpha );
} }
public void showParams( boolean TL, boolean TR, boolean BR ) { public void showParams( boolean TL, boolean TR, boolean BR ) {