use of com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ShopRoom method generateItems.
protected static ArrayList<Item> generateItems() {
ArrayList<Item> itemsToSpawn = new ArrayList<>();
switch(Dungeon.depth) {
case 6:
itemsToSpawn.add((Random.Int(2) == 0 ? new Shortsword().identify() : new HandAxe()).identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new FishingSpear().quantity(2) : new Shuriken().quantity(2));
itemsToSpawn.add(new LeatherArmor().identify());
break;
case 11:
itemsToSpawn.add((Random.Int(2) == 0 ? new Sword().identify() : new Mace()).identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new ThrowingSpear().quantity(2) : new Bolas().quantity(2));
itemsToSpawn.add(new MailArmor().identify());
break;
case 16:
itemsToSpawn.add((Random.Int(2) == 0 ? new Longsword().identify() : new BattleAxe()).identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new Javelin().quantity(2) : new Tomahawk().quantity(2));
itemsToSpawn.add(new ScaleArmor().identify());
break;
case 21:
itemsToSpawn.add(Random.Int(2) == 0 ? new Greatsword().identify() : new WarHammer().identify());
itemsToSpawn.add(Random.Int(2) == 0 ? new Trident().quantity(2) : new ThrowingHammer().quantity(2));
itemsToSpawn.add(new PlateArmor().identify());
itemsToSpawn.add(new Torch());
itemsToSpawn.add(new Torch());
itemsToSpawn.add(new Torch());
break;
}
itemsToSpawn.add(TippedDart.randomTipped());
itemsToSpawn.add(new MerchantsBeacon());
itemsToSpawn.add(ChooseBag(Dungeon.hero.belongings));
itemsToSpawn.add(new PotionOfHealing());
for (int i = 0; i < 3; i++) itemsToSpawn.add(Generator.random(Generator.Category.POTION));
itemsToSpawn.add(new ScrollOfIdentify());
itemsToSpawn.add(new ScrollOfRemoveCurse());
itemsToSpawn.add(new ScrollOfMagicMapping());
itemsToSpawn.add(Generator.random(Generator.Category.SCROLL));
for (int i = 0; i < 2; i++) itemsToSpawn.add(Random.Int(2) == 0 ? Generator.random(Generator.Category.POTION) : Generator.random(Generator.Category.SCROLL));
itemsToSpawn.add(new SmallRation());
itemsToSpawn.add(new SmallRation());
itemsToSpawn.add(new Bomb().random());
switch(Random.Int(5)) {
case 1:
itemsToSpawn.add(new Bomb());
break;
case 2:
itemsToSpawn.add(new Bomb().random());
break;
case 3:
case 4:
itemsToSpawn.add(new Honeypot());
break;
}
if (Dungeon.depth == 6) {
itemsToSpawn.add(new Ankh());
itemsToSpawn.add(new Weightstone());
} else {
itemsToSpawn.add(Random.Int(2) == 0 ? new Ankh() : new Weightstone());
}
TimekeepersHourglass hourglass = Dungeon.hero.belongings.getItem(TimekeepersHourglass.class);
if (hourglass != null) {
int bags = 0;
// this way players who get the hourglass late can still max it, usually.
switch(Dungeon.depth) {
case 6:
bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.20f);
break;
case 11:
bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.25f);
break;
case 16:
bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.50f);
break;
case 21:
bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.80f);
break;
}
for (int i = 1; i <= bags; i++) {
itemsToSpawn.add(new TimekeepersHourglass.sandBag());
hourglass.sandBags++;
}
}
Item rare;
switch(Random.Int(10)) {
case 0:
rare = Generator.random(Generator.Category.WAND);
rare.level(0);
break;
case 1:
rare = Generator.random(Generator.Category.RING);
rare.level(0);
break;
case 2:
rare = Generator.random(Generator.Category.ARTIFACT);
break;
default:
rare = new Stylus();
}
rare.cursed = rare.cursedKnown = false;
itemsToSpawn.add(rare);
// hard limit is 63 items + 1 shopkeeper, as shops can't be bigger than 8x8=64 internally
if (itemsToSpawn.size() > 63)
throw new RuntimeException("Shop attempted to carry more than 63 items!");
Random.shuffle(itemsToSpawn);
return itemsToSpawn;
}
use of com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Level method create.
public void create() {
Random.seed(Dungeon.seedCurDepth());
if (!(Dungeon.bossLevel() || Dungeon.depth == 21)) /*final shop floor*/
{
if (Dungeon.isChallenged(Challenges.NO_FOOD)) {
addItemToSpawn(new SmallRation());
} else {
addItemToSpawn(Generator.random(Generator.Category.FOOD));
}
if (Dungeon.isChallenged(Challenges.DARKNESS)) {
addItemToSpawn(new Torch());
}
if (Dungeon.posNeeded()) {
addItemToSpawn(new PotionOfStrength());
Dungeon.LimitedDrops.STRENGTH_POTIONS.count++;
}
if (Dungeon.souNeeded()) {
addItemToSpawn(new ScrollOfUpgrade());
Dungeon.LimitedDrops.UPGRADE_SCROLLS.count++;
}
if (Dungeon.asNeeded()) {
addItemToSpawn(new Stylus());
Dungeon.LimitedDrops.ARCANE_STYLI.count++;
}
DriedRose rose = Dungeon.hero.belongings.getItem(DriedRose.class);
if (rose != null && rose.isIdentified() && !rose.cursed) {
// aim to drop 1 petal every 2 floors
int petalsNeeded = (int) Math.ceil((float) ((Dungeon.depth / 2) - rose.droppedPetals) / 3);
for (int i = 1; i <= petalsNeeded; i++) {
// the player may miss a single petal and still max their rose.
if (rose.droppedPetals < 11) {
addItemToSpawn(new DriedRose.Petal());
rose.droppedPetals++;
}
}
}
if (Dungeon.depth > 1) {
switch(Random.Int(10)) {
case 0:
if (!Dungeon.bossLevel(Dungeon.depth + 1)) {
feeling = Feeling.CHASM;
}
break;
case 1:
feeling = Feeling.WATER;
break;
case 2:
feeling = Feeling.GRASS;
break;
case 3:
feeling = Feeling.DARK;
addItemToSpawn(new Torch());
viewDistance = Math.round(viewDistance / 2f);
break;
}
}
}
do {
width = height = length = 0;
mobs = new HashSet<>();
heaps = new SparseArray<>();
blobs = new HashMap<>();
plants = new SparseArray<>();
traps = new SparseArray<>();
customTiles = new HashSet<>();
customWalls = new HashSet<>();
} while (!build());
buildFlagMaps();
cleanWalls();
createMobs();
createItems();
Random.seed();
}
Aggregations