v1.2.0: fixed various errors with sentry rooms

This commit is contained in:
Evan Debenham 2022-03-18 16:34:54 -04:00
parent 41870cf64b
commit b1ae257c3b
3 changed files with 18 additions and 4 deletions

View File

@ -15,7 +15,7 @@ levels.rooms.special.massgraveroom$bones.name=Mass grave
levels.rooms.special.massgraveroom$bones.desc=Bones litter the floor, what happened here? levels.rooms.special.massgraveroom$bones.desc=Bones litter the floor, what happened here?
levels.rooms.special.sentryroom$sentry.name=red sentry levels.rooms.special.sentryroom$sentry.name=red sentry
levels.rooms.special.sentryroom$sentry.desc=This blood-red sentry seems to be positioned here to guard the treasure at the other end of this room. It will fire beams of disintegration magic at you if you step in the area it defends. It's immune to all harmful effects, but seems to take a while to charge up before it starts firing.\n\nSomehow the sentry only wants to fire on you, as if it knows that the denizens of the dungeon are no threat to the treasure. levels.rooms.special.sentryroom$sentry.desc=This blood-red sentry seems to be positioned here to guard the treasure at the other end of this room. It will fire beams of disintegration magic at you if you step in the area it defends.\n\nIt's immune to all harmful effects and can see through invisibility, but seems to take a while to charge up before it starts firing.\n\nSomehow the sentry only wants to fire on you, as if it knows that the denizens of the dungeon are no threat to the treasure.
levels.rooms.special.toxicgasroom$toxicvent.name=toxic vent levels.rooms.special.toxicgasroom$toxicvent.name=toxic vent
levels.rooms.special.toxicgasroom$toxicvent.desc=A careless adventurer must have triggered this trap ages ago. Despite its inactive state, it's still spewing toxic gas into the room and shows no signs of stopping. You'll need some way to prevent damage from the gas if you want to explore this room. levels.rooms.special.toxicgasroom$toxicvent.desc=A careless adventurer must have triggered this trap ages ago. Despite its inactive state, it's still spewing toxic gas into the room and shows no signs of stopping. You'll need some way to prevent damage from the gas if you want to explore this room.

View File

@ -59,6 +59,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior.En
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Monk; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Monk;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Snake; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Snake;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell; import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
@ -1278,7 +1279,7 @@ public class Hero extends Char {
Mob target = null; Mob target = null;
for (Mob m : Dungeon.level.mobs.toArray(new Mob[0])) { for (Mob m : Dungeon.level.mobs.toArray(new Mob[0])) {
if (fieldOfView[ m.pos ] && m.alignment == Alignment.ENEMY) { if (fieldOfView[ m.pos ] && m.alignment == Alignment.ENEMY && !(m instanceof NPC)) {
visible.add(m); visible.add(m);
if (!visibleEnemies.contains( m )) { if (!visibleEnemies.contains( m )) {
newMob = true; newMob = true;

View File

@ -39,8 +39,10 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MobSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.MobSprite;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.particles.Emitter;
@ -215,6 +217,7 @@ public class SentryRoom extends SpecialRoom {
spriteClass = SentrySprite.class; spriteClass = SentrySprite.class;
properties.add(Property.IMMOVABLE); properties.add(Property.IMMOVABLE);
alignment = Alignment.ENEMY;
} }
private float initialChargeDelay; private float initialChargeDelay;
@ -224,9 +227,18 @@ public class SentryRoom extends SpecialRoom {
@Override @Override
protected boolean act() { protected boolean act() {
if (Dungeon.hero != null){ if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
fieldOfView = new boolean[Dungeon.level.length()];
}
Dungeon.level.updateFieldOfView( this, fieldOfView );
if (Dungeon.level.map[Dungeon.hero.pos] == Terrain.EMPTY_SP if (properties().contains(Property.IMMOVABLE)){
throwItems();
}
if (Dungeon.hero != null){
if (fieldOfView[Dungeon.hero.pos]
&& Dungeon.level.map[Dungeon.hero.pos] == Terrain.EMPTY_SP
&& room.inside(Dungeon.level.cellToPoint(Dungeon.hero.pos))){ && room.inside(Dungeon.level.cellToPoint(Dungeon.hero.pos))){
if (curChargeDelay > 0.001f){ //helps prevent rounding errors if (curChargeDelay > 0.001f){ //helps prevent rounding errors
@ -264,6 +276,7 @@ public class SentryRoom extends SpecialRoom {
public void onZapComplete(){ public void onZapComplete(){
Dungeon.hero.damage(Random.NormalIntRange(2+Dungeon.depth/2, 4+Dungeon.depth), new Eye.DeathGaze()); Dungeon.hero.damage(Random.NormalIntRange(2+Dungeon.depth/2, 4+Dungeon.depth), new Eye.DeathGaze());
if (!Dungeon.hero.isAlive()){ if (!Dungeon.hero.isAlive()){
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
Dungeon.fail( getClass() ); Dungeon.fail( getClass() );
} }
} }