use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class AmuletScene method create.
@Override
public void create() {
super.create();
RenderedTextMultiline text = null;
if (!noText) {
text = renderMultiline(Messages.get(this, "text"), 8);
text.maxWidth(WIDTH);
add(text);
}
amulet = new Image(Assets.AMULET);
add(amulet);
RedButton btnExit = new RedButton(Messages.get(this, "exit")) {
@Override
protected void onClick() {
Dungeon.win(Amulet.class);
Dungeon.deleteGame(GamesInProgress.curSlot, true);
Game.switchScene(RankingsScene.class);
}
};
btnExit.setSize(WIDTH, BTN_HEIGHT);
add(btnExit);
RedButton btnStay = new RedButton(Messages.get(this, "stay")) {
@Override
protected void onClick() {
onBackPressed();
}
};
btnStay.setSize(WIDTH, BTN_HEIGHT);
add(btnStay);
float height;
if (noText) {
height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = (Camera.main.width - amulet.width) / 2;
amulet.y = (Camera.main.height - height) / 2;
align(amulet);
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
} else {
height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = (Camera.main.width - amulet.width) / 2;
amulet.y = (Camera.main.height - height) / 2;
align(amulet);
text.setPos((Camera.main.width - text.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
align(text);
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.top() + text.height() + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
}
new Flare(8, 48).color(0xFFDDBB, true).show(amulet, 0).angularSpeed = +30;
fadeIn();
}
use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare 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.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfTerror method doRead.
@Override
public void doRead() {
new Flare(5, 32).color(0xFF0000, true).show(curUser.sprite, 2f);
Sample.INSTANCE.play(Assets.SND_READ);
Invisibility.dispel();
int count = 0;
Mob affected = null;
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.affect(mob, Terror.class, Terror.DURATION).object = curUser.id();
if (mob.buff(Terror.class) != null) {
count++;
affected = mob;
}
}
}
switch(count) {
case 0:
GLog.i(Messages.get(this, "none"));
break;
case 1:
GLog.i(Messages.get(this, "one", affected.name));
break;
default:
GLog.i(Messages.get(this, "many"));
}
setKnown();
readAnimation();
}
use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method die.
@Override
public void die(Object cause) {
curAction = null;
Ankh ankh = null;
// look for ankhs in player inventory, prioritize ones which are blessed.
for (Item item : belongings) {
if (item instanceof Ankh) {
if (ankh == null || ((Ankh) item).isBlessed()) {
ankh = (Ankh) item;
}
}
}
if (ankh != null && ankh.isBlessed()) {
this.HP = HT / 4;
// ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again.
Buff.detach(this, Paralysis.class);
spend(-cooldown());
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
ankh.detach(belongings.backpack);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
GLog.w(Messages.get(this, "revive"));
Statistics.ankhsUsed++;
return;
}
Actor.fixTime();
super.die(cause);
if (ankh == null) {
reallyDie(cause);
} else {
Dungeon.deleteGame(GamesInProgress.curSlot, false);
GameScene.show(new WndResurrect(ankh, cause));
}
}
Aggregations