level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; if (level.heaps.get(level.pointToCell(p)) != null) chests++; level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; if (level.heaps.get(level.pointToCell(p)) != null) chests++; level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; if (level.heaps.get(level.pointToCell(p)) != null) chests++; level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; if (level.heaps.get(level.pointToCell(p)) != null) chests++; level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); chests--; Painter.set(level, p, Terrain.EMPTY_SP); if (chests > 0) { level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); chests--; Painter.set(level, p, Terrain.EMPTY_SP); if (chests > 0) { level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); chests--; Painter.set(level, p, Terrain.EMPTY_SP); if (chests > 0) { level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); chests--;
@Override public Group addVisuals() { super.addVisuals(); PrisonLevel.addPrisonVisuals(this, visuals); return visuals; }
protected boolean canAttack( Char enemy ) { return Dungeon.level.adjacent( pos, enemy.pos ); }
@Override protected boolean act() { int count = 0; for (Mob mob : mobs.toArray(new Mob[0])){ if (mob.alignment == Char.Alignment.ENEMY) count++; } if (count < nMobs()) { Mob mob = createMob(); mob.state = mob.WANDERING; mob.pos = randomRespawnCell(); if (Dungeon.hero.isAlive() && mob.pos != -1 && distance(Dungeon.hero.pos, mob.pos) >= 4) { GameScene.add( mob ); if (Statistics.amuletObtained) { mob.beckon( Dungeon.hero.pos ); } } } spend(respawnTime()); return true; } };
public void paint( Level level ) { for (Door door : connected.values()) { door.set( Door.Type.REGULAR ); } Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.EMPTY); RitualMarker vis = new RitualMarker(); Point c = center(); vis.pos(c.x - 1, c.y - 1); level.customTiles.add(vis); Painter.fill(level, c.x-1, c.y-1, 3, 3, Terrain.EMPTY_DECO); level.addItemToSpawn(new CeremonialCandle()); level.addItemToSpawn(new CeremonialCandle()); level.addItemToSpawn(new CeremonialCandle()); level.addItemToSpawn(new CeremonialCandle()); CeremonialCandle.ritualPos = c.x + (level.width() * c.y); }
public void paint( Level level ) { Painter.fill( level, this, Terrain.WALL ); Painter.fill( level, this, 1, Terrain.EMPTY_SP ); Painter.fill( level, this, 2, Terrain.EMPTY ); int cx = (left + right) / 2; int cy = (top + bottom) / 2; int c = cx + cy * level.width(); Random.shuffle(prizeClasses); Item i1, i2; i1 = prize( level ); i2 = prize( level ); level.drop( i1, c ).type = Heap.Type.CRYSTAL_CHEST; level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Heap.Type.CRYSTAL_CHEST; level.addItemToSpawn( new CrystalKey( Dungeon.depth ) ); entrance().set( Door.Type.LOCKED ); level.addItemToSpawn( new IronKey( Dungeon.depth ) ); }
level.addItemToSpawn(new PotionOfLiquidFlame()); pos = level.pointToCell(random()); } while (level.map[pos] != Terrain.EMPTY_SP || level.findMob(pos) != null); skele.pos = pos; level.mobs.add( skele ); 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.setHauntedIfCursed(1f); h.type = Heap.Type.SKELETON;
Dungeon.level.width() * DungeonTilemap.SIZE, Dungeon.level.height() * DungeonTilemap.SIZE, Dungeon.level.waterTex() ){ levelVisuals = Dungeon.level.addVisuals(); add(levelVisuals); fog = new FogOfWar( Dungeon.level.width(), Dungeon.level.height() ); add( fog ); 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 ); pos = Dungeon.level.randomRespawnCell(); tries--; } while (tries > 0 && Dungeon.level.heaps.get(pos) != null); for (Item item : ported) { Dungeon.level.drop( item, pos ).type = Heap.Type.CHEST;
addItemToSpawn( new SmallRation() ); } else { addItemToSpawn(Generator.random(Generator.Category.FOOD)); addItemToSpawn( new Torch() ); addItemToSpawn( new PotionOfStrength() ); Dungeon.LimitedDrops.STRENGTH_POTIONS.count++; addItemToSpawn( new ScrollOfUpgrade() ); Dungeon.LimitedDrops.UPGRADE_SCROLLS.count++; addItemToSpawn( new Stylus() ); Dungeon.LimitedDrops.ARCANE_STYLI.count++; if ( Dungeon.depth / 5 == enchChapter && Dungeon.seed % 4 + 1 == Dungeon.depth % 5){ addItemToSpawn( new StoneOfEnchantment() ); addItemToSpawn( new StoneOfIntuition() ); addItemToSpawn(new DriedRose.Petal()); rose.droppedPetals++; case 3: feeling = Feeling.DARK; addItemToSpawn(new Torch()); viewDistance = Math.round(viewDistance/2f); break;
@Override protected void activate(final int cell) { boolean[] FOV = new boolean[Dungeon.level.length()]; Point c = Dungeon.level.cellToPoint(cell); ShadowCaster.castShadow(c.x, c.y, FOV, Dungeon.level.losBlocking, DIST); int eX = Math.min(Dungeon.level.width()-1, c.x + DIST); int eY = Math.min(Dungeon.level.height()-1, c.y + DIST); int curr = y*Dungeon.level.width() + sX; for ( int x = sX; x <= eX; x++){ Dungeon.level.discover(curr);
public void paint( Level level ) { Door entrance = entrance(); entrance.set(Door.Type.LOCKED); level.addItemToSpawn(new IronKey(Dungeon.depth)); Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.GRASS); int heartX = Random.IntRange(left+1, right-1); int heartY = Random.IntRange(top+1, bottom-1); if (entrance.x == left) { heartX = right - 1; } else if (entrance.x == right) { heartX = left + 1; } else if (entrance.y == top) { heartY = bottom - 1; } else if (entrance.y == bottom) { heartY = top + 1; } placePlant(level, heartX + heartY * level.width(), new RotHeart()); int lashers = ((width()-2)*(height()-2))/8; for (int i = 1; i <= lashers; i++){ int pos; do { pos = level.pointToCell(random()); } while (!validPlantPos(level, pos)); placePlant(level, pos, new RotLasher()); } }
setSize( bundle.getInt(WIDTH), bundle.getInt(HEIGHT)); viewDistance = Math.round(viewDistance/2f); buildFlagMaps(); cleanWalls();
public static int findStep(Char ch, int from, int to, boolean pass[], boolean[] visible ) { if (Dungeon.level.adjacent( from, to )) { return Actor.findChar( to ) == null && (pass[to] || Dungeon.level.avoid[to]) ? to : -1; } setupPassable(); if (ch.flying || ch.buff( Amok.class ) != null) { BArray.or( pass, Dungeon.level.avoid, passable ); } else { System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() ); } for (Char c : Actor.chars()) { if (visible[c.pos]) { passable[c.pos] = false; } } return PathFinder.getStep( from, to, passable ); }
@Override public void explode(int cell) { super.explode(cell); boolean[] FOV = new boolean[Dungeon.level.length()]; Point c = Dungeon.level.cellToPoint(cell); ShadowCaster.castShadow(c.x, c.y, FOV, Dungeon.level.losBlocking, 8); for (int i = 0; i < FOV.length; i++) { if (FOV[i]) { if (Dungeon.level.heroFOV[i] && !Dungeon.level.solid[i]) { //TODO better vfx? CellEmitter.center( i ).burst( BlastParticle.FACTORY, 5 ); } Char ch = Actor.findChar(i); if (ch != null){ //regular bomb damage int damage = Math.round(Random.NormalIntRange( Dungeon.depth+5, 10 + Dungeon.depth * 2 )); damage -= ch.drRoll(); ch.damage(damage, this); if (ch == Dungeon.hero && !ch.isAlive()) Dungeon.fail(Bomb.class); } } } }
@Override public void create() { super.create(); for (int i=0; i < length(); i++) { int flags = Terrain.flags[map[i]]; if ((flags & Terrain.PIT) != 0){ passable[i] = avoid[i] = false; solid[i] = true; } } }
@Override public void fullyClear() { super.fullyClear(); Dungeon.level.buildFlagMaps(); }
m = Dungeon.level.createMob(); } else { try {
level.addItemToSpawn(new PotionOfLiquidFlame()); pos = level.pointToCell(random()); } while (level.map[pos] != Terrain.EMPTY_SP || level.findMob(pos) != null); skele.pos = pos; level.mobs.add( skele ); 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.setHauntedIfCursed(1f); h.type = Heap.Type.SKELETON;
Dungeon.level.width() * DungeonTilemap.SIZE, Dungeon.level.height() * DungeonTilemap.SIZE, Dungeon.level.waterTex() ){ levelVisuals = Dungeon.level.addVisuals(); add(levelVisuals); fog = new FogOfWar( Dungeon.level.width(), Dungeon.level.height() ); add( fog ); 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 ); pos = Dungeon.level.randomRespawnCell(); tries--; } while (tries > 0 && Dungeon.level.heaps.get(pos) != null); for (Item item : ported) { Dungeon.level.drop( item, pos ).type = Heap.Type.CHEST;