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

@ -56,6 +56,8 @@ public class Potion extends Item {
"Are you sure you want to throw it? In most cases it makes sense to drink it.";
private static final float TIME_TO_DRINK = 1f;
protected String initials;
private static final Class<?>[] potions = {
PotionOfHealing.class,
@ -269,6 +271,10 @@ public class Potion extends Item {
"This flask contains a swirling " + color + " liquid. " +
"Who knows what it will do when drunk or thrown?";
}
public String initials(){
return isKnown() ? initials : null;
}
@Override
public boolean isIdentified() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,9 @@ public abstract class Scroll extends Item {
public static final String AC_READ = "READ";
protected static final float TIME_TO_READ = 1f;
protected String initials;
private static final Class<?>[] scrolls = {
ScrollOfIdentify.class,
ScrollOfMagicMapping.class,
@ -169,6 +171,10 @@ public abstract class Scroll extends Item {
"This parchment is covered with indecipherable writing, and bears a title " +
"of rune " + rune + ". Who knows what it will do when read aloud?";
}
public String initials(){
return isKnown() ? initials : null;
}
@Override
public boolean isUpgradable() {

View File

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

View File

@ -23,7 +23,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
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.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
@ -33,6 +32,7 @@ public class ScrollOfLullaby extends Scroll {
{
name = "Scroll of Lullaby";
initials = "Lu";
}
@Override

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,6 +31,8 @@ public class ScrollOfUpgrade extends InventoryScroll {
{
name = "Scroll of Upgrade";
initials = "Up";
inventoryTitle = "Select an item to upgrade";
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.keys.Key;
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.melee.MeleeWeapon;
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 UPGRADED = 0x44FF44;
public static final int FADED = 0x999999;
public static final int WARNING = 0xFF8800;
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.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.measure();
if (item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion
|| item instanceof PotionOfStrength || item instanceof PotionOfMight)
bottomRight.hardlight( UPGRADED );
else
bottomRight.hardlight( FADED );
} else {
bottomRight.text( null );
}