v0.6.1: added a new type of connection room (and chasm variant)

This commit is contained in:
Evan Debenham 2017-07-24 14:32:31 -04:00 committed by Evan Debenham
parent ce274df5b8
commit 5c0648dcf2
5 changed files with 135 additions and 9 deletions

View File

@ -39,7 +39,7 @@ public class BridgeRoom extends TunnelRoom {
super.paint(level);
for (Room r : neigbours){
if (r instanceof BridgeRoom || r instanceof WalkwayRoom){
if (r instanceof BridgeRoom || r instanceof RingBridgeRoom || r instanceof WalkwayRoom){
Rect i = intersect(r);
if (i.width() != 0){
i.left++;

View File

@ -66,27 +66,28 @@ public abstract class ConnectionRoom extends Room {
rooms.add(PerimeterRoom.class);
rooms.add(WalkwayRoom.class);
rooms.add(MazeConnectionRoom.class);
rooms.add(RingTunnelRoom.class);
rooms.add(RingBridgeRoom.class);
}
private static float[][] chances = new float[27][];
static {
chances[1] = new float[]{10, 1, 0, 1, 0};
chances[1] = new float[]{20, 1, 0, 2, 2, 1};
chances[4] = chances[3] = chances[2] = chances[1];
chances[5] = new float[]{1, 0, 0, 0, 0};
chances[5] = new float[]{18, 0, 0, 0, 7, 0};
chances[6] = new float[]{0, 0, 10, 2, 0};
chances[6] = new float[]{0, 0, 22, 3, 0, 0};
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
chances[11] = new float[]{10, 0, 0, 5, 0};
chances[11] = new float[]{12, 0, 0, 5, 5, 3};
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
chances[16] = new float[]{0, 1, 10, 1, 0};
chances[16] = new float[]{0, 0, 18, 3, 3, 1};
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
chances[21] = chances[5];
chances[22] = new float[]{10, 3, 0, 2, 0};
chances[22] = new float[]{15, 4, 0, 2, 3, 2};
chances[26] = chances[25] = chances[24] = chances[23] = chances[22];
}

View File

@ -0,0 +1,52 @@
/*
* 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.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.watabou.utils.Rect;
public class RingBridgeRoom extends RingTunnelRoom {
@Override
public void paint(Level level) {
Painter.fill(level, this, 1, Terrain.CHASM);
super.paint(level);
for (Room r : neigbours){
if (r instanceof BridgeRoom || r instanceof RingBridgeRoom || r instanceof WalkwayRoom){
Rect i = intersect(r);
if (i.width() != 0){
i.left++;
i.right--;
} else {
i.top++;
i.bottom--;
}
Painter.fill(level, i.left, i.top, i.width()+1, i.height()+1, Terrain.CHASM);
}
}
}
}

View File

@ -0,0 +1,73 @@
/*
* 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.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.watabou.utils.GameMath;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
import com.watabou.utils.Rect;
public class RingTunnelRoom extends TunnelRoom {
@Override
public int minWidth() {
return Math.max(5, super.minWidth());
}
@Override
public int minHeight() {
return Math.max(5, super.minHeight());
}
@Override
public void paint(Level level) {
super.paint(level);
int floor = level.tunnelTile();
Rect ring = getConnectionSpace();
Painter.fill( level, ring.left, ring.top, 3, 3, floor);
Painter.fill( level, ring.left+1, ring.top+1, 1, 1, Terrain.WALL);
}
//caches the value so multiple calls will always return the same.
private Rect connSpace;
@Override
protected Rect getConnectionSpace() {
if (connSpace == null) {
Point c = getDoorCenter();
c.x = (int) GameMath.gate(left + 2, c.x, right - 2);
c.y = (int) GameMath.gate(top + 2, c.y, bottom - 2);
connSpace = new Rect(c.x-1, c.y-1, c.x+1, c.y+1);
}
return connSpace;
}
}

View File

@ -39,7 +39,7 @@ public class WalkwayRoom extends PerimeterRoom {
super.paint(level);
for (Room r : neigbours){
if (r instanceof BridgeRoom || r instanceof WalkwayRoom){
if (r instanceof BridgeRoom || r instanceof RingBridgeRoom || r instanceof WalkwayRoom){
Rect i = intersect(r);
if (i.width() != 0){
i.left++;