v0.6.0: refactored connecting rooms
This commit is contained in:
parent
8f19112875
commit
e0d6f7227a
|
@ -26,8 +26,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.TunnelRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel.TunnelRoom;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ExplosiveTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ExplosiveTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel.TunnelRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.TunnelRoom;
|
||||||
import com.watabou.utils.GameMath;
|
import com.watabou.utils.GameMath;
|
||||||
import com.watabou.utils.Point;
|
import com.watabou.utils.Point;
|
||||||
import com.watabou.utils.PointF;
|
import com.watabou.utils.PointF;
|
||||||
|
|
|
@ -21,16 +21,14 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.TunnelRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RatKingRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RatKingRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel.PassageRoom;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel.TunnelRoom;
|
|
||||||
import com.watabou.utils.Graph;
|
import com.watabou.utils.Graph;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
import com.watabou.utils.Rect;
|
import com.watabou.utils.Rect;
|
||||||
|
@ -378,6 +376,7 @@ public class LegacyBuilder extends Builder {
|
||||||
Room roomShop = null;
|
Room roomShop = null;
|
||||||
int shopSquare = 0;
|
int shopSquare = 0;
|
||||||
ListIterator<Room> it = rooms.listIterator();
|
ListIterator<Room> it = rooms.listIterator();
|
||||||
|
/*
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Room r = it.next();
|
Room r = it.next();
|
||||||
if (r.getClass().equals(Room.class) && r.connected.size() > 0) {
|
if (r.getClass().equals(Room.class) && r.connected.size() > 0) {
|
||||||
|
@ -387,7 +386,7 @@ public class LegacyBuilder extends Builder {
|
||||||
shopSquare = r.square();
|
shopSquare = r.square();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (roomShop == null || shopSquare < 54) {
|
if (roomShop == null || shopSquare < 54) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -547,7 +546,7 @@ public class LegacyBuilder extends Builder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Level.pitRoomNeeded && !pitMade) return false;
|
if (Level.pitRoomNeeded && !pitMade) return false;
|
||||||
*/
|
|
||||||
Class<? extends Room> tunnelType = TunnelRoom.class;
|
Class<? extends Room> tunnelType = TunnelRoom.class;
|
||||||
if ((Dungeon.depth > 5 && Dungeon.depth <= 10) ||
|
if ((Dungeon.depth > 5 && Dungeon.depth <= 10) ||
|
||||||
(Dungeon.depth > 15 && Dungeon.depth <= 20)){
|
(Dungeon.depth > 15 && Dungeon.depth <= 20)){
|
||||||
|
@ -583,7 +582,7 @@ public class LegacyBuilder extends Builder {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.TunnelRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel.TunnelRoom;
|
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.TunnelRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel.TunnelRoom;
|
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* 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.rooms.connection;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
|
|
||||||
|
public abstract class ConnectionRoom extends Room {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minWidth() { return 3; }
|
||||||
|
public int maxWidth() { return 10; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minHeight() { return 3; }
|
||||||
|
public int maxHeight() { return 10; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minConnections(int direction) {
|
||||||
|
if (direction == ALL) return 2;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxConnections(int direction) {
|
||||||
|
if (direction == ALL) return 16;
|
||||||
|
else return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -19,7 +19,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
|
@ -29,7 +29,9 @@ import com.watabou.utils.Point;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
public class PassageRoom extends TunnelRoom {
|
//tunnels along the room's perimeter
|
||||||
|
//FIXME should be refactored, like shop rooms (which use perimiter logic for item placement)
|
||||||
|
public class PerimeterRoom extends ConnectionRoom {
|
||||||
|
|
||||||
private static int pasWidth;
|
private static int pasWidth;
|
||||||
private static int pasHeight;
|
private static int pasHeight;
|
|
@ -19,35 +19,15 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.tunnel;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
|
||||||
import com.watabou.utils.Point;
|
import com.watabou.utils.Point;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class TunnelRoom extends Room {
|
//tunnels along the rooms center, with straight lines
|
||||||
|
public class TunnelRoom extends ConnectionRoom {
|
||||||
@Override
|
|
||||||
public int minWidth() { return 3; }
|
|
||||||
public int maxWidth() { return 10; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int minHeight() { return 3; }
|
|
||||||
public int maxHeight() { return 10; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int minConnections(int direction) {
|
|
||||||
if (direction == ALL) return 2;
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int maxConnections(int direction) {
|
|
||||||
if (direction == ALL) return 16;
|
|
||||||
else return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void paint(Level level) {
|
public void paint(Level level) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user