v0.6.4: extended the functionality of the pouch and holster bags

This commit is contained in:
Evan Debenham 2018-03-17 19:57:08 -04:00
parent 5cf58a74c8
commit 57959e3c6d
11 changed files with 115 additions and 69 deletions

View File

@ -29,10 +29,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Senior;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shielded;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -71,6 +71,7 @@ public class Badges {
ALL_POTIONS_IDENTIFIED( 21 ),
ALL_SCROLLS_IDENTIFIED( 22 ),
ALL_ITEMS_IDENTIFIED( 23, true ),
//these names are a bit outdated, but it doesn't really matter.
BAG_BOUGHT_SEED_POUCH,
BAG_BOUGHT_SCROLL_HOLDER,
BAG_BOUGHT_POTION_BANDOLIER,
@ -429,13 +430,13 @@ public class Badges {
public static void validateAllBagsBought( Item bag ) {
Badge badge = null;
if (bag instanceof SeedPouch) {
if (bag instanceof VelvetPouch) {
badge = Badge.BAG_BOUGHT_SEED_POUCH;
} else if (bag instanceof ScrollHolder) {
badge = Badge.BAG_BOUGHT_SCROLL_HOLDER;
} else if (bag instanceof PotionBandolier) {
badge = Badge.BAG_BOUGHT_POTION_BANDOLIER;
} else if (bag instanceof WandHolster) {
} else if (bag instanceof MagicalHolster) {
badge = Badge.BAG_BOUGHT_WAND_HOLSTER;
}

View File

@ -104,10 +104,10 @@ public class Dungeon {
//containers
DEW_VIAL,
SEED_POUCH,
VELVET_POUCH,
SCROLL_HOLDER,
POTION_BANDOLIER,
WAND_HOLSTER;
MAGICAL_HOLSTER;
public int count = 0;
@ -138,6 +138,14 @@ public class Dungeon {
} else {
lim.count = 0;
}
}
//saves prior to 0.6.4
if (bundle.contains("SEED_POUCH")) {
LimitedDrops.VELVET_POUCH.count = bundle.getInt("SEED_POUCH");
}
if (bundle.contains("WAND_HOLSTER")) {
LimitedDrops.MAGICAL_HOLSTER.count = bundle.getInt("WAND_HOLSTER");
}
}
@ -154,10 +162,10 @@ public class Dungeon {
BLANDFRUIT_SEED.count = counts[8];
THIEVES_ARMBAND.count = counts[9];
DEW_VIAL.count = counts[10];
SEED_POUCH.count = counts[11];
VELVET_POUCH.count = counts[11];
SCROLL_HOLDER.count = counts[12];
POTION_BANDOLIER.count = counts[13];
WAND_HOLSTER.count = counts[14];
MAGICAL_HOLSTER.count = counts[14];
GUARD_HP.count = counts[15];
}

View File

@ -141,6 +141,15 @@ public class ShatteredPixelDungeon extends Game {
com.shatteredpixel.shatteredpixeldungeon.levels.traps.CorrosionTrap.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.traps.VenomTrap" );
//v0.6.4
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch.class,
"com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster.class,
"com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster" );
}
@SuppressWarnings("deprecation")

View File

@ -23,9 +23,10 @@ package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class WandHolster extends Bag {
public class MagicalHolster extends Bag {
{
image = ItemSpriteSheet.HOLSTER;
@ -33,11 +34,12 @@ public class WandHolster extends Bag {
size = 12;
}
public static float HOLSTER_SCALE_FACTOR = 0.85f;
public static final float HOLSTER_SCALE_FACTOR = 0.85f;
public static final float HOLSTER_DURABILITY_FACTOR = 1.2f;
@Override
public boolean grab( Item item ) {
return item instanceof Wand;
return item instanceof Wand || item instanceof MissileWeapon;
}
@Override
@ -45,7 +47,11 @@ public class WandHolster extends Bag {
if (super.collect( container )) {
if (owner != null) {
for (Item item : items) {
((Wand)item).charge( owner, HOLSTER_SCALE_FACTOR );
if (item instanceof Wand) {
((Wand) item).charge(owner, HOLSTER_SCALE_FACTOR);
} else if (item instanceof MissileWeapon){
((MissileWeapon) item).holster = true;
}
}
}
return true;
@ -64,7 +70,7 @@ public class WandHolster extends Bag {
@Override
public int price() {
return 50;
return 60;
}
}

View File

@ -22,10 +22,11 @@
package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class SeedPouch extends Bag {
public class VelvetPouch extends Bag {
{
image = ItemSpriteSheet.POUCH;
@ -35,7 +36,7 @@ public class SeedPouch extends Bag {
@Override
public boolean grab( Item item ) {
return item instanceof Plant.Seed;
return item instanceof Plant.Seed || item instanceof Runestone;
}
@Override

View File

@ -36,7 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
@ -111,8 +111,8 @@ public abstract class Wand extends Item {
public boolean collect( Bag container ) {
if (super.collect( container )) {
if (container.owner != null) {
if (container instanceof WandHolster)
charge( container.owner, ((WandHolster) container).HOLSTER_SCALE_FACTOR );
if (container instanceof MagicalHolster)
charge( container.owner, ((MagicalHolster) container).HOLSTER_SCALE_FACTOR );
else
charge( container.owner );
}

View File

@ -30,6 +30,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SnipersMark;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
@ -55,6 +57,8 @@ abstract public class MissileWeapon extends Weapon {
protected static final float MAX_DURABILITY = 100;
protected float durability = MAX_DURABILITY;
public boolean holster;
//used to reduce durability from the source weapon stack, rather than the one being thrown.
protected MissileWeapon parent;
@ -64,7 +68,13 @@ abstract public class MissileWeapon extends Weapon {
actions.remove( AC_EQUIP );
return actions;
}
@Override
public boolean collect(Bag container) {
if (container instanceof MagicalHolster) holster = true;
return super.collect(container);
}
@Override
public int throwPos(Hero user, int dst) {
if (hasEnchant(Projecting.class)
@ -153,9 +163,10 @@ abstract public class MissileWeapon extends Weapon {
}
protected float durabilityPerUse(){
float usage = Dungeon.hero.heroClass == HeroClass.HUNTRESS ?
MAX_DURABILITY/15f:
MAX_DURABILITY/10f;
float usage = MAX_DURABILITY/10f;
if (Dungeon.hero.heroClass == HeroClass.HUNTRESS) usage /= 1.5f;
else if (holster) usage /= MagicalHolster.HOLSTER_DURABILITY_FACTOR;
usage /= RingOfSharpshooting.durabilityMultiplier( Dungeon.hero );

View File

@ -41,10 +41,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
@ -52,6 +52,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.BattleAxe;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greatsword;
@ -64,6 +65,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WarHammer;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Bolas;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.FishingSpear;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Javelin;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingHammer;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tomahawk;
@ -301,41 +303,49 @@ public class ShopRoom extends SpecialRoom {
}
protected static Bag ChooseBag(Belongings pack){
//0=pouch, 1=holder, 2=bandolier, 3=holster
int[] bagItems = new int[4];
int seeds = 0, scrolls = 0, potions = 0, wands = 0;
//count up items in the main bag, for bags which haven't yet been dropped.
//count up items in the main bag
for (Item item : pack.backpack.items) {
if (!Dungeon.LimitedDrops.SEED_POUCH.dropped() && item instanceof Plant.Seed)
seeds++;
else if (!Dungeon.LimitedDrops.SCROLL_HOLDER.dropped() && item instanceof Scroll)
scrolls++;
else if (!Dungeon.LimitedDrops.POTION_BANDOLIER.dropped() && item instanceof Potion)
potions++;
else if (!Dungeon.LimitedDrops.WAND_HOLSTER.dropped() && item instanceof Wand)
wands++;
if (item instanceof Plant.Seed || item instanceof Runestone) bagItems[0]++;
if (item instanceof Scroll) bagItems[1]++;
if (item instanceof Potion) bagItems[2]++;
if (item instanceof Wand || item instanceof MissileWeapon) bagItems[3]++;
}
//disqualify bags that have already been dropped
if (Dungeon.LimitedDrops.VELVET_POUCH.dropped()) bagItems[0] = -1;
if (Dungeon.LimitedDrops.SCROLL_HOLDER.dropped()) bagItems[1] = -1;
if (Dungeon.LimitedDrops.POTION_BANDOLIER.dropped()) bagItems[2] = -1;
if (Dungeon.LimitedDrops.MAGICAL_HOLSTER.dropped()) bagItems[3] = -1;
//find the best bag to drop. This does give a preference to later bags, if counts are equal
int bestBagIdx = 0;
for (int i = 1; i <= 3; i++){
if (bagItems[bestBagIdx] <= bagItems[i]){
bestBagIdx = i;
}
}
//drop it, or return nothing if no bag works
if (bagItems[bestBagIdx] == -1) return null;
switch (bestBagIdx){
case 0: default:
Dungeon.LimitedDrops.VELVET_POUCH.drop();
return new VelvetPouch();
case 1:
Dungeon.LimitedDrops.SCROLL_HOLDER.drop();
return new ScrollHolder();
case 2:
Dungeon.LimitedDrops.POTION_BANDOLIER.drop();
return new PotionBandolier();
case 3:
Dungeon.LimitedDrops.MAGICAL_HOLSTER.drop();
return new MagicalHolster();
}
//then pick whichever valid bag has the most items available to put into it.
//note that the order here gives a perference if counts are otherwise equal
if (seeds >= scrolls && seeds >= potions && seeds >= wands && !Dungeon.LimitedDrops.SEED_POUCH.dropped()) {
Dungeon.LimitedDrops.SEED_POUCH.drop();
return new SeedPouch();
} else if (scrolls >= potions && scrolls >= wands && !Dungeon.LimitedDrops.SCROLL_HOLDER.dropped()) {
Dungeon.LimitedDrops.SCROLL_HOLDER.drop();
return new ScrollHolder();
} else if (potions >= wands && !Dungeon.LimitedDrops.POTION_BANDOLIER.dropped()) {
Dungeon.LimitedDrops.POTION_BANDOLIER.drop();
return new PotionBandolier();
} else if (!Dungeon.LimitedDrops.WAND_HOLSTER.dropped()) {
Dungeon.LimitedDrops.WAND_HOLSTER.drop();
return new WandHolster();
}
return null;
}
}

View File

@ -40,10 +40,10 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Honeypot;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
@ -877,13 +877,13 @@ public class GameScene extends PixelScene {
WndBag wnd =
mode == Mode.SEED ?
WndBag.getBag( SeedPouch.class, listener, mode, title ) :
WndBag.getBag( VelvetPouch.class, listener, mode, title ) :
mode == Mode.SCROLL ?
WndBag.getBag( ScrollHolder.class, listener, mode, title ) :
mode == Mode.POTION ?
WndBag.getBag( PotionBandolier.class, listener, mode, title ) :
mode == Mode.WAND ?
WndBag.getBag( WandHolster.class, listener, mode, title ) :
WndBag.getBag( MagicalHolster.class, listener, mode, title ) :
WndBag.lastBag( listener, mode, title );
if (scene != null) scene.addToFront( wnd );

View File

@ -31,10 +31,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
@ -134,10 +134,10 @@ public class WndBag extends WndTabbed {
Belongings stuff = Dungeon.hero.belongings;
Bag[] bags = {
stuff.backpack,
stuff.getItem( SeedPouch.class ),
stuff.getItem( VelvetPouch.class ),
stuff.getItem( ScrollHolder.class ),
stuff.getItem( PotionBandolier.class ),
stuff.getItem( WandHolster.class )};
stuff.getItem( MagicalHolster.class )};
for (Bag b : bags) {
if (b != null) {
@ -301,11 +301,11 @@ public class WndBag extends WndTabbed {
}
private Image icon() {
if (bag instanceof SeedPouch) {
if (bag instanceof VelvetPouch) {
return Icons.get( Icons.SEED_POUCH );
} else if (bag instanceof ScrollHolder) {
return Icons.get( Icons.SCROLL_HOLDER );
} else if (bag instanceof WandHolster) {
} else if (bag instanceof MagicalHolster) {
return Icons.get( Icons.WAND_HOLSTER );
} else if (bag instanceof PotionBandolier) {
return Icons.get( Icons.POTION_BANDOLIER );

View File

@ -325,11 +325,11 @@ items.bags.potionbandolier.desc=This thick bandolier fits around your chest like
items.bags.scrollholder.name=scroll holder
items.bags.scrollholder.desc=This tubular container looks like it would hold an astronomer's charts, but your scrolls will fit just as well.\n\nThe holder doesn't look very flammable, so your scrolls should be safe from fire inside it.
items.bags.seedpouch.name=seed pouch
items.bags.seedpouch.desc=This small velvet pouch allows you to store any number of seeds in it. Very convenient.
items.bags.velvetpouch.name=velvet pouch
items.bags.velvetpouch.desc=This small velvet pouch can store many small items in it, such as seeds and runestones.
items.bags.wandholster.name=wand holster
items.bags.wandholster.desc=This slim holster is made from some exotic animal hide, and is designed to compactly hold many wands.\n\nThe holster projects a magical field around itself, causing all wands inside to recharge slightly faster.
items.bags.magicalholster.name=magical holster
items.bags.magicalholster.desc=This slim holster is made from some exotic animal hide, and posses powerful magic which lets it store a massive amount of ranged weapons.\n\nYou can simply reach into the bag and will always grab the item you were looking for.\n\nDue to the holster's magic, wands will charge slightly faster and missile weapons will last slightly longer inside of it.