v0.3.0c: refactored finding a character, no longer need to maintain chars[] array

This commit is contained in:
Evan Debenham
2015-06-06 00:17:07 -04:00
parent 3cf7979a4c
commit dbeff25d2c
12 changed files with 9 additions and 46 deletions
@@ -591,7 +591,6 @@ public abstract class RegularLevel extends Level {
if (Actor.findChar(mob.pos) == null && Level.passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
Actor.occupyCell(mob);
//TODO: perhaps externalize this logic into a method. Do I want to make mobs more likely to clump deeper down?
if (mobsToSpawn > 0 && Random.Int(4) == 0){
@@ -601,7 +600,6 @@ public abstract class RegularLevel extends Level {
if (Actor.findChar(mob.pos) == null && Level.passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
Actor.occupyCell(mob);
}
}
}
@@ -63,6 +63,5 @@ public class BlacksmithPainter extends Painter {
npc.pos = room.random( 1 );
} while (level.heaps.get( npc.pos ) != null);
level.mobs.add( npc );
Actor.occupyCell( npc );
}
}
@@ -77,7 +77,6 @@ public class PoolPainter extends Painter {
piranha.pos = room.random();
} while (level.map[piranha.pos] != Terrain.WATER|| Actor.findChar( piranha.pos ) != null);
level.mobs.add( piranha );
Actor.occupyCell( piranha );
}
}
@@ -67,6 +67,5 @@ public class StatuePainter extends Painter {
Statue statue = new Statue();
statue.pos = cx + cy * Level.WIDTH;
level.mobs.add( statue );
Actor.occupyCell( statue );
}
}
@@ -48,12 +48,6 @@ public class SummoningTrap extends Trap {
return;
}
Char c = Actor.findChar( pos );
if (c != null) {
Actor.occupyCell( c );
}
int nMobs = 1;
if (Random.Int( 2 ) == 0) {
nMobs++;
@@ -79,7 +73,6 @@ public class SummoningTrap extends Trap {
int index = Random.index( candidates );
DUMMY.pos = candidates.get( index );
Actor.occupyCell( DUMMY );
respawnPoints.add( candidates.remove( index ) );
nMobs--;