v0.8.1: refactored consumable icons into generic item icons (2/2)

This commit is contained in:
Evan Debenham 2020-05-11 21:43:43 -04:00
parent e205e7e13e
commit 2dfa01e1ad
59 changed files with 358 additions and 280 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -167,7 +167,8 @@ public class Assets {
public static class Sprites {
public static final String ITEMS = "sprites/items.png";
public static final String ITEMS = "sprites/items.png";
public static final String ITEM_ICONS = "sprites/item_icons.png";
public static final String WARRIOR = "sprites/warrior.png";
public static final String MAGE = "sprites/mage.png";

View File

@ -67,6 +67,7 @@ public class Item implements Bundlable {
protected String name = Messages.get(this, "name");
public int image = 0;
public int icon = -1; //used as an identifier for items with randomized images
public boolean stackable = false;
protected int quantity = 1;

View File

@ -87,8 +87,6 @@ public class Potion extends Item {
private static final float TIME_TO_DRINK = 1f;
protected Integer initials;
private static final Class<?>[] potions = {
PotionOfHealing.class,
PotionOfExperience.class,
@ -383,10 +381,6 @@ public class Potion extends Item {
return isKnown() ? desc() : Messages.get(this, "unknown_desc");
}
public Integer initials(){
return isKnown() ? initials : null;
}
@Override
public boolean isIdentified() {
return isKnown();

View File

@ -22,11 +22,12 @@
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfExperience extends Potion {
{
initials = 0;
icon = ItemSpriteSheet.Icons.POTION_EXP;
bones = true;
}

View File

@ -26,13 +26,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class PotionOfFrost extends Potion {
{
initials = 1;
icon = ItemSpriteSheet.Icons.POTION_FROST;
}
@Override

View File

@ -25,12 +25,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfHaste extends Potion {
{
initials = 2;
icon = ItemSpriteSheet.Icons.POTION_HASTE;
}
@Override

View File

@ -35,12 +35,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfHealing extends Potion {
{
initials = 3;
icon = ItemSpriteSheet.Icons.POTION_HEALING;
bones = true;
}

View File

@ -26,13 +26,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class PotionOfInvisibility extends Potion {
{
initials = 4;
icon = ItemSpriteSheet.Icons.POTION_INVIS;
}
@Override

View File

@ -30,13 +30,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Levitation;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class PotionOfLevitation extends Potion {
{
initials = 5;
icon = ItemSpriteSheet.Icons.POTION_LEVITATE;
}
@Override

View File

@ -26,13 +26,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class PotionOfLiquidFlame extends Potion {
{
initials = 6;
icon = ItemSpriteSheet.Icons.POTION_LIQFLAME;
}
@Override

View File

@ -26,12 +26,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfMindVision extends Potion {
{
initials = 7;
icon = ItemSpriteSheet.Icons.POTION_MINDVIS;
}
@Override

View File

@ -26,12 +26,13 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class PotionOfParalyticGas extends Potion {
{
initials = 8;
icon = ItemSpriteSheet.Icons.POTION_PARAGAS;
}
@Override

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@ -44,7 +45,7 @@ public class PotionOfPurity extends Potion {
private static ArrayList<Class> affectedBlobs;
{
initials = 9;
icon = ItemSpriteSheet.Icons.POTION_PURITY;
affectedBlobs = new ArrayList<>(new BlobImmunity().immunities());
}

View File

@ -25,12 +25,13 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfStrength extends Potion {
{
initials = 10;
icon = ItemSpriteSheet.Icons.POTION_STRENGTH;
}
@Override

View File

@ -26,12 +26,13 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class PotionOfToxicGas extends Potion {
{
initials = 11;
icon = ItemSpriteSheet.Icons.POTION_TOXICGAS;
}
@Override

View File

@ -24,11 +24,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AdrenalineSurge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfAdrenalineSurge extends ExoticPotion {
{
initials = 10;
icon = ItemSpriteSheet.Icons.POTION_ARENSURGE;
}
@Override

View File

@ -29,12 +29,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class PotionOfCleansing extends ExoticPotion {
{
initials = 9;
icon = ItemSpriteSheet.Icons.POTION_CLEANSE;
}
@Override

View File

@ -26,12 +26,13 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class PotionOfCorrosiveGas extends ExoticPotion {
{
initials = 11;
icon = ItemSpriteSheet.Icons.POTION_CORROGAS;
}
@Override

View File

@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
import com.watabou.utils.PathFinder;
@ -45,7 +46,7 @@ import java.util.HashSet;
public class PotionOfDragonsBreath extends ExoticPotion {
{
initials = 6;
icon = ItemSpriteSheet.Icons.POTION_DRGBREATH;
}
//a lot of this is copy-paste from wand of fireblast

View File

@ -24,11 +24,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfEarthenArmor extends ExoticPotion {
{
initials = 8;
icon = ItemSpriteSheet.Icons.POTION_EARTHARMR;
}
@Override

View File

@ -24,11 +24,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfHolyFuror extends ExoticPotion {
{
initials = 0;
icon = ItemSpriteSheet.Icons.POTION_HOLYFUROR;
}
@Override

View File

@ -25,11 +25,12 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSight;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfMagicalSight extends ExoticPotion {
{
initials = 7;
icon = ItemSpriteSheet.Icons.POTION_MAGISIGHT;
}
@Override

View File

@ -24,11 +24,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfShielding extends ExoticPotion {
{
initials = 3;
icon = ItemSpriteSheet.Icons.POTION_SHIELDING;
}
@Override

View File

@ -26,12 +26,13 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SmokeScreen;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class PotionOfShroudingFog extends ExoticPotion {
{
initials = 4;
icon = ItemSpriteSheet.Icons.POTION_SHROUDFOG;
}
@Override

View File

@ -29,13 +29,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class PotionOfSnapFreeze extends ExoticPotion {
{
initials = 1;
icon = ItemSpriteSheet.Icons.POTION_SNAPFREEZ;
}
@Override

View File

@ -24,11 +24,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Stamina;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfStamina extends ExoticPotion {
{
initials = 2;
icon = ItemSpriteSheet.Icons.POTION_STAMINA;
}
@Override

View File

@ -26,12 +26,13 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StormCloud;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class PotionOfStormClouds extends ExoticPotion {
{
initials = 5;
icon = ItemSpriteSheet.Icons.POTION_STRMCLOUD;
}
@Override

View File

@ -62,8 +62,6 @@ public abstract class Scroll extends Item {
protected static final float TIME_TO_READ = 1f;
protected Integer initials;
private static final Class<?>[] scrolls = {
ScrollOfIdentify.class,
ScrollOfMagicMapping.class,
@ -236,10 +234,6 @@ public abstract class Scroll extends Item {
Messages.get(this, "unknown_desc");
}
public Integer initials(){
return isKnown() ? initials : null;
}
@Override
public boolean isUpgradable() {
return false;

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.effects.Identification;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample;
@ -36,7 +37,7 @@ import java.util.ArrayList;
public class ScrollOfIdentify extends InventoryScroll {
{
initials = 0;
icon = ItemSpriteSheet.Icons.SCROLL_IDENTIFY;
mode = WndBag.Mode.UNIDENTIFED;
bones = true;

View File

@ -29,13 +29,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class ScrollOfLullaby extends Scroll {
{
initials = 1;
icon = ItemSpriteSheet.Icons.SCROLL_LULLABY;
}
@Override

View File

@ -33,13 +33,14 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class ScrollOfMagicMapping extends Scroll {
{
initials = 2;
icon = ItemSpriteSheet.Icons.SCROLL_MAGICMAP;
}
@Override

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
@ -40,7 +41,7 @@ import java.util.ArrayList;
public class ScrollOfMirrorImage extends Scroll {
{
initials = 3;
icon = ItemSpriteSheet.Icons.SCROLL_MIRRORIMG;
}
private static final int NIMAGES = 2;

View File

@ -32,13 +32,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class ScrollOfRage extends Scroll {
{
initials = 5;
icon = ItemSpriteSheet.Icons.SCROLL_RAGE;
}
@Override

View File

@ -30,13 +30,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EnergyParticle;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class ScrollOfRecharging extends Scroll {
{
initials = 6;
icon = ItemSpriteSheet.Icons.SCROLL_RECHARGE;
}
@Override

View File

@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample;
@ -40,7 +41,7 @@ import com.watabou.noosa.audio.Sample;
public class ScrollOfRemoveCurse extends InventoryScroll {
{
initials = 7;
icon = ItemSpriteSheet.Icons.SCROLL_REMCURSE;
mode = WndBag.Mode.UNCURSABLE;
}
@ -117,6 +118,8 @@ public class ScrollOfRemoveCurse extends InventoryScroll {
return ((Weapon)item).hasCurseEnchant();
} else if (item instanceof Armor){
return ((Armor)item).hasCurseGlyph();
} else if (item.level() != item.buffedLvl()) {
return true;
} else {
return false;
}

View File

@ -29,12 +29,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ScrollOfRetribution extends Scroll {
{
initials = 4;
icon = ItemSpriteSheet.Icons.SCROLL_RETRIB;
}
@Override

View File

@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@ -50,7 +51,7 @@ import java.util.ArrayList;
public class ScrollOfTeleportation extends Scroll {
{
initials = 8;
icon = ItemSpriteSheet.Icons.SCROLL_TELEPORT;
}
@Override

View File

@ -31,13 +31,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class ScrollOfTerror extends Scroll {
{
initials = 9;
icon = ItemSpriteSheet.Icons.SCROLL_TERROR;
}
@Override

View File

@ -44,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.utils.Random;
@ -52,7 +53,7 @@ import com.watabou.utils.Reflection;
public class ScrollOfTransmutation extends InventoryScroll {
{
initials = 10;
icon = ItemSpriteSheet.Icons.SCROLL_TRANSMUTE;
mode = WndBag.Mode.TRANMSUTABLE;
bones = true;

View File

@ -34,13 +34,14 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class ScrollOfUpgrade extends InventoryScroll {
{
initials = 11;
icon = ItemSpriteSheet.Icons.SCROLL_UPGRADE;
mode = WndBag.Mode.UPGRADEABLE;
}

View File

@ -28,12 +28,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ScrollOfAffection extends ExoticScroll {
{
initials = 1;
icon = ItemSpriteSheet.Icons.SCROLL_AFFECTION;
}
@Override

View File

@ -25,11 +25,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class ScrollOfAntiMagic extends ExoticScroll {
{
initials = 7;
icon = ItemSpriteSheet.Icons.SCROLL_ANTIMAGIC;
}
@Override

View File

@ -30,12 +30,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ScrollOfConfusion extends ExoticScroll {
{
initials = 5;
icon = ItemSpriteSheet.Icons.SCROLL_CONFUSION;
}
@Override

View File

@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -46,7 +47,7 @@ import java.util.HashSet;
public class ScrollOfDivination extends ExoticScroll {
{
initials = 0;
icon = ItemSpriteSheet.Icons.SCROLL_DIVINATE;
}
@Override

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
@ -38,7 +39,7 @@ import com.watabou.noosa.audio.Sample;
public class ScrollOfEnchantment extends ExoticScroll {
{
initials = 11;
icon = ItemSpriteSheet.Icons.SCROLL_ENCHANT;
}
@Override

View File

@ -26,12 +26,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Foresight;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ScrollOfForesight extends ExoticScroll {
{
initials = 2;
icon = ItemSpriteSheet.Icons.SCROLL_FORESIGHT;
}
@Override

View File

@ -27,12 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ScrollOfMysticalEnergy extends ExoticScroll {
{
initials = 6;
icon = ItemSpriteSheet.Icons.SCROLL_MYSTENRG;
}
@Override

View File

@ -28,13 +28,14 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportat
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Game;
public class ScrollOfPassage extends ExoticScroll {
{
initials = 8;
icon = ItemSpriteSheet.Icons.SCROLL_ENCHANT;
}
@Override

View File

@ -29,12 +29,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ScrollOfPetrification extends ExoticScroll {
{
initials = 9;
icon = ItemSpriteSheet.Icons.SCROLL_PETRIF;
}
@Override

View File

@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -38,7 +39,7 @@ import com.watabou.utils.Random;
public class ScrollOfPolymorph extends ExoticScroll {
{
initials = 10;
icon = ItemSpriteSheet.Icons.SCROLL_POLYMORPH;
}
@Override

View File

@ -29,12 +29,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PrismaticGuard;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.PrismaticImage;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ScrollOfPrismaticImage extends ExoticScroll {
{
initials = 3;
icon = ItemSpriteSheet.Icons.SCROLL_PRISIMG;
}
@Override

View File

@ -30,13 +30,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class ScrollOfPsionicBlast extends ExoticScroll {
{
initials = 4;
icon = ItemSpriteSheet.Icons.SCROLL_PSIBLAST;
}
@Override

View File

@ -23,34 +23,11 @@ package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.effects.Identification;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHaste;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -65,6 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.Image;
import com.watabou.utils.Reflection;
import java.util.HashSet;
@ -83,38 +61,7 @@ public class StoneOfIntuition extends InventoryStone {
}
//in order of their consumable icon
public static Class[] potions = new Class[]{
PotionOfExperience.class,
PotionOfFrost.class,
PotionOfHaste.class,
PotionOfHealing.class,
PotionOfInvisibility.class,
PotionOfLevitation.class,
PotionOfLiquidFlame.class,
PotionOfMindVision.class,
PotionOfParalyticGas.class,
PotionOfPurity.class,
PotionOfStrength.class,
PotionOfToxicGas.class
};
public static Class[] scrolls = new Class[]{
ScrollOfIdentify.class,
ScrollOfLullaby.class,
ScrollOfMagicMapping.class,
ScrollOfMirrorImage.class,
ScrollOfRetribution.class,
ScrollOfRage.class,
ScrollOfRecharging.class,
ScrollOfRemoveCurse.class,
ScrollOfTeleportation.class,
ScrollOfTerror.class,
ScrollOfTransmutation.class,
ScrollOfUpgrade.class
};
static Class curGuess = null;
private static Class curGuess = null;
public class WndGuess extends Window {
@ -163,17 +110,15 @@ public class StoneOfIntuition extends InventoryStone {
int placed = 0;
HashSet<Class<?extends Item>> unIDed = new HashSet<>();
final Class[] all;
final Class<?extends Item>[] all;
final int row;
if (item.isIdentified()){
hide();
return;
} else if (item instanceof Potion){
unIDed.addAll(Potion.getUnknown());
all = potions.clone();
all = (Class<? extends Item>[]) Generator.Category.POTION.classes.clone();
if (item instanceof ExoticPotion){
row = 8;
for (int i = 0; i < all.length; i++){
all[i] = ExoticPotion.regToExo.get(all[i]);
}
@ -182,24 +127,19 @@ public class StoneOfIntuition extends InventoryStone {
exoUID.add(ExoticPotion.regToExo.get(i));
}
unIDed = exoUID;
} else {
row = 0;
}
} else if (item instanceof Scroll){
unIDed.addAll(Scroll.getUnknown());
all = scrolls.clone();
if (item instanceof ExoticScroll){
row = 24;
for (int i = 0; i < all.length; i++){
all = (Class<? extends Item>[]) Generator.Category.SCROLL.classes.clone();
if (item instanceof ExoticScroll) {
for (int i = 0; i < all.length; i++) {
all[i] = ExoticScroll.regToExo.get(all[i]);
}
HashSet<Class<?extends Item>> exoUID = new HashSet<>();
for (Class<?extends Item> i : unIDed){
HashSet<Class<? extends Item>> exoUID = new HashSet<>();
for (Class<? extends Item> i : unIDed) {
exoUID.add(ExoticScroll.regToExo.get(i));
}
unIDed = exoUID;
} else {
row = 16;
}
} else {
hide();
@ -231,7 +171,8 @@ public class StoneOfIntuition extends InventoryStone {
super.onClick();
}
};
Image im = new Image(Assets.Interfaces.CONS_ICONS, 7*i, row, 7, 8);
Image im = new Image(Assets.Sprites.ITEM_ICONS);
im.frame(ItemSpriteSheet.Icons.film.get(Reflection.newInstance(all[i]).icon));
im.scale.set(2f);
btn.icon(im);
btn.setRect(left + placed*BTN_SIZE, top, BTN_SIZE, BTN_SIZE);

View File

@ -27,14 +27,21 @@ import com.watabou.noosa.TextureFilm;
public class ItemSpriteSheet {
private static final int WIDTH = 16;
public static final int SIZE = 16;
public static TextureFilm film = new TextureFilm( Assets.Sprites.ITEMS, 16, 16 );
public static TextureFilm film = new TextureFilm( Assets.Sprites.ITEMS, SIZE, SIZE );
private static int xy(int x, int y){
x -= 1; y -= 1;
return x + WIDTH*y;
}
private static void assignItemRect( int item, int width, int height ){
int x = (item % WIDTH) * SIZE;
int y = (item / WIDTH) * SIZE;
film.add( item, x, y, x+width, y+height);
}
private static final int PLACEHOLDERS = xy(1, 1); //16 slots
//SOMETHING is the default item sprite at position 0. May show up ingame if there are bugs.
public static final int SOMETHING = PLACEHOLDERS+0;
@ -672,11 +679,145 @@ public class ItemSpriteSheet {
//16 free slots
//for smaller 8x8 icons that often accompany an item sprite
public static class Icons {
private static final int WIDTH = 16;
public static final int SIZE = 8;
public static TextureFilm film = new TextureFilm( Assets.Sprites.ITEM_ICONS, SIZE, SIZE );
private static int xy(int x, int y){
x -= 1; y -= 1;
return x + WIDTH*y;
}
private static void assignIconRect( int item, int width, int height ){
int x = (item % WIDTH) * SIZE;
int y = (item / WIDTH) * SIZE;
film.add( item, x, y, x+width, y+height);
}
private static final int RINGS = xy(1, 1); //16 slots
//16 free slots
private static final int SCROLLS = xy(1, 3); //16 slots
public static final int SCROLL_UPGRADE = SCROLLS+0;
public static final int SCROLL_IDENTIFY = SCROLLS+1;
public static final int SCROLL_REMCURSE = SCROLLS+2;
public static final int SCROLL_MIRRORIMG= SCROLLS+3;
public static final int SCROLL_RECHARGE = SCROLLS+4;
public static final int SCROLL_TELEPORT = SCROLLS+5;
public static final int SCROLL_LULLABY = SCROLLS+6;
public static final int SCROLL_MAGICMAP = SCROLLS+7;
public static final int SCROLL_RAGE = SCROLLS+8;
public static final int SCROLL_RETRIB = SCROLLS+9;
public static final int SCROLL_TERROR = SCROLLS+10;
public static final int SCROLL_TRANSMUTE= SCROLLS+11;
static {
assignIconRect( SCROLL_UPGRADE, 7, 7 );
assignIconRect( SCROLL_IDENTIFY, 4, 7 );
assignIconRect( SCROLL_REMCURSE, 7, 7 );
assignIconRect( SCROLL_MIRRORIMG, 7, 5 );
assignIconRect( SCROLL_RECHARGE, 7, 5 );
assignIconRect( SCROLL_TELEPORT, 7, 7 );
assignIconRect( SCROLL_LULLABY, 4, 5 );
assignIconRect( SCROLL_MAGICMAP, 7, 7 );
assignIconRect( SCROLL_RAGE, 5, 5 );
assignIconRect( SCROLL_RETRIB, 5, 6 );
assignIconRect( SCROLL_TERROR, 5, 7 );
assignIconRect( SCROLL_TRANSMUTE, 7, 7 );
}
private static final int EXOTIC_SCROLLS = xy(1, 4); //16 slots
public static final int SCROLL_ENCHANT = EXOTIC_SCROLLS+0;
public static final int SCROLL_DIVINATE = EXOTIC_SCROLLS+1;
public static final int SCROLL_ANTIMAGIC= EXOTIC_SCROLLS+2;
public static final int SCROLL_PRISIMG = EXOTIC_SCROLLS+3;
public static final int SCROLL_MYSTENRG = EXOTIC_SCROLLS+4;
public static final int SCROLL_PASSAGE = EXOTIC_SCROLLS+5;
public static final int SCROLL_AFFECTION= EXOTIC_SCROLLS+6;
public static final int SCROLL_FORESIGHT= EXOTIC_SCROLLS+7;
public static final int SCROLL_CONFUSION= EXOTIC_SCROLLS+8;
public static final int SCROLL_PSIBLAST = EXOTIC_SCROLLS+9;
public static final int SCROLL_PETRIF = EXOTIC_SCROLLS+10;
public static final int SCROLL_POLYMORPH= EXOTIC_SCROLLS+11;
static {
assignIconRect( SCROLL_ENCHANT, 7, 7 );
assignIconRect( SCROLL_DIVINATE, 7, 7 );
assignIconRect( SCROLL_ANTIMAGIC, 7, 7 );
assignIconRect( SCROLL_PRISIMG, 5, 7 );
assignIconRect( SCROLL_MYSTENRG, 7, 5 );
assignIconRect( SCROLL_PASSAGE, 5, 7 );
assignIconRect( SCROLL_AFFECTION, 7, 6 );
assignIconRect( SCROLL_FORESIGHT, 7, 5 );
assignIconRect( SCROLL_CONFUSION, 4, 7 );
assignIconRect( SCROLL_PSIBLAST, 5, 6 );
assignIconRect( SCROLL_PETRIF, 7, 5 );
assignIconRect( SCROLL_POLYMORPH, 7, 6 );
}
//16 free slots
private static final int POTIONS = xy(1, 6); //16 slots
public static final int POTION_STRENGTH = POTIONS+0;
public static final int POTION_HEALING = POTIONS+1;
public static final int POTION_MINDVIS = POTIONS+2;
public static final int POTION_FROST = POTIONS+3;
public static final int POTION_LIQFLAME = POTIONS+4;
public static final int POTION_TOXICGAS = POTIONS+5;
public static final int POTION_HASTE = POTIONS+6;
public static final int POTION_INVIS = POTIONS+7;
public static final int POTION_LEVITATE = POTIONS+8;
public static final int POTION_PARAGAS = POTIONS+9;
public static final int POTION_PURITY = POTIONS+10;
public static final int POTION_EXP = POTIONS+11;
static {
assignIconRect( POTION_STRENGTH, 7, 7 );
assignIconRect( POTION_HEALING, 6, 7 );
assignIconRect( POTION_MINDVIS, 7, 5 );
assignIconRect( POTION_FROST, 5, 7 );
assignIconRect( POTION_LIQFLAME, 5, 7 );
assignIconRect( POTION_TOXICGAS, 7, 7 );
assignIconRect( POTION_HASTE, 6, 6 );
assignIconRect( POTION_INVIS, 5, 7 );
assignIconRect( POTION_LEVITATE, 5, 5 );
assignIconRect( POTION_PARAGAS, 7, 7 );
assignIconRect( POTION_PURITY, 5, 5 );
assignIconRect( POTION_EXP, 5, 5 );
}
private static final int EXOTIC_POTIONS = xy(1, 7); //16 slots
public static final int POTION_ARENSURGE= EXOTIC_POTIONS+0;
public static final int POTION_SHIELDING= EXOTIC_POTIONS+1;
public static final int POTION_MAGISIGHT= EXOTIC_POTIONS+2;
public static final int POTION_SNAPFREEZ= EXOTIC_POTIONS+3;
public static final int POTION_DRGBREATH= EXOTIC_POTIONS+4;
public static final int POTION_CORROGAS = EXOTIC_POTIONS+5;
public static final int POTION_STAMINA = EXOTIC_POTIONS+6;
public static final int POTION_SHROUDFOG= EXOTIC_POTIONS+7;
public static final int POTION_STRMCLOUD= EXOTIC_POTIONS+8;
public static final int POTION_EARTHARMR= EXOTIC_POTIONS+9;
public static final int POTION_CLEANSE = EXOTIC_POTIONS+10;
public static final int POTION_HOLYFUROR= EXOTIC_POTIONS+11;
static {
assignIconRect( POTION_ARENSURGE, 7, 7);
assignIconRect( POTION_SHIELDING, 6, 7);
assignIconRect( POTION_MAGISIGHT, 7, 5);
assignIconRect( POTION_SNAPFREEZ, 5, 7);
assignIconRect( POTION_DRGBREATH, 5, 7);
assignIconRect( POTION_CORROGAS, 7, 7);
assignIconRect( POTION_STAMINA, 6, 6);
assignIconRect( POTION_SHROUDFOG, 5, 7);
assignIconRect( POTION_STRMCLOUD, 5, 5);
assignIconRect( POTION_EARTHARMR, 7, 7);
assignIconRect( POTION_CLEANSE, 5, 5);
assignIconRect( POTION_HOLYFUROR, 5, 5);
}
//16 free slots
private static void assignItemRect( int item, int width, int height){
int x = (item % WIDTH) * WIDTH;
int y = (item / WIDTH) * WIDTH;
film.add( item, x, y, x+width, y+height);
}
}

View File

@ -25,14 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
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.exotic.ExoticPotion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
@ -52,20 +45,17 @@ public class ItemSlot extends Button {
private static final float ENABLED = 1.0f;
private static final float DISABLED = 0.3f;
protected ItemSprite icon;
protected ItemSprite sprite;
protected Item item;
protected BitmapText topLeft;
protected BitmapText topRight;
protected BitmapText bottomRight;
protected Image bottomRightIcon;
protected boolean iconVisible = true;
protected BitmapText status;
protected BitmapText extra;
protected Image itemIcon;
protected BitmapText level;
private static final String TXT_STRENGTH = ":%d";
private static final String TXT_TYPICAL_STR = "%d?";
private static final String TXT_KEY_DEPTH = "\u007F%d";
private static final String TXT_LEVEL = "%+d";
private static final String TXT_CURSED = "";//"-";
// Special "virtual items"
public static final Item CHEST = new Item() {
@ -89,7 +79,7 @@ public class ItemSlot extends Button {
public ItemSlot() {
super();
icon.visible(false);
sprite.visible(false);
enable(false);
}
@ -103,63 +93,64 @@ public class ItemSlot extends Button {
super.createChildren();
icon = new ItemSprite();
add( icon );
sprite = new ItemSprite();
add(sprite);
topLeft = new BitmapText( PixelScene.pixelFont);
add( topLeft );
status = new BitmapText( PixelScene.pixelFont);
add(status);
topRight = new BitmapText( PixelScene.pixelFont);
add( topRight );
extra = new BitmapText( PixelScene.pixelFont);
add(extra);
bottomRight = new BitmapText( PixelScene.pixelFont);
add( bottomRight );
level = new BitmapText( PixelScene.pixelFont);
add(level);
}
@Override
protected void layout() {
super.layout();
icon.x = x + (width - icon.width) / 2f;
icon.y = y + (height - icon.height) / 2f;
PixelScene.align(icon);
sprite.x = x + (width - sprite.width) / 2f;
sprite.y = y + (height - sprite.height) / 2f;
PixelScene.align(sprite);
if (topLeft != null) {
topLeft.measure();
if (topLeft.width > width){
topLeft.scale.set(PixelScene.align(0.8f));
if (status != null) {
status.measure();
if (status.width > width){
status.scale.set(PixelScene.align(0.8f));
} else {
topLeft.scale.set(1f);
status.scale.set(1f);
}
topLeft.x = x;
topLeft.y = y;
PixelScene.align(topLeft);
status.x = x;
status.y = y;
PixelScene.align(status);
}
if (topRight != null) {
topRight.x = x + (width - topRight.width());
topRight.y = y;
PixelScene.align(topRight);
if (extra != null) {
extra.x = x + (width - extra.width());
extra.y = y;
PixelScene.align(extra);
}
if (bottomRight != null) {
bottomRight.x = x + (width - bottomRight.width());
bottomRight.y = y + (height - bottomRight.height());
PixelScene.align(bottomRight);
if (itemIcon != null){
itemIcon.x = x + width - (ItemSpriteSheet.Icons.SIZE + itemIcon.width())/2f;
itemIcon.y = y + (ItemSpriteSheet.Icons.SIZE - itemIcon.height)/2f;
PixelScene.align(itemIcon);
}
if (bottomRightIcon != null) {
bottomRightIcon.x = x + (width - bottomRightIcon.width()) -1;
bottomRightIcon.y = y + (height - bottomRightIcon.height());
PixelScene.align(bottomRightIcon);
if (level != null) {
level.x = x + (width - level.width());
level.y = y + (height - level.baseLine() - 1);
PixelScene.align(level);
}
}
public void item( Item item ) {
if (this.item == item) {
if (item != null) {
icon.frame(item.image());
icon.glow(item.glowing());
sprite.frame(item.image());
sprite.glow(item.glowing());
}
updateText();
return;
@ -170,112 +161,79 @@ public class ItemSlot extends Button {
if (item == null) {
enable(false);
icon.visible(false);
sprite.visible(false);
updateText();
} else {
enable(true);
icon.visible(true);
sprite.visible(true);
icon.view( item );
sprite.view( item );
updateText();
}
}
private void updateText(){
if (bottomRightIcon != null){
remove(bottomRightIcon);
bottomRightIcon = null;
if (itemIcon != null){
remove(itemIcon);
itemIcon = null;
}
if (item == null){
topLeft.visible = topRight.visible = bottomRight.visible = false;
status.visible = extra.visible = level.visible = false;
return;
} else {
topLeft.visible = topRight.visible = bottomRight.visible = true;
status.visible = extra.visible = level.visible = true;
}
topLeft.text( item.status() );
status.text( item.status() );
boolean isArmor = item instanceof Armor;
boolean isWeapon = item instanceof Weapon;
if (isArmor || isWeapon) {
if (item.icon != -1 && item.isIdentified()){
extra.text( null );
if (item.levelKnown || (isWeapon && !(item instanceof MeleeWeapon))) {
itemIcon = new Image(Assets.Sprites.ITEM_ICONS);
itemIcon.frame(ItemSpriteSheet.Icons.film.get(item.icon));
add(itemIcon);
int str = isArmor ? ((Armor)item).STRReq() : ((Weapon)item).STRReq();
topRight.text( Messages.format( TXT_STRENGTH, str ) );
} else if (item instanceof Weapon || item instanceof Armor) {
if (item.levelKnown){
int str = item instanceof Weapon ? ((Weapon)item).STRReq() : ((Armor)item).STRReq();
extra.text( Messages.format( TXT_STRENGTH, str ) );
if (str > Dungeon.hero.STR()) {
topRight.hardlight( DEGRADED );
extra.hardlight( DEGRADED );
} else {
topRight.resetColor();
extra.resetColor();
}
} else {
topRight.text( Messages.format( TXT_TYPICAL_STR, isArmor ?
((Armor)item).STRReq(0) :
((Weapon)item).STRReq(0) ) );
topRight.hardlight( WARNING );
int str = item instanceof Weapon ? ((Weapon)item).STRReq(0) : ((Armor)item).STRReq(0);
extra.text( Messages.format( TXT_TYPICAL_STR, str ) );
extra.hardlight( WARNING );
}
topRight.measure();
extra.measure();
} else if (item instanceof Key && !(item instanceof SkeletonKey)) {
topRight.text(Messages.format(TXT_KEY_DEPTH, ((Key) item).depth));
topRight.measure();
} else {
topRight.text( null );
extra.text( null );
}
int level = item.visiblyUpgraded();
int trueLvl = item.visiblyUpgraded();
int buffedLvl = item.buffedVisiblyUpgraded();
if (buffedLvl != 0) {
bottomRight.text( Messages.format( TXT_LEVEL, buffedLvl ) );
bottomRight.measure();
if (level == buffedLvl || buffedLvl <= 0) {
bottomRight.hardlight(buffedLvl > 0 ? UPGRADED : DEGRADED);
if (trueLvl != 0 && buffedLvl != 0) {
level.text( Messages.format( TXT_LEVEL, buffedLvl ) );
level.measure();
if (trueLvl == buffedLvl || buffedLvl <= 0) {
level.hardlight(buffedLvl > 0 ? UPGRADED : DEGRADED);
} else {
bottomRight.hardlight(buffedLvl > level ? ENHANCED : WARNING);
level.hardlight(buffedLvl > trueLvl ? ENHANCED : WARNING);
}
} else if (item instanceof Scroll || item instanceof Potion) {
bottomRight.text( null );
Integer iconInt;
if (item instanceof Scroll){
iconInt = ((Scroll) item).initials();
} else {
iconInt = ((Potion) item).initials();
}
if (iconInt != null && iconVisible) {
bottomRightIcon = new Image(Assets.Interfaces.CONS_ICONS);
int left = iconInt*7;
int top;
if (item instanceof Potion){
if (item instanceof ExoticPotion){
top = 8;
} else {
top = 0;
}
} else {
if (item instanceof ExoticScroll){
top = 24;
} else {
top = 16;
}
}
bottomRightIcon.frame(left, top, 7, 8);
add(bottomRightIcon);
}
} else {
bottomRight.text( null );
level.text( null );
}
layout();
@ -286,22 +244,20 @@ public class ItemSlot extends Button {
active = value;
float alpha = value ? ENABLED : DISABLED;
icon.alpha( alpha );
topLeft.alpha( alpha );
topRight.alpha( alpha );
bottomRight.alpha( alpha );
if (bottomRightIcon != null) bottomRightIcon.alpha( alpha );
sprite.alpha( alpha );
status.alpha( alpha );
extra.alpha( alpha );
level.alpha( alpha );
if (itemIcon != null) itemIcon.alpha( alpha );
}
public void showParams( boolean TL, boolean TR, boolean BR ) {
if (TL) add( topLeft );
else remove( topLeft );
public void showExtraInfo( boolean show ){
if (TR) add( topRight );
else remove( topRight );
if (show){
add(extra);
} else {
remove(extra);
}
if (BR) add( bottomRight );
else remove( bottomRight );
iconVisible = BR;
}
}

View File

@ -59,7 +59,7 @@ public class LootIndicator extends Tag {
return SPDAction.TAG_LOOT;
}
};
slot.showParams( true, false, false );
slot.showExtraInfo( false );
add( slot );
}
@ -67,7 +67,7 @@ public class LootIndicator extends Tag {
protected void layout() {
super.layout();
slot.setRect( x + 2, y + 3, width - 2, height - 6 );
slot.setRect( x + 2, y + 3, width - 3, height - 6 );
}
@Override

View File

@ -114,10 +114,10 @@ public class QuickRecipe extends Component {
}
if (quantity < in.quantity()) {
curr.icon.alpha(0.3f);
curr.sprite.alpha(0.3f);
hasInputs = false;
}
curr.showParams(true, false, true);
curr.showExtraInfo(false);
add(curr);
this.inputs.add(curr);
}
@ -147,9 +147,9 @@ public class QuickRecipe extends Component {
}
};
if (!hasInputs){
this.output.icon.alpha(0.3f);
this.output.sprite.alpha(0.3f);
}
this.output.showParams(true, false, true);
this.output.showExtraInfo(false);
add(this.output);
layout();

View File

@ -105,14 +105,14 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
}
@Override
protected void onPointerDown() {
icon.lightness( 0.7f );
sprite.lightness( 0.7f );
}
@Override
protected void onPointerUp() {
icon.resetColor();
sprite.resetColor();
}
};
slot.showParams( true, false, true );
slot.showExtraInfo( false );
add( slot );
crossB = Icons.TARGET.get();
@ -212,7 +212,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
sprite.parent.addToFront( crossM );
crossM.point(sprite.center(crossM));
crossB.point(slot.icon.center(crossB));
crossB.point(slot.sprite.center(crossB));
crossB.visible = true;
} else {