v0.8.0: tweaked skeleton/remains logic, now always haunted if cursed

This commit is contained in:
Evan Debenham 2019-11-13 12:25:46 -05:00
parent 458b21d5c6
commit 2b6b7c10b4
12 changed files with 14 additions and 14 deletions

View File

@ -128,9 +128,9 @@ public class Heap implements Bundlable {
} }
} }
public Heap setHauntedIfCursed( float chance ){ public Heap setHauntedIfCursed(){
for (Item item : items) { for (Item item : items) {
if (item.cursed && Random.Float() < chance) { if (item.cursed) {
haunted = true; haunted = true;
item.cursedKnown = true; item.cursedKnown = true;
break; break;

View File

@ -197,7 +197,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 ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, pos ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
} }

View File

@ -168,7 +168,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 ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, pos ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
} }

View File

@ -157,7 +157,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 ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, pos ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
} }

View File

@ -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 ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, pos ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
} }

View File

@ -619,7 +619,7 @@ public class NewPrisonBossLevel 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() ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, randomRespawnCell() ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
} }

View File

@ -160,7 +160,7 @@ public class OldPrisonBossLevel 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() ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, randomRespawnCell() ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
drop(new IronKey(10), randomPrisonCell()); drop(new IronKey(10), randomPrisonCell());
} }

View File

@ -315,7 +315,7 @@ public abstract class RegularLevel extends Level {
Heap dropped = drop( toDrop, cell ); Heap dropped = drop( toDrop, cell );
dropped.type = type; dropped.type = type;
if (type == Heap.Type.SKELETON){ if (type == Heap.Type.SKELETON){
dropped.setHauntedIfCursed(0.75f); dropped.setHauntedIfCursed();
} }
} }
@ -340,7 +340,7 @@ public abstract class RegularLevel extends Level {
map[cell] = Terrain.GRASS; map[cell] = Terrain.GRASS;
losBlocking[cell] = false; losBlocking[cell] = false;
} }
drop( item, cell ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, cell ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class ); DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );

View File

@ -114,7 +114,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 ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS; drop( item, pos ).setHauntedIfCursed().type = Heap.Type.REMAINS;
} }
} }

View File

@ -49,7 +49,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)).setHauntedIfCursed(1f).type = Heap.Type.SKELETON; level.drop(Generator.random(), level.pointToCell(center)).setHauntedIfCursed().type = Heap.Type.SKELETON;
for (Point p : getPoints()){ for (Point p : getPoints()){
int cell = level.pointToCell(p); int cell = level.pointToCell(p);

View File

@ -90,7 +90,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.setHauntedIfCursed(1f); h.setHauntedIfCursed();
h.type = Heap.Type.SKELETON; h.type = Heap.Type.SKELETON;
} }
} }

View File

@ -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 ).setHauntedIfCursed(1f); level.drop( prize( level ), remains ).setHauntedIfCursed();
} }
} }