use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class TeleportationTrap method activate.
@Override
public void activate() {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
Char ch = Actor.findChar(pos);
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch);
} else if (ch != null) {
int count = 10;
int pos;
do {
pos = Dungeon.level.randomRespawnCell();
if (count-- <= 0) {
break;
}
} while (pos == -1);
if (pos == -1 || Dungeon.bossLevel()) {
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
} else {
ch.pos = pos;
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
((Mob) ch).state = ((Mob) ch).WANDERING;
}
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
int cell = Dungeon.level.randomRespawnCell();
Item item = heap.pickUp();
if (cell != -1) {
Dungeon.level.drop(item, cell);
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class StudyRoom method paint.
@Override
public void paint(Level level) {
Painter.fill(level, this, Terrain.WALL);
Painter.fill(level, this, 1, Terrain.BOOKSHELF);
Painter.fill(level, this, 2, Terrain.EMPTY_SP);
for (Door door : connected.values()) {
Painter.drawInside(level, this, door, 2, Terrain.EMPTY_SP);
door.set(Door.Type.REGULAR);
}
// TODO add support for giant size as well
if (sizeCat == SizeCategory.LARGE) {
int pillarW = (width() - 7) / 2;
int pillarH = (height() - 7) / 2;
Painter.fill(level, left + 3, top + 3, pillarW, 1, Terrain.BOOKSHELF);
Painter.fill(level, left + 3, top + 3, 1, pillarH, Terrain.BOOKSHELF);
Painter.fill(level, left + 3, bottom - 2 - 1, pillarW, 1, Terrain.BOOKSHELF);
Painter.fill(level, left + 3, bottom - 2 - pillarH, 1, pillarH, Terrain.BOOKSHELF);
Painter.fill(level, right - 2 - pillarW, top + 3, pillarW, 1, Terrain.BOOKSHELF);
Painter.fill(level, right - 2 - 1, top + 3, 1, pillarH, Terrain.BOOKSHELF);
Painter.fill(level, right - 2 - pillarW, bottom - 2 - 1, pillarW, 1, Terrain.BOOKSHELF);
Painter.fill(level, right - 2 - 1, bottom - 2 - pillarH, 1, pillarH, Terrain.BOOKSHELF);
}
Point center = center();
Painter.set(level, center, Terrain.PEDESTAL);
Item prize = (Random.Int(2) == 0) ? level.findPrizeItem() : null;
if (prize != null) {
level.drop(prize, (center.x + center.y * level.width()));
} else {
level.drop(Generator.random(Random.oneOf(Generator.Category.POTION, Generator.Category.SCROLL)), (center.x + center.y * level.width()));
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class CursedWand method veryRareEffect.
private static void veryRareEffect(final Wand wand, final Hero user, final Ballistica bolt) {
switch(Random.Int(4)) {
// great forest fire!
case 0:
for (int i = 0; i < Dungeon.level.length(); i++) {
int c = Dungeon.level.map[i];
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS) {
GameScene.add(Blob.seed(i, 15, Regrowth.class));
}
}
do {
GameScene.add(Blob.seed(Dungeon.level.randomDestination(), 10, Fire.class));
} while (Random.Int(5) != 0);
new Flare(8, 32).color(0xFFFF66, true).show(user.sprite, 2f);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
GLog.p(Messages.get(CursedWand.class, "grass"));
GLog.w(Messages.get(CursedWand.class, "fire"));
wand.wandUsed();
break;
// superpowered mimic
case 1:
cursedFX(user, bolt, new Callback() {
public void call() {
Mimic mimic = Mimic.spawnAt(bolt.collisionPos, new ArrayList<Item>());
if (mimic != null) {
mimic.adjustStats(Dungeon.depth + 10);
mimic.HP = mimic.HT;
Item reward;
do {
reward = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, Generator.Category.RING, Generator.Category.WAND));
} while (reward.level() < 1);
Sample.INSTANCE.play(Assets.SND_MIMIC, 1, 1, 0.5f);
mimic.items.clear();
mimic.items.add(reward);
} else {
GLog.i(Messages.get(CursedWand.class, "nothing"));
}
wand.wandUsed();
}
});
break;
// crashes the game, yes, really.
case 2:
try {
Dungeon.saveAll();
if (Messages.lang() != Languages.ENGLISH) {
// Don't bother doing this joke to none-english speakers, I doubt it would translate.
GLog.i(Messages.get(CursedWand.class, "nothing"));
wand.wandUsed();
} else {
GameScene.show(new WndOptions("CURSED WAND ERROR", "this application will now self-destruct", "abort", "retry", "fail") {
@Override
protected void onSelect(int index) {
Game.instance.finish();
}
@Override
public void onBackPressed() {
// do nothing
}
});
}
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
// oookay maybe don't kill the game if the save failed.
GLog.i(Messages.get(CursedWand.class, "nothing"));
wand.wandUsed();
}
break;
// random transmogrification
case 3:
wand.wandUsed();
wand.detach(user.belongings.backpack);
Item result;
do {
result = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, Generator.Category.RING, Generator.Category.ARTIFACT));
} while (result.cursed);
if (result.isUpgradable())
result.upgrade();
result.cursed = result.cursedKnown = true;
GLog.w(Messages.get(CursedWand.class, "transmogrify"));
Dungeon.level.drop(result, user.pos).sprite.drop();
wand.wandUsed();
break;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class MissileWeapon method split.
@Override
public Item split(int amount) {
Item split = super.split(amount);
// have it reduce the durability of the main stack. Cleaner to the player this way
if (split != null) {
MissileWeapon m = (MissileWeapon) split;
m.durability = MAX_DURABILITY;
m.parent = this;
}
return split;
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class HallsBossLevel method createItems.
@Override
protected void createItems() {
Item item = Bones.get();
if (item != null) {
int pos;
do {
pos = Random.IntRange(ROOM_LEFT, ROOM_RIGHT) + Random.IntRange(ROOM_TOP + 1, ROOM_BOTTOM) * width();
} while (pos == entrance);
drop(item, pos).type = Heap.Type.REMAINS;
}
}
Aggregations