v1.2.0: roughly implemented crystal door choice rooms

This commit is contained in:
Evan Debenham 2022-03-09 15:56:14 -05:00
parent c6c125756c
commit 95cb59edb3
2 changed files with 106 additions and 1 deletions

View File

@ -0,0 +1,105 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2022 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.special;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
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.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class CrystalDoorChoiceRoom extends SpecialRoom {
@Override
public int minWidth() { return 7; }
public int minHeight() { return 7; }
@Override
public void paint(Level level) {
Painter.fill( level, this, Terrain.WALL );
Door entrance = entrance();
Room entry = new EmptyRoom();
Room room1 = new EmptyRoom();
Room room2 = new EmptyRoom();
if (entrance.x == left){
entry.set(left+1, top+1, left+2, bottom-1);
room1.set(entry.right+2, top+1, right-1, center().y-1);
room2.set(entry.right+2, room1.bottom+2, right-1, bottom-1);
Painter.set(level, new Point(entry.right+1, (room1.top + room1.bottom + 1)/2), Terrain.CRYSTAL_DOOR);
Painter.set(level, new Point(entry.right+1, (room2.top + room2.bottom)/2), Terrain.CRYSTAL_DOOR);
} else if (entrance.y == top){
entry.set(left+1, top+1, right-1, top+2);
room1.set(left+1, entry.bottom+2, center().x-1, bottom-1);
room2.set(room1.right+2, entry.bottom+2, right-1, bottom-1);
Painter.set(level, new Point((room1.left + room1.right + 1)/2, entry.bottom+1), Terrain.CRYSTAL_DOOR);
Painter.set(level, new Point((room2.left + room2.right)/2, entry.bottom+1), Terrain.CRYSTAL_DOOR);
} else if (entrance.x == right){
entry.set(right-2, top+1, right-1, bottom-1);
Painter.drawLine(level, new Point(right-1, top+1), new Point(right-1, bottom-1), Terrain.EMPTY);
room1.set(left+1, top+1, entry.left-2, center().y-1);
room2.set(left+1, room1.bottom+2, entry.left-2, bottom-1);
Painter.set(level, new Point(entry.left-1, (room1.top + room1.bottom + 1)/2), Terrain.CRYSTAL_DOOR);
Painter.set(level, new Point(entry.left-1, (room2.top + room2.bottom)/2), Terrain.CRYSTAL_DOOR);
} else if (entrance.y == bottom){
entry.set(left+1, bottom-2, right-1, bottom-1);
room1.set(left+1, top+1, center().x-1, entry.top-2);
room2.set(room1.right+2, top+1, right-1, entry.top-2);
Painter.set(level, new Point((room1.left + room1.right + 1)/2, entry.top-1), Terrain.CRYSTAL_DOOR);
Painter.set(level, new Point((room2.left + room2.right)/2, entry.top-1), Terrain.CRYSTAL_DOOR);
}
Painter.fill(level, entry, Terrain.EMPTY);
Painter.fill(level, room1, Terrain.EMPTY_SP);
Painter.fill(level, room2, Terrain.EMPTY_SP);
//TODO rewards
level.addItemToSpawn( new CrystalKey( Dungeon.depth ) );
entrance().set( Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
}
}

View File

@ -92,7 +92,7 @@ public abstract class SpecialRoom extends Room {
//only one special that uses crystal keys per floor
private static final ArrayList<Class<? extends SpecialRoom>> CRYSTAL_KEY_SPECIALS = new ArrayList<>( Arrays.asList(
PitRoom.class, VaultRoom.class
PitRoom.class, VaultRoom.class, CrystalDoorChoiceRoom.class
) );
public static ArrayList<Class<? extends Room>> runSpecials = new ArrayList<>();