v0.6.2: made field of vision storage none-static

This commit is contained in:
Evan Debenham 2017-09-16 03:57:53 -04:00
parent 126172d661
commit 68499b213a
92 changed files with 168 additions and 185 deletions

View File

@ -365,8 +365,6 @@ public class Dungeon {
DriedRose.restoreGhostHero( level, pos );
Actor.init();
visible = new boolean[level.length()];
Actor respawner = level.respawner();
if (respawner != null) {
Actor.add( level.respawner() );
@ -747,10 +745,10 @@ public class Dungeon {
return;
}
level.updateFieldOfView(hero, visible);
level.updateFieldOfView(hero, level.heroFOV);
if (hero.buff(MindVision.class) != null || hero.buff(Awareness.class) != null) {
BArray.or( level.visited, visible, 0, visible.length, level.visited );
BArray.or( level.visited, level.heroFOV, 0, level.heroFOV.length, level.visited );
GameScene.updateFog();
} else {
@ -767,7 +765,7 @@ public class Dungeon {
int pos = ax + ay * level.width();
for (int y = ay; y <= by; y++, pos+=level.width()) {
BArray.or( level.visited, visible, pos, len, level.visited );
BArray.or( level.visited, level.heroFOV, pos, len, level.visited );
}
GameScene.updateFog(ax, ay, len, by-ay);

View File

@ -41,7 +41,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Speed;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -79,11 +78,16 @@ public abstract class Char extends Actor {
public int viewDistance = 8;
protected boolean[] fieldOfView = null;
private HashSet<Buff> buffs = new HashSet<>();
@Override
protected boolean act() {
Dungeon.level.updateFieldOfView( this, Level.fieldOfView );
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
fieldOfView = new boolean[Dungeon.level.length()];
}
Dungeon.level.updateFieldOfView( this, fieldOfView );
return false;
}
@ -126,7 +130,7 @@ public abstract class Char extends Actor {
if (enemy == null || !enemy.isAlive()) return false;
boolean visibleFight = Dungeon.visible[pos] || Dungeon.visible[enemy.pos];
boolean visibleFight = Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[enemy.pos];
if (hit( this, enemy, false )) {
@ -266,7 +270,7 @@ public abstract class Char extends Actor {
if (buff( Paralysis.class ) != null) {
if (Random.Int( dmg ) >= Random.Int( HP )) {
Buff.detach( this, Paralysis.class );
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
GLog.i( Messages.get(Char.class, "out_of_paralysis", name) );
}
}
@ -433,7 +437,7 @@ public abstract class Char extends Actor {
}
if (this != Dungeon.hero) {
sprite.visible = Dungeon.visible[pos];
sprite.visible = Dungeon.level.heroFOV[pos];
}
}

View File

@ -39,7 +39,7 @@ public class Alchemy extends Blob {
if (Dungeon.level.insideMap(cell)) {
off[cell] = cur[cell];
volume += off[cell];
if (off[cell] > 0 && Dungeon.visible[cell]){
if (off[cell] > 0 && Dungeon.level.heroFOV[cell]){
Notes.add( Notes.Landmark.ALCHEMY );
}
}

View File

@ -55,7 +55,7 @@ public class Foliage extends Blob {
GameScene.updateMap(cell);
}
visible = visible || Dungeon.visible[cell];
visible = visible || Dungeon.level.heroFOV[cell];
} else {
off[cell] = 0;

View File

@ -54,7 +54,7 @@ public class Freezing {
heap.freeze();
}
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
CellEmitter.get( cell ).start( SnowParticle.FACTORY, 0.2f, 6 );
return true;
} else {

View File

@ -56,7 +56,7 @@ public class WaterOfAwareness extends WellWater {
Dungeon.level.discover( i );
if (Dungeon.visible[i]) {
if (Dungeon.level.heroFOV[i]) {
GameScene.discoverTile( i, terr );
}
}

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Rat;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Effects;
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;
@ -272,7 +271,7 @@ public class Preparation extends Buff implements ActionIndicator.Action {
Dungeon.hero.pos = attackPos;
Dungeon.level.press(Dungeon.hero.pos, Dungeon.hero);
//prevents the hero from being interrupted by seeing new enemies
Dungeon.level.updateFieldOfView(Dungeon.hero, Level.fieldOfView);
Dungeon.observe();
Dungeon.hero.checkVisibleMobs();
Dungeon.hero.sprite.place( Dungeon.hero.pos );

View File

@ -608,7 +608,7 @@ public class Hero extends Char {
} else {
if (Level.fieldOfView[npc.pos] && getCloser( npc.pos )) {
if (fieldOfView[npc.pos] && getCloser( npc.pos )) {
return true;
@ -875,7 +875,7 @@ public class Hero extends Char {
} else {
if (Level.fieldOfView[enemy.pos] && getCloser( enemy.pos )) {
if (fieldOfView[enemy.pos] && getCloser( enemy.pos )) {
return true;
@ -980,7 +980,7 @@ public class Hero extends Char {
Mob target = null;
for (Mob m : Dungeon.level.mobs) {
if (Level.fieldOfView[ m.pos ] && m.hostile) {
if (Dungeon.level.heroFOV[ m.pos ] && m.hostile) {
visible.add(m);
if (!visibleEnemies.contains( m )) {
newMob = true;
@ -998,7 +998,7 @@ public class Hero extends Char {
if (target != null && (QuickSlotButton.lastTarget == null ||
!QuickSlotButton.lastTarget.isAlive() ||
!Dungeon.visible[QuickSlotButton.lastTarget.pos])){
!Dungeon.level.heroFOV[QuickSlotButton.lastTarget.pos])){
QuickSlotButton.target(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 (!Dungeon.level.passable[cell] || (Dungeon.visible[cell] && Actor.findChar(cell) != null)) {
if (!Dungeon.level.passable[cell] || (fieldOfView[cell] && Actor.findChar(cell) != null)) {
newPath = true;
break;
}
@ -1080,7 +1080,7 @@ public class Hero extends Char {
passable[i] = p[i] && (v[i] || m[i]);
}
path = Dungeon.findPath(this, pos, target, passable, Level.fieldOfView);
path = Dungeon.findPath(this, pos, target, passable, fieldOfView);
}
if (path == null) return false;
@ -1135,7 +1135,7 @@ public class Hero extends Char {
curAction = new HeroAction.Alchemy( cell );
} else if (Level.fieldOfView[cell] && (ch = Actor.findChar( cell )) instanceof Mob) {
} else if (Dungeon.level.heroFOV[cell] && (ch = Actor.findChar( cell )) instanceof Mob) {
if (ch instanceof NPC) {
curAction = new HeroAction.Interact( (NPC)ch );
@ -1508,7 +1508,7 @@ public class Hero extends Char {
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] && p != pos) {
if (Dungeon.level.heroFOV[p] && p != pos) {
if (intentional) {
sprite.parent.addToBack( new CheckedCell( p ) );

View File

@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.BeeSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
@ -122,7 +121,7 @@ public class Bee extends Mob {
//if already targeting something, and that thing is still alive and near the pot, keeping targeting it.
if (enemy != null && enemy.isAlive() && Dungeon.level.mobs.contains(enemy)
&& Level.fieldOfView[enemy.pos] && enemy.invisible == 0
&& fieldOfView[enemy.pos] && enemy.invisible == 0
&& Dungeon.level.distance(enemy.pos, potPos) <= 3)
return enemy;

View File

@ -80,7 +80,7 @@ public class Brute extends Mob {
if (isAlive() && !enraged && HP < HT / 4) {
enraged = true;
spend( TICK );
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "enraged") );
}
}

View File

@ -101,7 +101,7 @@ public class DM300 extends Mob {
HP += Random.Int( 1, HT - HP );
sprite.emitter().burst( ElmoParticle.FACTORY, 5 );
if (Dungeon.visible[step] && Dungeon.hero.isAlive()) {
if (Dungeon.level.heroFOV[step] && Dungeon.hero.isAlive()) {
GLog.n( Messages.get(this, "repair") );
}
}
@ -115,7 +115,7 @@ public class DM300 extends Mob {
};
int cell = cells[Random.Int( cells.length )];
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
CellEmitter.get( cell ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
Camera.main.shake( 3, 0.7f );
Sample.INSTANCE.play( Assets.SND_ROCKS );

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfDisintegration;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -92,7 +91,7 @@ public class Eye extends Mob {
if (beamCooldown == 0) {
Ballistica aim = new Ballistica(pos, enemy.pos, Ballistica.STOP_TERRAIN);
if (enemy.invisible == 0 && !isCharmedBy(enemy) && Level.fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){
if (enemy.invisible == 0 && !isCharmedBy(enemy) && fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){
beam = aim;
beamTarget = aim.collisionPos;
return true;
@ -135,7 +134,7 @@ public class Eye extends Mob {
spend( attackDelay() );
beam = new Ballistica(pos, beamTarget, Ballistica.STOP_TERRAIN);
if (Dungeon.visible[pos] || Dungeon.visible[beam.collisionPos] ) {
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[beam.collisionPos] ) {
sprite.zap( beam.collisionPos );
return false;
} else {
@ -179,7 +178,7 @@ public class Eye extends Mob {
if (hit( this, ch, true )) {
ch.damage( Random.NormalIntRange( 30, 50 ), this );
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
ch.sprite.flash();
CellEmitter.center( pos ).burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) );
}

View File

@ -157,7 +157,7 @@ public class Goo extends Mob {
return true;
} else if (pumpedUp >= 2 || Random.Int( (HP*2 <= HT) ? 2 : 5 ) > 0) {
boolean visible = Dungeon.visible[pos];
boolean visible = Dungeon.level.heroFOV[pos];
if (visible) {
if (pumpedUp >= 2) {
@ -186,7 +186,7 @@ public class Goo extends Mob {
}
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "!!!") );
GLog.n( Messages.get(this, "pumpup") );
}

View File

@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -67,7 +66,8 @@ public class Guard extends Mob {
@Override
protected boolean act() {
Dungeon.level.updateFieldOfView( this, Level.fieldOfView );
//FIXME should handle chaining in an extended hunting aistate
/*Dungeon.level.updateFieldOfView( this, fieldOfView );
if (state == HUNTING &&
paralysed <= 0 &&
@ -82,9 +82,9 @@ public class Guard extends Mob {
return false;
} else {
} else {*/
return super.act();
}
//}
}
private boolean chain(int target){

View File

@ -315,7 +315,7 @@ public class King extends Mob {
public void die( Object cause ) {
super.die( cause );
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
Sample.INSTANCE.play( Assets.SND_BONES );
}
}

View File

@ -147,7 +147,7 @@ public class Mimic extends Mob {
m.sprite.turnTo( pos, Dungeon.hero.pos );
if (Dungeon.visible[m.pos]) {
if (Dungeon.level.heroFOV[m.pos]) {
CellEmitter.get( pos ).burst( Speck.factory( Speck.STAR ), 10 );
Sample.INSTANCE.play( Assets.SND_MIMIC );
}

View File

@ -47,7 +47,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -171,7 +170,7 @@ public abstract class Mob extends Char {
enemy = chooseEnemy();
boolean enemyInFOV = enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0;
boolean enemyInFOV = enemy != null && enemy.isAlive() && fieldOfView[enemy.pos] && enemy.invisible <= 0;
return state.act( enemyInFOV, justAlerted );
}
@ -207,7 +206,7 @@ public abstract class Mob extends Char {
//look for enemy mobs to attack, which are also not corrupted
for (Mob mob : Dungeon.level.mobs)
if (mob != this && Level.fieldOfView[mob.pos] && mob.hostile && mob.buff(Corruption.class) == null)
if (mob != this && fieldOfView[mob.pos] && mob.hostile && mob.buff(Corruption.class) == null)
enemies.add(mob);
if (enemies.size() > 0) return Random.element(enemies);
@ -219,13 +218,13 @@ public abstract class Mob extends Char {
//try to find an enemy mob to attack first.
for (Mob mob : Dungeon.level.mobs)
if (mob != this && Level.fieldOfView[mob.pos] && mob.hostile)
if (mob != this && fieldOfView[mob.pos] && mob.hostile)
enemies.add(mob);
if (enemies.size() > 0) return Random.element(enemies);
//try to find ally mobs to attack second.
for (Mob mob : Dungeon.level.mobs)
if (mob != this && Level.fieldOfView[mob.pos] && mob.ally)
if (mob != this && fieldOfView[mob.pos] && mob.ally)
enemies.add(mob);
if (enemies.size() > 0) return Random.element(enemies);
@ -236,7 +235,7 @@ public abstract class Mob extends Char {
//try to find ally mobs to attack.
for (Mob mob : Dungeon.level.mobs)
if (mob != this && Level.fieldOfView[mob.pos] && mob.ally)
if (mob != this && fieldOfView[mob.pos] && mob.ally)
enemies.add(mob);
//and add the hero to the list of targets.
@ -261,7 +260,7 @@ public abstract class Mob extends Char {
protected boolean moveSprite( int from, int to ) {
if (sprite.isVisible() && (Dungeon.visible[from] || Dungeon.visible[to])) {
if (sprite.isVisible() && (Dungeon.level.heroFOV[from] || Dungeon.level.heroFOV[to])) {
sprite.move( from, to );
return true;
} else {
@ -366,7 +365,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 (!Dungeon.level.passable[cell] || ( Level.fieldOfView[cell] && Actor.findChar(cell) != null)) {
if (!Dungeon.level.passable[cell] || ( fieldOfView[cell] && Actor.findChar(cell) != null)) {
newPath = true;
break;
}
@ -376,7 +375,7 @@ public abstract class Mob extends Char {
if (newPath) {
path = Dungeon.findPath(this, pos, target,
Dungeon.level.passable,
Level.fieldOfView);
fieldOfView);
}
//if hunting something, don't follow a path that is extremely inefficient
@ -401,7 +400,7 @@ public abstract class Mob extends Char {
protected boolean getFurther( int target ) {
int step = Dungeon.flee( this, pos, target,
Dungeon.level.passable,
Level.fieldOfView );
fieldOfView );
if (step != -1) {
move( step );
return true;
@ -432,7 +431,7 @@ public abstract class Mob extends Char {
protected boolean doAttack( Char enemy ) {
boolean visible = Dungeon.visible[pos];
boolean visible = Dungeon.level.heroFOV[pos];
if (visible) {
sprite.attack( enemy.pos );
@ -572,7 +571,7 @@ public abstract class Mob extends Char {
}
}
if (Dungeon.hero.isAlive() && !Dungeon.visible[pos]) {
if (Dungeon.hero.isAlive() && !Dungeon.level.heroFOV[pos]) {
GLog.i( Messages.get(this, "died") );
}
}

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.PiranhaSprite;
import com.watabou.utils.Random;
@ -57,13 +56,15 @@ public class Piranha extends Mob {
@Override
protected boolean act() {
if (!Dungeon.level.water[pos]) {
die( null );
sprite.killAndErase();
return true;
} else {
//FIXME should handle this is an extended hunting
//this causes pirahna to move away when a door is closed on them.
Dungeon.level.updateFieldOfView( this, Level.fieldOfView );
/*Dungeon.level.updateFieldOfView( this, Level.fieldOfView );
enemy = chooseEnemy();
if (state == this.HUNTING &&
!(enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0)){
@ -77,7 +78,7 @@ public class Piranha extends Mob {
} while (!getCloser(target));
moveSprite( oldPos, pos );
return true;
}
}*/
return super.act();
}
@ -121,7 +122,7 @@ public class Piranha extends Mob {
int step = Dungeon.findStep( this, pos, target,
Dungeon.level.water,
Level.fieldOfView );
fieldOfView );
if (step != -1) {
move( step );
return true;
@ -134,7 +135,7 @@ public class Piranha extends Mob {
protected boolean getFurther( int target ) {
int step = Dungeon.flee( this, pos, target,
Dungeon.level.water,
Level.fieldOfView );
fieldOfView );
if (step != -1) {
move( step );
return true;

View File

@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
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;
@ -84,7 +83,7 @@ public class Shaman extends Mob implements Callback {
} else {
boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos];
boolean visible = fieldOfView[pos] || fieldOfView[enemy.pos];
if (visible) {
sprite.zap( enemy.pos );
}

View File

@ -75,7 +75,7 @@ public class Skeleton extends Mob {
}
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
Sample.INSTANCE.play( Assets.SND_BONES );
}

View File

@ -79,7 +79,7 @@ public class Statue extends Mob {
@Override
protected boolean act() {
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
Notes.add( Notes.Landmark.STATUE );
}
return super.act();

View File

@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SuccubusSprite;
import com.watabou.noosa.audio.Sample;
@ -85,7 +84,7 @@ public class Succubus extends Mob {
@Override
protected boolean getCloser( int target ) {
if (Level.fieldOfView[target] && Dungeon.level.distance( pos, target ) > 2 && delay <= 0) {
if (fieldOfView[target] && Dungeon.level.distance( pos, target ) > 2 && delay <= 0) {
blink( target );
spend( -1 / speed() );

View File

@ -170,7 +170,7 @@ public class Tengu extends Mob {
int trapPos;
do {
trapPos = Random.Int( Dungeon.level.length() );
} while (!Level.fieldOfView[trapPos] || Dungeon.level.solid[trapPos]);
} while (!fieldOfView[trapPos] || Dungeon.level.solid[trapPos]);
if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) {
Dungeon.level.setTrap( new SpearTrap().reveal(), trapPos );
@ -201,13 +201,13 @@ public class Tengu extends Mob {
Actor.findChar(newPos) != null);
}
if (Dungeon.visible[pos]) CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
if (Dungeon.level.heroFOV[pos]) CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
sprite.move( pos, newPos );
move( newPos );
if (Dungeon.visible[newPos]) CellEmitter.get( newPos ).burst( Speck.factory( Speck.WOOL ), 6 );
if (Dungeon.level.heroFOV[newPos]) CellEmitter.get( newPos ).burst( Speck.factory( Speck.WOOL ), 6 );
Sample.INSTANCE.play( Assets.SND_PUFF );
spend( 1 / speed() );

View File

@ -203,7 +203,7 @@ public class Thief extends Mob {
if (enemySeen) {
sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Mob.class, "rage"));
state = HUNTING;
} else if (item != null && !Dungeon.visible[pos]) {
} else if (item != null && !Dungeon.level.heroFOV[pos]) {
int count = 32;
int newPos;
@ -212,15 +212,15 @@ public class Thief extends Mob {
if (count-- <= 0) {
break;
}
} while (newPos == -1 || Dungeon.visible[newPos] || Dungeon.level.distance(newPos, pos) < (count/3));
} while (newPos == -1 || Dungeon.level.heroFOV[newPos] || Dungeon.level.distance(newPos, pos) < (count/3));
if (newPos != -1) {
if (Dungeon.visible[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6);
if (Dungeon.level.heroFOV[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6);
pos = newPos;
sprite.place( pos );
sprite.visible = Dungeon.visible[pos];
if (Dungeon.visible[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6);
sprite.visible = Dungeon.level.heroFOV[pos];
if (Dungeon.level.heroFOV[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6);
}

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
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.sprites.CharSprite;
@ -87,7 +86,7 @@ public class Warlock extends Mob implements Callback {
} else {
boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos];
boolean visible = fieldOfView[pos] || fieldOfView[enemy.pos];
if (visible) {
sprite.zap( enemy.pos );
} else {

View File

@ -144,7 +144,7 @@ public class Ghost extends NPC {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
pos = newPos;
sprite.place(pos);
sprite.visible = Dungeon.visible[pos];
sprite.visible = Dungeon.level.heroFOV[pos];
}
}
}

View File

@ -54,7 +54,7 @@ public class Imp extends NPC {
@Override
protected boolean act() {
if (!Quest.given && Dungeon.visible[pos]) {
if (!Quest.given && Dungeon.level.heroFOV[pos]) {
if (!seenBefore) {
yell( Messages.get(this, "hey", Dungeon.hero.givenName() ) );
}

View File

@ -40,7 +40,7 @@ public class ImpShopkeeper extends Shopkeeper {
@Override
protected boolean act() {
if (!seenBefore && Dungeon.visible[pos]) {
if (!seenBefore && Dungeon.level.heroFOV[pos]) {
yell( Messages.get(this, "greetings", Dungeon.hero.givenName() ) );
seenBefore = true;
}

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MirrorSprite;
import com.watabou.utils.Bundle;
@ -100,7 +99,7 @@ public class MirrorImage extends NPC {
HashSet<Mob> enemies = new HashSet<>();
for (Mob mob : Dungeon.level.mobs) {
if (mob.hostile
&& Level.fieldOfView[mob.pos]
&& fieldOfView[mob.pos]
&& mob.state != mob.PASSIVE) {
enemies.add(mob);
}

View File

@ -22,8 +22,8 @@
package com.shatteredpixel.shatteredpixeldungeon.effects;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.noosa.particles.Emitter;
import com.watabou.utils.Random;
@ -56,7 +56,7 @@ public class BlobEmitter extends Emitter {
for (int i = blob.area.left; i < blob.area.right; i++) {
for (int j = blob.area.top; j < blob.area.bottom; j++) {
cell = i + j*Dungeon.level.width();
if (map[cell] > 0 && Dungeon.visible[cell]) {
if (map[cell] > 0 && Dungeon.level.heroFOV[cell]) {
float x = (i + Random.Float()) * size;
float y = (j + Random.Float()) * size;
factory.emit(this, index, x, y);

View File

@ -96,7 +96,7 @@ public class FlowParticle extends PixelParticle {
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
if (visible = Dungeon.level.heroFOV[pos]) {
super.update();

View File

@ -99,7 +99,7 @@ public class WindParticle extends PixelParticle {
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
if (visible = Dungeon.level.heroFOV[pos]) {
super.update();

View File

@ -115,7 +115,7 @@ public class Bomb extends Item {
Sample.INSTANCE.play( Assets.SND_BLAST );
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
CellEmitter.center( cell ).burst( BlastParticle.FACTORY, 30 );
}
@ -123,7 +123,7 @@ public class Bomb extends Item {
for (int n : PathFinder.NEIGHBOURS9) {
int c = cell + n;
if (c >= 0 && c < Dungeon.level.length()) {
if (Dungeon.visible[c]) {
if (Dungeon.level.heroFOV[c]) {
CellEmitter.get( c ).burst( SmokeParticle.FACTORY, 4 );
}

View File

@ -252,7 +252,7 @@ public class Heap implements Bundlable {
if (burnt || evaporated) {
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
if (burnt) {
burnFX( pos );
} else {

View File

@ -88,7 +88,7 @@ public class Honeypot extends Item {
public Item shatter( Char owner, int pos ) {
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
Sample.INSTANCE.play( Assets.SND_SHATTER );
Splash.at( pos, 0xffd500, 5 );
}

View File

@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
@ -49,7 +48,7 @@ public class HuntressArmor extends ClassArmor {
Item proto = new Shuriken();
for (Mob mob : Dungeon.level.mobs) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Callback callback = new Callback() {
@Override

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
@ -43,7 +42,7 @@ public class MageArmor extends ClassArmor {
public void doSpecial() {
for (Mob mob : Dungeon.level.mobs) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.affect( mob, Burning.class ).reignite( mob );
Buff.prolong( mob, Roots.class, 3 );
}

View File

@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -55,7 +54,7 @@ public class RogueArmor extends ClassArmor {
public void onSelect( Integer target ) {
if (target != null) {
if (!Level.fieldOfView[target] ||
if (!Dungeon.level.heroFOV[target] ||
!(Dungeon.level.passable[target] || Dungeon.level.avoid[target]) ||
Actor.findChar( target ) != null) {
@ -66,7 +65,7 @@ public class RogueArmor extends ClassArmor {
curUser.HP -= (curUser.HP / 3);
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.prolong( mob, Blindness.class, 2 );
if (mob.state == mob.HUNTING) mob.state = mob.WANDERING;
mob.sprite.emitter().burst( Speck.factory( Speck.LIGHT ), 4 );

View File

@ -475,7 +475,7 @@ public class DriedRose extends Artifact {
HashSet<Mob> enemies = new HashSet<>();
for (Mob mob : Dungeon.level.mobs) {
if (mob.hostile
&& Level.fieldOfView[mob.pos]
&& fieldOfView[mob.pos]
&& Dungeon.level.distance(mob.pos, Dungeon.hero.pos) <= 8
&& mob.state != mob.PASSIVE) {
enemies.add(mob);

View File

@ -233,7 +233,7 @@ public class LloydsBeacon extends Artifact {
ch.pos = pos;
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.visible[pos];
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}

View File

@ -82,7 +82,7 @@ public class TalismanOfForesight extends Artifact {
GameScene.updateMap(i);
if (Dungeon.visible[i]) {
if (Dungeon.level.heroFOV[i]) {
GameScene.discoverTile(i, terr);
}
}
@ -152,7 +152,7 @@ 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]
if (Dungeon.level.heroFOV[p]
&& Dungeon.level.secret[p]
&& Dungeon.level.map[p] != Terrain.SECRET_DOOR)
smthFound = true;

View File

@ -231,7 +231,7 @@ public class Potion extends Item {
}
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
GLog.i( Messages.get(Potion.class, "shatter") );
Sample.INSTANCE.play( Assets.SND_SHATTER );
splash( cell );

View File

@ -42,7 +42,7 @@ public class PotionOfLevitation extends Potion {
@Override
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );

View File

@ -41,7 +41,7 @@ public class PotionOfLiquidFlame extends Potion {
@Override
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );

View File

@ -37,7 +37,7 @@ public class PotionOfParalyticGas extends Potion {
@Override
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );

View File

@ -80,7 +80,7 @@ public class PotionOfPurity extends Potion {
blob.volume -= value;
procd = true;
if (Dungeon.visible[i]) {
if (Dungeon.level.heroFOV[i]) {
CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 1 );
}
}
@ -93,7 +93,7 @@ public class PotionOfPurity extends Potion {
if (procd) {
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}

View File

@ -37,7 +37,7 @@ public class PotionOfToxicGas extends Potion {
@Override
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );

View File

@ -103,7 +103,7 @@ public class CorpseDust extends Item {
int pos = 0;
do{
pos = Random.Int(Dungeon.level.length());
} while (!Dungeon.visible[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null);
} while (!Dungeon.level.heroFOV[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null);
Wraith.spawnAt(pos);
Sample.INSTANCE.play(Assets.SND_CURSED);
}

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
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.audio.Sample;
@ -47,7 +46,7 @@ public class ScrollOfLullaby extends Scroll {
Invisibility.dispel();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.affect( mob, Drowsy.class );
mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
}
@ -66,7 +65,7 @@ public class ScrollOfLullaby extends Scroll {
public void empoweredRead() {
doRead();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff drowsy = mob.buff(Drowsy.class);
if (drowsy != null) drowsy.act();
}

View File

@ -63,7 +63,7 @@ public class ScrollOfMagicMapping extends Scroll {
Dungeon.level.discover( i );
if (Dungeon.visible[i]) {
if (Dungeon.level.heroFOV[i]) {
GameScene.discoverTile( i, terr );
discover( i );

View File

@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -52,7 +51,7 @@ public class ScrollOfPsionicBlast extends Scroll {
Invisibility.dispel();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
mob.damage(mob.HT, this );
}
}
@ -80,7 +79,7 @@ public class ScrollOfPsionicBlast extends Scroll {
Invisibility.dispel();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
mob.damage(mob.HT, this );
}
}

View File

@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@ -46,7 +45,7 @@ public class ScrollOfRage extends Scroll {
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
mob.beckon( curUser.pos );
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.prolong(mob, Amok.class, 5f);
}
}
@ -74,7 +73,7 @@ public class ScrollOfRage extends Scroll {
@Override
public void empoweredRead() {
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.prolong(mob, Amok.class, 5f);
}
}

View File

@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@ -50,7 +49,7 @@ public class ScrollOfTerror extends Scroll {
int count = 0;
Mob affected = null;
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.affect( mob, Terror.class, Terror.DURATION ).object = curUser.id();
if (mob.buff(Terror.class) != null){
@ -79,7 +78,7 @@ public class ScrollOfTerror extends Scroll {
public void empoweredRead() {
doRead();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
if (Dungeon.level.heroFOV[mob.pos]) {
Terror t = mob.buff(Terror.class);
if (t != null){
Buff.prolong(mob, Terror.class, Terror.DURATION*1.5f);

View File

@ -166,7 +166,7 @@ public class CursedWand {
} else {
ch.pos = pos;
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.visible[pos];
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}
wand.wandUsed();

View File

@ -48,13 +48,13 @@ public class Displacing extends Weapon.Enchantment {
if (newPos != -1 && !Dungeon.bossLevel()) {
if (Dungeon.visible[defender.pos]) {
if (Dungeon.level.heroFOV[defender.pos]) {
CellEmitter.get( defender.pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 );
}
defender.pos = newPos;
defender.sprite.place( defender.pos );
defender.sprite.visible = Dungeon.visible[defender.pos];
defender.sprite.visible = Dungeon.level.heroFOV[defender.pos];
return 0;

View File

@ -241,7 +241,7 @@ public class CavesBossLevel extends Level {
} while (
!passable[boss.pos] ||
!outsideEntraceRoom( boss.pos ) ||
Dungeon.visible[boss.pos]);
heroFOV[boss.pos]);
GameScene.add( boss );
set( arenaDoor, Terrain.WALL );

View File

@ -180,7 +180,7 @@ public class CavesLevel extends RegularLevel {
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
if (visible = Dungeon.level.heroFOV[pos]) {
super.update();

View File

@ -213,10 +213,10 @@ public class CityBossLevel extends Level {
} while (
!passable[boss.pos] ||
!outsideEntraceRoom( boss.pos ) ||
(Dungeon.visible[boss.pos] && count++ < 20));
(heroFOV[boss.pos] && count++ < 20));
GameScene.add( boss );
if (Dungeon.visible[boss.pos]) {
if (heroFOV[boss.pos]) {
boss.notice();
boss.sprite.alpha( 0 );
boss.sprite.parent.add( new AlphaTweener( boss.sprite, 1, 0.1f ) );

View File

@ -187,7 +187,7 @@ public class CityLevel extends RegularLevel {
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
if (visible = Dungeon.level.heroFOV[pos]) {
super.update();
}
}

View File

@ -205,7 +205,7 @@ public class HallsBossLevel extends Level {
boss.pos = Random.Int( length() );
} while (
!passable[boss.pos] ||
Dungeon.visible[boss.pos]);
heroFOV[boss.pos]);
GameScene.add( boss );
boss.spawnFists();

View File

@ -183,7 +183,7 @@ public class HallsLevel extends RegularLevel {
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
if (visible = Dungeon.level.heroFOV[pos]) {
super.update();

View File

@ -116,9 +116,8 @@ public abstract class Level implements Bundlable {
public boolean[] discoverable;
public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 4 : 8;
//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 boolean[] heroFOV;
public boolean[] passable;
public boolean[] losBlocking;
@ -255,22 +254,21 @@ public abstract class Level implements Bundlable {
length = w * h;
map = new int[length];
Arrays.fill( map, Terrain.WALL );
Arrays.fill( map, feeling == Level.Feeling.CHASM ? Terrain.CHASM : Terrain.WALL );
visited = new boolean[length];
mapped = new boolean[length];
visited = new boolean[length];
mapped = new boolean[length];
fieldOfView = new boolean[length()];
heroFOV = new boolean[length];
passable = new boolean[length()];
losBlocking = new boolean[length()];
flamable = new boolean[length()];
secret = new boolean[length()];
solid = new boolean[length()];
avoid = new boolean[length()];
water = new boolean[length()];
pit = new boolean[length()];
passable = new boolean[length];
losBlocking = new boolean[length];
flamable = new boolean[length];
secret = new boolean[length];
solid = new boolean[length];
avoid = new boolean[length];
water = new boolean[length];
pit = new boolean[length];
PathFinder.setMapSize(w, h);
}
@ -530,7 +528,7 @@ public abstract class Level implements Bundlable {
int cell;
do {
cell = Random.Int( length() );
} while ((Dungeon.level == this && Dungeon.visible[cell])
} while ((Dungeon.level == this && heroFOV[cell])
|| !passable[cell]
|| Actor.findChar( cell ) != null);
return cell;
@ -677,7 +675,7 @@ public abstract class Level implements Bundlable {
if (heap == null) {
heap = new Heap();
heap.seen = Dungeon.level == this && Dungeon.visible[cell];
heap.seen = Dungeon.level == this && heroFOV[cell];
heap.pos = cell;
if (map[cell] == Terrain.CHASM || (Dungeon.level != null && pit[cell])) {
Dungeon.dropToChasm( item );

View File

@ -165,7 +165,7 @@ public class PrisonLevel extends RegularLevel {
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
if (visible = Dungeon.level.heroFOV[pos]) {
super.update();
}
}

View File

@ -259,7 +259,7 @@ public abstract class RegularLevel extends Level {
}
cell = pointToCell(room.random(1));
if ((Dungeon.level != this || !Dungeon.visible[cell])
if (!heroFOV[cell]
&& Actor.findChar( cell ) == null
&& passable[cell]
&& cell != exit) {

View File

@ -178,7 +178,7 @@ public class SewerLevel extends RegularLevel {
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
if (visible = Dungeon.level.heroFOV[pos]) {
super.update();

View File

@ -34,7 +34,7 @@ public class Door {
Level.set( pos, Terrain.OPEN_DOOR );
GameScene.updateMap( pos );
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
Dungeon.observe();
Sample.INSTANCE.play( Assets.SND_OPEN );
}
@ -44,7 +44,7 @@ public class Door {
if (Dungeon.level.heaps.get( pos ) == null) {
Level.set( pos, Terrain.DOOR );
GameScene.updateMap( pos );
if (Dungeon.visible[pos])
if (Dungeon.level.heroFOV[pos])
Dungeon.observe();
}
}

View File

@ -104,7 +104,6 @@ public class HighGrass {
}
CellEmitter.get( pos ).burst( LeafParticle.LEVEL_SPECIFIC, leaves );
if (Dungeon.visible[pos])
Dungeon.observe();
if (Dungeon.level.heroFOV[pos]) Dungeon.observe();
}
}

View File

@ -44,7 +44,7 @@ public class AlarmTrap extends Trap {
mob.beckon( pos );
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
GLog.w( Messages.get(this, "alarm") );
CellEmitter.center( pos ).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 );
}

View File

@ -42,7 +42,7 @@ public class ChillingTrap extends Trap{
@Override
public void activate() {
if (Dungeon.visible[ pos ]){
if (Dungeon.level.heroFOV[ pos ]){
Splash.at( pos, 0xFFB2D6FF, 5);
Sample.INSTANCE.play( Assets.SND_SHATTER );
}

View File

@ -53,7 +53,7 @@ public class CursingTrap extends Trap {
@Override
public void activate() {
if (Dungeon.visible[ pos ]) {
if (Dungeon.level.heroFOV[ pos ]) {
CellEmitter.get(pos).burst(ShadowParticle.UP, 5);
Sample.INSTANCE.play(Assets.SND_CURSED);
}

View File

@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@ -33,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -47,7 +47,7 @@ public class DisintegrationTrap extends Trap {
@Override
public void activate() {
if (Dungeon.visible[ pos ]) {
if (Dungeon.level.heroFOV[ pos ]) {
ShatteredPixelDungeon.scene().add( new Beam.DeathRay( DungeonTilemap.tileCenterToWorld(pos-1),
DungeonTilemap.tileCenterToWorld(pos+1)));
ShatteredPixelDungeon.scene().add(new Beam.DeathRay(DungeonTilemap.tileCenterToWorld(pos - Dungeon.level.width()),

View File

@ -59,7 +59,7 @@ public class FlashingTrap extends Trap {
}
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
GameScene.flash(0xFFFFFF);
CellEmitter.get(pos).burst( Speck.factory(Speck.LIGHT), 4 );
}

View File

@ -44,7 +44,7 @@ public class FrostTrap extends Trap {
@Override
public void activate() {
if (Dungeon.visible[ pos ]){
if (Dungeon.level.heroFOV[ pos ]){
Splash.at( pos, 0xFFB2D6FF, 10);
Sample.INSTANCE.play( Assets.SND_SHATTER );
}

View File

@ -47,7 +47,7 @@ public class GuardianTrap extends Trap {
mob.beckon( pos );
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
GLog.w( Messages.get(this, "alarm") );
CellEmitter.center(pos).start( Speck.factory(Speck.SCREAM), 0.3f, 3 );
}

View File

@ -53,7 +53,7 @@ public class RockfallTrap extends Trap {
if (Dungeon.level.solid[pos+i])
continue;
if (Dungeon.visible[ pos+i ]){
if (Dungeon.level.heroFOV[ pos+i ]){
CellEmitter.get( pos + i - Dungeon.level.width() ).start(Speck.factory(Speck.ROCK), 0.07f, 10);
if (!seen) {
Camera.main.shake(3, 0.7f);

View File

@ -42,7 +42,7 @@ public class SpearTrap extends Trap {
@Override
public void trigger() {
if (Dungeon.visible[pos]){
if (Dungeon.level.heroFOV[pos]){
Sample.INSTANCE.play(Assets.SND_TRAP);
}
//this trap is not disarmed by being triggered
@ -53,7 +53,7 @@ public class SpearTrap extends Trap {
@Override
public void activate() {
if (Dungeon.visible[pos]){
if (Dungeon.level.heroFOV[pos]){
Sample.INSTANCE.play(Assets.SND_HIT);
Wound.hit(pos);
}

View File

@ -69,7 +69,7 @@ public class TeleportationTrap extends Trap {
ch.pos = pos;
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.visible[pos];
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}

View File

@ -80,7 +80,7 @@ public abstract class Trap implements Bundlable {
public void trigger() {
if (active) {
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
Sample.INSTANCE.play(Assets.SND_TRAP);
}
disarm();

View File

@ -39,7 +39,7 @@ public class WeakeningTrap extends Trap{
@Override
public void activate() {
if (Dungeon.visible[ pos ]){
if (Dungeon.level.heroFOV[ pos ]){
CellEmitter.get(pos).burst(ShadowParticle.UP, 5);
}

View File

@ -54,7 +54,7 @@ public class Blindweed extends Plant {
}
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get( pos ).burst( Speck.factory( Speck.LIGHT ), 4 );
}
}

View File

@ -48,7 +48,7 @@ public class Earthroot extends Plant {
Buff.affect( ch, Armor.class ).level(ch.HT);
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.bottom( pos ).start( EarthParticle.FACTORY, 0.05f, 8 );
Camera.main.shake( 1, 0.4f );
}

View File

@ -62,13 +62,13 @@ public class Fadeleaf extends Plant {
ch.pos = newPos;
ch.sprite.place( ch.pos );
ch.sprite.visible = Dungeon.visible[ch.pos];
ch.sprite.visible = Dungeon.level.heroFOV[ch.pos];
}
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get( pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 );
}
}

View File

@ -41,7 +41,7 @@ public class Firebloom extends Plant {
GameScene.add( Blob.seed( pos, 2, Fire.class ) );
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get( pos ).burst( FlameParticle.FACTORY, 5 );
}
}

View File

@ -72,7 +72,7 @@ public abstract class Plant implements Bundlable {
public void wither() {
Dungeon.level.uproot( pos );
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get( pos ).burst( LeafParticle.GENERAL, 6 );
}
@ -168,7 +168,7 @@ public abstract class Plant implements Bundlable {
public Plant couch( int pos ) {
try {
if (Dungeon.visible != null && Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV != null && Dungeon.level.heroFOV[pos]) {
Sample.INSTANCE.play(Assets.SND_PLANT);
}
Plant plant = plantClass.newInstance();

View File

@ -45,7 +45,7 @@ public class Sorrowmoss extends Plant {
Buff.affect( ch, Poison.class ).set( Poison.durationFactor( ch ) * (4 + Dungeon.depth / 2) );
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.center( pos ).burst( PoisonParticle.SPLASH, 3 );
}
}

View File

@ -49,7 +49,7 @@ public class Sungrass extends Plant {
Buff.affect( ch, Health.class ).boost(ch.HT);
}
if (Dungeon.visible[pos]) {
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get( pos ).start( ShaftParticle.FACTORY, 0.2f, 3 );
}
}

View File

@ -617,7 +617,7 @@ public class GameScene extends PixelScene {
private void addMobSprite( Mob mob ) {
CharSprite sprite = mob.sprite();
sprite.visible = Dungeon.visible[mob.pos];
sprite.visible = Dungeon.level.heroFOV[mob.pos];
mobs.add( sprite );
sprite.link( mob );
}
@ -832,7 +832,7 @@ public class GameScene extends PixelScene {
if (scene != null) {
for (Mob mob : Dungeon.level.mobs) {
if (mob.sprite != null)
mob.sprite.visible = Dungeon.visible[mob.pos];
mob.sprite.visible = Dungeon.level.heroFOV[mob.pos];
}
}
}
@ -932,7 +932,7 @@ public class GameScene extends PixelScene {
objects.add(Dungeon.hero);
names.add(Dungeon.hero.className().toUpperCase(Locale.ENGLISH));
} else {
if (Dungeon.visible[cell]) {
if (Dungeon.level.heroFOV[cell]) {
Mob mob = (Mob) Actor.findChar(cell);
if (mob != null) {
objects.add(mob);

View File

@ -84,8 +84,6 @@ public class InterlevelScene extends PixelScene {
phase = Phase.FADE_IN;
timeLeft = TIME_TO_FADE;
Dungeon.visible = null;
thread = new Thread() {
@Override

View File

@ -53,7 +53,7 @@ public class SkeletonSprite extends MobSprite {
@Override
public void die() {
super.die();
if (Dungeon.visible[ch.pos]) {
if (Dungeon.level.heroFOV[ch.pos]) {
emitter().burst( Speck.factory( Speck.BONE ), 6 );
}
}

View File

@ -53,7 +53,7 @@ public class UndeadSprite extends MobSprite {
@Override
public void die() {
super.die();
if (Dungeon.visible[ch.pos]) {
if (Dungeon.level.heroFOV[ch.pos]) {
emitter().burst( Speck.factory( Speck.BONE ), 3 );
}
}

View File

@ -357,7 +357,7 @@ public class FogOfWar extends Image {
public void draw() {
if (!updated.isEmpty()){
updateTexture(Dungeon.visible, Dungeon.level.visited, Dungeon.level.mapped);
updateTexture(Dungeon.level.heroFOV, Dungeon.level.visited, Dungeon.level.mapped);
updating.setEmpty();
}

View File

@ -173,7 +173,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
if (lastTarget != null &&
Actor.chars().contains( lastTarget ) &&
lastTarget.isAlive() &&
Dungeon.visible[lastTarget.pos]) {
Dungeon.level.heroFOV[lastTarget.pos]) {
targeting = true;
CharSprite sprite = lastTarget.sprite;