From da0e6c686c22234c0a13188a383a8892743f5edd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 1 Nov 2015 21:45:58 -0500 Subject: [PATCH] v0.3.2: reworked floor 10 and the tengu fight (lots of changes) --- assets/custom_tiles/prison_exit.png | Bin 0 -> 4064 bytes .../shatteredpixeldungeon/Assets.java | 1 + .../shatteredpixeldungeon/actors/Actor.java | 4 +- .../actors/mobs/Tengu.java | 102 ++- .../shatteredpixeldungeon/levels/Level.java | 6 +- .../levels/PrisonBossLevel.java | 645 +++++++++++------- .../levels/PrisonLevel.java | 12 +- .../scenes/GameScene.java | 9 +- 8 files changed, 480 insertions(+), 299 deletions(-) create mode 100644 assets/custom_tiles/prison_exit.png diff --git a/assets/custom_tiles/prison_exit.png b/assets/custom_tiles/prison_exit.png new file mode 100644 index 0000000000000000000000000000000000000000..8a241154892ab62cc0d3c310bb3a7656542d8ac8 GIT binary patch literal 4064 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

CvTuY~xe3zhydi9=Lq17_3qE#VHxG-IYz zmQ#e23dJ=-xR4f%(nr-)dH0B7s(=7`&^Ig)E)=_2fS@>TH#9@vCW!7xVRIl*acJWp zV_X$aK+46^TO?3iMH>a96H{@m_?#96fdslZ!kSnh=74ThTz~a@slprX#*S1Vge|bC zq#=ks1tGJ8#eo(`I1OO4zbq29OLYqf=W0%?fM{x}=~TIx!hp5u-xeUY;5FRERwi@Qcqt6J8h8ZI33sOI$ z5b2QJw|@2b2Y$5#btf4P!ufmDa4(drM(TV2LX1PRgbz7qR`EX)9h7eh6>hfWUkEb_ z{n0eJ9&attTzMJY&O-VHpm&VB64vJFV!g?)@l7gK)JLda&8hedqPVoq7*HY1K4PA8 zn+cwZ-AqVL3<~l=dTSvZT%ao&RlH3kY-%C;f0-J1fzKS&G@hR6b{WSl_-atbM1o6Y z+%S@;m8i{+p7C#sg>qXO(EBXlOQDx^OwzW%{zIDQc5Opz`k=7KpgBZ>zWU6Sosu1x UXC;roe!GB!jjQ!tEB}-K2^>(%g8%>k literal 0 HcmV?d00001 diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java b/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java index cf1f23791..3b6e1c4e2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java @@ -112,6 +112,7 @@ public class Assets { public static final String WEAK_FLOOR = "custom_tiles/weak_floor.png"; public static final String PRISON_QUEST = "custom_tiles/prison_quests.png"; + public static final String PRISON_EXIT = "custom_tiles/prison_exit.png"; public static final String BUFFS_SMALL = "buffs.png"; public static final String BUFFS_LARGE = "large_buffs.png"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java index 7f0d00b79..b78c9b048 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java @@ -102,7 +102,7 @@ public abstract class Actor implements Bundlable { private static HashSet chars = new HashSet<>(); private static Actor current; - private static SparseArray ids = new SparseArray(); + private static SparseArray ids = new SparseArray<>(); private static float now = 0; @@ -231,7 +231,7 @@ public abstract class Actor implements Bundlable { ids.put( actor.id(), actor ); all.add( actor ); - actor.time += time; + actor.time = time; actor.onAdd(); if (actor instanceof Char) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java index e24ee09fb..fdec8264e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java @@ -24,13 +24,13 @@ import java.util.HashSet; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon; -import com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonTrap; +import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel; +import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SpearTrap; import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; -import com.shatteredpixel.shatteredpixeldungeon.Badges.Badge; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -39,7 +39,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery; -import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Death; @@ -62,13 +61,17 @@ public class Tengu extends Mob { HP = HT = 120; EXP = 20; defenseSkill = 20; + + HUNTING = new Hunting(); + + flying = true; //doesn't literally fly, but he is fleet-of-foot enough to avoid hazards } private int timeToJump = JUMP_DELAY; @Override public int damageRoll() { - return Random.NormalIntRange( 8, 15 ); + return Random.NormalIntRange( 6, 12 ); } @Override @@ -80,7 +83,26 @@ public class Tengu extends Mob { public int dr() { return 5; } - + + @Override + public void damage(int dmg, Object src) { + if (dmg > HP) { + ((PrisonBossLevel)Dungeon.level).progress(); + return; + } + + int beforeHitHP = HP; + super.damage(dmg, src); + + //phase 1 of the fight is over + if (beforeHitHP > HT/2 && HP <= HT/2){ + HP = HT/2; + yell("Let's make this interesting..."); + ((PrisonBossLevel)Dungeon.level).progress(); + BossHealthBar.bleed(true); + } + } + @Override public void die( Object cause ) { @@ -89,7 +111,6 @@ public class Tengu extends Mob { } GameScene.bossSlain(); - Dungeon.level.drop( new SkeletonKey( Dungeon.depth ), pos ).sprite.drop(); super.die( cause ); Badges.validateBossSlain(); @@ -121,7 +142,7 @@ public class Tengu extends Mob { @Override protected boolean doAttack( Char enemy ) { timeToJump--; - if (timeToJump <= 0 && Level.adjacent( pos, enemy.pos )) { + if (timeToJump <= 0) { jump(); return true; } else { @@ -131,28 +152,40 @@ public class Tengu extends Mob { private void jump() { timeToJump = JUMP_DELAY; - - for (int i=0; i < 4; i++) { + + for (int i=0; i < 3; i++) { int trapPos; do { trapPos = Random.Int( Level.LENGTH ); - } while (!Level.fieldOfView[trapPos] || !Level.passable[trapPos]); + } while (!Level.fieldOfView[trapPos] || Level.solid[trapPos]); if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) { - Dungeon.level.setTrap( new PoisonTrap().reveal(), trapPos ); + Dungeon.level.setTrap( new SpearTrap().reveal(), trapPos ); Level.set( trapPos, Terrain.TRAP ); ScrollOfMagicMapping.discover( trapPos ); } } int newPos; - do { - newPos = Random.Int( Level.LENGTH ); - } while ( - !Level.fieldOfView[newPos] || - !Level.passable[newPos] || - Level.adjacent( newPos, enemy.pos ) || - Actor.findChar( newPos ) != null); + //if we're in phase 1, want to warp around within the room + if (HP > HT/2) { + do { + newPos = Random.Int(Level.LENGTH); + } while ( + !Level.fieldOfView[newPos] || + Level.solid[newPos] || + Level.adjacent(newPos, enemy.pos) || + Actor.findChar(newPos) != null); + + //otherwise go wherever, as long as it's a little bit away + } else { + do { + newPos = Random.Int(Level.LENGTH); + } while ( + Level.solid[newPos] || + Level.distance(newPos, enemy.pos) < 8 || + Actor.findChar(newPos) != null); + } sprite.move( pos, newPos ); move( newPos ); @@ -169,7 +202,12 @@ public class Tengu extends Mob { public void notice() { super.notice(); BossHealthBar.assignBoss(this); - yell("Gotcha, " + Dungeon.hero.givenName() + "!"); + if (HP <= HT/2) BossHealthBar.bleed(true); + if (HP == HT) { + yell("You're mine, " + Dungeon.hero.givenName() + "!"); + } else { + yell("Face me, " + Dungeon.hero.givenName() + "!"); + } } @Override @@ -179,7 +217,7 @@ public class Tengu extends Mob { "These assassins are noted for extensive use of shuriken and traps."; } - private static final HashSet> RESISTANCES = new HashSet>(); + private static final HashSet> RESISTANCES = new HashSet<>(); static { RESISTANCES.add( ToxicGas.class ); RESISTANCES.add( Poison.class ); @@ -196,5 +234,29 @@ public class Tengu extends Mob { public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); BossHealthBar.assignBoss(this); + if (HP <= HT/2) BossHealthBar.bleed(true); + } + + //tengu is always hunting + private class Hunting extends Mob.Hunting{ + + @Override + public boolean act(boolean enemyInFOV, boolean justAlerted) { + enemySeen = enemyInFOV; + if (enemyInFOV && !isCharmedBy( enemy ) && canAttack( enemy )) { + + return doAttack( enemy ); + + } else { + + if (enemyInFOV) { + target = enemy.pos; + } + + spend( TICK ); + return true; + + } + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 4aeed0e12..2228bffe8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -579,8 +579,8 @@ public abstract class Level implements Bundlable { return null; } - - private void buildFlagMaps() { + + protected void buildFlagMaps() { for (int i=0; i < LENGTH; i++) { int flags = Terrain.flags[map[i]]; @@ -633,7 +633,7 @@ public abstract class Level implements Bundlable { } } - private void cleanWalls() { + protected void cleanWalls() { for (int i=0; i < LENGTH; i++) { boolean d = false; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java index 1a5c1b928..ff4fb6d4a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java @@ -21,41 +21,47 @@ package com.shatteredpixel.shatteredpixeldungeon.levels; import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.Bones; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Tengu; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; -import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey; -import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type; -import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; -import com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonTrap; +import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SpearTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual; +import com.shatteredpixel.shatteredpixeldungeon.ui.HealthIndicator; import com.watabou.noosa.Scene; +import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; -import com.watabou.utils.Graph; -import com.watabou.utils.Point; import com.watabou.utils.Random; -import java.util.List; +import java.util.ArrayList; -public class PrisonBossLevel extends RegularLevel { +public class PrisonBossLevel extends Level { { color1 = 0x6a723d; color2 = 0x88924c; } + + private enum State{ + START, + FIGHT_START, + MAZE, + FIGHT_ARENA, + WON + } - private Room anteroom; - private int arenaDoor; - - private boolean enteredArena = false; - private boolean keyDropped = false; + private State state; + private Tengu tengu; + + //we keep track of torches so we can kill them as needed when layouts change. + private ArrayList torches = new ArrayList<>(); @Override public String tilesTex() { @@ -67,297 +73,109 @@ public class PrisonBossLevel extends RegularLevel { return Assets.WATER_PRISON; } - private static final String ARENA = "arena"; - private static final String DOOR = "door"; - private static final String ENTERED = "entered"; - private static final String DROPPED = "droppped"; + private static final String STATE = "state"; + private static final String TENGU = "tengu"; @Override public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); - bundle.put( ARENA, roomExit ); - bundle.put( DOOR, arenaDoor ); - bundle.put( ENTERED, enteredArena ); - bundle.put( DROPPED, keyDropped ); + super.storeInBundle(bundle); + bundle.put( STATE, state ); + bundle.put( TENGU, tengu ); } @Override public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - roomExit = (Room)bundle.get( ARENA ); - arenaDoor = bundle.getInt( DOOR ); - enteredArena = bundle.getBoolean( ENTERED ); - keyDropped = bundle.getBoolean( DROPPED ); + super.restoreFromBundle(bundle); + state = bundle.getEnum( STATE, State.class ); + + //in some states tengu won't be in the world, in others he will be. + if (state == State.START || state == State.MAZE) { + tengu = (Tengu)bundle.get( TENGU ); + } else { + for (Mob mob : mobs){ + if (mob instanceof Tengu) { + tengu = (Tengu) mob; + break; + } + } + } } @Override protected boolean build() { - initRooms(); - - int distance; - int retry = 0; + map = MAP_START; + decorate(); - do { - - if (retry++ > 10) { - return false; - } - - int innerRetry = 0; - do { - if (innerRetry++ > 10) { - return false; - } - roomEntrance = Random.element( rooms ); - } while (roomEntrance.width() < 4 || roomEntrance.height() < 4); - - innerRetry = 0; - do { - if (innerRetry++ > 10) { - return false; - } - roomExit = Random.element( rooms ); - } while ( - roomExit == roomEntrance || - roomExit.width() < 7 || - roomExit.height() < 7 || - roomExit.top == 0); - - Graph.buildDistanceMap( rooms, roomExit ); - distance = Graph.buildPath( rooms, roomEntrance, roomExit ).size(); - - } while (distance < 3); - - roomEntrance.type = Type.ENTRANCE; - roomExit.type = Type.BOSS_EXIT; - - List path = Graph.buildPath( rooms, roomEntrance, roomExit ); - Graph.setPrice( path, roomEntrance.distance ); - - Graph.buildDistanceMap( rooms, roomExit ); - path = Graph.buildPath( rooms, roomEntrance, roomExit ); - - anteroom = path.get( path.size() - 2 ); - anteroom.type = Type.STANDARD; + buildFlagMaps(); + cleanWalls(); + + state = State.START; + entrance = 5+2*32; + exit = 0; + + resetTraps(); - Room room = roomEntrance; - for (Room next : path) { - room.connect( next ); - room = next; - } - - for (Room r : rooms) { - if (r.type == Type.NULL && r.connected.size() > 0) { - r.type = Type.PASSAGE; - } - } - - paint(); - - Room r = (Room)roomExit.connected.keySet().toArray()[0]; - if (roomExit.connected.get( r ).y == roomExit.top) { - return false; - } - - paintWater(); - paintGrass(); - - placeTraps(); - return true; } - - protected boolean[] water() { - return Patch.generate( 0.45f, 5 ); - } - - protected boolean[] grass() { - return Patch.generate( 0.30f, 4 ); - } - - protected void paintDoors( Room r ) { - - for (Room n : r.connected.keySet()) { - - if (r.type == Type.NULL) { - continue; - } - - Point door = r.connected.get( n ); - - if (r.type == Room.Type.PASSAGE && n.type == Room.Type.PASSAGE) { - - Painter.set( this, door, Terrain.EMPTY ); - - } else { - - Painter.set( this, door, Terrain.DOOR ); - - } - - } - } - - @Override - protected void placeTraps() { - - int nTraps = nTraps(); - for (int i=0; i < nTraps; i++) { - - int trapPos = Random.Int( LENGTH ); - - if (map[trapPos] == Terrain.EMPTY) { - map[trapPos] = Terrain.TRAP; - setTrap( new PoisonTrap().reveal(), trapPos ); - } - } - } - @Override protected void decorate() { - - for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) { - if (map[i] == Terrain.EMPTY) { - - float c = 0.15f; - if (map[i + 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) { - c += 0.2f; - } - if (map[i - 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) { - c += 0.2f; - } - if (map[i + 1] == Terrain.WALL && map[i - WIDTH] == Terrain.WALL) { - c += 0.2f; - } - if (map[i - 1] == Terrain.WALL && map[i - WIDTH] == Terrain.WALL) { - c += 0.2f; - } - - if (Random.Float() < c) { - map[i] = Terrain.EMPTY_DECO; - } - } - } - - for (int i=0; i < WIDTH; i++) { - if (map[i] == Terrain.WALL && - (map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) && - Random.Int( 4 ) == 0) { - - map[i] = Terrain.WALL_DECO; - } - } - - for (int i=WIDTH; i < LENGTH - WIDTH; i++) { - if (map[i] == Terrain.WALL && - map[i - WIDTH] == Terrain.WALL && - (map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) && - Random.Int( 2 ) == 0) { - - map[i] = Terrain.WALL_DECO; - } - } - - placeSign(); - - Point door = roomExit.entrance(); - arenaDoor = door.x + door.y * WIDTH; - Painter.set( this, arenaDoor, Terrain.LOCKED_DOOR ); - - Painter.fill( this, - roomExit.left + 2, - roomExit.top + 2, - roomExit.width() - 3, - roomExit.height() - 3, - Terrain.INACTIVE_TRAP ); - - for (int cell : roomExit.getCells()){ - if (map[cell] == Terrain.INACTIVE_TRAP){ - Trap t = new PoisonTrap().reveal(); - t.active = false; - setTrap(t, cell); - } - } + //do nothing, all decorations are hard-coded. } - + @Override protected void createMobs() { + tengu = new Tengu(); //We want to keep track of tengu independently of other mobs, he's not always in the level. } public Actor respawner() { return null; } - + @Override protected void createItems() { + int keyPos = 1+8*32; //initial position at top-left room - int keyPos = anteroom.random(); - while (!passable[keyPos]) { - keyPos = anteroom.random(); - } - drop( new IronKey( Dungeon.depth ), keyPos ).type = Heap.Type.CHEST; - - Item item = Bones.get(); - if (item != null) { - int pos; - do { - pos = roomEntrance.random(); - } while (pos == entrance || map[pos] == Terrain.SIGN); - drop( item, pos ).type = Heap.Type.REMAINS; - } + //randomly assign a room. + keyPos += Random.Int(4)*(4*32); //one of the 4 rows + keyPos += Random.Int(2)*6; // one of the 2 columns + + //and then a certain tile in that room. + keyPos += Random.Int(3) + Random.Int(3)*32; + + drop(new IronKey(10), keyPos); } @Override public void press( int cell, Char ch ) { - - super.press( cell, ch ); - - if (ch == Dungeon.hero && !enteredArena && roomExit.inside( cell )) { - - enteredArena = true; - seal(); - - int pos; - do { - pos = roomExit.random(); - } while (pos == cell || Actor.findChar( pos ) != null); - - Mob boss = Bestiary.mob( Dungeon.depth ); - boss.state = boss.HUNTING; - boss.pos = pos; - GameScene.add( boss ); - boss.notice(); - - mobPress( boss ); - - set( arenaDoor, Terrain.LOCKED_DOOR ); - GameScene.updateMap( arenaDoor ); - Dungeon.observe(); + super.press(cell, ch); + + if (ch == Dungeon.hero){ + //hero enters tengu's chamber + if (state == State.START + && ((Room)new Room().set(2, 25, 8, 32)).inside(cell)){ + progress(); + } + + //hero finishes the maze + else if (state == State.MAZE + && ((Room)new Room().set(4, 1, 7, 4)).inside(cell)){ + progress(); + } } } - + @Override public Heap drop( Item item, int cell ) { - if (!keyDropped && item instanceof SkeletonKey) { - - keyDropped = true; - unseal(); - - set( arenaDoor, Terrain.DOOR ); - GameScene.updateMap( arenaDoor ); - Dungeon.observe(); - } - return super.drop( item, cell ); } @Override public int randomRespawnCell() { - return roomEntrance.random(); + return 5+3*32; } @Override @@ -366,7 +184,7 @@ public class PrisonBossLevel extends RegularLevel { case Terrain.WATER: return "Dark cold water."; default: - return super.tileName( tile ); + return super.tileName(tile); } } @@ -376,12 +194,309 @@ public class PrisonBossLevel extends RegularLevel { case Terrain.EMPTY_DECO: return "There are old blood stains on the floor."; default: - return super.tileDesc( tile ); + return super.tileDesc(tile); } } - + + private void resetTraps(){ + for (Trap trap : traps.values()){ + trap.sprite.kill(); + } + traps.clear(); + + for (int i = 0; i < Level.LENGTH; i++){ + if (map[i] == Terrain.INACTIVE_TRAP) { + Trap t = new SpearTrap().reveal(); + t.active = false; + setTrap(t, i); + map[i] = Terrain.INACTIVE_TRAP; + } + } + } + + private void changeMap(int[] map){ + this.map = map; + GameScene.resetMap(); + buildFlagMaps(); + cleanWalls(); + + exit = entrance = 0; + for (int i = 0; i < LENGTH; i ++) + if (map[i] == Terrain.ENTRANCE) + entrance = i; + else if (map[i] == Terrain.EXIT) + exit = i; + + visited = mapped = new boolean[LENGTH]; + addVisuals(ShatteredPixelDungeon.scene()); + resetTraps(); + + for (Heap h : heaps.values().toArray(new Heap[heaps.values().size()])){ + h.destroy(); + } + + Dungeon.observe(); + } + + public void progress(){ + switch (state){ + //moving to the beginning of the fight + case START: + seal(); + set(5 + 25 * 32, Terrain.LOCKED_DOOR); + GameScene.updateMap(5 + 25 * 32); + + tengu.state = tengu.HUNTING; + tengu.pos = 5 + 28*32; //in the middle of the fight room + GameScene.add( tengu ); + tengu.notice(); + + state = State.FIGHT_START; + break; + + //halfway through, move to the maze + case FIGHT_START: + + changeMap(MAP_MAZE); + + Actor.remove(tengu); + mobs.remove(tengu); + HealthIndicator.instance.target(null); + tengu.sprite.kill(); + + GameScene.flash(0xFFFFFF); + Sample.INSTANCE.play(Assets.SND_BLAST); + + state = State.MAZE; + break; + + //maze beaten, moving to the arena + case MAZE: + Dungeon.hero.interrupt(); + Dungeon.hero.pos += 106; + Dungeon.hero.sprite.interruptMotion(); + Dungeon.hero.sprite.place(Dungeon.hero.pos); + + changeMap(MAP_ARENA); + + tengu.state = tengu.HUNTING; + do { + tengu.pos = Random.Int(LENGTH); + } while (solid[tengu.pos] || distance(tengu.pos, Dungeon.hero.pos) < 8); + GameScene.add(tengu); + tengu.notice(); + + state = State.FIGHT_ARENA; + break; + + //arena ended, fight over. + case FIGHT_ARENA: + unseal(); + + CustomTileVisual vis = new exitVisual(); + vis.pos(7, 7); + customTiles.add(vis); + ((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis); + + Dungeon.hero.interrupt(); + Dungeon.hero.pos = 5+27*32; + Dungeon.hero.sprite.interruptMotion(); + Dungeon.hero.sprite.place(Dungeon.hero.pos); + + changeMap(MAP_END); + + tengu.pos = 5+28*32; + tengu.sprite.interruptMotion(); + tengu.sprite.place(5 + 28 * 32); + tengu.die(Dungeon.hero); + + state = State.WON; + break; + } + } + @Override public void addVisuals( Scene scene ) { - PrisonLevel.addVisuals( this, scene ); + super.addVisuals(scene); + //kill old torches before adding new ones + for (PrisonLevel.Torch t : torches.toArray(new PrisonLevel.Torch[torches.size()])){ + t.kill(); + torches.remove(t); + } + + for (int i=0; i < LENGTH; i++) { + if (map[i] == Terrain.WALL_DECO) { + PrisonLevel.Torch t = new PrisonLevel.Torch( i ); + torches.add(t); + scene.add( t ); + } + } + } + + private static final int W = Terrain.WALL; + private static final int D = Terrain.DOOR; + private static final int L = Terrain.LOCKED_DOOR; + private static final int _ = Terrain.EMPTY; //for readability + private static final int S = Terrain.SIGN; + + private static final int T = Terrain.INACTIVE_TRAP; + + private static final int E = Terrain.ENTRANCE; + private static final int X = Terrain.EXIT; + + private static final int M = Terrain.WALL_DECO; + + private static final int[] MAP_START = + { W, W, W, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, _, E, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, S, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, D, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, M, W, L, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W}; + + //TODO: while this hardcoded maze is nice, it would be better to have it random each time. + private static final int[] MAP_MAZE = + { W, W, W, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, _, _, _, W, W, W, W, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + _, _, _, D, _, _, _, D, _, _, _, _, _, _, W, _, _, _, W, _, _, _, _, _, _, _, _, _, W, _, W, W, + W, W, W, W, _, _, _, W, W, W, W, W, W, _, W, _, W, W, W, W, W, W, W, W, W, W, W, _, W, _, W, W, + W, W, W, W, W, M, W, W, W, W, W, _, _, _, W, _, W, _, _, _, _, _, W, _, _, _, _, _, W, _, W, W, + W, W, W, W, W, D, W, W, W, W, W, W, W, _, W, _, W, _, W, W, W, W, W, W, W, W, W, _, W, _, W, W, + W, W, W, W, W, _, W, W, W, W, W, _, _, _, _, _, W, _, _, _, W, _, W, _, _, _, _, _, W, _, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, _, W, W, W, _, W, W, W, _, W, W, W, W, W, _, W, _, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, _, _, W, _, _, _, _, _, _, _, W, _, _, _, W, W, + W, _, _, _, D, _, D, _, _, _, W, _, W, W, W, W, W, W, W, W, W, _, W, _, W, W, W, W, W, _, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, W, _, W, _, W, _, W, _, W, _, W, _, W, _, _, _, _, _, W, W, + W, W, M, W, W, _, W, W, M, W, W, _, W, _, W, _, W, _, W, _, W, _, W, W, W, W, W, W, W, _, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, W, _, W, _, W, _, W, _, W, W, + W, _, _, _, D, _, D, _, _, _, W, _, W, _, W, W, W, W, W, W, W, _, W, _, W, _, W, _, W, _, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, W, _, W, _, _, _, _, _, W, _, _, _, _, _, _, _, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, _, W, _, W, W, W, W, W, _, W, _, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, W, _, W, _, W, _, W, _, _, _, W, _, W, _, _, _, W, W, + W, _, _, _, D, _, D, _, _, _, W, W, W, _, W, _, W, _, W, _, W, _, W, W, W, _, W, W, W, _, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, _, _, _, _, W, _, _, _, _, _, W, _, _, _, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, _, W, W, W, _, W, W, W, _, W, _, W, W, W, _, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, W, _, W, _, W, _, W, _, _, _, W, _, W, _, _, _, _, _, W, W, + W, _, _, _, D, _, D, _, _, _, W, _, W, _, W, _, W, W, W, W, W, _, W, W, W, _, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, W, _, _, _, W, _, W, _, _, _, _, _, _, _, _, _, _, _, W, W, + W, W, M, W, W, _, W, W, M, _, W, _, W, _, W, W, W, _, W, _, W, W, W, W, W, W, W, _, W, W, W, W, + W, W, W, W, W, _, W, W, W, _, W, _, _, _, W, _, W, _, W, _, _, _, _, _, _, _, W, _, W, _, W, W, + W, W, W, M, W, D, W, M, W, _, W, W, W, _, W, _, W, _, W, _, W, W, W, W, W, W, W, W, W, _, W, W, + W, W, W, T, T, T, T, T, W, _, W, _, _, _, _, _, _, _, _, _, _, _, _, _, W, _, _, _, _, _, W, W, + W, W, W, T, T, T, T, T, W, _, W, W, W, _, W, W, W, _, W, W, W, _, W, _, W, _, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, _, W, _, W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, _, _, W, W, + W, W, W, T, T, T, T, T, W, _, W, _, W, _, W, W, W, _, W, W, W, W, W, _, W, W, W, W, W, _, W, W, + W, W, W, T, T, T, T, T, W, _, _, _, _, _, _, _, W, _, _, _, _, _, W, _, _, _, _, _, W, _, W, W, + W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W}; + + private static final int[] MAP_ARENA = + { W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, W, + W, W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, + W, _, _, _, _, _, W, _, _, _, _, _, _, W, W, M, W, W, _, _, _, _, _, _, W, _, _, _, _, _, W, W, + W, _, _, _, _, _, W, _, _, _, _, _, W, W, _, _, _, W, W, _, _, _, _, _, W, _, _, _, _, _, W, W, + W, _, _, _, _, M, W, _, _, _, _, _, _, D, _, _, _, D, _, _, _, _, _, _, W, M, _, _, _, _, W, W, + W, _, _, W, W, W, W, _, _, _, _, _, W, W, _, _, _, W, W, _, _, _, _, _, W, W, W, W, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, M, W, W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, W, W, _, _, _, _, _, W, W, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, W, W, _, _, _, _, _, _, _, W, W, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, _, _, _, _, W, _, _, _, W, _, W, _, _, _, W, W, + W, _, _, W, W, D, W, W, _, _, _, _, _, W, _, _, _, W, _, _, _, _, _, W, W, D, W, W, _, _, W, W, + W, _, W, W, _, _, _, W, W, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, _, _, _, W, W, _, W, W, + W, _, W, M, _, _, _, M, W, _, _, _, _, _, _, M, _, _, _, _, _, _, W, M, _, _, _, M, W, _, W, W, + W, _, W, W, _, _, _, W, W, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, _, _, _, W, W, _, W, W, + W, _, _, W, W, D, W, W, _, _, _, _, _, W, _, _, _, W, _, _, _, _, _, W, W, D, W, W, _, _, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, _, _, _, _, W, _, _, _, W, _, W, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, W, W, _, _, _, _, _, _, _, W, W, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, W, W, _, _, _, _, _, W, W, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, M, W, W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, + W, _, _, W, W, W, W, _, _, _, _, _, W, W, _, _, _, W, W, _, _, _, _, _, W, W, W, W, _, _, W, W, + W, _, _, _, _, M, W, _, _, _, _, _, _, D, _, _, _, D, _, _, _, _, _, _, W, M, _, _, _, _, W, W, + W, _, _, _, _, _, W, _, _, _, _, _, W, W, _, _, _, W, W, _, _, _, _, _, W, _, _, _, _, _, W, W, + W, _, _, _, _, _, W, _, _, _, _, _, _, W, W, M, W, W, _, _, _, _, _, _, W, _, _, _, _, _, W, W, + W, W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, + W, W, W, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, W, W, W, W, + W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W}; + + private static final int[] MAP_END = + { W, W, W, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, _, E, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, S, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, D, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, _, W, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, _, _, _, _, _, _, _, _, _, _, _, _, _, X, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, W, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, _, W, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, D, _, D, _, _, _, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, _, _, _, W, _, W, _, _, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, M, W, W, _, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, _, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, M, W, D, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, + W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W}; + + + public static class exitVisual extends CustomTileVisual{ + + { + name = "prison exit"; + + tx = Assets.PRISON_EXIT; + txX = txY = 0; + tileW = tileH = 16; + } + + @Override + public String desc() { + return super.desc(); + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java index b1ba3fd99..9350ef50e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java @@ -151,25 +151,21 @@ public class PrisonLevel extends RegularLevel { case Terrain.BOOKSHELF: return "This is probably a vestige of a prison library. Might it burn?"; default: - return super.tileDesc( tile ); + return super.tileDesc(tile); } } @Override public void addVisuals( Scene scene ) { - super.addVisuals( scene ); - addVisuals( this, scene ); - } - - public static void addVisuals( Level level, Scene scene ) { + super.addVisuals(scene); for (int i=0; i < LENGTH; i++) { - if (level.map[i] == Terrain.WALL_DECO) { + if (map[i] == Terrain.WALL_DECO) { scene.add( new Torch( i ) ); } } } - private static class Torch extends Emitter { + public static class Torch extends Emitter { private int pos; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index a797b4e95..2f2467408 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -628,7 +628,14 @@ public class GameScene extends PixelScene { public static void pickUp( Item item ) { scene.toolbar.pickup( item ); } - + + public static void resetMap() { + if (scene != null) { + scene.tiles.map(Dungeon.level.map, Level.WIDTH ); + + } + } + public static void updateMap() { if (scene != null) { scene.tiles.updated.set( 0, 0, Level.WIDTH, Level.HEIGHT );