Implement random force floors

This commit is contained in:
Eevee (Evelyn Woods) committed 2020-09-01 05:26:25 -06:00
1 parent 7a9bc725d4
commit 9dccb310e0
2 files changed
+20 -1

No files matched your search

+15
View File
@@ -234,6 +234,8 @@ class Level {
this.tic_counter = 0;
this.hint_shown = null;
// TODO in lynx/steam, this carries over between levels; in tile world, you can set it manually
this.force_floor_direction = 'north';
let n = 0;
let connectables = [];
@@ -615,12 +617,25 @@ class Level {
}
}
// -------------------------------------------------------------------------
// Level alteration methods. EVERYTHING that changes the state of a level,
// including the state of a single tile, should do it through one of these
// for undo/rewind purposes
collect_chip() {
if (this.chips_remaining > 0) {
this.chips_remaining--;
}
}
// Get the next direction a random force floor will use. They share global
// state and cycle clockwise.
get_force_floor_direction() {
let d = this.force_floor_direction;
this.force_floor_direction = DIRECTIONS[d].right;
return d;
}
// TODO make a set of primitives for actually altering the level that also
// record how to undo themselves
make_slide(actor, mode) {
+5 -1
View File
@@ -225,7 +225,11 @@ const TILE_TYPES = {
},
},
force_floor_all: {
// TODO cc2 cycles these...
// TODO ms: this is random, and an acting wall to monsters (!)
on_arrive(me, level, other) {
other.direction = level.get_force_floor_direction();
level.make_slide(other, 'force');
},
},
bomb: {
// TODO explode