diff --git a/assets/icons.png b/assets/icons.png index 14e067903a..12cd0c6bf9 100644 Binary files a/assets/icons.png and b/assets/icons.png differ diff --git a/assets/items.png b/assets/items.png index 25d9336338..473d6c77f1 100644 Binary files a/assets/items.png and b/assets/items.png differ diff --git a/src/com/watabou/pixeldungeon/Badges.java b/src/com/watabou/pixeldungeon/Badges.java index ea575b0148..7d2bb15dc1 100644 --- a/src/com/watabou/pixeldungeon/Badges.java +++ b/src/com/watabou/pixeldungeon/Badges.java @@ -34,6 +34,7 @@ import com.watabou.pixeldungeon.actors.mobs.Senior; import com.watabou.pixeldungeon.actors.mobs.Shielded; import com.watabou.pixeldungeon.items.Item; +import com.watabou.pixeldungeon.items.bags.PotionBelt; import com.watabou.pixeldungeon.items.bags.ScrollHolder; import com.watabou.pixeldungeon.items.bags.SeedPouch; import com.watabou.pixeldungeon.items.bags.WandHolster; @@ -70,6 +71,7 @@ public static enum Badge { BAG_BOUGHT_SEED_POUCH, BAG_BOUGHT_SCROLL_HOLDER, BAG_BOUGHT_WAND_HOLSTER, + BAG_BOUGHT_POTION_BELT, ALL_BAGS_BOUGHT( "All bags bought", 23 ), DEATH_FROM_FIRE( "Death from fire", 24 ), DEATH_FROM_POISON( "Death from poison", 25 ), @@ -479,6 +481,8 @@ public static void validateAllBagsBought( Item bag ) { badge = Badge.BAG_BOUGHT_SCROLL_HOLDER; } else if (bag instanceof WandHolster) { badge = Badge.BAG_BOUGHT_WAND_HOLSTER; + } else if (bag instanceof PotionBelt) { + badge = Badge.BAG_BOUGHT_POTION_BELT; } if (badge != null) { @@ -488,7 +492,8 @@ public static void validateAllBagsBought( Item bag ) { if (!local.contains( Badge.ALL_BAGS_BOUGHT ) && local.contains( Badge.BAG_BOUGHT_SCROLL_HOLDER ) && local.contains( Badge.BAG_BOUGHT_SEED_POUCH ) && - local.contains( Badge.BAG_BOUGHT_WAND_HOLSTER )) { + local.contains( Badge.BAG_BOUGHT_WAND_HOLSTER ) && + local.contains( Badge.BAG_BOUGHT_POTION_BELT)) { badge = Badge.ALL_BAGS_BOUGHT; local.add( badge ); diff --git a/src/com/watabou/pixeldungeon/actors/buffs/Frost.java b/src/com/watabou/pixeldungeon/actors/buffs/Frost.java index 18546ce811..5d88f779cc 100644 --- a/src/com/watabou/pixeldungeon/actors/buffs/Frost.java +++ b/src/com/watabou/pixeldungeon/actors/buffs/Frost.java @@ -23,11 +23,14 @@ import com.watabou.pixeldungeon.items.Item; import com.watabou.pixeldungeon.items.food.FrozenCarpaccio; import com.watabou.pixeldungeon.items.food.MysteryMeat; +import com.watabou.pixeldungeon.items.potions.Potion; import com.watabou.pixeldungeon.items.rings.RingOfElements.Resistance; import com.watabou.pixeldungeon.ui.BuffIndicator; +import com.watabou.pixeldungeon.utils.GLog; public class Frost extends FlavourBuff { + private static final String TXT_SHATTERS = "The cold causes %s to shatter!"; private static final float DURATION = 5f; @Override @@ -47,6 +50,11 @@ public boolean attachTo( Char target ) { if (!carpaccio.collect( hero.belongings.backpack )) { Dungeon.level.drop( carpaccio, target.pos ).sprite.drop(); } + } else if(item instanceof Potion) { + + item = item.detach( hero.belongings.backpack ); + GLog.w( TXT_SHATTERS, item.toString() ); + ((Potion) item).shatter( target.pos ); } } diff --git a/src/com/watabou/pixeldungeon/items/bags/PotionBelt.java b/src/com/watabou/pixeldungeon/items/bags/PotionBelt.java new file mode 100644 index 0000000000..c48b98ab99 --- /dev/null +++ b/src/com/watabou/pixeldungeon/items/bags/PotionBelt.java @@ -0,0 +1,32 @@ +package com.watabou.pixeldungeon.items.bags; + +import com.watabou.pixeldungeon.items.Item; +import com.watabou.pixeldungeon.items.potions.Potion; +import com.watabou.pixeldungeon.sprites.ItemSpriteSheet; + +public class PotionBelt extends Bag { + + { + name = "potion belt"; + image = ItemSpriteSheet.BELT; + + size = 12; + } + + @Override + public boolean grab( Item item ) { + return item instanceof Potion; + } + + @Override + public int price() { + return 50; + } + + @Override + public String info() { + return + "This strong leather belt is capable of storing all your potions while protecting them from shattering due to frost."; + } + +} diff --git a/src/com/watabou/pixeldungeon/items/potions/Potion.java b/src/com/watabou/pixeldungeon/items/potions/Potion.java index 07ed50a741..0151d35e68 100644 --- a/src/com/watabou/pixeldungeon/items/potions/Potion.java +++ b/src/com/watabou/pixeldungeon/items/potions/Potion.java @@ -178,6 +178,12 @@ protected void onSelect(int index) { } } + public void shatter( int cell ) { + GLog.i( "The flask shatters and " + color() + " liquid splashes harmlessly" ); + Sample.INSTANCE.play( Assets.SND_SHATTER ); + splash( cell ); + } + protected void drink( Hero hero ) { detach( hero.belongings.backpack ); @@ -212,12 +218,6 @@ protected void apply( Hero hero ) { shatter( hero.pos ); } - protected void shatter( int cell ) { - GLog.i( "The flask shatters and " + color() + " liquid splashes harmlessly" ); - Sample.INSTANCE.play( Assets.SND_SHATTER ); - splash( cell ); - } - public boolean isKnown() { return handler.isKnown( this ); } diff --git a/src/com/watabou/pixeldungeon/items/potions/PotionOfFrost.java b/src/com/watabou/pixeldungeon/items/potions/PotionOfFrost.java index 408b918221..3f5ea21bae 100644 --- a/src/com/watabou/pixeldungeon/items/potions/PotionOfFrost.java +++ b/src/com/watabou/pixeldungeon/items/potions/PotionOfFrost.java @@ -35,7 +35,7 @@ public class PotionOfFrost extends Potion { } @Override - protected void shatter( int cell ) { + public void shatter( int cell ) { PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE ); diff --git a/src/com/watabou/pixeldungeon/items/potions/PotionOfLiquidFlame.java b/src/com/watabou/pixeldungeon/items/potions/PotionOfLiquidFlame.java index f728124592..f214203472 100644 --- a/src/com/watabou/pixeldungeon/items/potions/PotionOfLiquidFlame.java +++ b/src/com/watabou/pixeldungeon/items/potions/PotionOfLiquidFlame.java @@ -30,7 +30,7 @@ public class PotionOfLiquidFlame extends Potion { } @Override - protected void shatter( int cell ) { + public void shatter( int cell ) { setKnown(); diff --git a/src/com/watabou/pixeldungeon/items/potions/PotionOfParalyticGas.java b/src/com/watabou/pixeldungeon/items/potions/PotionOfParalyticGas.java index 7678bd2c7e..76a09472fc 100644 --- a/src/com/watabou/pixeldungeon/items/potions/PotionOfParalyticGas.java +++ b/src/com/watabou/pixeldungeon/items/potions/PotionOfParalyticGas.java @@ -30,7 +30,7 @@ public class PotionOfParalyticGas extends Potion { } @Override - protected void shatter( int cell ) { + public void shatter( int cell ) { setKnown(); diff --git a/src/com/watabou/pixeldungeon/items/potions/PotionOfPurity.java b/src/com/watabou/pixeldungeon/items/potions/PotionOfPurity.java index d0e04ff52f..34d57e89ed 100644 --- a/src/com/watabou/pixeldungeon/items/potions/PotionOfPurity.java +++ b/src/com/watabou/pixeldungeon/items/potions/PotionOfPurity.java @@ -45,7 +45,7 @@ public class PotionOfPurity extends Potion { } @Override - protected void shatter( int cell ) { + public void shatter( int cell ) { PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE ); diff --git a/src/com/watabou/pixeldungeon/items/potions/PotionOfToxicGas.java b/src/com/watabou/pixeldungeon/items/potions/PotionOfToxicGas.java index be8a32cab7..f4cf041283 100644 --- a/src/com/watabou/pixeldungeon/items/potions/PotionOfToxicGas.java +++ b/src/com/watabou/pixeldungeon/items/potions/PotionOfToxicGas.java @@ -31,7 +31,7 @@ public class PotionOfToxicGas extends Potion { } @Override - protected void shatter( int cell ) { + public void shatter( int cell ) { setKnown(); diff --git a/src/com/watabou/pixeldungeon/levels/painters/ShopPainter.java b/src/com/watabou/pixeldungeon/levels/painters/ShopPainter.java index 59b92f40c8..e30adeb3ab 100644 --- a/src/com/watabou/pixeldungeon/levels/painters/ShopPainter.java +++ b/src/com/watabou/pixeldungeon/levels/painters/ShopPainter.java @@ -30,6 +30,7 @@ import com.watabou.pixeldungeon.items.Torch; import com.watabou.pixeldungeon.items.Weightstone; import com.watabou.pixeldungeon.items.armor.*; +import com.watabou.pixeldungeon.items.bags.PotionBelt; import com.watabou.pixeldungeon.items.bags.ScrollHolder; import com.watabou.pixeldungeon.items.bags.SeedPouch; import com.watabou.pixeldungeon.items.bags.WandHolster; @@ -95,21 +96,21 @@ private static Item[] range() { case 6: items.add( (Random.Int( 2 ) == 0 ? new Quarterstaff() : new Spear()).identify() ); items.add( new LeatherArmor().identify() ); - items.add( new SeedPouch() ); + items.add( new PotionBelt() ); items.add( new Weightstone() ); break; case 11: items.add( (Random.Int( 2 ) == 0 ? new Sword() : new Mace()).identify() ); items.add( new MailArmor().identify() ); - items.add( new ScrollHolder() ); + items.add( new SeedPouch() ); items.add( new Weightstone() ); break; case 16: items.add( (Random.Int( 2 ) == 0 ? new Longsword() : new BattleAxe()).identify() ); items.add( new ScaleArmor().identify() ); - items.add( new WandHolster() ); + items.add( new ScrollHolder() ); items.add( new Weightstone() ); break; @@ -125,6 +126,7 @@ private static Item[] range() { items.add( new PlateArmor().identify() ); break; } + items.add( new WandHolster() ); items.add( new Torch() ); items.add( new Torch() ); break; diff --git a/src/com/watabou/pixeldungeon/sprites/ItemSpriteSheet.java b/src/com/watabou/pixeldungeon/sprites/ItemSpriteSheet.java index 713966a7c2..3beb6d06fb 100644 --- a/src/com/watabou/pixeldungeon/sprites/ItemSpriteSheet.java +++ b/src/com/watabou/pixeldungeon/sprites/ItemSpriteSheet.java @@ -157,6 +157,7 @@ public class ItemSpriteSheet { public static final int POUCH = 83; public static final int HOLDER = 104; public static final int HOLSTER = 111; + public static final int BELT = 124; // Misc public static final int ANKH = 1; diff --git a/src/com/watabou/pixeldungeon/ui/Icons.java b/src/com/watabou/pixeldungeon/ui/Icons.java index 40432fa518..ad33c3182c 100644 --- a/src/com/watabou/pixeldungeon/ui/Icons.java +++ b/src/com/watabou/pixeldungeon/ui/Icons.java @@ -44,6 +44,7 @@ public enum Icons { SEED_POUCH, SCROLL_HOLDER, WAND_HOLSTER, + POTIONS_BELT, CHECKED, UNCHECKED, EXIT, @@ -120,6 +121,9 @@ public static Image get( Icons type ) { case WAND_HOLSTER: icon.frame( icon.texture.uvRect( 88, 0, 98, 10 ) ); break; + case POTIONS_BELT: + icon.frame( icon.texture.uvRect( 98, 0, 108, 10 ) ); + break; case CHECKED: icon.frame( icon.texture.uvRect( 54, 12, 66, 24 ) ); break; @@ -127,7 +131,7 @@ public static Image get( Icons type ) { icon.frame( icon.texture.uvRect( 66, 12, 78, 24 ) ); break; case EXIT: - icon.frame( icon.texture.uvRect( 98, 0, 114, 16 ) ); + icon.frame( icon.texture.uvRect( 108, 0, 124, 16 ) ); break; case CHALLENGE_OFF: icon.frame( icon.texture.uvRect( 78, 16, 102, 40 ) ); diff --git a/src/com/watabou/pixeldungeon/windows/WndBag.java b/src/com/watabou/pixeldungeon/windows/WndBag.java index e74d346b28..a9da79930a 100644 --- a/src/com/watabou/pixeldungeon/windows/WndBag.java +++ b/src/com/watabou/pixeldungeon/windows/WndBag.java @@ -32,6 +32,7 @@ import com.watabou.pixeldungeon.items.Item; import com.watabou.pixeldungeon.items.armor.Armor; import com.watabou.pixeldungeon.items.bags.Bag; +import com.watabou.pixeldungeon.items.bags.PotionBelt; import com.watabou.pixeldungeon.items.bags.ScrollHolder; import com.watabou.pixeldungeon.items.bags.SeedPouch; import com.watabou.pixeldungeon.items.bags.WandHolster; @@ -66,7 +67,7 @@ public static enum Mode { protected static final int SLOT_SIZE = 28; protected static final int SLOT_MARGIN = 1; - protected static final int TAB_WIDTH = 30; + protected static final int TAB_WIDTH = 24; protected static final int TITLE_HEIGHT = 12; @@ -112,6 +113,7 @@ public WndBag( Bag bag, Listener listener, Mode mode, String title ) { Belongings stuff = Dungeon.hero.belongings; Bag[] bags = { stuff.backpack, + stuff.getItem( PotionBelt.class ), stuff.getItem( SeedPouch.class ), stuff.getItem( ScrollHolder.class ), stuff.getItem( WandHolster.class )}; @@ -259,6 +261,8 @@ private Image icon() { return Icons.get( Icons.SCROLL_HOLDER ); } else if (bag instanceof WandHolster) { return Icons.get( Icons.WAND_HOLSTER ); + } else if (bag instanceof PotionBelt) { + return Icons.get( Icons.POTIONS_BELT ); } else { return Icons.get( Icons.BACKPACK ); }