v0.6.2: made several level properties none-static

This commit is contained in:
Evan Debenham 2017-09-16 00:27:22 -04:00
parent 6530cf0675
commit 126172d661
72 changed files with 180 additions and 213 deletions

View File

@ -791,7 +791,7 @@ public class Dungeon {
setupPassable();
if (ch.flying || ch.buff( Amok.class ) != null) {
BArray.or( pass, Level.avoid, passable );
BArray.or( pass, Dungeon.level.avoid, passable );
} else {
System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
}
@ -808,13 +808,13 @@ public class Dungeon {
public static int findStep(Char ch, int from, int to, boolean pass[], boolean[] visible ) {
if (level.adjacent( from, to )) {
return Actor.findChar( to ) == null && (pass[to] || Level.avoid[to]) ? to : -1;
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, Level.avoid, passable );
BArray.or( pass, Dungeon.level.avoid, passable );
} else {
System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
}
@ -833,7 +833,7 @@ public class Dungeon {
setupPassable();
if (ch.flying) {
BArray.or( pass, Level.avoid, passable );
BArray.or( pass, Dungeon.level.avoid, passable );
} else {
System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
}

View File

@ -414,7 +414,7 @@ public abstract class Char extends Actor {
if (Dungeon.level.adjacent( step, pos ) && buff( Vertigo.class ) != null) {
sprite.interruptMotion();
int newPos = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
if (!(Level.passable[newPos] || Level.avoid[newPos]) || Actor.findChar( newPos ) != null)
if (!(Dungeon.level.passable[newPos] || Dungeon.level.avoid[newPos]) || Actor.findChar( newPos ) != null)
return;
else {
sprite.move(pos, newPos);

View File

@ -139,7 +139,7 @@ public class Blob extends Actor {
protected void evolve() {
boolean[] blocking = Level.solid;
boolean[] blocking = Dungeon.level.solid;
int cell;
for (int i=area.top-1; i <= area.bottom; i++) {
for (int j = area.left-1; j <= area.right; j++) {

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -39,7 +38,7 @@ public class Fire extends Blob {
@Override
protected void evolve() {
boolean[] flamable = Level.flamable;
boolean[] flamable = Dungeon.level.flamable;
int cell;
int fire;

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SnowParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.watabou.utils.Random;
public class Freezing {
@ -39,7 +38,7 @@ public class Freezing {
Char ch = Actor.findChar( cell );
if (ch != null) {
if (Level.water[ch.pos]){
if (Dungeon.level.water[ch.pos]){
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f));
} else {
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f));

View File

@ -96,7 +96,7 @@ public abstract class WellWater extends Blob {
int newPlace;
do {
newPlace = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
} while (!Level.passable[newPlace] && !Level.avoid[newPlace]);
} while (!Dungeon.level.passable[newPlace] && !Dungeon.level.avoid[newPlace]);
Dungeon.level.drop( heap.pickUp(), newPlace ).sprite.drop( pos );
return false;

View File

@ -38,7 +38,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@ -141,7 +140,7 @@ public class Burning extends Buff implements Hero.Doom {
detach();
}
if (Level.flamable[target.pos] && Blob.volumeAt(target.pos, Fire.class) == 0) {
if (Dungeon.level.flamable[target.pos] && Blob.volumeAt(target.pos, Fire.class) == 0) {
GameScene.add( Blob.seed( target.pos, 4, Fire.class ) );
}
@ -149,7 +148,7 @@ public class Burning extends Buff implements Hero.Doom {
left -= TICK;
if (left <= 0 ||
(Level.water[target.pos] && !target.flying)) {
(Dungeon.level.water[target.pos] && !target.flying)) {
detach();
}

View File

@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -248,7 +247,8 @@ public class Combo extends Buff implements ActionIndicator.Action {
int ofs = PathFinder.NEIGHBOURS8[i];
if (enemy.pos - target.pos == ofs) {
int newPos = enemy.pos + ofs;
if ((Level.passable[newPos] || Level.avoid[newPos]) && Actor.findChar( newPos ) == null) {
if ((Dungeon.level.passable[newPos] || Dungeon.level.avoid[newPos])
&& Actor.findChar( newPos ) == null) {
Actor.addDelayed( new Pushing( enemy, enemy.pos, newPos ), -1 );

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
@ -97,7 +96,7 @@ public class Frost extends FlavourBuff {
super.detach();
if (target.paralysed > 0)
target.paralysed--;
if (Level.water[target.pos])
if (Dungeon.level.water[target.pos])
Buff.prolong(target, Chill.class, 4f);
}

View File

@ -22,7 +22,6 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -67,7 +66,7 @@ public class Ooze extends Buff {
}
spend( TICK );
}
if (Level.water[target.pos]) {
if (Dungeon.level.water[target.pos]) {
detach();
}
return true;

View File

@ -249,7 +249,7 @@ public class Preparation extends Buff implements ActionIndicator.Action {
AttackLevel lvl = AttackLevel.getLvl(turnsInvis);
boolean[] passable = new boolean[Dungeon.level.length()];
PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.or(Level.passable, Level.avoid, passable), lvl.blinkDistance+1);
PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, passable), lvl.blinkDistance+1);
if (PathFinder.distance[cell] == Integer.MAX_VALUE){
GLog.w(Messages.get(Preparation.class, "out_of_reach"));
return;

View File

@ -379,7 +379,7 @@ public class Hero extends Char {
if (armor.hasGlyph(Swiftness.class)) {
speed *= (1.1f + 0.01f * belongings.armor.level());
} else if (armor.hasGlyph(Flow.class) && Level.water[pos]){
} else if (armor.hasGlyph(Flow.class) && Dungeon.level.water[pos]){
speed *= (1.5f + 0.05f * belongings.armor.level());
}
}
@ -422,7 +422,7 @@ public class Hero extends Char {
if (wep != null && Dungeon.level.distance( pos, enemy.pos ) <= wep.reachFactor(this)){
boolean[] passable = BArray.not(Level.solid, null);
boolean[] passable = BArray.not(Dungeon.level.solid, null);
for (Mob m : Dungeon.level.mobs)
passable[m.pos] = false;
@ -1035,7 +1035,7 @@ public class Hero extends Char {
path = null;
if (Actor.findChar( target ) == null) {
if (Level.pit[target] && !flying && !Level.solid[target]) {
if (Dungeon.level.pit[target] && !flying && !Dungeon.level.solid[target]) {
if (!Chasm.jumpConfirmed){
Chasm.heroJump(this);
interrupt();
@ -1044,7 +1044,7 @@ public class Hero extends Char {
}
return false;
}
if (Level.passable[target] || Level.avoid[target]) {
if (Dungeon.level.passable[target] || Dungeon.level.avoid[target]) {
step = target;
}
}
@ -1062,7 +1062,7 @@ public class Hero extends Char {
int lookAhead = (int) GameMath.gate(0, path.size()-1, 2);
for (int i = 0; i < lookAhead; i++){
int cell = path.get(i);
if (!Level.passable[cell] || (Dungeon.visible[cell] && Actor.findChar(cell) != null)) {
if (!Dungeon.level.passable[cell] || (Dungeon.visible[cell] && Actor.findChar(cell) != null)) {
newPath = true;
break;
}
@ -1072,7 +1072,7 @@ public class Hero extends Char {
if (newPath) {
int len = Dungeon.level.length();
boolean[] p = Level.passable;
boolean[] p = Dungeon.level.passable;
boolean[] v = Dungeon.level.visited;
boolean[] m = Dungeon.level.mapped;
boolean[] passable = new boolean[len];
@ -1336,7 +1336,7 @@ public class Hero extends Char {
int length = Dungeon.level.length();
int[] map = Dungeon.level.map;
boolean[] visited = Dungeon.level.visited;
boolean[] discoverable = Level.discoverable;
boolean[] discoverable = Dungeon.level.discoverable;
for (int i=0; i < length; i++) {
@ -1363,7 +1363,7 @@ public class Hero extends Char {
ArrayList<Integer> passable = new ArrayList<Integer>();
for (Integer ofs : PathFinder.NEIGHBOURS8) {
int cell = pos + ofs;
if ((Level.passable[cell] || Level.avoid[cell]) && Dungeon.level.heaps.get( cell ) == null) {
if ((Dungeon.level.passable[cell] || Dungeon.level.avoid[cell]) && Dungeon.level.heaps.get( cell ) == null) {
passable.add( cell );
}
}
@ -1411,7 +1411,7 @@ public class Hero extends Char {
if (!flying) {
if (Level.water[pos]) {
if (Dungeon.level.water[pos]) {
Sample.INSTANCE.play( Assets.SND_WATER, 1, 1, Random.Float( 0.8f, 1.25f ) );
} else {
Sample.INSTANCE.play( Assets.SND_STEP );
@ -1514,7 +1514,7 @@ public class Hero extends Char {
sprite.parent.addToBack( new CheckedCell( p ) );
}
if (Level.secret[p]){
if (Dungeon.level.secret[p]){
float chance;
//intentional searches always succeed

View File

@ -120,7 +120,7 @@ public class DM300 extends Mob {
Camera.main.shake( 3, 0.7f );
Sample.INSTANCE.play( Assets.SND_ROCKS );
if (Level.water[cell]) {
if (Dungeon.level.water[cell]) {
GameScene.ripple( cell );
} else if (Dungeon.level.map[cell] == Terrain.EMPTY) {
Level.set( cell, Terrain.EMPTY_DECO );

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
@ -30,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfFireblast;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ElementalSprite;
import com.watabou.utils.Random;
@ -88,7 +88,7 @@ public class Elemental extends Mob {
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
}
} else if (buff instanceof Frost || buff instanceof Chill) {
if (Level.water[this.pos])
if (Dungeon.level.water[this.pos])
damage( Random.NormalIntRange( HT / 2, HT ), buff );
else
damage( Random.NormalIntRange( 1, HT * 2 / 3 ), buff );

View File

@ -163,7 +163,7 @@ public class Eye extends Mob {
for (int pos : beam.subPath(1, beam.dist)) {
if (Level.flamable[pos]) {
if (Dungeon.level.flamable[pos]) {
Dungeon.level.destroy( pos );
GameScene.updateMap( pos );

View File

@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.CurareDart;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GnollTricksterSprite;
@ -80,7 +79,7 @@ public class GnollTrickster extends Gnoll {
if (effect >=6 && enemy.buff(Burning.class) == null){
if (Level.flamable[enemy.pos])
if (Dungeon.level.flamable[enemy.pos])
GameScene.add(Blob.seed(enemy.pos, 4, Fire.class));
Buff.affect(enemy, Burning.class).reignite( enemy );

View File

@ -38,7 +38,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@ -77,7 +76,7 @@ public class Goo extends Mob {
int max = (HP*2 <= HT) ? 15 : 10;
if (pumpedUp > 0) {
pumpedUp = 0;
PathFinder.buildDistanceMap( pos, BArray.not( Level.solid, null ), 2 );
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE)
CellEmitter.get(i).burst(ElmoParticle.FACTORY, 10);
@ -110,7 +109,7 @@ public class Goo extends Mob {
@Override
public boolean act() {
if (Level.water[pos] && HP < HT) {
if (Dungeon.level.water[pos] && HP < HT) {
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
if (HP*2 == HT) {
BossHealthBar.bleed(false);
@ -146,7 +145,7 @@ public class Goo extends Mob {
protected boolean doAttack( Char enemy ) {
if (pumpedUp == 1) {
((GooSprite)sprite).pumpUp();
PathFinder.buildDistanceMap( pos, BArray.not( Level.solid, null ), 2 );
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE)
GameScene.add(Blob.seed(i, 2, GooWarn.class));
@ -182,7 +181,7 @@ public class Goo extends Mob {
for (int i=0; i < PathFinder.NEIGHBOURS9.length; i++) {
int j = pos + PathFinder.NEIGHBOURS9[i];
if (!Level.solid[j]) {
if (!Dungeon.level.solid[j]) {
GameScene.add(Blob.seed(j, 2, GooWarn.class));
}
}

View File

@ -93,12 +93,14 @@ public class Guard extends Mob {
Ballistica chain = new Ballistica(pos, target, Ballistica.PROJECTILE);
if (chain.collisionPos != enemy.pos || chain.path.size() < 2 || Level.pit[chain.path.get(1)])
if (chain.collisionPos != enemy.pos
|| chain.path.size() < 2
|| Dungeon.level.pit[chain.path.get(1)])
return false;
else {
int newPos = -1;
for (int i : chain.subPath(1, chain.dist)){
if (!Level.solid[i] && Actor.findChar(i) == null){
if (!Dungeon.level.solid[i] && Actor.findChar(i) == null){
newPos = i;
break;
}

View File

@ -42,7 +42,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportat
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfDisintegration;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
import com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.KingSprite;
@ -187,7 +186,7 @@ public class King extends Mob {
sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.4f, 2 );
Sample.INSTANCE.play( Assets.SND_CHALLENGE );
boolean[] passable = Level.passable.clone();
boolean[] passable = Dungeon.level.passable.clone();
for (Char c : Actor.chars()) {
passable[c.pos] = false;
}

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MimicSprite;
import com.watabou.noosa.audio.Sample;
@ -119,7 +118,7 @@ public class Mimic extends Mob {
ArrayList<Integer> candidates = new ArrayList<>();
for (int n : PathFinder.NEIGHBOURS8) {
int cell = pos + n;
if ((Level.passable[cell] || Level.avoid[cell]) && Actor.findChar( cell ) == null) {
if ((Dungeon.level.passable[cell] || Dungeon.level.avoid[cell]) && Actor.findChar( cell ) == null) {
candidates.add( cell );
}
}

View File

@ -309,7 +309,7 @@ public abstract class Mob extends Char {
path = null;
if (Actor.findChar( target ) == null && Level.passable[target]) {
if (Actor.findChar( target ) == null && Dungeon.level.passable[target]) {
step = target;
}
@ -366,7 +366,7 @@ public abstract class Mob extends Char {
int lookAhead = (int)GameMath.gate(1, path.size()-1, 4);
for (int i = 0; i < lookAhead; i++) {
int cell = path.get(i);
if (!Level.passable[cell] || ( Level.fieldOfView[cell] && Actor.findChar(cell) != null)) {
if (!Dungeon.level.passable[cell] || ( Level.fieldOfView[cell] && Actor.findChar(cell) != null)) {
newPath = true;
break;
}
@ -375,7 +375,7 @@ public abstract class Mob extends Char {
if (newPath) {
path = Dungeon.findPath(this, pos, target,
Level.passable,
Dungeon.level.passable,
Level.fieldOfView);
}
@ -400,7 +400,7 @@ public abstract class Mob extends Char {
protected boolean getFurther( int target ) {
int step = Dungeon.flee( this, pos, target,
Level.passable,
Dungeon.level.passable,
Level.fieldOfView );
if (step != -1) {
move( step );

View File

@ -57,7 +57,7 @@ public class Piranha extends Mob {
@Override
protected boolean act() {
if (!Level.water[pos]) {
if (!Dungeon.level.water[pos]) {
die( null );
sprite.killAndErase();
return true;
@ -120,7 +120,7 @@ public class Piranha extends Mob {
}
int step = Dungeon.findStep( this, pos, target,
Level.water,
Dungeon.level.water,
Level.fieldOfView );
if (step != -1) {
move( step );
@ -133,7 +133,7 @@ public class Piranha extends Mob {
@Override
protected boolean getFurther( int target ) {
int step = Dungeon.flee( this, pos, target,
Level.water,
Dungeon.level.water,
Level.fieldOfView );
if (step != -1) {
move( step );

View File

@ -93,7 +93,7 @@ public class Shaman extends Mob implements Callback {
if (hit( this, enemy, true )) {
int dmg = Random.NormalIntRange(3, 10);
if (Level.water[enemy.pos] && !enemy.flying) {
if (Dungeon.level.water[enemy.pos] && !enemy.flying) {
dmg *= 1.5f;
}
enemy.damage( dmg, LightningTrap.LIGHTNING );

View File

@ -108,11 +108,11 @@ public class Succubus extends Mob {
if (Actor.findChar( cell ) != null && cell != this.pos)
cell = route.path.get(route.dist-1);
if (Level.avoid[ cell ]){
if (Dungeon.level.avoid[ cell ]){
ArrayList<Integer> candidates = new ArrayList<>();
for (int n : PathFinder.NEIGHBOURS8) {
cell = route.collisionPos + n;
if (Level.passable[cell] && Actor.findChar( cell ) == null) {
if (Dungeon.level.passable[cell] && Actor.findChar( cell ) == null) {
candidates.add( cell );
}
}

View File

@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -87,7 +86,7 @@ public class Swarm extends Mob {
if (HP >= damage + 2) {
ArrayList<Integer> candidates = new ArrayList<>();
boolean[] passable = Level.passable;
boolean[] passable = Dungeon.level.passable;
int[] neighbours = {pos + 1, pos - 1, pos + Dungeon.level.width(), pos - Dungeon.level.width()};
for (int n : neighbours) {

View File

@ -170,7 +170,7 @@ public class Tengu extends Mob {
int trapPos;
do {
trapPos = Random.Int( Dungeon.level.length() );
} while (!Level.fieldOfView[trapPos] || Level.solid[trapPos]);
} while (!Level.fieldOfView[trapPos] || Dungeon.level.solid[trapPos]);
if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) {
Dungeon.level.setTrap( new SpearTrap().reveal(), trapPos );
@ -196,7 +196,7 @@ public class Tengu extends Mob {
do {
newPos = Random.Int(Dungeon.level.length());
} while (
Level.solid[newPos] ||
Dungeon.level.solid[newPos] ||
Dungeon.level.distance(newPos, enemy.pos) < 8 ||
Actor.findChar(newPos) != null);
}

View File

@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.WraithSprite;
import com.watabou.noosa.tweeners.AlphaTweener;
@ -94,14 +93,14 @@ public class Wraith extends Mob {
public static void spawnAround( int pos ) {
for (int n : PathFinder.NEIGHBOURS4) {
int cell = pos + n;
if (Level.passable[cell] && Actor.findChar( cell ) == null) {
if (Dungeon.level.passable[cell] && Actor.findChar( cell ) == null) {
spawnAt( cell );
}
}
}
public static Wraith spawnAt( int pos ) {
if (Level.passable[pos] && Actor.findChar( pos ) == null) {
if (Dungeon.level.passable[pos] && Actor.findChar( pos ) == null) {
Wraith w = new Wraith();
w.adjustStats( Dungeon.depth );

View File

@ -42,7 +42,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -87,7 +86,7 @@ public class Yog extends Mob {
do {
fist1.pos = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
fist2.pos = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
} while (!Level.passable[fist1.pos] || !Level.passable[fist2.pos] || fist1.pos == fist2.pos);
} while (!Dungeon.level.passable[fist1.pos] || !Dungeon.level.passable[fist2.pos] || fist1.pos == fist2.pos);
GameScene.add( fist1 );
GameScene.add( fist2 );
@ -132,7 +131,7 @@ public class Yog extends Mob {
for (int i=0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
if (Actor.findChar( p ) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
spawnPoints.add( p );
}
}
@ -255,7 +254,7 @@ public class Yog extends Mob {
@Override
public boolean act() {
if (Level.water[pos] && HP < HT) {
if (Dungeon.level.water[pos] && HP < HT) {
sprite.emitter().burst( ShadowParticle.UP, 2 );
HP += REGENERATION;
}

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.quest.DwarfToken;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.levels.CityLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ImpSprite;
@ -191,8 +190,8 @@ public class Imp extends NPC {
level.heaps.get( npc.pos ) != null ||
level.findMob( npc.pos ) != null ||
//The imp doesn't move, so he cannot obstruct a passageway
!(Level.passable[npc.pos + PathFinder.CIRCLE4[0]] && Level.passable[npc.pos + PathFinder.CIRCLE4[2]]) ||
!(Level.passable[npc.pos + PathFinder.CIRCLE4[1]] && Level.passable[npc.pos + PathFinder.CIRCLE4[3]]));
!(Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[0]] && Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[2]]) ||
!(Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[1]] && Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[3]]));
level.mobs.add( npc );
spawned = true;

View File

@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
@ -44,7 +43,7 @@ public abstract class NPC extends Mob {
int n;
do {
n = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
} while (!Level.passable[n] && !Level.avoid[n]);
} while (!Dungeon.level.passable[n] && !Dungeon.level.avoid[n]);
Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
}
}

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@ -87,13 +86,13 @@ public class Bomb extends Item {
@Override
protected void onThrow( int cell ) {
if (!Level.pit[ cell ] && lightingFuse) {
if (!Dungeon.level.pit[ cell ] && lightingFuse) {
Actor.addDelayed(fuse = new Fuse().ignite(this), 2);
}
if (Actor.findChar( cell ) != null && !(Actor.findChar( cell ) instanceof Hero) ){
ArrayList<Integer> candidates = new ArrayList<>();
for (int i : PathFinder.NEIGHBOURS8)
if (Level.passable[cell + i])
if (Dungeon.level.passable[cell + i])
candidates.add(cell + i);
int newCell = candidates.isEmpty() ? cell : Random.element(candidates);
Dungeon.level.drop( this, newCell ).sprite.drop( cell );
@ -128,7 +127,7 @@ public class Bomb extends Item {
CellEmitter.get( c ).burst( SmokeParticle.FACTORY, 4 );
}
if (Level.flamable[c]) {
if (Dungeon.level.flamable[c]) {
Dungeon.level.destroy( c );
GameScene.updateMap( c );
terrainAffected = true;

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
@ -80,7 +79,7 @@ public class Honeypot extends Item {
@Override
protected void onThrow( int cell ) {
if (Level.pit[cell]) {
if (Dungeon.level.pit[cell]) {
super.onThrow( cell );
} else {
Dungeon.level.drop(shatter( null, cell ), cell);
@ -97,7 +96,7 @@ public class Honeypot extends Item {
int newPos = pos;
if (Actor.findChar( pos ) != null) {
ArrayList<Integer> candidates = new ArrayList<Integer>();
boolean[] passable = Level.passable;
boolean[] passable = Dungeon.level.passable;
for (int n : PathFinder.NEIGHBOURS4) {
int c = pos + n;

View File

@ -56,7 +56,7 @@ public class RogueArmor extends ClassArmor {
if (target != null) {
if (!Level.fieldOfView[target] ||
!(Level.passable[target] || Level.avoid[target]) ||
!(Dungeon.level.passable[target] || Dungeon.level.avoid[target]) ||
Actor.findChar( target ) != null) {
GLog.w( Messages.get(RogueArmor.class, "fov") );

View File

@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Bundle;
@ -54,7 +53,7 @@ public class Multiplicity extends Armor.Glyph {
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = defender.pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
if (Actor.findChar( p ) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
spawnPoints.add( p );
}
}

View File

@ -130,7 +130,7 @@ public class DriedRose extends Artifact {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = hero.pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) {
if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
spawnPoints.add(p);
}
}
@ -269,7 +269,7 @@ public class DriedRose extends Artifact {
int ghostPos;
do {
ghostPos = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
} while (Level.solid[ghostPos] || level.findMob(ghostPos) != null);
} while (Dungeon.level.solid[ghostPos] || level.findMob(ghostPos) != null);
heldGhost.pos = ghostPos;
heldGhost = null;
@ -318,7 +318,7 @@ public class DriedRose extends Artifact {
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = target.pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) {
if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
spawnPoints.add(p);
}
}
@ -573,7 +573,7 @@ public class DriedRose extends Artifact {
if (rose != null && rose.armor != null){
if (rose.armor.hasGlyph(Swiftness.class)) {
speed *= (1.1f + 0.01f * rose.armor.level());
} else if (rose.armor.hasGlyph(Flow.class) && Level.water[pos]){
} else if (rose.armor.hasGlyph(Flow.class) && Dungeon.level.water[pos]){
speed *= (1.5f + 0.05f * rose.armor.level());
}
}
@ -627,7 +627,7 @@ public class DriedRose extends Artifact {
rose.talkedTo = true;
GameScene.show(new WndQuest(this, Messages.get(this, "introduce") ));
return false;
} else if (Level.passable[pos] || Dungeon.hero.flying) {
} else if (Dungeon.level.passable[pos] || Dungeon.hero.flying) {
int curPos = pos;
moveSprite( pos, Dungeon.hero.pos );

View File

@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Chains;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
@ -105,7 +104,7 @@ public class EtherealChains extends Artifact {
if (target != null && (Dungeon.level.visited[target] || Dungeon.level.mapped[target])){
//chains cannot be used to go where it is impossible to walk to
PathFinder.buildDistanceMap(target, BArray.or(Level.passable, Level.avoid, null));
PathFinder.buildDistanceMap(target, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null));
if (PathFinder.distance[curUser.pos] == Integer.MAX_VALUE){
GLog.w( Messages.get(EtherealChains.class, "cant_reach") );
return;
@ -140,7 +139,7 @@ public class EtherealChains extends Artifact {
int bestPos = -1;
for (int i : chain.subPath(1, chain.dist)){
//prefer to the earliest point on the path
if (!Level.solid[i] && Actor.findChar(i) == null){
if (!Dungeon.level.solid[i] && Actor.findChar(i) == null){
bestPos = i;
break;
}
@ -182,7 +181,7 @@ public class EtherealChains extends Artifact {
private void chainLocation( Ballistica chain, final Hero hero ){
//don't pull if the collision spot is in a wall
if (Level.solid[chain.collisionPos]){
if (Dungeon.level.solid[chain.collisionPos]){
GLog.i( Messages.get(this, "inside_wall"));
return;
}
@ -190,7 +189,7 @@ public class EtherealChains extends Artifact {
//don't pull if there are no solid objects next to the pull location
boolean solidFound = false;
for (int i : PathFinder.NEIGHBOURS8){
if (Level.solid[chain.collisionPos + i]){
if (Dungeon.level.solid[chain.collisionPos + i]){
solidFound = true;
break;
}

View File

@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -153,7 +152,9 @@ public class TalismanOfForesight extends Artifact {
for (int y = ay; y <= by; y++) {
for (int x = ax, p = ax + y * Dungeon.level.width(); x <= bx; x++, p++) {
if (Dungeon.visible[p] && Level.secret[p] && Dungeon.level.map[p] != Terrain.SECRET_DOOR)
if (Dungeon.visible[p]
&& Dungeon.level.secret[p]
&& Dungeon.level.map[p] != Terrain.SECRET_DOOR)
smthFound = true;
}
}

View File

@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -215,7 +214,7 @@ public class Potion extends Item {
@Override
protected void onThrow( int cell ) {
if (Dungeon.level.map[cell] == Terrain.WELL || Level.pit[cell]) {
if (Dungeon.level.map[cell] == Terrain.WELL || Dungeon.level.pit[cell]) {
super.onThrow( cell );

View File

@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
@ -41,7 +40,7 @@ public class PotionOfFrost extends Potion {
@Override
public void shatter( int cell ) {
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.losBlocking, null ), DISTANCE );
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
@ -50,7 +49,7 @@ public class PotionOfLiquidFlame extends Potion {
}
for (int offset : PathFinder.NEIGHBOURS9){
if (Level.flamable[cell+offset]
if (Dungeon.level.flamable[cell+offset]
|| Actor.findChar(cell+offset) != null
|| Dungeon.level.heaps.get(cell+offset) != null) {

View File

@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GasesImmunity;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -52,7 +51,7 @@ public class PotionOfPurity extends Potion {
@Override
public void shatter( int cell ) {
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.losBlocking, null ), DISTANCE );
boolean procd = false;

View File

@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
@ -104,7 +103,7 @@ public class CeremonialCandle extends Item {
ArrayList<Integer> candidates = new ArrayList<>();
for (int n : PathFinder.NEIGHBOURS8) {
int cell = ritualPos + n;
if ((Level.passable[cell] || Level.avoid[cell]) && Actor.findChar( cell ) == null) {
if ((Dungeon.level.passable[cell] || Dungeon.level.avoid[cell]) && Actor.findChar( cell ) == null) {
candidates.add( cell );
}
}

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -104,7 +103,7 @@ public class CorpseDust extends Item {
int pos = 0;
do{
pos = Random.Int(Dungeon.level.length());
} while (!Dungeon.visible[pos] || !Level.passable[pos] || Actor.findChar( pos ) != null);
} while (!Dungeon.visible[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null);
Wraith.spawnAt(pos);
Sample.INSTANCE.play(Assets.SND_CURSED);
}

View File

@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -49,7 +48,7 @@ public class ScrollOfMagicMapping extends Scroll {
int length = Dungeon.level.length();
int[] map = Dungeon.level.map;
boolean[] mapped = Dungeon.level.mapped;
boolean[] discoverable = Level.discoverable;
boolean[] discoverable = Dungeon.level.discoverable;
boolean noticed = false;

View File

@ -22,13 +22,13 @@
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
@ -79,7 +79,7 @@ public class ScrollOfMirrorImage extends Scroll {
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = hero.pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
if (Actor.findChar( p ) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
respawnPoints.add( p );
}
}

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -83,9 +82,9 @@ public class ScrollOfTeleportation extends Scroll {
}
public static void teleportToLocation(Hero hero, int pos){
PathFinder.buildDistanceMap(pos, BArray.or(Level.passable, Level.avoid, null));
PathFinder.buildDistanceMap(pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null));
if (PathFinder.distance[hero.pos] == Integer.MAX_VALUE
|| (!Level.passable[pos] && !Level.avoid[pos])
|| (!Dungeon.level.passable[pos] && !Dungeon.level.avoid[pos])
|| Actor.findChar(pos) != null){
GLog.w( Messages.get(ScrollOfTeleportation.class, "cant_reach") );
return;

View File

@ -22,17 +22,16 @@
package com.shatteredpixel.shatteredpixeldungeon.items.wands;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
@ -80,7 +79,7 @@ public class WandOfDisintegration extends DamageWand {
chars.add( ch );
}
if (Level.flamable[c]) {
if (Dungeon.level.flamable[c]) {
Dungeon.level.destroy( c );
GameScene.updateMap( c );
@ -88,7 +87,7 @@ public class WandOfDisintegration extends DamageWand {
}
if (Level.solid[c])
if (Dungeon.level.solid[c])
terrainPassed++;
CellEmitter.center( c ).burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) );

View File

@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -81,7 +80,7 @@ public class WandOfFireblast extends DamageWand {
//only ignite cells directly near caster if they are flammable
if (!Dungeon.level.adjacent(bolt.sourcePos, cell)
|| Level.flamable[cell]){
|| Dungeon.level.flamable[cell]){
GameScene.add( Blob.seed( cell, 1+chargesPerCast(), Fire.class ) );
}
@ -105,7 +104,7 @@ public class WandOfFireblast extends DamageWand {
//burn... BURNNNNN!.....
private void spreadFlames(int cell, float strength){
if (strength >= 0 && (Level.passable[cell] || Level.flamable[cell])){
if (strength >= 0 && (Dungeon.level.passable[cell] || Dungeon.level.flamable[cell])){
affectedCells.add(cell);
if (strength >= 1.5f) {
visualCells.remove(cell);
@ -115,7 +114,7 @@ public class WandOfFireblast extends DamageWand {
} else {
visualCells.add(cell);
}
} else if (!Level.passable[cell])
} else if (!Dungeon.level.passable[cell])
visualCells.add(cell);
}

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
@ -82,7 +81,7 @@ public class WandOfFrost extends DamageWand {
ch.damage(damage, this);
if (ch.isAlive()){
if (Level.water[ch.pos])
if (Dungeon.level.water[ch.pos])
Buff.prolong(ch, Chill.class, 4+level());
else
Buff.prolong(ch, Chill.class, 2+level());

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Lightning;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.LightningTrap;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -68,7 +67,7 @@ public class WandOfLightning extends DamageWand {
//lightning deals less damage per-target, the more targets that are hit.
float multipler = 0.4f + (0.6f/affected.size());
//if the main target is in water, all affected take full damage
if (Level.water[bolt.collisionPos]) multipler = 1f;
if (Dungeon.level.water[bolt.collisionPos]) multipler = 1f;
int min = 5 + level();
int max = 10 + 5*level();
@ -99,12 +98,12 @@ public class WandOfLightning extends DamageWand {
affected.add( ch );
int dist;
if (Level.water[ch.pos] && !ch.flying)
if (Dungeon.level.water[ch.pos] && !ch.flying)
dist = 2;
else
dist = 1;
PathFinder.buildDistanceMap( ch.pos, BArray.not( Level.solid, null ), dist );
PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE){
Char n = Actor.findChar( i );

View File

@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.RainbowParticl
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -105,7 +104,7 @@ public class WandOfPrismaticLight extends DamageWand {
for (int n : PathFinder.NEIGHBOURS9){
int cell = c+n;
if (Level.discoverable[cell])
if (Dungeon.level.discoverable[cell])
Dungeon.level.mapped[cell] = true;
int terr = Dungeon.level.map[cell];

View File

@ -109,7 +109,7 @@ public class WandOfRegrowth extends Wand {
}
private void spreadRegrowth(int cell, float strength){
if (strength >= 0 && Level.passable[cell] && !Level.losBlocking[cell]){
if (strength >= 0 && Dungeon.level.passable[cell] && !Dungeon.level.losBlocking[cell]){
affectedCells.add(cell);
if (strength >= 1.5f) {
spreadRegrowth(cell + PathFinder.CIRCLE8[left(direction)], strength - 1.5f);
@ -118,7 +118,7 @@ public class WandOfRegrowth extends Wand {
} else {
visualCells.add(cell);
}
} else if (!Level.passable[cell] || Level.losBlocking[cell])
} else if (!Dungeon.level.passable[cell] || Dungeon.level.losBlocking[cell])
visualCells.add(cell);
}
@ -199,7 +199,7 @@ public class WandOfRegrowth extends Wand {
float strength = maxDist;
for (int c : bolt.subPath(1, dist)) {
strength--; //as we start at dist 1, not 0.
if (!Level.losBlocking[c]) {
if (!Dungeon.level.losBlocking[c]) {
affectedCells.add(c);
spreadRegrowth(c + PathFinder.CIRCLE8[left(direction)], strength - 1);
spreadRegrowth(c + PathFinder.CIRCLE8[direction], strength - 1);
@ -266,7 +266,7 @@ public class WandOfRegrowth extends Wand {
ArrayList<Integer> candidates = new ArrayList<Integer>();
for (int i : PathFinder.NEIGHBOURS8){
if (Level.passable[pos+i]){
if (Dungeon.level.passable[pos+i]){
candidates.add(pos+i);
}
}
@ -300,7 +300,7 @@ public class WandOfRegrowth extends Wand {
ArrayList<Integer> candidates = new ArrayList<Integer>();
for (int i : PathFinder.NEIGHBOURS8){
if (Level.passable[pos+i]){
if (Dungeon.level.passable[pos+i]){
candidates.add(pos+i);
}
}

View File

@ -21,12 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.Lightning;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.LightningTrap;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.PathFinder;
@ -78,7 +78,7 @@ public class Shocking extends Weapon.Enchantment {
}
affected.add(ch);
ch.damage(Level.water[ch.pos] && !ch.flying ? (int) (damage * 2) : damage, LightningTrap.LIGHTNING);
ch.damage(Dungeon.level.water[ch.pos] && !ch.flying ? 2*damage : damage, LightningTrap.LIGHTNING);
ch.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3);
ch.sprite.flash();

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
@ -28,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
@ -66,7 +66,7 @@ public class IncendiaryDart extends MissileWeapon {
@Override
protected void onThrow( int cell ) {
Char enemy = Actor.findChar( cell );
if ((enemy == null || enemy == curUser) && Level.flamable[cell])
if ((enemy == null || enemy == curUser) && Dungeon.level.flamable[cell])
GameScene.add( Blob.seed( cell, 4, Fire.class ) );
else
super.onThrow( cell );

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Random;
@ -58,7 +57,7 @@ abstract public class MissileWeapon extends Weapon {
@Override
public int throwPos(Hero user, int dst) {
if (hasEnchant(Projecting.class)
&& !Level.solid[dst] && Dungeon.level.distance(user.pos, dst) <= 4){
&& !Dungeon.level.solid[dst] && Dungeon.level.distance(user.pos, dst) <= 4){
return dst;
} else {
return super.throwPos(user, dst);

View File

@ -109,25 +109,25 @@ public abstract class Level implements Bundlable {
protected static final float TIME_TO_RESPAWN = 50;
public int version;
public int[] map;
public boolean[] visited;
public boolean[] mapped;
public boolean[] discoverable;
public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 4 : 8;
//FIXME should not be static!
//TODO even though it would cost more memory, it may make more sense to have this be a property of char.
public static boolean[] fieldOfView;
public static boolean[] passable;
public static boolean[] losBlocking;
public static boolean[] flamable;
public static boolean[] secret;
public static boolean[] solid;
public static boolean[] avoid;
public static boolean[] water;
public static boolean[] pit;
public static boolean[] discoverable;
public boolean[] passable;
public boolean[] losBlocking;
public boolean[] flamable;
public boolean[] secret;
public boolean[] solid;
public boolean[] avoid;
public boolean[] water;
public boolean[] pit;
public Feeling feeling = Feeling.NONE;
@ -620,22 +620,26 @@ public abstract class Level implements Bundlable {
}
}
public static void set( int cell, int terrain ) {
Painter.set( Dungeon.level, cell, terrain );
public static void set( int cell, int terrain ){
set( cell, terrain, Dungeon.level );
}
public static void set( int cell, int terrain, Level level ) {
Painter.set( level, cell, terrain );
if (terrain != Terrain.TRAP && terrain != Terrain.SECRET_TRAP && terrain != Terrain.INACTIVE_TRAP){
Dungeon.level.traps.remove( cell );
level.traps.remove( cell );
}
int flags = Terrain.flags[terrain];
passable[cell] = (flags & Terrain.PASSABLE) != 0;
losBlocking[cell] = (flags & Terrain.LOS_BLOCKING) != 0;
flamable[cell] = (flags & Terrain.FLAMABLE) != 0;
secret[cell] = (flags & Terrain.SECRET) != 0;
solid[cell] = (flags & Terrain.SOLID) != 0;
avoid[cell] = (flags & Terrain.AVOID) != 0;
pit[cell] = (flags & Terrain.PIT) != 0;
water[cell] = terrain == Terrain.WATER;
level.passable[cell] = (flags & Terrain.PASSABLE) != 0;
level.losBlocking[cell] = (flags & Terrain.LOS_BLOCKING) != 0;
level.flamable[cell] = (flags & Terrain.FLAMABLE) != 0;
level.secret[cell] = (flags & Terrain.SECRET) != 0;
level.solid[cell] = (flags & Terrain.SOLID) != 0;
level.avoid[cell] = (flags & Terrain.AVOID) != 0;
level.pit[cell] = (flags & Terrain.PIT) != 0;
level.water[cell] = terrain == Terrain.WATER;
}
public Heap drop( Item item, int cell ) {
@ -688,7 +692,7 @@ public abstract class Level implements Bundlable {
int n;
do {
n = cell + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
} while (!Level.passable[n] && !Level.avoid[n]);
} while (!passable[n] && !avoid[n]);
return drop( item, n );
}

View File

@ -215,7 +215,7 @@ public abstract class RegularLevel extends Level {
Mob mob = createMob();
mob.pos = pointToCell(roomToSpawn.random());
if (findMob(mob.pos) == null && Level.passable[mob.pos]) {
if (findMob(mob.pos) == null && passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
@ -224,7 +224,7 @@ public abstract class RegularLevel extends Level {
mob = createMob();
mob.pos = pointToCell(roomToSpawn.random());
if (findMob(mob.pos) == null && Level.passable[mob.pos]) {
if (findMob(mob.pos) == null && passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
}
@ -261,7 +261,7 @@ public abstract class RegularLevel extends Level {
cell = pointToCell(room.random(1));
if ((Dungeon.level != this || !Dungeon.visible[cell])
&& Actor.findChar( cell ) == null
&& Level.passable[cell]
&& passable[cell]
&& cell != exit) {
return cell;
}
@ -282,7 +282,7 @@ public abstract class RegularLevel extends Level {
}
cell = pointToCell(room.random());
if (Level.passable[cell]) {
if (passable[cell]) {
return cell;
}

View File

@ -22,11 +22,11 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
@ -42,10 +42,10 @@ public class BlazingTrap extends Trap {
@Override
public void activate() {
PathFinder.buildDistanceMap( pos, BArray.not( Level.solid, null ), 2 );
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Level.pit[i] || Level.water[i])
if (Dungeon.level.pit[i] || Dungeon.level.water[i])
GameScene.add(Blob.seed(i, 1, Fire.class));
else
GameScene.add(Blob.seed(i, 5, Fire.class));

View File

@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
@ -50,16 +49,19 @@ public class FlockTrap extends Trap {
{ actPriority = 3; }
protected boolean act() {
PathFinder.buildDistanceMap( pos, BArray.not( Level.solid, null ), 2 );
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE)
if (Dungeon.level.insideMap(i) && Actor.findChar(i) == null && !(Level.pit[i])) {
Sheep sheep = new Sheep();
sheep.lifespan = 2 + Random.Int(Dungeon.depth + 10);
sheep.pos = i;
Dungeon.level.mobPress(sheep);
GameScene.add(sheep);
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Dungeon.level.insideMap(i)
&& Actor.findChar(i) == null
&& !(Dungeon.level.pit[i])) {
Sheep sheep = new Sheep();
sheep.lifespan = 2 + Random.Int(Dungeon.depth + 10);
sheep.pos = i;
Dungeon.level.mobPress(sheep);
GameScene.add(sheep);
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
}
}
}
Sample.INSTANCE.play(Assets.SND_PUFF);

View File

@ -67,11 +67,11 @@ public class PitfallTrap extends Trap {
super.disarm();
int stateChanges = 0;
boolean curPassable = Level.passable[pos + PathFinder.CIRCLE8[PathFinder.CIRCLE8.length-1]];
boolean curPassable = Dungeon.level.passable[pos + PathFinder.CIRCLE8[PathFinder.CIRCLE8.length-1]];
for (int i : PathFinder.CIRCLE8){
if (curPassable != Level.passable[pos + i]){
if (curPassable != Dungeon.level.passable[pos + i]){
stateChanges++;
curPassable = Level.passable[pos + i];
curPassable = Dungeon.level.passable[pos + i];
}
}

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Camera;
@ -51,7 +50,7 @@ public class RockfallTrap extends Trap {
for (int i : PathFinder.NEIGHBOURS9){
if (Level.solid[pos+i])
if (Dungeon.level.solid[pos+i])
continue;
if (Dungeon.visible[ pos+i ]){

View File

@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
@ -60,7 +59,7 @@ public class SummoningTrap extends Trap {
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
if (Actor.findChar( p ) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
candidates.add( p );
}
}

View File

@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.mechanics;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import java.util.ArrayList;
import java.util.List;
@ -103,13 +102,13 @@ public class Ballistica {
while (Dungeon.level.insideMap(cell)) {
//if we're in a wall, collide with the previous cell along the path.
if (stopTerrain && cell != sourcePos && !Level.passable[cell] && !Level.avoid[cell]) {
if (stopTerrain && cell != sourcePos && !Dungeon.level.passable[cell] && !Dungeon.level.avoid[cell]) {
collide(path.get(path.size() - 1));
}
path.add(cell);
if ((stopTerrain && cell != sourcePos && Level.losBlocking[cell])
if ((stopTerrain && cell != sourcePos && Dungeon.level.losBlocking[cell])
|| (cell != sourcePos && stopChars && Actor.findChar( cell ) != null)
|| (cell == to && stopTarget)){
collide(cell);

View File

@ -22,7 +22,6 @@
package com.shatteredpixel.shatteredpixeldungeon.mechanics;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
public final class ShadowCaster {
@ -48,7 +47,7 @@ public final class ShadowCaster {
fieldOfView[y * Dungeon.level.width() + x] = true;
boolean[] losBlocking = Level.losBlocking;
boolean[] losBlocking = Dungeon.level.losBlocking;
Obstacles obs = new Obstacles();
scanSector( distance, fieldOfView, losBlocking, obs, x, y, +1, +1, 0, 0 );

View File

@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.utils.PathFinder;
@ -39,7 +38,7 @@ public class Icecap extends Plant {
@Override
public void activate() {
PathFinder.buildDistanceMap( pos, BArray.not( Level.losBlocking, null ), 1 );
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.losBlocking, null ), 1 );
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );

View File

@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.audio.Sample;
@ -142,7 +141,9 @@ public abstract class Plant implements Bundlable {
@Override
protected void onThrow( int cell ) {
if (Dungeon.level.map[cell] == Terrain.ALCHEMY || Level.pit[cell] || Dungeon.level.traps.get(cell) != null) {
if (Dungeon.level.map[cell] == Terrain.ALCHEMY
|| Dungeon.level.pit[cell]
|| Dungeon.level.traps.get(cell) != null) {
super.onThrow( cell );
} else {
Dungeon.level.plant( this, cell );

View File

@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.TorchHalo;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SnowParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -193,7 +192,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
isMoving = true;
if (visible && Level.water[from] && !ch.flying) {
if (visible && Dungeon.level.water[from] && !ch.flying) {
GameScene.ripple( from );
}
@ -559,7 +558,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
public void onComplete( Tweener tweener ) {
if (tweener == jumpTweener) {
if (visible && Level.water[ch.pos] && !ch.flying) {
if (visible && Dungeon.level.water[ch.pos] && !ch.flying) {
GameScene.ripple( ch.pos );
}
if (jumpCallback != null) {

View File

@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
@ -286,7 +285,7 @@ public class ItemSprite extends MovieClip {
place(heap.pos);
if (visible) {
boolean water = Level.water[heap.pos];
boolean water = Dungeon.level.water[heap.pos];
if (water) {
GameScene.ripple(heap.pos);

View File

@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.TextureFilm;
import com.watabou.utils.Callback;
@ -69,7 +68,7 @@ public class TenguSprite extends MobSprite {
isMoving = true;
if (Level.water[to]) {
if (Dungeon.level.water[to]) {
GameScene.ripple( to );
}

View File

@ -25,7 +25,6 @@ import android.opengl.GLES20;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.watabou.gltextures.SmartTexture;
import com.watabou.gltextures.TextureCache;
import com.watabou.glwrap.Texture;
@ -161,7 +160,7 @@ public class FogOfWar extends Image {
if (cell >= Dungeon.level.length()) continue; //do nothing
if (!Level.discoverable[cell]
if (!Dungeon.level.discoverable[cell]
|| (!visible[cell] && !visited[cell] && !mapped[cell])){
//we skip filling cells here if it isn't a full update
// because they must already be dark

View File

@ -22,7 +22,6 @@
package com.shatteredpixel.shatteredpixeldungeon.tiles;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.Tilemap;
@ -58,7 +57,7 @@ public class WallBlockingTilemap extends Tilemap {
if (prev == CLEARED){
return;
} else if (!Level.discoverable[cell]) {
} else if (!Dungeon.level.discoverable[cell]) {
curr = CLEARED;
//handles blocking wall overhang (which is technically on a none wall tile)

View File

@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -45,9 +44,9 @@ public class WndInfoCell extends Window {
super();
int tile = Dungeon.level.map[cell];
if (Level.water[cell]) {
if (Dungeon.level.water[cell]) {
tile = Terrain.WATER;
} else if (Level.pit[cell]) {
} else if (Dungeon.level.pit[cell]) {
tile = Terrain.CHASM;
}