v0.6.1: added two new uncommon rooms

This commit is contained in:
Evan Debenham 2017-07-24 15:36:06 -04:00 committed by Evan Debenham
parent 5c0648dcf2
commit 6f301d48ff
4 changed files with 149 additions and 7 deletions

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
//other rooms should only extend emptyRoom if they do not add significant terrain
public class EmptyRoom extends StandardRoom {
@Override

View File

@ -0,0 +1,80 @@
/*
* 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.standard;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ExplosiveTrap;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class MinefieldRoom extends StandardRoom {
@Override
public float[] sizeCatProbs() {
return new float[]{4, 1, 0};
}
@Override
public void paint(Level level) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
for (Door door : connected.values()) {
door.set( Door.Type.REGULAR );
}
int mines = (int)Math.round(Math.sqrt(square()));
switch (sizeCat){
case NORMAL:
mines -= 3;
break;
case LARGE:
mines += 3;
break;
case GIANT:
mines += 9;
break;
}
for (int i = 0; i < mines; i++ ){
int pos;
do {
pos = level.pointToCell(random(1));
} while (level.traps.get(pos) != null);
//randomly places some embers around the mines
for (int j = 0; j < 8; j ++){;
int c = PathFinder.NEIGHBOURS8[Random.Int(8)];
if (level.traps.get(pos+c) == null && level.map[pos+c] == Terrain.EMPTY){
Painter.set(level, pos+c, Terrain.EMBERS);
}
}
Painter.set(level, pos, Terrain.SECRET_TRAP);
level.setTrap(new ExplosiveTrap().hide(), pos);
}
}
}

View File

@ -129,27 +129,29 @@ public abstract class StandardRoom extends Room {
rooms.add(GrassyGraveRoom.class);
rooms.add(StripedRoom.class);
rooms.add(StudyRoom.class);
rooms.add(SuspiciousChestRoom.class);
rooms.add(MinefieldRoom.class);
}
private static float[][] chances = new float[27][];
static {
chances[1] = new float[]{22, 10, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1};
chances[2] = new float[]{22, 10, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
chances[1] = new float[]{25, 15, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0};
chances[2] = new float[]{25, 15, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
chances[4] = chances[3] = chances[2];
chances[5] = new float[]{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
chances[5] = new float[]{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
chances[6] = new float[]{22, 0, 10, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
chances[6] = new float[]{25, 0, 15, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
chances[11] = new float[]{22, 0, 0, 10, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
chances[11] = new float[]{25, 0, 0, 15, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
chances[16] = new float[]{22, 0, 0, 0, 10, 0, 1, 1, 1, 1, 1, 1, 1, 1};
chances[16] = new float[]{25, 0, 0, 0, 15, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
chances[21] = chances[5];
chances[22] = new float[]{22, 0, 0, 0, 0, 10, 1, 1, 1, 1, 1, 1, 1, 1};
chances[22] = new float[]{25, 0, 0, 0, 0, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
chances[26] = chances[25] = chances[24] = chances[23] = chances[22];
}

View File

@ -0,0 +1,59 @@
/*
* 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.standard;
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.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
public class SuspiciousChestRoom extends EmptyRoom {
@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);
Item i = level.findPrizeItem();
if ( i == null ){
i = new Gold().random();
}
int center = level.pointToCell(center());
Painter.set(level, center, Terrain.PEDESTAL);
level.drop(i, center).type = Heap.Type.MIMIC;
}
}