Merging 1.7.5 Source: levels changes

This commit is contained in:
Evan Debenham 2015-02-02 11:10:04 -05:00
parent e931525669
commit 9dab291797
6 changed files with 35 additions and 38 deletions

View File

@ -159,7 +159,7 @@ public class CavesLevel extends RegularLevel {
for (Room r : rooms) { for (Room r : rooms) {
if (r.type == Type.STANDARD) { if (r.type == Type.STANDARD) {
for (Room n : r.neigbours) { for (Room n : r.neigbours) {
if (n.type == Type.STANDARD && !r.connected.containsKey( n )/* && Random.Int( 2 ) == 0*/) { if (n.type == Type.STANDARD && !r.connected.containsKey( n )) {
Rect w = r.intersect( n ); Rect w = r.intersect( n );
if (w.left == w.right && w.bottom - w.top >= 5) { if (w.left == w.right && w.bottom - w.top >= 5) {

View File

@ -18,6 +18,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels; package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.watabou.noosa.Scene; import com.watabou.noosa.Scene;
import com.watabou.noosa.tweeners.AlphaTweener;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Bones; import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
@ -180,14 +181,21 @@ public class CityBossLevel extends Level {
Mob boss = Bestiary.mob( Dungeon.depth ); Mob boss = Bestiary.mob( Dungeon.depth );
boss.state = boss.HUNTING; boss.state = boss.HUNTING;
int count = 0;
do { do {
boss.pos = Random.Int( LENGTH ); boss.pos = Random.Int( LENGTH );
} while ( } while (
!passable[boss.pos] || !passable[boss.pos] ||
!outsideEntraceRoom( boss.pos ) || !outsideEntraceRoom( boss.pos ) ||
Dungeon.visible[boss.pos]); (Dungeon.visible[boss.pos] && count++ < 20));
GameScene.add( boss ); GameScene.add( boss );
if (Dungeon.visible[boss.pos]) {
boss.notice();
boss.sprite.alpha( 0 );
boss.sprite.parent.add( new AlphaTweener( boss.sprite, 1, 0.1f ) );
}
set( arenaDoor, Terrain.LOCKED_DOOR ); set( arenaDoor, Terrain.LOCKED_DOOR );
GameScene.updateMap( arenaDoor ); GameScene.updateMap( arenaDoor );
Dungeon.observe(); Dungeon.observe();

View File

@ -85,18 +85,11 @@ public class HallsLevel extends RegularLevel {
} }
} else } else
if (map[i] == Terrain.WALL) { if (map[i] == Terrain.WALL &&
map[i-1] != Terrain.WALL_DECO && map[i-WIDTH] != Terrain.WALL_DECO &&
Random.Int( 20 ) == 0) {
int count = 0; map[i] = Terrain.WALL_DECO;
for (int j=0; j < NEIGHBOURS4.length; j++) {
if (map[i + NEIGHBOURS4[j]] == Terrain.WATER) {
count++;
}
}
if (Random.Int( 4 ) < count) {
map[i] = Terrain.WALL_DECO;
}
} }
} }

View File

@ -47,6 +47,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
@ -54,6 +56,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
@ -116,8 +119,6 @@ public abstract class Level implements Bundlable {
private static final String TXT_HIDDEN_PLATE_CLICKS = "A hidden pressure plate clicks!"; private static final String TXT_HIDDEN_PLATE_CLICKS = "A hidden pressure plate clicks!";
public static boolean resizingNeeded; public static boolean resizingNeeded;
// This one can be different from resizingNeeded if the level
// was created in the older version of the game
public static int loadedMapSize; public static int loadedMapSize;
public int[] map; public int[] map;
@ -197,7 +198,7 @@ public abstract class Level implements Bundlable {
addItemToSpawn( new PotionOfStrength() ); addItemToSpawn( new PotionOfStrength() );
Dungeon.limitedDrops.strengthPotions.count++; Dungeon.limitedDrops.strengthPotions.count++;
} }
if (Dungeon.soeNeeded()) { if (Dungeon.souNeeded()) {
addItemToSpawn( new ScrollOfUpgrade() ); addItemToSpawn( new ScrollOfUpgrade() );
Dungeon.limitedDrops.upgradeScrolls.count++; Dungeon.limitedDrops.upgradeScrolls.count++;
} }
@ -369,7 +370,8 @@ public abstract class Level implements Bundlable {
} }
private void adjustMapSize() { private void adjustMapSize() {
// For levels from older saves // For levels saved before 1.6.3
// Seeing as shattered started on 1.7.1 this is never used, but the code may be resused in future.
if (map.length < LENGTH) { if (map.length < LENGTH) {
resizingNeeded = true; resizingNeeded = true;
@ -414,8 +416,11 @@ public abstract class Level implements Bundlable {
} }
abstract protected boolean build(); abstract protected boolean build();
abstract protected void decorate(); abstract protected void decorate();
abstract protected void createMobs(); abstract protected void createMobs();
abstract protected void createItems(); abstract protected void createItems();
public void addVisuals( Scene scene ) { public void addVisuals( Scene scene ) {
@ -597,11 +602,13 @@ public abstract class Level implements Bundlable {
public Heap drop( Item item, int cell ) { public Heap drop( Item item, int cell ) {
//This messy if statement deals will items which should not drop in challenges primarily.
if ((Dungeon.isChallenged( Challenges.NO_FOOD ) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) || if ((Dungeon.isChallenged( Challenges.NO_FOOD ) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) ||
(Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) || (Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) ||
(Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) || (Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) ||
(Dungeon.isChallenged( Challenges.NO_HERBALISM ) && (item instanceof Plant.Seed || item instanceof Dewdrop)) || (Dungeon.isChallenged( Challenges.NO_HERBALISM ) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch)) ||
item == null) { (Dungeon.isChallenged( Challenges.NO_SCROLLS ) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade)) || item instanceof ScrollHolder)) ||
item == null) {
Heap heap = new Heap(); Heap heap = new Heap();
GameScene.add( heap ); GameScene.add( heap );

View File

@ -627,6 +627,9 @@ public abstract class RegularLevel extends Level {
case 4: case 4:
type = Heap.Type.CHEST; type = Heap.Type.CHEST;
break; break;
case 5:
type = Dungeon.depth > 1 ? Heap.Type.MIMIC : Heap.Type.CHEST;
break;
default: default:
type = Heap.Type.HEAP; type = Heap.Type.HEAP;
} }

View File

@ -239,17 +239,3 @@ public class Room extends Rect implements Graph.Node, Bundlable {
} }
} }
} }