v0.7.2: buffed scroll of teleportation
This commit is contained in:
parent
efa4ededa4
commit
08b552e689
|
@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
|||
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.secret.SecretRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
|
||||
|
@ -172,9 +173,33 @@ public class ScrollOfTeleportation extends Scroll {
|
|||
teleportHero( hero );
|
||||
} else {
|
||||
int pos = Random.element(candidates);
|
||||
boolean secretDoor = false;
|
||||
int doorPos = -1;
|
||||
if (level.room(pos) instanceof SpecialRoom){
|
||||
SpecialRoom room = (SpecialRoom) level.room(pos);
|
||||
if (room.entrance() != null){
|
||||
doorPos = level.pointToCell(room.entrance());
|
||||
for (int i : PathFinder.NEIGHBOURS8){
|
||||
if (!room.inside(level.cellToPoint(doorPos + i))
|
||||
&& level.passable[doorPos + i]
|
||||
&& Actor.findChar(doorPos + i) == null){
|
||||
secretDoor = room instanceof SecretRoom;
|
||||
pos = doorPos + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") );
|
||||
appear( hero, pos );
|
||||
if (!hero.flying) Dungeon.level.press( pos, hero );
|
||||
if (secretDoor && level.map[doorPos] == Terrain.SECRET_DOOR){
|
||||
Sample.INSTANCE.play( Assets.SND_SECRET );
|
||||
int oldValue = Dungeon.level.map[doorPos];
|
||||
GameScene.discoverTile( doorPos, oldValue );
|
||||
Dungeon.level.discover( doorPos );
|
||||
ScrollOfMagicMapping.discover( doorPos );
|
||||
}
|
||||
Dungeon.observe();
|
||||
GameScene.updateFog();
|
||||
}
|
||||
|
|
|
@ -381,13 +381,16 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable {
|
|||
//does nothing by default
|
||||
}
|
||||
|
||||
public static class Door extends Point {
|
||||
public static class Door extends Point implements Bundlable {
|
||||
|
||||
public enum Type {
|
||||
EMPTY, TUNNEL, REGULAR, UNLOCKED, HIDDEN, BARRICADE, LOCKED
|
||||
}
|
||||
public Type type = Type.EMPTY;
|
||||
|
||||
public Door(){
|
||||
}
|
||||
|
||||
public Door( Point p ){
|
||||
super(p);
|
||||
}
|
||||
|
@ -401,5 +404,19 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable {
|
|||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
bundle.put("x", x);
|
||||
bundle.put("y", y);
|
||||
bundle.put("type", type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
x = bundle.getInt("x");
|
||||
y = bundle.getInt("y");
|
||||
type = bundle.getEnum("type", Type.class);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -53,8 +53,35 @@ public class SpecialRoom extends Room {
|
|||
return 1;
|
||||
}
|
||||
|
||||
private Door entrance;
|
||||
|
||||
public Door entrance() {
|
||||
return connected.values().iterator().next();
|
||||
if (entrance == null){
|
||||
if (connected.isEmpty()){
|
||||
return null;
|
||||
} else {
|
||||
entrance = connected.values().iterator().next();
|
||||
}
|
||||
}
|
||||
return entrance;
|
||||
}
|
||||
|
||||
private static final String ENTRANCE = "entrance";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
if (entrance() != null){
|
||||
bundle.put(ENTRANCE, entrance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
if (bundle.contains(ENTRANCE)){
|
||||
entrance = (Door)bundle.get(ENTRANCE);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ArrayList<Class<? extends SpecialRoom>> ALL_SPEC = new ArrayList<>( Arrays.asList(
|
||||
|
|
|
@ -853,7 +853,7 @@ items.scrolls.scrollofteleportation.tele=In a blink of an eye you were teleporte
|
|||
items.scrolls.scrollofteleportation.no_tele=Strong magic aura of this place prevents you from teleporting!
|
||||
items.scrolls.scrollofteleportation.cant_reach=You can't teleport there.
|
||||
items.scrolls.scrollofteleportation.prompt=Choose a location to teleport
|
||||
items.scrolls.scrollofteleportation.desc=The spell on this parchment instantly transports the reader to a different location on the dungeon level. The scroll prioritizes areas the reader hasn't been to before, through it is not able to teleport past locked doors or barricades.
|
||||
items.scrolls.scrollofteleportation.desc=The spell on this parchment instantly transports the reader to a different location on the dungeon level. The scroll prioritizes areas the reader hasn't been to before, through it is not able to teleport past locked doors or barricades. It can, however, reveal hidden doors that lead to new areas.
|
||||
|
||||
items.scrolls.scrollofterror.name=scroll of terror
|
||||
items.scrolls.scrollofterror.none=The scroll emits a brilliant flash of red light.
|
||||
|
|
Loading…
Reference in New Issue
Block a user