v0.6.0: refactoring room painters into room types pt.1

This commit is contained in:
Evan Debenham 2017-03-08 19:35:21 -05:00
parent a7b3e4ca54
commit c120a78239
49 changed files with 329 additions and 378 deletions

View File

@ -51,9 +51,9 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.LastShopLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.StartScene;

View File

@ -27,6 +27,7 @@ import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -35,10 +36,10 @@ import com.watabou.noosa.Game;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.audio.Music;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.GameMath;
import java.util.Locale;
import javax.microedition.khronos.opengles.GL10;
import java.util.Locale;
public class ShatteredPixelDungeon extends Game {
@ -163,6 +164,17 @@ public class ShatteredPixelDungeon extends Game {
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion.class,
"com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stench" );
//0.6.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.MassGraveRoom.Bones.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.painters.MassGravePainter.Bones.class" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.RitualSiteRoom.RitualMarker.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.painters.RitualSitePainter.RitualMarker.class" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.WeakFloorRoom.HiddenWell.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.painters.WeakFloorPainter.HiddenWell.class" );
com.watabou.utils.Bundle.exceptionReporter =
new com.watabou.utils.Bundle.BundleExceptionCallback() {

View File

@ -32,8 +32,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.DarkGold;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.Pickaxe;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.BlacksmithSprite;

View File

@ -33,8 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;

View File

@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ToxicTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;

View File

@ -23,11 +23,9 @@ package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTileSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ExplosiveTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap;
@ -48,6 +46,8 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TeleportationTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.VenomTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WarpingTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTileSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.particles.PixelParticle;

View File

@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTileSheet;

View File

@ -23,10 +23,9 @@ package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTileSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BlazingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.CursingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisarmingTrap;
@ -46,6 +45,8 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.VenomTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WarpingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WeakeningTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTileSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.noosa.Group;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;

View File

@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.Group;

View File

@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.Group;
import com.watabou.utils.Bundle;

View File

@ -27,7 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.Group;
import com.watabou.utils.Graph;

View File

@ -66,8 +66,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.MassGravePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.MassGraveRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -369,7 +368,7 @@ public abstract class Level implements Bundlable {
CustomTiledVisual vis = (CustomTiledVisual)p;
//for compatibilities with pre-0.5.0b saves
//extends one of the bones visuals and discards the rest
if (vis instanceof MassGravePainter.Bones && vis.tileH == 0){
if (vis instanceof MassGraveRoom.Bones && vis.tileH == 0){
int cell = vis.tileX + vis.tileY*width;
if (map[cell] == Terrain.EMPTY_SP &&
DungeonTileSheet.wallStitcheable(map[cell - width]) &&

View File

@ -19,10 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.watabou.utils.Point;
import com.watabou.utils.Rect;

View File

@ -33,7 +33,8 @@ 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.levels.painters.MazePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.MazeRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SpearTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -306,7 +307,7 @@ public class PrisonBossLevel extends Level {
maze.set(10, 1, 31, 29);
maze.connected.put(null, new Room.Door(10, 2));
maze.connected.put(maze, new Room.Door(20, 29));
MazePainter.paint(this, maze);
MazeRoom.paint(this, maze);
buildFlagMaps();
cleanWalls();
GameScene.resetMap();

View File

@ -23,11 +23,11 @@ package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Wandmaker;
import com.shatteredpixel.shatteredpixeldungeon.effects.Halo;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.AlarmTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ChillingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap;
@ -44,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TeleportationTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ToxicTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.noosa.Group;
import com.watabou.noosa.particles.Emitter;
import com.watabou.utils.PointF;

View File

@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -34,9 +33,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.ShopPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.ShopRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ChillingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ExplosiveTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap;
@ -55,6 +54,7 @@ import java.util.List;
public abstract class RegularLevel extends Level {
protected ArrayList<Room> rooms;
protected Room roomEntrance;
@ -135,7 +135,7 @@ public abstract class RegularLevel extends Level {
if (Dungeon.shopOnLevel()) {
Room shop = null;
for (Room r : roomEntrance.connected.keySet()) {
if (r.connected.size() == 1 && ((r.width()-1)*(r.height()-1) >= ShopPainter.spaceNeeded())) {
if (r.connected.size() == 1 && ((r.width()-1)*(r.height()-1) >= ShopRoom.spaceNeeded())) {
shop = r;
break;
}
@ -795,7 +795,7 @@ public abstract class RegularLevel extends Level {
}
if (r.type == Type.ENTRANCE){
roomEntrance = r;
} else if (r.type == Type.EXIT || r.type == Type.BOSS_EXIT){
} else if (r.type == Type.EXIT){
roomExit = r;
}
}

View File

@ -29,7 +29,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.Group;

View File

@ -23,10 +23,10 @@ package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost;
import com.shatteredpixel.shatteredpixeldungeon.effects.Ripple;
import com.shatteredpixel.shatteredpixeldungeon.items.DewVial;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.AlarmTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ChillingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FlockTrap;
@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ToxicTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.particles.Emitter;

View File

@ -32,7 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;

View File

@ -1,43 +0,0 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2017 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 <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
public class BossExitPainter extends Painter {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
for (Room.Door door : room.connected.values()) {
door.set( Room.Door.Type.REGULAR );
}
level.exit = room.top * level.width() + (room.left + room.right) / 2;
set( level, level.exit, Terrain.LOCKED_EXIT );
}
}

View File

@ -19,39 +19,39 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
//import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SacrificialFire;
public class AltarPainter extends Painter {
public class AltarRoom extends Room {
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 );
Painter.fill( level, room, Terrain.WALL );
Painter.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 );
Point p = Painter.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 );
Painter.set( level, p, Terrain.EMPTY_SP );
}
} else {
Point p = drawInside( level, room, door, Math.abs( door.y - c.y ) - 2, Terrain.EMPTY_SP );
Point p = Painter.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 );
Painter.set( level, p, Terrain.EMPTY_SP );
}
}
fill( level, c.x - 1, c.y - 1, 3, 3, Terrain.EMBERS );
set( level, c, Terrain.PEDESTAL );
Painter.fill( level, c.x - 1, c.y - 1, 3, 3, Terrain.EMBERS );
Painter.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 );

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Bomb;
@ -27,17 +27,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class ArmoryPainter extends Painter {
public class ArmoryRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
Room.Door entrance = room.entrance();
Point statue = null;
@ -51,7 +51,7 @@ public class ArmoryPainter extends Painter {
statue = new Point( Random.Int( 2 ) == 0 ? room.left+1 : room.right-1, room.top+1 );
}
if (statue != null) {
set( level, statue, Terrain.STATUE );
Painter.set( level, statue, Terrain.STATUE );
}
int n = Random.IntRange( 1, 2 );

View File

@ -19,24 +19,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class BlacksmithPainter extends Painter {
public class BlacksmithRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.TRAP );
fill( level, room, 2, Terrain.EMPTY_SP );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.TRAP );
Painter.fill( level, room, 2, Terrain.EMPTY_SP );
for (int i=0; i < 2; i++) {
int pos;
@ -52,7 +52,7 @@ public class BlacksmithPainter extends Painter {
for (Room.Door door : room.connected.values()) {
door.set( Room.Door.Type.UNLOCKED );
drawInside( level, room, door, 1, Terrain.EMPTY );
Painter.drawInside( level, room, door, 1, Terrain.EMPTY );
}
Blacksmith npc = new Blacksmith();

View File

@ -19,25 +19,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
public class CryptPainter extends Painter {
public class CryptRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
Point c = room.center();
int cx = c.x;
@ -49,24 +49,24 @@ public class CryptPainter extends Painter {
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
if (entrance.x == room.left) {
set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
Painter.set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
Painter.set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
cx = room.right - 2;
} else if (entrance.x == room.right) {
set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
Painter.set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
Painter.set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
cx = room.left + 2;
} else if (entrance.y == room.top) {
set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
Painter.set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
Painter.set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
cy = room.bottom - 2;
} else if (entrance.y == room.bottom) {
set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
Painter.set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
Painter.set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
cy = room.top + 2;
}
level.drop( prize( level ), cx + cy * level.width() ).type = Type.TOMB;
level.drop( prize( level ), cx + cy * level.width() ).type = Heap.Type.TOMB;
}
private static Item prize( Level level ) {

View File

@ -19,18 +19,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
public class EntrancePainter extends Painter {
public class EntranceRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
for (Room.Door door : room.connected.values()) {
door.set( Room.Door.Type.REGULAR );
@ -39,7 +39,7 @@ public class EntrancePainter extends Painter {
do {
level.entrance = level.pointToCell(room.random(1));
} while (level.findMob(level.entrance) != null);
set( level, level.entrance, Terrain.ENTRANCE );
Painter.set( level, level.entrance, Terrain.ENTRANCE );
}
}

View File

@ -19,25 +19,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
public class ExitPainter extends Painter {
public class ExitRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
for (Room.Door door : room.connected.values()) {
door.set( Room.Door.Type.REGULAR );
}
level.exit = level.pointToCell(room.random( 1 ));
set( level, level.exit, Terrain.EXIT );
Painter.set( level, level.exit, Terrain.EXIT );
}
}

View File

@ -19,25 +19,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Foliage;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
import com.watabou.utils.Random;
public class GardenPainter extends Painter {
public class GardenRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.HIGH_GRASS );
fill( level, room, 2, Terrain.GRASS );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.HIGH_GRASS );
Painter.fill( level, room, 2, Terrain.GRASS );
room.entrance().set( Room.Door.Type.REGULAR );

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy;
@ -28,17 +28,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class LaboratoryPainter extends Painter {
public class LaboratoryRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY_SP );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY_SP );
Room.Door entrance = room.entrance();
@ -52,7 +52,7 @@ public class LaboratoryPainter extends Painter {
} else if (entrance.y == room.bottom) {
pot = new Point( Random.Int( 2 ) == 0 ? room.left + 1 : room.right - 1, room.top+1 );
}
set( level, pot, Terrain.ALCHEMY );
Painter.set( level, pot, Terrain.ALCHEMY );
Alchemy alchemy = new Alchemy();
alchemy.seed( level, pot.x + level.width() * pot.y, 1 );

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -29,25 +29,25 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class LibraryPainter extends Painter {
public class LibraryRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY_SP );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY_SP );
Room.Door entrance = room.entrance();
Point a = null;
Point b = null;
fill( level, room.left + 1, room.top+1, room.width() - 1, 1 , Terrain.BOOKSHELF );
Painter.fill( level, room.left + 1, room.top+1, room.width() - 1, 1 , Terrain.BOOKSHELF );
if (entrance.y == room.top){
set( level, entrance.x, entrance.y + 1, Terrain.EMPTY_SP );
Painter.set( level, entrance.x, entrance.y + 1, Terrain.EMPTY_SP );
}
int n = Random.IntRange( 2, 3 );

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
@ -28,23 +28,23 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfHealth;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WellWater;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class MagicWellPainter extends Painter {
public class MagicWellRoom extends Room {
private static final Class<?>[] WATERS =
{WaterOfAwareness.class, WaterOfHealth.class, WaterOfTransmutation.class};
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
Point c = room.center();
set( level, c.x, c.y, Terrain.WELL );
Painter.set( level, c.x, c.y, Terrain.WELL );
@SuppressWarnings("unchecked")
Class<? extends WellWater> waterClass =

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Skeleton;
@ -30,7 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTiledVisual;
@ -39,7 +39,7 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
public class MassGravePainter extends Painter {
public class MassGraveRoom extends Room {
public static void paint( Level level, Room room){
@ -47,8 +47,8 @@ public class MassGravePainter extends Painter {
entrance.set(Room.Door.Type.BARRICADE);
level.addItemToSpawn(new PotionOfLiquidFlame());
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.EMPTY_SP);
Painter.fill(level, room, Terrain.WALL);
Painter.fill(level, room, 1, Terrain.EMPTY_SP);
Bones b = new Bones();

View File

@ -19,17 +19,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Random;
public class MazePainter extends Painter {
public class MazeRoom extends Room {
public static void paint( Level level, Room room ) {
fill(level, room, 1, Terrain.EMPTY);
Painter.fill(level, room, 1, Terrain.EMPTY);
//true = space, false = wall
boolean[][] maze = new boolean[room.width() + 1][room.height() + 1];
@ -82,11 +82,11 @@ public class MazePainter extends Painter {
}
fill(level, room, 1, Terrain.EMPTY);
Painter.fill(level, room, 1, Terrain.EMPTY);
for (int x = 0; x < maze.length; x++)
for (int y = 0; y < maze[0].length; y++) {
if (!maze[x][y]) {
fill(level, x + room.left, y + room.top, 1, 1, Terrain.WALL);
Painter.fill(level, x + room.left, y + room.top, 1, 1, Terrain.WALL);
}
}
}

View File

@ -19,16 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.watabou.utils.Point;
import java.util.ArrayList;
import java.util.Collections;
public class PassagePainter extends Painter {
public class PassageRoom extends Room {
private static int pasWidth;
private static int pasHeight;
@ -63,11 +63,11 @@ public class PassagePainter extends Painter {
int p = joints.get( start );
do {
set( level, p2xy( room, p ), floor );
Painter.set( level, p2xy( room, p ), floor );
p = (p + 1) % perimeter;
} while (p != joints.get( end ));
set( level, p2xy( room, p ), floor );
Painter.set( level, p2xy( room, p ), floor );
for (Room.Door door : room.connected.values()) {
door.set( Room.Door.Type.TUNNEL );

View File

@ -19,25 +19,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class PitPainter extends Painter {
public class PitRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
Room.Door entrance = room.entrance();
entrance.set( Room.Door.Type.LOCKED );
@ -52,14 +52,14 @@ public class PitPainter extends Painter {
} else if (entrance.y == room.bottom) {
well = new Point( Random.Int( 2 ) == 0 ? room.left + 1 : room.right - 1, room.top+1 );
}
set( level, well, Terrain.EMPTY_WELL );
Painter.set( level, well, Terrain.EMPTY_WELL );
int remains = level.pointToCell(room.random());
while (level.map[remains] == Terrain.EMPTY_WELL) {
remains = level.pointToCell(room.random());
}
level.drop( new IronKey( Dungeon.depth ), remains ).type = Type.SKELETON;
level.drop( new IronKey( Dungeon.depth ), remains ).type = Heap.Type.SKELETON;
int loot = Random.Int( 3 );
if (loot == 0) {
level.drop( Generator.random( Generator.Category.RING ), remains );

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha;
@ -29,18 +29,18 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Random;
public class PoolPainter extends Painter {
public class PoolRoom extends Room {
private static final int NPIRANHAS = 3;
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.WATER );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.WATER );
Room.Door door = room.entrance();
door.set( Room.Door.Type.REGULAR );
@ -72,7 +72,7 @@ public class PoolPainter extends Painter {
int pos = x + y * level.width();
level.drop( prize( level ), pos ).type =
Random.Int( 3 ) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;
set( level, pos, Terrain.PEDESTAL );
Painter.set( level, pos, Terrain.PEDESTAL );
level.addItemToSpawn( new PotionOfInvisibility() );

View File

@ -19,23 +19,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.RatKing;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Random;
public class RatKingPainter extends Painter {
public class RatKingRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY_SP );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY_SP );
Room.Door entrance = room.entrance();
entrance.set( Room.Door.Type.HIDDEN );

View File

@ -19,18 +19,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.CeremonialCandle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTiledVisual;
import com.watabou.utils.Point;
public class RitualSitePainter extends Painter {
public class RitualSiteRoom extends Room {
public static void paint( Level level, Room room) {
@ -38,16 +38,16 @@ public class RitualSitePainter extends Painter {
door.set( Room.Door.Type.REGULAR );
}
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.EMPTY);
Painter.fill(level, room, Terrain.WALL);
Painter.fill(level, room, 1, Terrain.EMPTY);
RitualMarker vis = new RitualMarker();
Point c = room.center();
vis.pos(c.x - 1, c.y - 1);
level.customTiles.add(vis);
fill(level, c.x-1, c.y-1, 3, 3, Terrain.EMPTY_DECO);
Painter.fill(level, c.x-1, c.y-1, 3, 3, Terrain.EMPTY_DECO);
level.addItemToSpawn(new CeremonialCandle());
level.addItemToSpawn(new CeremonialCandle());

View File

@ -19,38 +19,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.AltarPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.ArmoryPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.BlacksmithPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.BossExitPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.CryptPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.EntrancePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.ExitPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.GardenPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.LaboratoryPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.LibraryPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.MagicWellPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.MassGravePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.PassagePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.PitPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.PoolPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.RatKingPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.RitualSitePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.RotGardenPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.ShopPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.StandardPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.StatuePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.StoragePainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.TrapsPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.TreasuryPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.TunnelPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.VaultPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.WeakFloorPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
import com.watabou.utils.Graph;
@ -72,41 +44,52 @@ public class Room extends Rect implements Graph.Node, Bundlable {
public int distance;
public int price = 1;
public Room(){
super();
}
public Room(Rect other){
super(other);
}
public Room( int left, int top, int right, int bottom ) {
super( left, top, right, bottom );
}
//TODO convert these types into full subclasses of room
public static enum Type {
NULL( null ),
STANDARD ( StandardPainter.class ),
ENTRANCE ( EntrancePainter.class ),
EXIT ( ExitPainter.class ),
BOSS_EXIT ( BossExitPainter.class ),
TUNNEL ( TunnelPainter.class ),
PASSAGE ( PassagePainter.class ),
SHOP ( ShopPainter.class ),
BLACKSMITH ( BlacksmithPainter.class ),
TREASURY ( TreasuryPainter.class ),
ARMORY ( ArmoryPainter.class ),
LIBRARY ( LibraryPainter.class ),
LABORATORY ( LaboratoryPainter.class ),
VAULT ( VaultPainter.class ),
TRAPS ( TrapsPainter.class ),
STORAGE ( StoragePainter.class ),
MAGIC_WELL ( MagicWellPainter.class ),
GARDEN ( GardenPainter.class ),
CRYPT ( CryptPainter.class ),
STATUE ( StatuePainter.class ),
POOL ( PoolPainter.class ),
RAT_KING ( RatKingPainter.class ),
WEAK_FLOOR ( WeakFloorPainter.class ),
PIT ( PitPainter.class ),
ALTAR ( AltarPainter.class ),
STANDARD ( StandardRoom.class ),
ENTRANCE ( EntranceRoom.class ),
EXIT ( ExitRoom.class ),
TUNNEL ( MazeRoom.class ),
PASSAGE ( PassageRoom.class ),
SHOP ( ShopRoom.class ),
BLACKSMITH ( BlacksmithRoom.class ),
TREASURY ( TreasuryRoom.class ),
ARMORY ( ArmoryRoom.class ),
LIBRARY ( LibraryRoom.class ),
LABORATORY ( LaboratoryRoom.class ),
VAULT ( VaultRoom.class ),
TRAPS ( TrapsRoom.class ),
STORAGE ( StorageRoom.class ),
MAGIC_WELL ( MagicWellRoom.class ),
GARDEN ( GardenRoom.class ),
CRYPT ( CryptRoom.class ),
STATUE ( StatueRoom.class ),
POOL ( PoolRoom.class ),
RAT_KING ( RatKingRoom.class ),
WEAK_FLOOR ( WeakFloorRoom.class ),
PIT ( PitRoom.class ),
//prison quests
MASS_GRAVE ( MassGravePainter.class ),
ROT_GARDEN ( RotGardenPainter.class ),
RITUAL_SITE ( RitualSitePainter.class );
MASS_GRAVE ( MassGraveRoom.class ),
ROT_GARDEN ( RotGardenRoom.class ),
RITUAL_SITE ( RitualSiteRoom.class );
private Method paint;
Type( Class<? extends Painter> painter ) {
Type( Class<? extends Room> painter ) {
if (painter == null)
paint = null;
else

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
@ -27,12 +27,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotHeart;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotLasher;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class RotGardenPainter extends Painter {
public class RotGardenRoom extends Room {
public static void paint( Level level, Room room ) {
@ -40,8 +40,8 @@ public class RotGardenPainter extends Painter {
entrance.set(Room.Door.Type.LOCKED);
level.addItemToSpawn(new IronKey(Dungeon.depth));
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.GRASS);
Painter.fill(level, room, Terrain.WALL);
Painter.fill(level, room, 1, Terrain.GRASS);
int heartX = Random.IntRange(room.left+1, room.right-1);
@ -90,7 +90,7 @@ public class RotGardenPainter extends Painter {
for(int i : PathFinder.NEIGHBOURS8) {
if (level.map[pos + i] == Terrain.GRASS){
set(level, pos + i, Terrain.HIGH_GRASS);
Painter.set(level, pos + i, Terrain.HIGH_GRASS);
}
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
@ -68,7 +68,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tamahawk;
import com.shatteredpixel.shatteredpixeldungeon.levels.LastShopLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.watabou.utils.PathFinder;
@ -78,7 +78,7 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.Collections;
public class ShopPainter extends Painter {
public class ShopRoom extends Room {
private static int pasWidth;
private static int pasHeight;
@ -87,8 +87,8 @@ public class ShopPainter extends Painter {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY_SP );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY_SP );
pasWidth = room.width() - 2;
pasHeight = room.height() - 2;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -27,17 +27,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class StandardPainter extends Painter {
public class StandardRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
Painter.fill( level, room, Terrain.WALL );
for (Room.Door door : room.connected.values()) {
door.set( Room.Door.Type.REGULAR );
}
@ -92,7 +92,7 @@ public class StandardPainter extends Painter {
}
}
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, 1, Terrain.EMPTY );
}
private static void paintBurned( Level level, Room room ) {
@ -125,7 +125,7 @@ public class StandardPainter extends Painter {
}
private static void paintGraveyard( Level level, Room room ) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.GRASS );
Painter.fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.GRASS );
int w = room.width() - 1;
int h = room.height() - 1;
@ -143,37 +143,37 @@ public class StandardPainter extends Painter {
}
private static void paintStriped( Level level, Room room ) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.EMPTY_SP );
Painter.fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.EMPTY_SP );
if (room.width() > room.height()) {
for (int i=room.left + 2; i < room.right; i += 2) {
fill( level, i, room.top + 1, 1, room.height() - 1, Terrain.HIGH_GRASS );
Painter.fill( level, i, room.top + 1, 1, room.height() - 1, Terrain.HIGH_GRASS );
}
} else {
for (int i=room.top + 2; i < room.bottom; i += 2) {
fill( level, room.left + 1, i, room.width() - 1, 1, Terrain.HIGH_GRASS );
Painter.fill( level, room.left + 1, i, room.width() - 1, 1, Terrain.HIGH_GRASS );
}
}
}
//TODO: this is almost a special room type now, consider moving this into its own painter if/when you address room gen significantly.
private static void paintStudy( Level level, Room room ) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.BOOKSHELF );
fill( level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3 , Terrain.EMPTY_SP );
Painter.fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.BOOKSHELF );
Painter.fill( level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3 , Terrain.EMPTY_SP );
for (Point door : room.connected.values()) {
if (door.x == room.left) {
set( level, door.x + 1, door.y, Terrain.EMPTY );
Painter.set( level, door.x + 1, door.y, Terrain.EMPTY );
} else if (door.x == room.right) {
set( level, door.x - 1, door.y, Terrain.EMPTY );
Painter.set( level, door.x - 1, door.y, Terrain.EMPTY );
} else if (door.y == room.top) {
set( level, door.x, door.y + 1, Terrain.EMPTY );
Painter.set( level, door.x, door.y + 1, Terrain.EMPTY );
} else if (door.y == room.bottom) {
set( level, door.x , door.y - 1, Terrain.EMPTY );
Painter.set( level, door.x , door.y - 1, Terrain.EMPTY );
}
}
Point center = room.center();
set( level, center, Terrain.PEDESTAL );
Painter.set( level, center, Terrain.PEDESTAL );
if (Random.Int(2) != 0){
Item prize = level.findPrizeItem();
if (prize != null) {
@ -189,7 +189,7 @@ public class StandardPainter extends Painter {
private static void paintBridge( Level level, Room room ) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 ,
Painter.fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 ,
!Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) && Random.Int( 3 ) == 0 ?
Terrain.CHASM :
Terrain.WATER );
@ -209,9 +209,9 @@ public class StandardPainter extends Painter {
int s = room.width() / 2;
drawInside( level, room, door1, s, Terrain.EMPTY_SP );
drawInside( level, room, door2, s, Terrain.EMPTY_SP );
fill( level, room.center().x, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP );
Painter.drawInside( level, room, door1, s, Terrain.EMPTY_SP );
Painter.drawInside( level, room, door2, s, Terrain.EMPTY_SP );
Painter.fill( level, room.center().x, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP );
} else
if ((door1.y == room.top && door2.y == room.bottom) ||
@ -219,44 +219,44 @@ public class StandardPainter extends Painter {
int s = room.height() / 2;
drawInside( level, room, door1, s, Terrain.EMPTY_SP );
drawInside( level, room, door2, s, Terrain.EMPTY_SP );
fill( level, Math.min( door1.x, door2.x ), room.center().y, Math.abs( door1.x - door2.x ) + 1, 1, Terrain.EMPTY_SP );
Painter.drawInside( level, room, door1, s, Terrain.EMPTY_SP );
Painter.drawInside( level, room, door2, s, Terrain.EMPTY_SP );
Painter.fill( level, Math.min( door1.x, door2.x ), room.center().y, Math.abs( door1.x - door2.x ) + 1, 1, Terrain.EMPTY_SP );
} else
if (door1.x == door2.x) {
fill( level, door1.x == room.left ? room.left + 1 : room.right - 1, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP );
Painter.fill( level, door1.x == room.left ? room.left + 1 : room.right - 1, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP );
} else
if (door1.y == door2.y) {
fill( level, Math.min( door1.x, door2.x ), door1.y == room.top ? room.top + 1 : room.bottom - 1, Math.abs( door1.x - door2.x ) + 1, 1, Terrain.EMPTY_SP );
Painter.fill( level, Math.min( door1.x, door2.x ), door1.y == room.top ? room.top + 1 : room.bottom - 1, Math.abs( door1.x - door2.x ) + 1, 1, Terrain.EMPTY_SP );
} else
if (door1.y == room.top || door1.y == room.bottom) {
drawInside( level, room, door1, Math.abs( door1.y - door2.y ), Terrain.EMPTY_SP );
drawInside( level, room, door2, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, door1, Math.abs( door1.y - door2.y ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, door2, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP );
} else
if (door1.x == room.left || door1.x == room.right) {
drawInside( level, room, door1, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP );
drawInside( level, room, door2, Math.abs( door1.y - door2.y ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, door1, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, door2, Math.abs( door1.y - door2.y ), Terrain.EMPTY_SP );
}
}
private static void paintFissure( Level level, Room room ) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 ,Terrain.EMPTY );
Painter.fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 ,Terrain.EMPTY );
for (int i=room.top + 2; i < room.bottom - 1; i++) {
for (int j=room.left + 2; j < room.right - 1; j++) {
int v = Math.min( i - room.top, room.bottom - i );
int h = Math.min( j - room.left, room.right - j );
if (Math.min( v, h ) > 2 || Random.Int( 2 ) == 0) {
set( level, j, i, Terrain.CHASM );
Painter.set( level, j, i, Terrain.CHASM );
}
}
}

View File

@ -19,22 +19,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
public class StatuePainter extends Painter {
public class StatueRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
Point c = room.center();
int cx = c.x;
@ -47,22 +47,22 @@ public class StatuePainter extends Painter {
if (door.x == room.left) {
fill( level, room.right - 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
Painter.fill( level, room.right - 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
cx = room.right - 2;
} else if (door.x == room.right) {
fill( level, room.left + 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
Painter.fill( level, room.left + 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
cx = room.left + 2;
} else if (door.y == room.top) {
fill( level, room.left + 1, room.bottom - 1, room.width() - 1, 1 , Terrain.STATUE );
Painter.fill( level, room.left + 1, room.bottom - 1, room.width() - 1, 1 , Terrain.STATUE );
cy = room.bottom - 2;
} else if (door.y == room.bottom) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, 1 , Terrain.STATUE );
Painter.fill( level, room.left + 1, room.top + 1, room.width() - 1, 1 , Terrain.STATUE );
cy = room.top + 2;
}

View File

@ -19,25 +19,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Honeypot;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Random;
public class StoragePainter extends Painter {
public class StorageRoom extends Room {
public static void paint( Level level, Room room ) {
final int floor = Terrain.EMPTY_SP;
fill( level, room, Terrain.WALL );
fill( level, room, 1, floor );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, floor );
boolean honeyPot = Random.Int( 2 ) == 0;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
@ -29,7 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BlazingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap;
@ -48,11 +48,11 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WarpingTrap;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class TrapsPainter extends Painter {
public class TrapsRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
Painter.fill( level, room, Terrain.WALL );
Class<? extends Trap> trapClass;
switch (Random.Int(5)){
@ -68,9 +68,9 @@ public class TrapsPainter extends Painter {
}
if (trapClass == null){
fill(level, room, 1, Terrain.CHASM);
Painter.fill(level, room, 1, Terrain.CHASM);
} else {
fill(level, room, 1, Terrain.TRAP);
Painter.fill(level, room, 1, Terrain.TRAP);
}
Room.Door door = room.entrance();
@ -83,19 +83,19 @@ public class TrapsPainter extends Painter {
if (door.x == room.left) {
x = room.right - 1;
y = room.top + room.height() / 2;
fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
Painter.fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
} else if (door.x == room.right) {
x = room.left + 1;
y = room.top + room.height() / 2;
fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
Painter.fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
} else if (door.y == room.top) {
x = room.left + room.width() / 2;
y = room.bottom - 1;
fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
Painter.fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
} else if (door.y == room.bottom) {
x = room.left + room.width() / 2;
y = room.top + 1;
fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
Painter.fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
}
for(Point p : room.getPoints()) {
@ -112,11 +112,11 @@ public class TrapsPainter extends Painter {
int pos = x + y * level.width();
if (Random.Int( 3 ) == 0) {
if (lastRow == Terrain.CHASM) {
set( level, pos, Terrain.EMPTY );
Painter.set( level, pos, Terrain.EMPTY );
}
level.drop( prize( level ), pos ).type = Heap.Type.CHEST;
} else {
set( level, pos, Terrain.PEDESTAL );
Painter.set( level, pos, Terrain.PEDESTAL );
level.drop( prize( level ), pos );
}

View File

@ -19,25 +19,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Random;
public class TreasuryPainter extends Painter {
public class TreasuryRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
set( level, room.center(), Terrain.STATUE );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY );
Painter.set( level, room.center(), Terrain.STATUE );
Heap.Type heapType = Random.Int( 2 ) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;

View File

@ -19,14 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class TunnelPainter extends Painter {
public class TunnelRoom extends Room {
public static void paint( Level level, Room room ) {
@ -47,14 +47,14 @@ public class TunnelPainter extends Painter {
from = room.left + 1;
for (int i=door.y; i != c.y; i += step) {
set( level, from, i, floor );
Painter.set( level, from, i, floor );
}
} else if (door.x == room.right) {
to = room.right - 1;
for (int i=door.y; i != c.y; i += step) {
set( level, to, i, floor );
Painter.set( level, to, i, floor );
}
} else {
@ -66,13 +66,13 @@ public class TunnelPainter extends Painter {
}
for (int i=door.y+step; i != c.y; i += step) {
set( level, door.x, i, floor );
Painter.set( level, door.x, i, floor );
}
}
}
for (int i=from; i <= to; i++) {
set( level, i, c.y, floor );
Painter.set( level, i, c.y, floor );
}
} else {
@ -88,14 +88,14 @@ public class TunnelPainter extends Painter {
from = room.top + 1;
for (int i=door.x; i != c.x; i += step) {
set( level, i, from, floor );
Painter.set( level, i, from, floor );
}
} else if (door.y == room.bottom) {
to = room.bottom - 1;
for (int i=door.x; i != c.x; i += step) {
set( level, i, to, floor );
Painter.set( level, i, to, floor );
}
} else {
@ -107,13 +107,13 @@ public class TunnelPainter extends Painter {
}
for (int i=door.x+step; i != c.x; i += step) {
set( level, i, door.y, floor );
Painter.set( level, i, door.y, floor );
}
}
}
for (int i=from; i <= to; i++) {
set( level, c.x, i, floor );
Painter.set( level, c.x, i, floor );
}
}

View File

@ -19,27 +19,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class VaultPainter extends Painter {
public class VaultRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY_SP );
fill( level, room, 2, Terrain.EMPTY );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.EMPTY_SP );
Painter.fill( level, room, 2, Terrain.EMPTY );
int cx = (room.left + room.right) / 2;
int cy = (room.top + room.bottom) / 2;
@ -48,7 +48,7 @@ public class VaultPainter extends Painter {
switch (Random.Int( 3 )) {
case 0:
level.drop( prize( level ), c ).type = Type.LOCKED_CHEST;
level.drop( prize( level ), c ).type = Heap.Type.LOCKED_CHEST;
level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
break;
@ -58,14 +58,14 @@ public class VaultPainter extends Painter {
i1 = prize( level );
i2 = prize( level );
} while (i1.getClass() == i2.getClass());
level.drop( i1, c ).type = Type.CRYSTAL_CHEST;
level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Type.CRYSTAL_CHEST;
level.drop( i1, c ).type = Heap.Type.CRYSTAL_CHEST;
level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Heap.Type.CRYSTAL_CHEST;
level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
break;
case 2:
level.drop( prize( level ), c );
set( level, c, Terrain.PEDESTAL );
Painter.set( level, c, Terrain.PEDESTAL );
break;
}

View File

@ -19,43 +19,43 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTiledVisual;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class WeakFloorPainter extends Painter {
public class WeakFloorRoom extends Room {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.CHASM );
Painter.fill( level, room, Terrain.WALL );
Painter.fill( level, room, 1, Terrain.CHASM );
Room.Door door = room.entrance();
door.set( Room.Door.Type.REGULAR );
if (door.x == room.left) {
for (int i=room.top + 1; i < room.bottom; i++) {
drawInside( level, room, new Point( room.left, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, new Point( room.left, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
}
} else if (door.x == room.right) {
for (int i=room.top + 1; i < room.bottom; i++) {
drawInside( level, room, new Point( room.right, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, new Point( room.right, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
}
} else if (door.y == room.top) {
for (int i=room.left + 1; i < room.right; i++) {
drawInside( level, room, new Point( i, room.top ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, new Point( i, room.top ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
}
} else if (door.y == room.bottom) {
for (int i=room.left + 1; i < room.right; i++) {
drawInside( level, room, new Point( i, room.bottom ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
Painter.drawInside( level, room, new Point( i, room.bottom ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
}
}
@ -69,7 +69,7 @@ public class WeakFloorPainter extends Painter {
} else if (door.y == room.bottom) {
well = new Point( Random.Int( 2 ) == 0 ? room.left + 1 : room.right - 1, room.top+2 );
}
set(level, well, Terrain.CHASM);
Painter.set(level, well, Terrain.CHASM);
CustomTiledVisual vis = new HiddenWell();
vis.pos(well.x, well.y);
level.customTiles.add(vis);

View File

@ -38,15 +38,15 @@ levels.features.sign.burn=As you try to read the sign it bursts into greenish fl
###painters
levels.painters.massgravepainter$bones.name=Mass grave
levels.painters.massgravepainter$bones.desc=bones litter the floor, what happened here?
###rooms
levels.rooms.massgraveroom$bones.name=Mass grave
levels.rooms.massgraveroom$bones.desc=bones litter the floor, what happened here?
levels.painters.ritualsitepainter$ritualmarker.name=Ritual marker
levels.painters.ritualsitepainter$ritualmarker.desc=A painted marker for some dark ritual. Candles are usually placed on the four corners.
levels.rooms.ritualsiteroom$ritualmarker.name=Ritual marker
levels.rooms.ritualsiteroom$ritualmarker.desc=A painted marker for some dark ritual. Candles are usually placed on the four corners.
levels.painters.weakfloorpainter$hiddenwell.name=Distant well
levels.painters.weakfloorpainter$hiddenwell.desc=You can just make out a well in the depths below, perhaps there is something down there?
levels.rooms.weakfloorroom$hiddenwell.name=Distant well
levels.rooms.weakfloorroom$hiddenwell.desc=You can just make out a well in the depths below, perhaps there is something down there?
###traps