v0.6.2: more secret room implementation
This commit is contained in:
parent
0cfaeaad98
commit
cdad2fa5e0
|
@ -23,8 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.builders;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.MazeConnectionRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretTunnelRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
||||
|
@ -153,7 +153,7 @@ public abstract class RegularBuilder extends Builder {
|
|||
connectionChances[connectingRooms]--;
|
||||
|
||||
for (int j = 0; j < connectingRooms; j++){
|
||||
ConnectionRoom t = r instanceof SecretRoom ? new SecretTunnelRoom() : ConnectionRoom.createRoom();
|
||||
ConnectionRoom t = r instanceof SecretRoom ? new MazeConnectionRoom() : ConnectionRoom.createRoom();
|
||||
tries = 3;
|
||||
|
||||
do {
|
||||
|
|
|
@ -46,7 +46,12 @@ public class MazeConnectionRoom extends ConnectionRoom {
|
|||
}
|
||||
|
||||
for (Door door : connected.values()) {
|
||||
door.set( Door.Type.TUNNEL );
|
||||
door.set( Door.Type.HIDDEN );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxConnections(int direction) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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.secret;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Bomb;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Honeypot;
|
||||
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;
|
||||
import com.watabou.utils.Point;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class SecretHoneypotRoom extends SecretRoom {
|
||||
|
||||
@Override
|
||||
public void paint(Level level) {
|
||||
Painter.fill( level, this, Terrain.WALL );
|
||||
Painter.fill(level, this, 1, Terrain.EMPTY );
|
||||
|
||||
Point center = center();
|
||||
|
||||
Honeypot.ShatteredPot pot = new Honeypot.ShatteredPot();
|
||||
level.drop(pot, level.pointToCell(center));
|
||||
|
||||
Bee bee = new Bee();
|
||||
bee.spawn( Dungeon.depth );
|
||||
bee.HP = bee.HT;
|
||||
bee.pos = level.pointToCell(center);
|
||||
level.mobs.add( bee );
|
||||
|
||||
pot.setBee(bee);
|
||||
bee.setPotInfo(level.pointToCell(center), null);
|
||||
|
||||
placeItem(new Honeypot(), level);
|
||||
|
||||
placeItem( Random.Int(3) == 0 ? new Bomb.DoubleBomb() : new Bomb(), level);
|
||||
|
||||
if (Random.Int(2) == 0){
|
||||
placeItem( new Bomb(), level);
|
||||
}
|
||||
|
||||
entrance().set(Door.Type.HIDDEN);
|
||||
}
|
||||
|
||||
private void placeItem(Item item, Level level){
|
||||
int itemPos;
|
||||
do {
|
||||
itemPos = level.pointToCell(random());
|
||||
} while (level.heaps.get(itemPos) != null);
|
||||
|
||||
level.drop(item, itemPos);
|
||||
}
|
||||
}
|
|
@ -55,8 +55,7 @@ public class SecretLarderRoom extends SecretRoom {
|
|||
|
||||
@Override
|
||||
public void paint(Level level) {
|
||||
super.paint(level);
|
||||
|
||||
Painter.fill(level, this, Terrain.WALL);
|
||||
Painter.fill(level, this, 1, Terrain.EMPTY_SP);
|
||||
|
||||
int nFood = width()-2;
|
||||
|
|
|
@ -36,7 +36,9 @@ public abstract class SecretRoom extends SpecialRoom {
|
|||
|
||||
|
||||
private static final ArrayList<Class<? extends SecretRoom>> ALL_SECRETS = new ArrayList<>( Arrays.asList(
|
||||
SecretGardenRoom.class, SecretLaboratoryRoom.class, SecretLibraryRoom.class, SecretLarderRoom.class, SecretTransmutationRoom.class));
|
||||
SecretGardenRoom.class, SecretLaboratoryRoom.class, SecretLibraryRoom.class,
|
||||
SecretLarderRoom.class, SecretTransmutationRoom.class, SecretRunestoneRoom.class,
|
||||
SecretHoneypotRoom.class));
|
||||
|
||||
public static ArrayList<Class<? extends SecretRoom>> runSecrets = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* 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.secret;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfIntuition;
|
||||
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;
|
||||
|
||||
public class SecretRunestoneRoom extends SecretRoom {
|
||||
|
||||
@Override
|
||||
public void paint(Level level) {
|
||||
Painter.fill( level, this, Terrain.WALL );
|
||||
Painter.fill(level, this, 1, Terrain.EMPTY);
|
||||
|
||||
Door entrance = entrance();
|
||||
Point center = center();
|
||||
|
||||
if (entrance.x == left || entrance.x == right){
|
||||
Painter.drawLine(level,
|
||||
new Point(center.x, top+1),
|
||||
new Point(center.x, bottom-1),
|
||||
Terrain.BOOKSHELF);
|
||||
if (entrance.x == left) {
|
||||
Painter.fill(level, center.x+1, top+1, right-center.x-1, height()-2, Terrain.EMPTY_SP);
|
||||
} else {
|
||||
Painter.fill(level, left+1, top+1, center.x-left-1, height()-2, Terrain.EMPTY_SP);
|
||||
}
|
||||
} else {
|
||||
Painter.drawLine(level,
|
||||
new Point(left+1, center.y),
|
||||
new Point(right-1, center.y),
|
||||
Terrain.BOOKSHELF);
|
||||
if (entrance.y == top) {
|
||||
Painter.fill(level, left+1, center.y+1, width()-2, bottom-center.y-1, Terrain.EMPTY_SP);
|
||||
} else {
|
||||
Painter.fill(level, left+1, top+1, width()-2, center.y-top-1, Terrain.EMPTY_SP);
|
||||
}
|
||||
}
|
||||
|
||||
level.addItemToSpawn(new PotionOfLiquidFlame());
|
||||
|
||||
int runeStones = Random.NormalIntRange(2, 4);
|
||||
for (int i = 0; i <runeStones; i++){
|
||||
int dropPos;
|
||||
do{
|
||||
dropPos = level.pointToCell(random());
|
||||
} while (level.map[dropPos] != Terrain.EMPTY_SP);
|
||||
level.drop( i == 0? new StoneOfEnchantment() : new StoneOfIntuition(), dropPos);
|
||||
}
|
||||
|
||||
entrance.set(Door.Type.HIDDEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceWater(Point p) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceGrass(Point p) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,44 +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.rooms.secret;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.TunnelRoom;
|
||||
|
||||
|
||||
public class SecretTunnelRoom extends TunnelRoom {
|
||||
|
||||
@Override
|
||||
public int maxConnections(int direction) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Level level) {
|
||||
super.paint(level);
|
||||
|
||||
for (Door door : connected.values()) {
|
||||
door.set( Door.Type.HIDDEN );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user