v0.7.0: fixed various bugs caused by teleportation scroll relying on room connections
This commit is contained in:
parent
11ed648dfd
commit
6563576648
|
@ -29,7 +29,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
|
@ -39,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.noosa.tweeners.AlphaTweener;
|
import com.watabou.noosa.tweeners.AlphaTweener;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
|
import com.watabou.utils.Point;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -140,26 +143,29 @@ public class ScrollOfTeleportation extends Scroll {
|
||||||
RegularLevel level = (RegularLevel) Dungeon.level;
|
RegularLevel level = (RegularLevel) Dungeon.level;
|
||||||
ArrayList<Integer> candidates = new ArrayList<>();
|
ArrayList<Integer> candidates = new ArrayList<>();
|
||||||
|
|
||||||
Room r;
|
for (Room r : level.rooms()){
|
||||||
for (int i = 0; i < level.length(); i++){
|
if (r instanceof SpecialRoom){
|
||||||
if (!level.passable[i] || level.visited[i]){
|
int terr;
|
||||||
continue;
|
boolean locked = false;
|
||||||
}
|
for (Point p : r.getPoints()){
|
||||||
r = level.room(i);
|
terr = level.map[level.pointToCell(p)];
|
||||||
if (r == null || Actor.findChar(i) != null){
|
if (terr == Terrain.LOCKED_DOOR || terr == Terrain.BARRICADE){
|
||||||
continue;
|
locked = true;
|
||||||
}
|
break;
|
||||||
boolean locked = false;
|
}
|
||||||
for (Room.Door d : r.connected.values()){
|
}
|
||||||
if (d.type == Room.Door.Type.LOCKED || d.type == Room.Door.Type.BARRICADE) {
|
if (locked){
|
||||||
locked = true;
|
continue;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (locked){
|
|
||||||
continue;
|
int cell;
|
||||||
|
for (Point p : r.getPoints()){
|
||||||
|
cell = level.pointToCell(p);
|
||||||
|
if (level.passable[cell] && !level.visited[cell] && Actor.findChar(cell) != null){
|
||||||
|
candidates.add(cell);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
candidates.add(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidates.isEmpty()){
|
if (candidates.isEmpty()){
|
||||||
|
|
|
@ -390,9 +390,18 @@ public abstract class RegularLevel extends Level {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Room> rooms() {
|
||||||
|
return new ArrayList<>(rooms);
|
||||||
|
}
|
||||||
|
|
||||||
//FIXME pit rooms shouldn't be problematic enough to warrant this
|
//FIXME pit rooms shouldn't be problematic enough to warrant this
|
||||||
public boolean hasPitRoom(){
|
public boolean hasPitRoom(){
|
||||||
return randomRoom(PitRoom.class) != null;
|
for (Room r : rooms) {
|
||||||
|
if (r instanceof PitRoom) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Room randomRoom( Class<?extends Room> type ) {
|
protected Room randomRoom( Class<?extends Room> type ) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user