use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class King method summon.
private void summon() {
nextPedestal = !nextPedestal;
sprite.centerEmitter().start(Speck.factory(Speck.SCREAM), 0.4f, 2);
Sample.INSTANCE.play(Assets.SND_CHALLENGE);
boolean[] passable = Dungeon.level.passable.clone();
for (Char c : Actor.chars()) {
passable[c.pos] = false;
}
int undeadsToSummon = maxArmySize() - Undead.count;
PathFinder.buildDistanceMap(pos, passable, undeadsToSummon);
PathFinder.distance[pos] = Integer.MAX_VALUE;
int dist = 1;
undeadLabel: for (int i = 0; i < undeadsToSummon; i++) {
do {
for (int j = 0; j < Dungeon.level.length(); j++) {
if (PathFinder.distance[j] == dist) {
Undead undead = new Undead();
undead.pos = j;
GameScene.add(undead);
ScrollOfTeleportation.appear(undead, j);
new Flare(3, 32).color(0x000000, false).show(undead.sprite, 2f);
PathFinder.distance[j] = Integer.MAX_VALUE;
continue undeadLabel;
}
}
dist++;
} while (dist < undeadsToSummon);
}
yell(Messages.get(this, "arise"));
}
use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class AboutScene method create.
@Override
public void create() {
super.create();
final float colWidth = Camera.main.width / (SPDSettings.landscape() ? 2 : 1);
final float colTop = (Camera.main.height / 2) - (SPDSettings.landscape() ? 30 : 90);
final float wataOffset = SPDSettings.landscape() ? colWidth : 0;
Image shpx = Icons.SHPX.get();
shpx.x = (colWidth - shpx.width()) / 2;
shpx.y = colTop;
align(shpx);
add(shpx);
new Flare(7, 64).color(0x225511, true).show(shpx, 0).angularSpeed = +20;
RenderedText shpxtitle = renderText(TTL_SHPX, 8);
shpxtitle.hardlight(Window.SHPX_COLOR);
add(shpxtitle);
shpxtitle.x = (colWidth - shpxtitle.width()) / 2;
shpxtitle.y = shpx.y + shpx.height + 5;
align(shpxtitle);
RenderedTextMultiline shpxtext = renderMultiline(TXT_SHPX, 8);
shpxtext.maxWidth((int) Math.min(colWidth, 120));
add(shpxtext);
shpxtext.setPos((colWidth - shpxtext.width()) / 2, shpxtitle.y + shpxtitle.height() + 12);
align(shpxtext);
RenderedTextMultiline shpxlink = renderMultiline(LNK_SHPX, 8);
shpxlink.maxWidth(shpxtext.maxWidth());
shpxlink.hardlight(Window.SHPX_COLOR);
add(shpxlink);
shpxlink.setPos((colWidth - shpxlink.width()) / 2, shpxtext.bottom() + 6);
align(shpxlink);
TouchArea shpxhotArea = new TouchArea(shpxlink.left(), shpxlink.top(), shpxlink.width(), shpxlink.height()) {
@Override
protected void onClick(NoosaInputProcessor.Touch touch) {
Gdx.net.openURI("http://" + LNK_SHPX);
}
};
add(shpxhotArea);
Image wata = Icons.WATA.get();
wata.x = wataOffset + (colWidth - wata.width()) / 2;
wata.y = SPDSettings.landscape() ? colTop : shpxlink.top() + wata.height + 20;
align(wata);
add(wata);
new Flare(7, 64).color(0x112233, true).show(wata, 0).angularSpeed = +20;
RenderedText wataTitle = renderText(TTL_WATA, 8);
wataTitle.hardlight(Window.TITLE_COLOR);
add(wataTitle);
wataTitle.x = wataOffset + (colWidth - wataTitle.width()) / 2;
wataTitle.y = wata.y + wata.height + 11;
align(wataTitle);
RenderedTextMultiline wataText = renderMultiline(TXT_WATA, 8);
wataText.maxWidth((int) Math.min(colWidth, 120));
add(wataText);
wataText.setPos(wataOffset + (colWidth - wataText.width()) / 2, wataTitle.y + wataTitle.height() + 12);
align(wataText);
RenderedTextMultiline wataLink = renderMultiline(LNK_WATA, 8);
wataLink.maxWidth((int) Math.min(colWidth, 120));
wataLink.hardlight(Window.TITLE_COLOR);
add(wataLink);
wataLink.setPos(wataOffset + (colWidth - wataLink.width()) / 2, wataText.bottom() + 6);
align(wataLink);
TouchArea hotArea = new TouchArea(wataLink.left(), wataLink.top(), wataLink.width(), wataLink.height()) {
@Override
protected void onClick(NoosaInputProcessor.Touch touch) {
Gdx.net.openURI("http://" + LNK_WATA);
}
};
add(hotArea);
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
fadeIn();
}
use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class GameScene method create.
@Override
public void create() {
Music.INSTANCE.play(Assets.TUNE, true);
SPDSettings.lastClass(Dungeon.hero.heroClass.ordinal());
super.create();
Camera.main.zoom(GameMath.gate(minZoom, defaultZoom + SPDSettings.zoom(), maxZoom));
scene = this;
terrain = new Group();
add(terrain);
water = new SkinnedBlock(Dungeon.level.width() * DungeonTilemap.SIZE, Dungeon.level.height() * DungeonTilemap.SIZE, Dungeon.level.waterTex()) {
@Override
protected NoosaScript script() {
return NoosaScriptNoLighting.get();
}
@Override
public void draw() {
// water has no alpha component, this improves performance
Blending.disable();
super.draw();
Blending.enable();
}
};
terrain.add(water);
ripples = new Group();
terrain.add(ripples);
DungeonTileSheet.setupVariance(Dungeon.level.map.length, Dungeon.seedCurDepth());
tiles = new DungeonTerrainTilemap();
terrain.add(tiles);
customTiles = new Group();
terrain.add(customTiles);
for (CustomTiledVisual visual : Dungeon.level.customTiles) {
addCustomTile(visual);
}
visualGrid = new GridTileMap();
terrain.add(visualGrid);
terrainFeatures = new TerrainFeaturesTilemap(Dungeon.level.plants, Dungeon.level.traps);
terrain.add(terrainFeatures);
levelVisuals = Dungeon.level.addVisuals();
add(levelVisuals);
heaps = new Group();
add(heaps);
for (IntMap.Entry<Heap> heap : Dungeon.level.heaps) {
addHeapSprite(heap.value);
}
emitters = new Group();
effects = new Group();
healthIndicators = new Group();
emoicons = new Group();
mobs = new Group();
add(mobs);
for (Mob mob : Dungeon.level.mobs) {
addMobSprite(mob);
if (Statistics.amuletObtained) {
mob.beckon(Dungeon.hero.pos);
}
}
walls = new DungeonWallsTilemap();
add(walls);
customWalls = new Group();
add(customWalls);
for (CustomTiledVisual visual : Dungeon.level.customWalls) {
addCustomWall(visual);
}
wallBlocking = new WallBlockingTilemap();
add(wallBlocking);
add(emitters);
add(effects);
gases = new Group();
add(gases);
for (Blob blob : Dungeon.level.blobs.values()) {
blob.emitter = null;
addBlobSprite(blob);
}
fog = new FogOfWar(Dungeon.level.width(), Dungeon.level.height());
add(fog);
spells = new Group();
add(spells);
statuses = new Group();
add(statuses);
add(healthIndicators);
// always appears ontop of other health indicators
add(new TargetHealthIndicator());
add(emoicons);
hero = new HeroSprite();
hero.place(Dungeon.hero.pos);
hero.updateArmor();
mobs.add(hero);
add(cellSelector = new CellSelector(tiles));
pane = new StatusPane();
pane.camera = uiCamera;
pane.setSize(uiCamera.width, 0);
add(pane);
toolbar = new Toolbar();
toolbar.camera = uiCamera;
toolbar.setRect(0, uiCamera.height - toolbar.height(), uiCamera.width, toolbar.height());
add(toolbar);
attack = new AttackIndicator();
attack.camera = uiCamera;
add(attack);
loot = new LootIndicator();
loot.camera = uiCamera;
add(loot);
action = new ActionIndicator();
action.camera = uiCamera;
add(action);
resume = new ResumeIndicator();
resume.camera = uiCamera;
add(resume);
log = new GameLog();
log.camera = uiCamera;
log.newLine();
add(log);
layoutTags();
busy = new BusyIndicator();
busy.camera = uiCamera;
busy.x = 1;
busy.y = pane.bottom() + 1;
add(busy);
switch(InterlevelScene.mode) {
case RESURRECT:
ScrollOfTeleportation.appear(Dungeon.hero, Dungeon.level.entrance);
new Flare(8, 32).color(0xFFFF66, true).show(hero, 2f);
break;
case RETURN:
ScrollOfTeleportation.appear(Dungeon.hero, Dungeon.hero.pos);
break;
case FALL:
Chasm.heroLand();
break;
case DESCEND:
switch(Dungeon.depth) {
case 1:
WndStory.showChapter(WndStory.ID_SEWERS);
break;
case 6:
WndStory.showChapter(WndStory.ID_PRISON);
break;
case 11:
WndStory.showChapter(WndStory.ID_CAVES);
break;
case 16:
WndStory.showChapter(WndStory.ID_CITY);
break;
case 22:
WndStory.showChapter(WndStory.ID_HALLS);
break;
}
if (Dungeon.hero.isAlive() && Dungeon.depth != 22) {
Badges.validateNoKilling();
}
break;
default:
}
ArrayList<Item> dropped = Dungeon.droppedItems.get(Dungeon.depth);
if (dropped != null) {
for (Item item : dropped) {
int pos = Dungeon.level.randomRespawnCell();
if (item instanceof Potion) {
((Potion) item).shatter(pos);
} else if (item instanceof Plant.Seed) {
Dungeon.level.plant((Plant.Seed) item, pos);
} else if (item instanceof Honeypot) {
Dungeon.level.drop(((Honeypot) item).shatter(null, pos), pos);
} else {
Dungeon.level.drop(item, pos);
}
}
Dungeon.droppedItems.remove(Dungeon.depth);
}
Dungeon.hero.next();
Camera.main.target = hero;
if (InterlevelScene.mode != InterlevelScene.Mode.NONE) {
if (Dungeon.depth == Statistics.deepestFloor && (InterlevelScene.mode == InterlevelScene.Mode.DESCEND || InterlevelScene.mode == InterlevelScene.Mode.FALL)) {
GLog.h(Messages.get(this, "descend"), Dungeon.depth);
Sample.INSTANCE.play(Assets.SND_DESCEND);
} else if (InterlevelScene.mode == InterlevelScene.Mode.RESET) {
GLog.h(Messages.get(this, "warp"));
} else {
GLog.h(Messages.get(this, "return"), Dungeon.depth);
}
switch(Dungeon.level.feeling) {
case CHASM:
GLog.w(Messages.get(this, "chasm"));
break;
case WATER:
GLog.w(Messages.get(this, "water"));
break;
case GRASS:
GLog.w(Messages.get(this, "grass"));
break;
case DARK:
GLog.w(Messages.get(this, "dark"));
break;
default:
}
if (Dungeon.level instanceof RegularLevel && ((RegularLevel) Dungeon.level).secretDoors > Random.IntRange(3, 4)) {
GLog.w(Messages.get(this, "secrets"));
}
InterlevelScene.mode = InterlevelScene.Mode.NONE;
fadeIn();
}
selectCell(defaultCellListener);
}
use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Mob method rollToDropLoot.
public void rollToDropLoot() {
if (Dungeon.hero.lvl > maxLvl + 2)
return;
float lootChance = this.lootChance;
lootChance *= RingOfWealth.dropChanceMultiplier(Dungeon.hero);
if (Random.Float() < lootChance) {
Item loot = createLoot();
if (loot != null) {
Dungeon.level.drop(loot, pos).sprite.drop();
}
}
// ring of wealth logic
if (Ring.getBonus(Dungeon.hero, RingOfWealth.Wealth.class) > 0) {
int rolls = 1;
if (properties.contains(Property.BOSS))
rolls = 15;
else if (properties.contains(Property.MINIBOSS))
rolls = 5;
ArrayList<Item> bonus = RingOfWealth.tryRareDrop(Dungeon.hero, rolls);
if (bonus != null) {
for (Item b : bonus) Dungeon.level.drop(b, pos).sprite.drop();
new Flare(8, 32).color(0xFFFF00, true).show(sprite, 2f);
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.effects.Flare in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfRemoveCurse method onItemSelected.
@Override
protected void onItemSelected(Item item) {
new Flare(6, 32).show(curUser.sprite, 2f);
boolean procced = uncurse(curUser, item);
Weakness.detach(curUser, Weakness.class);
if (procced) {
GLog.p(Messages.get(this, "cleansed"));
} else {
GLog.i(Messages.get(this, "not_cleansed"));
}
}
Aggregations