v0.7.0b: adjusted wraith spawning from bones functionality
This commit is contained in:
parent
aec81b5917
commit
e298e4671e
|
@ -62,8 +62,6 @@ import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class Heap implements Bundlable {
|
public class Heap implements Bundlable {
|
||||||
|
|
||||||
private static final int SEEDS_TO_POTION = 3;
|
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
HEAP,
|
HEAP,
|
||||||
|
@ -82,6 +80,7 @@ public class Heap implements Bundlable {
|
||||||
|
|
||||||
public ItemSprite sprite;
|
public ItemSprite sprite;
|
||||||
public boolean seen = false;
|
public boolean seen = false;
|
||||||
|
public boolean haunted = false;
|
||||||
|
|
||||||
public LinkedList<Item> items = new LinkedList<Item>();
|
public LinkedList<Item> items = new LinkedList<Item>();
|
||||||
|
|
||||||
|
@ -140,6 +139,14 @@ public class Heap implements Bundlable {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (haunted){
|
||||||
|
if (Wraith.spawnAt( pos ) == null) {
|
||||||
|
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
|
||||||
|
hero.damage( hero.HP / 2, this );
|
||||||
|
}
|
||||||
|
Sample.INSTANCE.play( Assets.SND_CURSED );
|
||||||
|
}
|
||||||
|
|
||||||
if (type != Type.MIMIC) {
|
if (type != Type.MIMIC) {
|
||||||
type = Type.HEAP;
|
type = Type.HEAP;
|
||||||
|
@ -153,6 +160,17 @@ public class Heap implements Bundlable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Heap setHauntedIfCursed( float chance ){
|
||||||
|
for (Item item : items) {
|
||||||
|
if (item.cursed && Random.Float() < chance) {
|
||||||
|
haunted = true;
|
||||||
|
item.cursedKnown = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return items.size();
|
return items.size();
|
||||||
}
|
}
|
||||||
|
@ -429,6 +447,7 @@ public class Heap implements Bundlable {
|
||||||
private static final String SEEN = "seen";
|
private static final String SEEN = "seen";
|
||||||
private static final String TYPE = "type";
|
private static final String TYPE = "type";
|
||||||
private static final String ITEMS = "items";
|
private static final String ITEMS = "items";
|
||||||
|
private static final String HAUNTED = "haunted";
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@ -449,6 +468,8 @@ public class Heap implements Bundlable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
haunted = bundle.getBoolean( HAUNTED );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -457,6 +478,7 @@ public class Heap implements Bundlable {
|
||||||
bundle.put( SEEN, seen );
|
bundle.put( SEEN, seen );
|
||||||
bundle.put( TYPE, type.toString() );
|
bundle.put( TYPE, type.toString() );
|
||||||
bundle.put( ITEMS, items );
|
bundle.put( ITEMS, items );
|
||||||
|
bundle.put( HAUNTED, haunted );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class CavesBossLevel extends Level {
|
||||||
do {
|
do {
|
||||||
pos = Random.IntRange( ROOM_LEFT, ROOM_RIGHT ) + Random.IntRange( ROOM_TOP + 1, ROOM_BOTTOM ) * width();
|
pos = Random.IntRange( ROOM_LEFT, ROOM_RIGHT ) + Random.IntRange( ROOM_TOP + 1, ROOM_BOTTOM ) * width();
|
||||||
} while (pos == entrance);
|
} while (pos == entrance);
|
||||||
drop( item, pos ).type = Heap.Type.REMAINS;
|
drop( item, pos ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class CityBossLevel extends Level {
|
||||||
Random.IntRange( LEFT + 1, LEFT + HALL_WIDTH - 2 ) +
|
Random.IntRange( LEFT + 1, LEFT + HALL_WIDTH - 2 ) +
|
||||||
Random.IntRange( TOP + HALL_HEIGHT + 2, TOP + HALL_HEIGHT + CHAMBER_HEIGHT ) * width();
|
Random.IntRange( TOP + HALL_HEIGHT + 2, TOP + HALL_HEIGHT + CHAMBER_HEIGHT ) * width();
|
||||||
} while (pos == entrance);
|
} while (pos == entrance);
|
||||||
drop( item, pos ).type = Heap.Type.REMAINS;
|
drop( item, pos ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class HallsBossLevel extends Level {
|
||||||
do {
|
do {
|
||||||
pos = Random.IntRange( ROOM_LEFT, ROOM_RIGHT ) + Random.IntRange( ROOM_TOP + 1, ROOM_BOTTOM ) * width();
|
pos = Random.IntRange( ROOM_LEFT, ROOM_RIGHT ) + Random.IntRange( ROOM_TOP + 1, ROOM_BOTTOM ) * width();
|
||||||
} while (pos == entrance);
|
} while (pos == entrance);
|
||||||
drop( item, pos ).type = Heap.Type.REMAINS;
|
drop( item, pos ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class LastShopLevel extends RegularLevel {
|
||||||
do {
|
do {
|
||||||
pos = pointToCell(roomEntrance.random());
|
pos = pointToCell(roomEntrance.random());
|
||||||
} while (pos == entrance);
|
} while (pos == entrance);
|
||||||
drop( item, pos ).type = Heap.Type.REMAINS;
|
drop( item, pos ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class PrisonBossLevel extends Level {
|
||||||
protected void createItems() {
|
protected void createItems() {
|
||||||
Item item = Bones.get();
|
Item item = Bones.get();
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
drop( item, randomRespawnCell() ).type = Heap.Type.REMAINS;
|
drop( item, randomRespawnCell() ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
drop(new IronKey(10), randomPrisonCell());
|
drop(new IronKey(10), randomPrisonCell());
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,7 +341,11 @@ public abstract class RegularLevel extends Level {
|
||||||
addItemToSpawn(new GoldenKey(Dungeon.depth));
|
addItemToSpawn(new GoldenKey(Dungeon.depth));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
drop( toDrop, cell ).type = type;
|
Heap dropped = drop( toDrop, cell );
|
||||||
|
dropped.type = type;
|
||||||
|
if (type == Heap.Type.SKELETON){
|
||||||
|
dropped.setHauntedIfCursed(0.75f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -362,7 +366,7 @@ public abstract class RegularLevel extends Level {
|
||||||
map[cell] = Terrain.GRASS;
|
map[cell] = Terrain.GRASS;
|
||||||
losBlocking[cell] = false;
|
losBlocking[cell] = false;
|
||||||
}
|
}
|
||||||
drop( item, cell ).type = Heap.Type.REMAINS;
|
drop( item, cell ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//guide pages
|
//guide pages
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class SewerBossLevel extends SewerLevel {
|
||||||
do {
|
do {
|
||||||
pos = pointToCell(roomEntrance.random());
|
pos = pointToCell(roomEntrance.random());
|
||||||
} while (pos == entrance || solid[pos]);
|
} while (pos == entrance || solid[pos]);
|
||||||
drop( item, pos ).type = Heap.Type.REMAINS;
|
drop( item, pos ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class SecretSummoningRoom extends SecretRoom {
|
||||||
Painter.fill(level, this, 1, Terrain.SECRET_TRAP);
|
Painter.fill(level, this, 1, Terrain.SECRET_TRAP);
|
||||||
|
|
||||||
Point center = center();
|
Point center = center();
|
||||||
level.drop(Generator.random(), level.pointToCell(center)).type = Heap.Type.SKELETON;
|
level.drop(Generator.random(), level.pointToCell(center)).setHauntedIfCursed(0.75f).type = Heap.Type.SKELETON;
|
||||||
|
|
||||||
for (Point p : getPoints()){
|
for (Point p : getPoints()){
|
||||||
int cell = level.pointToCell(p);
|
int cell = level.pointToCell(p);
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class MassGraveRoom extends SpecialRoom {
|
||||||
pos = level.pointToCell(random());
|
pos = level.pointToCell(random());
|
||||||
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
|
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
|
||||||
Heap h = level.drop(item, pos);
|
Heap h = level.drop(item, pos);
|
||||||
|
h.haunted = true;
|
||||||
h.type = Heap.Type.SKELETON;
|
h.type = Heap.Type.SKELETON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class PitRoom extends SpecialRoom {
|
||||||
|
|
||||||
int n = Random.IntRange( 1, 2 );
|
int n = Random.IntRange( 1, 2 );
|
||||||
for (int i=0; i < n; i++) {
|
for (int i=0; i < n; i++) {
|
||||||
level.drop( prize( level ), remains );
|
level.drop( prize( level ), remains ).setHauntedIfCursed(0.75f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user