v0.2.4d: added name initials for identified potions and scrolls

This commit is contained in:
Evan Debenham 2015-03-21 15:37:33 -04:00
parent b6a1e3ec9e
commit 394d7a0a73
27 changed files with 59 additions and 3 deletions

View File

@ -57,6 +57,8 @@ public class Potion extends Item {
private static final float TIME_TO_DRINK = 1f; private static final float TIME_TO_DRINK = 1f;
protected String initials;
private static final Class<?>[] potions = { private static final Class<?>[] potions = {
PotionOfHealing.class, PotionOfHealing.class,
PotionOfExperience.class, PotionOfExperience.class,
@ -270,6 +272,10 @@ public class Potion extends Item {
"Who knows what it will do when drunk or thrown?"; "Who knows what it will do when drunk or thrown?";
} }
public String initials(){
return isKnown() ? initials : null;
}
@Override @Override
public boolean isIdentified() { public boolean isIdentified() {
return isKnown(); return isKnown();

View File

@ -23,6 +23,7 @@ public class PotionOfExperience extends Potion {
{ {
name = "Potion of Experience"; name = "Potion of Experience";
initials = "Ex";
bones = true; bones = true;
} }

View File

@ -32,6 +32,7 @@ public class PotionOfFrost extends Potion {
{ {
name = "Potion of Frost"; name = "Potion of Frost";
initials = "Fr";
} }
@Override @Override

View File

@ -31,6 +31,7 @@ public class PotionOfHealing extends Potion {
{ {
name = "Potion of Healing"; name = "Potion of Healing";
initials = "He";
bones = true; bones = true;
} }

View File

@ -32,6 +32,7 @@ public class PotionOfInvisibility extends Potion {
{ {
name = "Potion of Invisibility"; name = "Potion of Invisibility";
initials = "In";
} }
@Override @Override

View File

@ -32,6 +32,7 @@ public class PotionOfLevitation extends Potion {
{ {
name = "Potion of Levitation"; name = "Potion of Levitation";
initials = "Le";
} }
@Override @Override

View File

@ -32,6 +32,7 @@ public class PotionOfLiquidFlame extends Potion {
{ {
name = "Potion of Liquid Flame"; name = "Potion of Liquid Flame";
initials = "LF";
} }
@Override @Override

View File

@ -26,6 +26,7 @@ public class PotionOfMight extends PotionOfStrength {
{ {
name = "Potion of Might"; name = "Potion of Might";
initials = "Mi";
bones = true; bones = true;
} }

View File

@ -27,6 +27,7 @@ public class PotionOfMindVision extends Potion {
{ {
name = "Potion of Mind Vision"; name = "Potion of Mind Vision";
initials = "MV";
} }
@Override @Override

View File

@ -28,6 +28,7 @@ public class PotionOfParalyticGas extends Potion {
{ {
name = "Potion of Paralytic Gas"; name = "Potion of Paralytic Gas";
initials = "PG";
} }
@Override @Override

View File

@ -44,6 +44,7 @@ public class PotionOfPurity extends Potion {
{ {
name = "Potion of Purification"; name = "Potion of Purification";
initials = "Pu";
} }
@Override @Override

View File

@ -26,6 +26,7 @@ public class PotionOfStrength extends Potion {
{ {
name = "Potion of Strength"; name = "Potion of Strength";
initials = "St";
bones = true; bones = true;
} }

View File

@ -20,7 +20,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -29,6 +28,7 @@ public class PotionOfToxicGas extends Potion {
{ {
name = "Potion of Toxic Gas"; name = "Potion of Toxic Gas";
initials = "TG";
} }
@Override @Override

View File

@ -41,6 +41,8 @@ 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;
private static final Class<?>[] scrolls = { private static final Class<?>[] scrolls = {
ScrollOfIdentify.class, ScrollOfIdentify.class,
ScrollOfMagicMapping.class, ScrollOfMagicMapping.class,
@ -170,6 +172,10 @@ public abstract class Scroll extends Item {
"of rune " + rune + ". Who knows what it will do when read aloud?"; "of rune " + rune + ". Who knows what it will do when read aloud?";
} }
public String initials(){
return isKnown() ? initials : null;
}
@Override @Override
public boolean isUpgradable() { public boolean isUpgradable() {
return false; return false;

View File

@ -27,6 +27,8 @@ public class ScrollOfIdentify extends InventoryScroll {
{ {
name = "Scroll of Identify"; name = "Scroll of Identify";
initials = "Id";
inventoryTitle = "Select an item to identify"; inventoryTitle = "Select an item to identify";
mode = WndBag.Mode.UNIDENTIFED; mode = WndBag.Mode.UNIDENTIFED;

View File

@ -23,7 +23,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
@ -33,6 +32,7 @@ public class ScrollOfLullaby extends Scroll {
{ {
name = "Scroll of Lullaby"; name = "Scroll of Lullaby";
initials = "Lu";
} }
@Override @Override

View File

@ -35,6 +35,7 @@ public class ScrollOfMagicMapping extends Scroll {
{ {
name = "Scroll of Magic Mapping"; name = "Scroll of Magic Mapping";
initials = "MM";
} }
@Override @Override

View File

@ -32,6 +32,8 @@ public class ScrollOfMagicalInfusion extends InventoryScroll {
{ {
name = "Scroll of Magical Infusion"; name = "Scroll of Magical Infusion";
initials = "MaI";
inventoryTitle = "Select an item to infuse"; inventoryTitle = "Select an item to infuse";
mode = WndBag.Mode.ENCHANTABLE; mode = WndBag.Mode.ENCHANTABLE;

View File

@ -35,6 +35,7 @@ public class ScrollOfMirrorImage extends Scroll {
{ {
name = "Scroll of Mirror Image"; name = "Scroll of Mirror Image";
initials = "MI";
} }
@Override @Override

View File

@ -36,6 +36,7 @@ public class ScrollOfPsionicBlast extends Scroll {
{ {
name = "Scroll of Psionic Blast"; name = "Scroll of Psionic Blast";
initials = "PB";
bones = true; bones = true;
} }

View File

@ -34,6 +34,7 @@ public class ScrollOfRage extends Scroll {
{ {
name = "Scroll of Rage"; name = "Scroll of Rage";
initials = "Ra";
} }
@Override @Override

View File

@ -29,6 +29,7 @@ public class ScrollOfRecharging extends Scroll {
{ {
name = "Scroll of Recharging"; name = "Scroll of Recharging";
initials = "Re";
} }
@Override @Override

View File

@ -36,6 +36,7 @@ public class ScrollOfRemoveCurse extends Scroll {
{ {
name = "Scroll of Remove Curse"; name = "Scroll of Remove Curse";
initials = "RC";
} }
@Override @Override

View File

@ -35,6 +35,7 @@ public class ScrollOfTeleportation extends Scroll {
{ {
name = "Scroll of Teleportation"; name = "Scroll of Teleportation";
initials = "TP";
} }
@Override @Override

View File

@ -32,6 +32,7 @@ public class ScrollOfTerror extends Scroll {
{ {
name = "Scroll of Terror"; name = "Scroll of Terror";
initials = "Te";
} }
@Override @Override

View File

@ -31,6 +31,8 @@ public class ScrollOfUpgrade extends InventoryScroll {
{ {
name = "Scroll of Upgrade"; name = "Scroll of Upgrade";
initials = "Up";
inventoryTitle = "Select an item to upgrade"; inventoryTitle = "Select an item to upgrade";
mode = WndBag.Mode.UPGRADEABLE; mode = WndBag.Mode.UPGRADEABLE;

View File

@ -22,6 +22,12 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key; import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -35,6 +41,7 @@ public class ItemSlot extends Button {
public static final int DEGRADED = 0xFF4444; public static final int DEGRADED = 0xFF4444;
public static final int UPGRADED = 0x44FF44; public static final int UPGRADED = 0x44FF44;
public static final int FADED = 0x999999;
public static final int WARNING = 0xFF8800; public static final int WARNING = 0xFF8800;
private static final float ENABLED = 1.0f; private static final float ENABLED = 1.0f;
@ -176,6 +183,18 @@ public class ItemSlot extends Button {
bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : TXT_CURSED ); bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : TXT_CURSED );
bottomRight.measure(); bottomRight.measure();
bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED ); 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.measure();
if (item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion
|| item instanceof PotionOfStrength || item instanceof PotionOfMight)
bottomRight.hardlight( UPGRADED );
else
bottomRight.hardlight( FADED );
} else { } else {
bottomRight.text( null ); bottomRight.text( null );
} }