From 648246641aa30a19a048b53c0bc422ecf03afbb9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 9 Nov 2015 15:23:22 -0500 Subject: [PATCH] Merging 1.9.1 source: level changes Differences: - Altar room turned off for now - Keep the guaranteed transmutation well --- .../shatteredpixeldungeon/levels/Level.java | 41 +++++++++--- .../levels/RegularLevel.java | 1 + .../shatteredpixeldungeon/levels/Room.java | 1 + .../levels/features/Sign.java | 3 +- .../levels/painters/AltarPainter.java | 64 +++++++++++++++++++ .../levels/painters/CryptPainter.java | 2 +- .../levels/painters/PoolPainter.java | 2 +- .../levels/painters/ShopPainter.java | 4 +- .../levels/painters/TrapsPainter.java | 2 +- .../levels/painters/VaultPainter.java | 3 +- .../levels/traps/DisintegrationTrap.java | 2 +- .../levels/traps/GuardianTrap.java | 2 +- 12 files changed, 109 insertions(+), 18 deletions(-) create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/AltarPainter.java diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 942f59e9f..bf823cfbc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -615,13 +615,7 @@ public abstract class Level implements Bundlable { for (int i=WIDTH; i < LENGTH - WIDTH; i++) { if (water[i]) { - int t = Terrain.WATER_TILES; - for (int j=0; j < NEIGHBOURS4.length; j++) { - if ((Terrain.flags[map[i + NEIGHBOURS4[j]]] & Terrain.UNSTITCHABLE) != 0) { - t += 1 << j; - } - } - map[i] = t; + map[i] = getWaterTile( i ); } if (pit[i]) { @@ -640,7 +634,38 @@ public abstract class Level implements Bundlable { } } } - + + private int getWaterTile( int pos ) { + int t = Terrain.WATER_TILES; + for (int j=0; j < NEIGHBOURS4.length; j++) { + if ((Terrain.flags[map[pos + NEIGHBOURS4[j]]] & Terrain.UNSTITCHABLE) != 0) { + t += 1 << j; + } + } + return t; + } + + public void destroy( int pos ) { + if ((Terrain.flags[map[pos]] & Terrain.UNSTITCHABLE) == 0) { + + set( pos, Terrain.EMBERS ); + + } else { + boolean flood = false; + for (int j=0; j < NEIGHBOURS4.length; j++) { + if (water[pos + NEIGHBOURS4[j]]) { + flood = true; + break; + } + } + if (flood) { + set( pos, getWaterTile( pos ) ); + } else { + set( pos, Terrain.EMBERS ); + } + } + } + protected void cleanWalls() { for (int i=0; i < LENGTH; i++) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 3a693c427..cce04934c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -500,6 +500,7 @@ public abstract class RegularLevel extends Level { break; case HIDDEN: map[door] = Terrain.SECRET_DOOR; + secretDoors++; break; case BARRICADE: map[door] = Random.Int( 3 ) == 0 ? Terrain.BOOKSHELF : Terrain.BARRICADE; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java index 5097b640f..0291f3ad0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java @@ -69,6 +69,7 @@ public class Room extends Rect implements Graph.Node, Bundlable { RAT_KING ( RatKingPainter.class ), WEAK_FLOOR ( WeakFloorPainter.class ), PIT ( PitPainter.class ), + ALTAR ( AltarPainter.class ), //prison quests MASS_GRAVE ( MassGravePainter.class ), diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java index 8f7d08697..4d56a7c0e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Sign.java @@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; import com.shatteredpixel.shatteredpixeldungeon.levels.DeadEndLevel; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -114,7 +113,7 @@ public class Sign { if (index >= 21) { - Level.set( pos, Terrain.EMBERS ); + Dungeon.level.destroy( pos ); GameScene.updateMap( pos ); GameScene.discoverTile( pos, Terrain.SIGN ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/AltarPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/AltarPainter.java new file mode 100644 index 000000000..6815be124 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/AltarPainter.java @@ -0,0 +1,64 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ +package com.shatteredpixel.shatteredpixeldungeon.levels.painters; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +//import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SacrificialFire; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.levels.Room; +import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; +import com.watabou.utils.Point; + +public class AltarPainter extends Painter { + + public static void paint( Level level, Room room ) { + + fill( level, room, Terrain.WALL ); + fill( level, room, 1, Dungeon.bossLevel( Dungeon.depth + 1 ) ? Terrain.HIGH_GRASS : Terrain.CHASM ); + + Point c = room.center(); + Room.Door door = room.entrance(); + if (door.x == room.left || door.x == room.right) { + Point p = drawInside( level, room, door, Math.abs( door.x - c.x ) - 2, Terrain.EMPTY_SP ); + for (; p.y != c.y; p.y += p.y < c.y ? +1 : -1) { + set( level, p, Terrain.EMPTY_SP ); + } + } else { + Point p = drawInside( level, room, door, Math.abs( door.y - c.y ) - 2, Terrain.EMPTY_SP ); + for (; p.x != c.x; p.x += p.x < c.x ? +1 : -1) { + set( level, p, Terrain.EMPTY_SP ); + } + } + + fill( level, c.x - 1, c.y - 1, 3, 3, Terrain.EMBERS ); + set( level, c, Terrain.PEDESTAL ); + + //TODO: find some use for sacrificial fire... but not the vanilla one. scroll of wipe out is too strong. + /*SacrificialFire fire = (SacrificialFire)level.blobs.get( SacrificialFire.class ); + if (fire == null) { + fire = new SacrificialFire(); + } + fire.seed( c.x + c.y * Level.WIDTH, 5 + Dungeon.depth * 5 ); + level.blobs.put( SacrificialFire.class, fire );*/ + + door.set( Room.Door.Type.EMPTY ); + } +} \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/CryptPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/CryptPainter.java index 44e47e93c..0e22e4941 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/CryptPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/CryptPainter.java @@ -73,7 +73,7 @@ public class CryptPainter extends Painter { for (int i=0; i < 3; i++) { Item another = Generator.random( Generator.Category.ARMOR ); - if (another.level > prize.level) { + if (another.level() > prize.level()) { prize = another; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java index 97f9fd81a..03bc00745 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/PoolPainter.java @@ -103,7 +103,7 @@ public class PoolPainter extends Painter { Generator.Category.WEAPON, Generator.Category.ARMOR ) ); - if (another.level > prize.level) { + if (another.level() > prize.level()) { prize = another; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java index a0c36bbfe..44828fb7f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/ShopPainter.java @@ -234,11 +234,11 @@ public class ShopPainter extends Painter { switch (Random.Int(10)){ case 0: rare = Generator.random( Generator.Category.WAND ); - if (rare.level > 0 ) rare.degrade( rare.level ); + rare.level( 0 ); break; case 1: rare = Generator.random(Generator.Category.RING); - rare.level = 1; + rare.level( 1 ); break; case 2: rare = Generator.random( Generator.Category.ARTIFACT ).identify(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java index 69b990a23..1296f9697 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java @@ -125,7 +125,7 @@ public class TrapsPainter extends Painter { Generator.Category.WEAPON, Generator.Category.ARMOR ) ); - if (another.level > prize.level) { + if (another.level() > prize.level()) { prize = another; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java index d947268c4..a90d5e0c0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/VaultPainter.java @@ -36,7 +36,8 @@ public class VaultPainter extends Painter { public static void paint( Level level, Room room ) { fill( level, room, Terrain.WALL ); - fill( level, room, 1, Terrain.EMPTY ); + fill( level, room, 1, Terrain.EMPTY_SP ); + fill( level, room, 2, Terrain.EMPTY ); int cx = (room.left + room.right) / 2; int cy = (room.top + room.bottom) / 2; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java index cae18be53..90fb552ec 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java @@ -77,7 +77,7 @@ public class DisintegrationTrap extends Trap { bag = (Bag)item; item = Random.element(bag.items); } - if (item.level > 0 || item.unique) return; + if (item.level() > 0 || item.unique) return; if (!item.stackable){ item.detachAll(bag); GLog.w("the trap disintegrates your " + item.name() + "!"); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java index ab31ce0b5..22f23070d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java @@ -85,7 +85,7 @@ public class GuardianTrap extends Trap { super(); weapon.enchant(null); - weapon.degrade(weapon.level); + weapon.degrade(weapon.level()); } @Override