v0.7.0: added runestones to drop system, added a runestone secret room
This commit is contained in:
parent
a2904557db
commit
9582beea21
|
@ -196,12 +196,12 @@ public class Generator {
|
||||||
FOOD ( 0, Food.class ),
|
FOOD ( 0, Food.class ),
|
||||||
|
|
||||||
POTION ( 20, Potion.class ),
|
POTION ( 20, Potion.class ),
|
||||||
SEED ( 0, Plant.Seed.class ),
|
SEED ( 0, Plant.Seed.class ), //dropped by grass
|
||||||
|
|
||||||
SCROLL ( 20, Scroll.class ),
|
SCROLL ( 20, Scroll.class ),
|
||||||
STONE ( 0, Runestone.class),
|
STONE ( 5, Runestone.class),
|
||||||
|
|
||||||
GOLD ( 20, Gold.class );
|
GOLD ( 15, Gold.class );
|
||||||
|
|
||||||
public Class<?>[] classes;
|
public Class<?>[] classes;
|
||||||
public float[] probs;
|
public float[] probs;
|
||||||
|
@ -278,7 +278,7 @@ public class Generator {
|
||||||
SCROLL.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
|
SCROLL.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
|
||||||
|
|
||||||
STONE.classes = new Class<?>[]{
|
STONE.classes = new Class<?>[]{
|
||||||
StoneOfEnchantment.class, //1 is garunteed to drop on floors 6-19
|
StoneOfEnchantment.class, //1 is guaranteed to drop on floors 6-19
|
||||||
StoneOfAugmentation.class, //1 is sold in each shop
|
StoneOfAugmentation.class, //1 is sold in each shop
|
||||||
StoneOfIntuition.class, //1 additional stone is also dropped on floors 1-3
|
StoneOfIntuition.class, //1 additional stone is also dropped on floors 1-3
|
||||||
StoneOfAggression.class,
|
StoneOfAggression.class,
|
||||||
|
|
|
@ -390,6 +390,11 @@ public abstract class RegularLevel extends Level {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME pit rooms shouldn't be problematic enough to warrant this
|
||||||
|
public boolean hasPitRoom(){
|
||||||
|
return randomRoom(PitRoom.class) != null;
|
||||||
|
}
|
||||||
|
|
||||||
protected Room randomRoom( Class<?extends Room> type ) {
|
protected Room randomRoom( Class<?extends Room> type ) {
|
||||||
Random.shuffle( rooms );
|
Random.shuffle( rooms );
|
||||||
for (Room r : rooms) {
|
for (Room r : rooms) {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
|
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
@ -63,6 +64,17 @@ public class SecretRunestoneRoom extends SecretRoom {
|
||||||
level.addItemToSpawn(new PotionOfLiquidFlame());
|
level.addItemToSpawn(new PotionOfLiquidFlame());
|
||||||
|
|
||||||
int dropPos;
|
int dropPos;
|
||||||
|
|
||||||
|
do{
|
||||||
|
dropPos = level.pointToCell(random());
|
||||||
|
} while (level.map[dropPos] != Terrain.EMPTY);
|
||||||
|
level.drop( Generator.random(Generator.Category.STONE), dropPos);
|
||||||
|
|
||||||
|
do{
|
||||||
|
dropPos = level.pointToCell(random());
|
||||||
|
} while (level.map[dropPos] != Terrain.EMPTY && level.heaps.get(dropPos) != null);
|
||||||
|
level.drop( Generator.random(Generator.Category.STONE), dropPos);
|
||||||
|
|
||||||
do{
|
do{
|
||||||
dropPos = level.pointToCell(random());
|
dropPos = level.pointToCell(random());
|
||||||
} while (level.map[dropPos] != Terrain.EMPTY_SP);
|
} while (level.map[dropPos] != Terrain.EMPTY_SP);
|
||||||
|
|
|
@ -25,8 +25,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
import com.watabou.utils.Point;
|
import com.watabou.utils.Point;
|
||||||
|
@ -58,7 +60,7 @@ public class LaboratoryRoom extends SpecialRoom {
|
||||||
alchemy.seed( level, pot.x + level.width() * pot.y, chapter*10 + Random.IntRange(0, 20) );
|
alchemy.seed( level, pot.x + level.width() * pot.y, chapter*10 + Random.IntRange(0, 20) );
|
||||||
level.blobs.put( Alchemy.class, alchemy );
|
level.blobs.put( Alchemy.class, alchemy );
|
||||||
|
|
||||||
int n = Random.IntRange( 1, 2 );
|
int n = Random.IntRange( 2, 3 );
|
||||||
for (int i=0; i < n; i++) {
|
for (int i=0; i < n; i++) {
|
||||||
int pos;
|
int pos;
|
||||||
do {
|
do {
|
||||||
|
@ -69,14 +71,20 @@ public class LaboratoryRoom extends SpecialRoom {
|
||||||
level.drop( prize( level ), pos );
|
level.drop( prize( level ), pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
entrance.set( Door.Type.REGULAR );
|
if (level instanceof RegularLevel && ((RegularLevel)level).hasPitRoom()){
|
||||||
|
entrance.set( Door.Type.REGULAR );
|
||||||
|
} else {
|
||||||
|
entrance.set( Door.Type.LOCKED );
|
||||||
|
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Item prize( Level level ) {
|
private static Item prize( Level level ) {
|
||||||
|
|
||||||
Item prize = level.findPrizeItem( Potion.class );
|
Item prize = level.findPrizeItem( Potion.class );
|
||||||
if (prize == null)
|
if (prize == null)
|
||||||
prize = Generator.random( Generator.Category.POTION );
|
prize = Generator.random( Random.oneOf( Generator.Category.POTION, Generator.Category.STONE ));
|
||||||
|
|
||||||
return prize;
|
return prize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2018 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.Generator;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
public class RunestoneRoom extends SpecialRoom {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint( Level level) {
|
||||||
|
|
||||||
|
Painter.fill( level, this, Terrain.WALL );
|
||||||
|
Painter.fill( level, this, 1, Terrain.CHASM );
|
||||||
|
|
||||||
|
Painter.drawInside( level, this, entrance(), 2, Terrain.EMPTY_SP);
|
||||||
|
Painter.fill( level, this, 2, Terrain.EMPTY );
|
||||||
|
|
||||||
|
int n = Random.NormalIntRange(2, 4);
|
||||||
|
int dropPos;
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
do {
|
||||||
|
dropPos = level.pointToCell(random());
|
||||||
|
} while (level.map[dropPos] != Terrain.EMPTY);
|
||||||
|
level.drop(prize(level), dropPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
entrance().set( Door.Type.LOCKED );
|
||||||
|
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Item prize( Level level ) {
|
||||||
|
|
||||||
|
Item prize = level.findPrizeItem( Runestone.class );
|
||||||
|
if (prize == null)
|
||||||
|
prize = Generator.random( Generator.Category.STONE );
|
||||||
|
|
||||||
|
return prize;
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,7 +59,7 @@ public class SpecialRoom extends Room {
|
||||||
|
|
||||||
private static final ArrayList<Class<? extends SpecialRoom>> ALL_SPEC = new ArrayList<>( Arrays.asList(
|
private static final ArrayList<Class<? extends SpecialRoom>> ALL_SPEC = new ArrayList<>( Arrays.asList(
|
||||||
WeakFloorRoom.class, MagicWellRoom.class, CryptRoom.class, PoolRoom.class, GardenRoom.class, LibraryRoom.class, ArmoryRoom.class,
|
WeakFloorRoom.class, MagicWellRoom.class, CryptRoom.class, PoolRoom.class, GardenRoom.class, LibraryRoom.class, ArmoryRoom.class,
|
||||||
TreasuryRoom.class, TrapsRoom.class, StorageRoom.class, StatueRoom.class, VaultRoom.class
|
TreasuryRoom.class, TrapsRoom.class, StorageRoom.class, StatueRoom.class, VaultRoom.class, RunestoneRoom.class
|
||||||
) );
|
) );
|
||||||
|
|
||||||
public static ArrayList<Class<? extends Room>> runSpecials = new ArrayList<>();
|
public static ArrayList<Class<? extends Room>> runSpecials = new ArrayList<>();
|
||||||
|
@ -101,6 +101,7 @@ public class SpecialRoom extends Room {
|
||||||
floorSpecials.remove( ArmoryRoom.class );
|
floorSpecials.remove( ArmoryRoom.class );
|
||||||
floorSpecials.remove( CryptRoom.class );
|
floorSpecials.remove( CryptRoom.class );
|
||||||
floorSpecials.remove( LibraryRoom.class );
|
floorSpecials.remove( LibraryRoom.class );
|
||||||
|
floorSpecials.remove( RunestoneRoom.class );
|
||||||
floorSpecials.remove( StatueRoom.class );
|
floorSpecials.remove( StatueRoom.class );
|
||||||
floorSpecials.remove( TreasuryRoom.class );
|
floorSpecials.remove( TreasuryRoom.class );
|
||||||
floorSpecials.remove( VaultRoom.class );
|
floorSpecials.remove( VaultRoom.class );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user