v3.1.0: added a new type of standard room to replace empty ones
This commit is contained in:
@@ -171,19 +171,24 @@ public class Random {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//returns an index from chances, the probability of each index is the weight values in changes
|
//returns an index from chances, the probability of each index is the weight values in changes
|
||||||
|
//negative values are treated as 0
|
||||||
public static int chances( float[] chances ) {
|
public static int chances( float[] chances ) {
|
||||||
|
|
||||||
int length = chances.length;
|
int length = chances.length;
|
||||||
|
|
||||||
float sum = 0;
|
float sum = 0;
|
||||||
for (int i=0; i < length; i++) {
|
for (int i=0; i < length; i++) {
|
||||||
sum += chances[i];
|
sum += Math.max(0, chances[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sum <= 0){
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float value = Float( sum );
|
float value = Float( sum );
|
||||||
sum = 0;
|
sum = 0;
|
||||||
for (int i=0; i < length; i++) {
|
for (int i=0; i < length; i++) {
|
||||||
sum += chances[i];
|
sum += Math.max(0, chances[i]);
|
||||||
if (value < sum) {
|
if (value < sum) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2025 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.standard;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
|
||||||
|
public class RegionDecoLineRoom extends StatueLineRoom {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int decoTerrain() {
|
||||||
|
return Terrain.REGION_DECO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -121,32 +121,38 @@ public abstract class StandardRoom extends Room {
|
|||||||
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
||||||
static {
|
static {
|
||||||
rooms.add(EmptyRoom.class);
|
rooms.add(EmptyRoom.class);
|
||||||
|
rooms.add(RegionDecoLineRoom.class);
|
||||||
|
rooms.add(StatueLineRoom.class);
|
||||||
|
|
||||||
rooms.add(SewerPipeRoom.class);
|
rooms.add(SewerPipeRoom.class);
|
||||||
rooms.add(RingRoom.class);
|
rooms.add(RingRoom.class);
|
||||||
rooms.add(WaterBridgeRoom.class);
|
rooms.add(WaterBridgeRoom.class);
|
||||||
rooms.add(CircleBasinRoom.class);
|
rooms.add(CircleBasinRoom.class);
|
||||||
|
rooms.add(EmptyRoom.class); //TODO
|
||||||
|
|
||||||
rooms.add(SegmentedRoom.class);
|
rooms.add(SegmentedRoom.class);
|
||||||
rooms.add(PillarsRoom.class);
|
rooms.add(PillarsRoom.class);
|
||||||
rooms.add(ChasmBridgeRoom.class);
|
rooms.add(ChasmBridgeRoom.class);
|
||||||
rooms.add(CellBlockRoom.class);
|
rooms.add(CellBlockRoom.class);
|
||||||
|
rooms.add(EmptyRoom.class); //TODO
|
||||||
|
|
||||||
rooms.add(CaveRoom.class);
|
rooms.add(CaveRoom.class);
|
||||||
rooms.add(CavesFissureRoom.class);
|
rooms.add(CavesFissureRoom.class);
|
||||||
rooms.add(CirclePitRoom.class);
|
rooms.add(CirclePitRoom.class);
|
||||||
rooms.add(CircleWallRoom.class);
|
rooms.add(CircleWallRoom.class);
|
||||||
|
rooms.add(EmptyRoom.class);
|
||||||
|
|
||||||
rooms.add(HallwayRoom.class);
|
rooms.add(HallwayRoom.class);
|
||||||
rooms.add(StatuesRoom.class);
|
rooms.add(StatuesRoom.class);
|
||||||
rooms.add(LibraryRingRoom.class);
|
rooms.add(LibraryRingRoom.class);
|
||||||
rooms.add(SegmentedLibraryRoom.class);
|
rooms.add(SegmentedLibraryRoom.class);
|
||||||
|
rooms.add(EmptyRoom.class); //TODO
|
||||||
|
|
||||||
rooms.add(RuinsRoom.class);
|
rooms.add(RuinsRoom.class);
|
||||||
rooms.add(ChasmRoom.class);
|
rooms.add(ChasmRoom.class);
|
||||||
rooms.add(SkullsRoom.class);
|
rooms.add(SkullsRoom.class);
|
||||||
rooms.add(RitualRoom.class);
|
rooms.add(RitualRoom.class);
|
||||||
|
rooms.add(EmptyRoom.class); //TODO
|
||||||
|
|
||||||
|
|
||||||
rooms.add(PlantsRoom.class);
|
rooms.add(PlantsRoom.class);
|
||||||
@@ -163,21 +169,21 @@ public abstract class StandardRoom extends Room {
|
|||||||
|
|
||||||
private static float[][] chances = new float[27][];
|
private static float[][] chances = new float[27][];
|
||||||
static {
|
static {
|
||||||
chances[1] = new float[]{5, 10,10,10,5, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,0,1,0,1,0,1,1,0,0};
|
chances[1] = new float[]{0,5,0, 10,10,10,5,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,0,1,0,1,0,1,1,0,0};
|
||||||
chances[2] = new float[]{5, 10,10,10,5, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
chances[2] = new float[]{0,5,0, 10,10,10,5,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||||
chances[4] = chances[3] = chances[2];
|
chances[4] = chances[3] = chances[2];
|
||||||
chances[5] = new float[]{5, 10,10,10,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,0,0,0,0,0,0};
|
chances[5] = new float[]{0,5,0, 10,10,10,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
chances[6] = new float[]{5, 0,0,0,0, 10,10,10,5, 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
chances[6] = new float[]{0,5,0, 0,0,0,0,0, 10,10,10,5,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||||
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
||||||
|
|
||||||
chances[11] = new float[]{5, 0,0,0,0, 0,0,0,0, 15,10,5,5, 0,0,0,0, 0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
chances[11] = new float[]{0,5,0, 0,0,0,0,0, 0,0,0,0,0, 15,10,5,5,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||||
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
||||||
|
|
||||||
chances[16] = new float[]{5, 0,0,0,0, 0,0,0,0, 0,0,0,0, 10,10,10,5, 0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
chances[16] = new float[]{0,0,5, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 10,10,10,5,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||||
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
|
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
|
||||||
|
|
||||||
chances[21] = new float[]{5, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 15,10,5,5, 1,1,1,1,1,1,1,1,1,1};
|
chances[21] = new float[]{0,0,5, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 15,10,5,5,0, 1,1,1,1,1,1,1,1,1,1};
|
||||||
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
|
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2025 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.standard;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
|
import com.watabou.utils.Point;
|
||||||
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
//places a line of statues along the least used wall
|
||||||
|
public class StatueLineRoom extends StandardRoom {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minWidth() {
|
||||||
|
return Math.max(5, super.minWidth());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minHeight() {
|
||||||
|
return Math.max(5, super.minHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Integer N = 0;
|
||||||
|
private static final Integer E = 1;
|
||||||
|
private static final Integer S = 2;
|
||||||
|
private static final Integer W = 3;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Level level) {
|
||||||
|
Painter.fill( level, this, Terrain.WALL );
|
||||||
|
Painter.fill( level, this, 1 , Terrain.EMPTY );
|
||||||
|
|
||||||
|
float[] sidePreferences = new float[]{1, 1, 1, 1};
|
||||||
|
|
||||||
|
//try to place the deco objects along a wall without doors
|
||||||
|
for (Door door : connected.values()) {
|
||||||
|
door.set( Door.Type.REGULAR );
|
||||||
|
if (door.y == top) sidePreferences[N] -= 2;
|
||||||
|
if (door.y == top+1) sidePreferences[N] -= 1;
|
||||||
|
|
||||||
|
if (door.y == bottom) sidePreferences[S] -= 2;
|
||||||
|
if (door.y == bottom-1) sidePreferences[S] -= 1;
|
||||||
|
|
||||||
|
if (door.x == left) sidePreferences[W] -= 2;
|
||||||
|
if (door.x == left+1) sidePreferences[W] -= 1;
|
||||||
|
|
||||||
|
if (door.x == right) sidePreferences[E] -= 2;
|
||||||
|
if (door.x == right-1) sidePreferences[E] -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if there are no walls with no doors, prefer fewer doors (corner doors count for half)
|
||||||
|
int chosenSide = Random.chances(sidePreferences);
|
||||||
|
while (chosenSide == -1) {
|
||||||
|
sidePreferences[N]++;
|
||||||
|
sidePreferences[E]++;
|
||||||
|
sidePreferences[S]++;
|
||||||
|
sidePreferences[W]++;
|
||||||
|
chosenSide = Random.chances(sidePreferences);
|
||||||
|
}
|
||||||
|
|
||||||
|
fillAlongSide(chosenSide, level);
|
||||||
|
for (Door door : connected.values()) {
|
||||||
|
door.set( Door.Type.REGULAR );
|
||||||
|
Painter.drawInside(level, this, door, 1, Terrain.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int decoTerrain(){
|
||||||
|
return Terrain.STATUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillAlongSide(Integer side, Level level){
|
||||||
|
switch (side){
|
||||||
|
case 0: //N
|
||||||
|
Painter.drawLine(level, new Point(left+1, top+1), new Point(right-1, top+1), decoTerrain());
|
||||||
|
break;
|
||||||
|
case 1: //E
|
||||||
|
Painter.drawLine(level, new Point(right-1, top+1), new Point(right-1, bottom-1), decoTerrain());
|
||||||
|
break;
|
||||||
|
case 2: //S
|
||||||
|
Painter.drawLine(level, new Point(left+1, bottom-1), new Point(right-1, bottom-1), decoTerrain());
|
||||||
|
break;
|
||||||
|
case 3: //W
|
||||||
|
Painter.drawLine(level, new Point(left+1, top+1), new Point(left+1, bottom-1), decoTerrain());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -130,41 +130,50 @@ public class EntranceRoom extends StandardRoom {
|
|||||||
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
||||||
static {
|
static {
|
||||||
rooms.add(EntranceRoom.class);
|
rooms.add(EntranceRoom.class);
|
||||||
|
rooms.add(RegionDecoLineEntranceRoom.class);
|
||||||
|
rooms.add(StatueLineEntranceRoom.class);
|
||||||
|
|
||||||
rooms.add(WaterBridgeEntranceRoom.class);
|
rooms.add(WaterBridgeEntranceRoom.class);
|
||||||
rooms.add(CircleBasinEntranceRoom.class);
|
rooms.add(CircleBasinEntranceRoom.class);
|
||||||
|
rooms.add(EntranceRoom.class); //TODO
|
||||||
|
|
||||||
rooms.add(ChasmBridgeEntranceRoom.class);
|
rooms.add(ChasmBridgeEntranceRoom.class);
|
||||||
rooms.add(PillarsEntranceRoom.class);
|
rooms.add(PillarsEntranceRoom.class);
|
||||||
|
rooms.add(EntranceRoom.class); //TODO
|
||||||
|
|
||||||
rooms.add(CaveEntranceRoom.class);
|
rooms.add(CaveEntranceRoom.class);
|
||||||
rooms.add(CavesFissureEntranceRoom.class);
|
rooms.add(CavesFissureEntranceRoom.class);
|
||||||
|
rooms.add(EntranceRoom.class); //TODO
|
||||||
|
|
||||||
rooms.add(HallwayEntranceRoom.class);
|
rooms.add(HallwayEntranceRoom.class);
|
||||||
rooms.add(StatuesEntranceRoom.class);
|
rooms.add(StatuesEntranceRoom.class);
|
||||||
|
rooms.add(EntranceRoom.class); //TODO
|
||||||
|
|
||||||
rooms.add(ChasmEntranceRoom.class);
|
rooms.add(ChasmEntranceRoom.class);
|
||||||
rooms.add(RitualEntranceRoom.class);
|
rooms.add(RitualEntranceRoom.class);
|
||||||
|
rooms.add(EntranceRoom.class); //TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float[][] chances = new float[27][];
|
private static float[][] chances = new float[27][];
|
||||||
static {
|
static {
|
||||||
chances[1] = new float[]{1, 0,0, 0,0, 0,0, 0,0, 0,0};
|
//first 2 floors only use empty room.
|
||||||
|
// First floor is to give a simple start room
|
||||||
|
// 2nd floor for tutorialization
|
||||||
|
chances[1] = new float[]{1,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0};
|
||||||
chances[2] = chances[1];
|
chances[2] = chances[1];
|
||||||
chances[3] = new float[]{3, 6,1, 0,0, 0,0, 0,0, 0,0};
|
chances[3] = new float[]{0,3,0, 6,1,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0};
|
||||||
chances[5] = chances[4] = chances[3];
|
chances[5] = chances[4] = chances[3];
|
||||||
|
|
||||||
chances[6] = new float[]{2, 0,0, 4,4, 0,0, 0,0, 0,0};
|
chances[6] = new float[]{0,2,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0, 0,0,0};
|
||||||
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
||||||
|
|
||||||
chances[11] = new float[]{2, 0,0, 0,0, 4,4, 0,0, 0,0};
|
chances[11] = new float[]{0,2,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0};
|
||||||
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
||||||
|
|
||||||
chances[16] = new float[]{2, 0,0, 0,0, 0,0, 4,4, 0,0};
|
chances[16] = new float[]{0,0,2, 0,0,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0};
|
||||||
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
|
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
|
||||||
|
|
||||||
chances[21] = new float[]{3, 0,0, 0,0, 0,0, 0,0, 6,1};
|
chances[21] = new float[]{0,0,3, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 6,1,0};
|
||||||
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
|
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2025 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.standard.entrance;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
|
||||||
|
public class RegionDecoLineEntranceRoom extends StatueLineEntranceRoom {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int decoTerrain() {
|
||||||
|
return Terrain.REGION_DECO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2025 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.standard.entrance;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StatueLineRoom;
|
||||||
|
|
||||||
|
public class StatueLineEntranceRoom extends StatueLineRoom {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minWidth() {
|
||||||
|
return Math.max(7, super.minWidth());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minHeight() {
|
||||||
|
return Math.max(7, super.minHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEntrance() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Level level) {
|
||||||
|
super.paint(level);
|
||||||
|
|
||||||
|
int entrance;
|
||||||
|
do {
|
||||||
|
entrance = level.pointToCell(random(3));
|
||||||
|
} while (level.findMob(entrance) != null);
|
||||||
|
|
||||||
|
Painter.set( level, entrance, Terrain.ENTRANCE );
|
||||||
|
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -73,38 +73,45 @@ public class ExitRoom extends StandardRoom {
|
|||||||
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
||||||
static {
|
static {
|
||||||
rooms.add(ExitRoom.class);
|
rooms.add(ExitRoom.class);
|
||||||
|
rooms.add(RegionDecoLineExitRoom.class);
|
||||||
|
rooms.add(StatueLineExitRoom.class);
|
||||||
|
|
||||||
rooms.add(WaterBridgeExitRoom.class);
|
rooms.add(WaterBridgeExitRoom.class);
|
||||||
rooms.add(CircleBasinExitRoom.class);
|
rooms.add(CircleBasinExitRoom.class);
|
||||||
|
rooms.add(ExitRoom.class); //todo
|
||||||
|
|
||||||
rooms.add(ChasmBridgeExitRoom.class);
|
rooms.add(ChasmBridgeExitRoom.class);
|
||||||
rooms.add(PillarsExitRoom.class);
|
rooms.add(PillarsExitRoom.class);
|
||||||
|
rooms.add(ExitRoom.class); //todo
|
||||||
|
|
||||||
rooms.add(CaveExitRoom.class);
|
rooms.add(CaveExitRoom.class);
|
||||||
rooms.add(CavesFissureExitRoom.class);
|
rooms.add(CavesFissureExitRoom.class);
|
||||||
|
rooms.add(ExitRoom.class); //todo
|
||||||
|
|
||||||
rooms.add(HallwayExitRoom.class);
|
rooms.add(HallwayExitRoom.class);
|
||||||
rooms.add(StatuesExitRoom.class);
|
rooms.add(StatuesExitRoom.class);
|
||||||
|
rooms.add(ExitRoom.class); //todo
|
||||||
|
|
||||||
rooms.add(ChasmExitRoom.class);
|
rooms.add(ChasmExitRoom.class);
|
||||||
rooms.add(RitualExitRoom.class);
|
rooms.add(RitualExitRoom.class);
|
||||||
|
rooms.add(ExitRoom.class); //todo
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float[][] chances = new float[27][];
|
private static float[][] chances = new float[27][];
|
||||||
static {
|
static {
|
||||||
chances[1] = new float[]{3, 6,1, 0,0, 0,0, 0,0, 0,0};
|
chances[1] = new float[]{0,3,0, 6,1,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0};
|
||||||
chances[5] = chances[4] = chances[3] = chances[2] = chances[1];
|
chances[5] = chances[4] = chances[3] = chances[2] = chances[1];
|
||||||
|
|
||||||
chances[6] = new float[]{2, 0,0, 4,4, 0,0, 0,0, 0,0};
|
chances[6] = new float[]{0,2,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0, 0,0,0};
|
||||||
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
||||||
|
|
||||||
chances[11] = new float[]{2, 0,0, 0,0, 4,4, 0,0, 0,0};
|
chances[11] = new float[]{0,2,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0};
|
||||||
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
||||||
|
|
||||||
chances[16] = new float[]{2, 0,0, 0,0, 0,0, 4,4, 0,0};
|
chances[16] = new float[]{0,0,2, 0,0,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0};
|
||||||
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
|
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
|
||||||
|
|
||||||
chances[21] = new float[]{3, 0,0, 0,0, 0,0, 0,0, 6,1};
|
chances[21] = new float[]{0,0,3, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 6,1,0};
|
||||||
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
|
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2025 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.standard.exit;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
|
||||||
|
public class RegionDecoLineExitRoom extends StatueLineExitRoom {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int decoTerrain() {
|
||||||
|
return Terrain.REGION_DECO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2025 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.standard.exit;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StatueLineRoom;
|
||||||
|
|
||||||
|
public class StatueLineExitRoom extends StatueLineRoom {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minWidth() {
|
||||||
|
return Math.max(7, super.minWidth());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int minHeight() {
|
||||||
|
return Math.max(7, super.minHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isExit() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Level level) {
|
||||||
|
super.paint(level);
|
||||||
|
|
||||||
|
int exit;
|
||||||
|
do {
|
||||||
|
exit = level.pointToCell(random(3));
|
||||||
|
} while (level.findMob(exit) != null);
|
||||||
|
|
||||||
|
Painter.set(level, exit, Terrain.EXIT);
|
||||||
|
level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user