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_LARGE = "large_buffs.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 FONT1X = "font1x.png";

View File

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

View File

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

View File

@ -32,6 +32,10 @@ import com.watabou.utils.PathFinder;
public class PotionOfFrost extends Potion {
private static final int DISTANCE = 2;
{
initials = 1;
}
@Override
public void shatter( int cell ) {

View File

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

View File

@ -33,7 +33,11 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfInvisibility extends Potion {
private static final float ALPHA = 0.4f;
{
initials = 3;
}
@Override
public void apply( Hero hero ) {
setKnown();

View File

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

View File

@ -32,7 +32,11 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfLiquidFlame extends Potion {
{
initials = 5;
}
@Override
public void shatter( int cell ) {

View File

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

View File

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

View File

@ -28,7 +28,11 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfParalyticGas extends Potion {
{
initials = 8;
}
@Override
public void shatter( int cell ) {

View File

@ -43,7 +43,11 @@ import com.watabou.utils.PathFinder;
public class PotionOfPurity extends Potion {
private static final int DISTANCE = 5;
{
initials = 9;
}
@Override
public void shatter( int cell ) {

View File

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

View File

@ -29,6 +29,10 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfToxicGas extends Potion {
{
initials = 11;
}
@Override
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 String initials = Messages.get(this, "initials");
protected int initials;
private static final Class<?>[] scrolls = {
ScrollOfIdentify.class,
@ -181,7 +181,7 @@ public abstract class Scroll extends Item {
Messages.get(this, "unknown_desc", rune());
}
public String initials(){
public Integer initials(){
return isKnown() ? initials : null;
}

View File

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

View File

@ -33,7 +33,11 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfLullaby extends Scroll {
{
initials = 1;
}
@Override
protected void doRead() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,11 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfRecharging extends Scroll {
public static final float BUFF_DURATION = 30f;
{
initials = 7;
}
@Override
protected void doRead() {

View File

@ -33,7 +33,11 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class ScrollOfRemoveCurse extends Scroll {
{
initials = 8;
}
@Override
protected void doRead() {

View File

@ -32,7 +32,11 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.tweeners.AlphaTweener;
public class ScrollOfTeleportation extends Scroll {
{
initials = 9;
}
@Override
protected void doRead() {

View File

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

View File

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

View File

@ -20,6 +20,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
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.utils.Utils;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Image;
import com.watabou.noosa.ui.Button;
public class ItemSlot extends Button {
@ -54,6 +56,7 @@ public class ItemSlot extends Button {
protected BitmapText topLeft;
protected BitmapText topRight;
protected BitmapText bottomRight;
protected Image bottomRightIcon;
private static final String TXT_STRENGTH = ":%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.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 ) {
@ -189,16 +197,21 @@ public class ItemSlot extends Button {
bottomRight.measure();
bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED );
} else if (item instanceof Scroll || item instanceof Potion) {
if (item instanceof Scroll) bottomRight.text(((Scroll) item).initials());
else bottomRight.text(((Potion) item).initials());
bottomRight.text( null );
bottomRight.measure();
if (item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion
|| item instanceof PotionOfStrength || item instanceof PotionOfMight)
bottomRight.hardlight( UPGRADED );
else
bottomRight.hardlight( FADED );
Integer iconInt;
if (item instanceof Scroll){
iconInt = ((Scroll) item).initials();
} else {
iconInt = ((Potion) item).initials();
}
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 {
bottomRight.text( null );
@ -217,6 +230,7 @@ public class ItemSlot extends Button {
topLeft.alpha( alpha );
topRight.alpha( alpha );
bottomRight.alpha( alpha );
if (bottomRightIcon != null) bottomRightIcon.alpha( alpha );
}
public void showParams( boolean TL, boolean TR, boolean BR ) {