use of com.shatteredpixel.shatteredpixeldungeon.items.Gold in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Bones method get.
public static Item get() {
if (depth == -1) {
try {
Bundle bundle = FileUtils.bundleFromFile(BONES_FILE);
depth = bundle.getInt(LEVEL);
item = (Item) bundle.get(ITEM);
return get();
} catch (IOException e) {
return null;
}
} else {
// heroes who are challenged cannot find bones
if (depth == Dungeon.depth && Dungeon.challenges == 0) {
FileUtils.deleteFile(BONES_FILE);
depth = 0;
// Enforces artifact uniqueness
if (item instanceof Artifact) {
if (Generator.removeArtifact(((Artifact) item).getClass())) {
try {
// generates a new artifact of the same type, always +0
Artifact artifact = (Artifact) item.getClass().newInstance();
artifact.cursed = true;
artifact.cursedKnown = true;
return artifact;
} catch (Exception e) {
ShatteredPixelDungeon.reportException(e);
return new Gold(item.price());
}
} else {
return new Gold(item.price());
}
}
if (item.isUpgradable()) {
item.cursed = true;
item.cursedKnown = true;
if (item.isUpgradable()) {
// caps at +3
if (item.level() > 3) {
item.degrade(item.level() - 3);
}
item.levelKnown = false;
}
}
item.reset();
return item;
} else {
return null;
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Gold in project shattered-pixel-dungeon-gdx by 00-Evan.
the class RingOfWealth method generateRareDrop.
// TODO this is a start, but i'm sure this could be made more interesting...
private static ArrayList<Item> generateRareDrop() {
float roll = Random.Float();
ArrayList<Item> items = new ArrayList<>();
if (roll < 0.6f) {
switch(Random.Int(3)) {
case 0:
items.add(new Gold().random());
break;
case 1:
items.add(Generator.random(Generator.Category.POTION));
break;
case 2:
items.add(Generator.random(Generator.Category.SCROLL));
break;
}
} else if (roll < 0.9f) {
switch(Random.Int(3)) {
case 0:
items.add(Generator.random(Generator.Category.SEED));
items.add(Generator.random(Generator.Category.SEED));
items.add(Generator.random(Generator.Category.SEED));
items.add(Generator.random(Generator.Category.SEED));
items.add(Generator.random(Generator.Category.SEED));
break;
case 1:
items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL));
items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL));
items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL));
break;
case 2:
items.add(new Bomb().random());
items.add(new Honeypot());
break;
}
} else {
Gold g = new Gold();
g.random();
g.quantity(g.quantity() * 5);
items.add(g);
}
return items;
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Gold in project shattered-pixel-dungeon-gdx by 00-Evan.
the class GrassyGraveRoom method paint.
@Override
public void paint(Level level) {
Painter.fill(level, this, Terrain.WALL);
for (Door door : connected.values()) {
door.set(Door.Type.REGULAR);
}
Painter.fill(level, this, 1, Terrain.GRASS);
int w = width() - 2;
int h = height() - 2;
int nGraves = Math.max(w, h) / 2;
int index = Random.Int(nGraves);
int shift = Random.Int(2);
for (int i = 0; i < nGraves; i++) {
int pos = w > h ? left + 1 + shift + i * 2 + (top + 2 + Random.Int(h - 2)) * level.width() : (left + 2 + Random.Int(w - 2)) + (top + 1 + shift + i * 2) * level.width();
level.drop(i == index ? Generator.random() : new Gold().random(), pos).type = Heap.Type.TOMB;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Gold in project shattered-pixel-dungeon-gdx by 00-Evan.
the class MassGraveRoom method paint.
public void paint(Level level) {
Door entrance = entrance();
entrance.set(Door.Type.BARRICADE);
level.addItemToSpawn(new PotionOfLiquidFlame());
Painter.fill(level, this, Terrain.WALL);
Painter.fill(level, this, 1, Terrain.EMPTY_SP);
Bones b = new Bones();
b.setRect(left + 1, top, width() - 2, height() - 1);
level.customTiles.add(b);
// 50% 1 skeleton, 50% 2 skeletons
for (int i = 0; i <= Random.Int(2); i++) {
Skeleton skele = new Skeleton();
int pos;
do {
pos = level.pointToCell(random());
} while (level.map[pos] != Terrain.EMPTY_SP || level.findMob(pos) != null);
skele.pos = pos;
level.mobs.add(skele);
}
ArrayList<Item> items = new ArrayList<>();
// 100% corpse dust, 2x100% 1 coin, 2x30% coins, 1x60% random item, 1x30% armor
items.add(new CorpseDust());
items.add(new Gold(1));
items.add(new Gold(1));
if (Random.Float() <= 0.3f)
items.add(new Gold());
if (Random.Float() <= 0.3f)
items.add(new Gold());
if (Random.Float() <= 0.6f)
items.add(Generator.random());
if (Random.Float() <= 0.3f)
items.add(Generator.randomArmor());
for (Item item : items) {
int pos;
do {
pos = level.pointToCell(random());
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
Heap h = level.drop(item, pos);
h.type = Heap.Type.SKELETON;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Gold in project shattered-pixel-dungeon-gdx by 00-Evan.
the class RatKingRoom method addChest.
private static void addChest(Level level, int pos, int door) {
if (pos == door - 1 || pos == door + 1 || pos == door - level.width() || pos == door + level.width()) {
return;
}
Item prize = new Gold(Random.IntRange(10, 25));
level.drop(prize, pos).type = Heap.Type.CHEST;
}
Aggregations