Make ghosts erase fire even if they just got the boots from the same cell

This commit is contained in:
Eevee (Evelyn Woods) 2020-12-26 04:23:23 -07:00
parent 8fbd454059
commit 059a523347
2 changed files with 21 additions and 36 deletions

View File

@ -1475,13 +1475,6 @@ export class Level extends LevelInterface {
// Also reset slide here, since slide mode is differently important for forced moves
this.make_slide(actor, null);
// Let the actor perform any weird behavior of its own; note that this does NOT respect
// 'ignores' since it passes the whole cell in, which is good because ghosts use this to
// stamp out fire and dirt
if (actor.type.on_step_on) {
actor.type.on_step_on(actor, this, cell);
}
// Step on topmost things first -- notably, it's safe to step on water with flippers on top
for (let tile of Array.from(cell).reverse()) {
if (tile === actor)

View File

@ -138,6 +138,14 @@ const TILE_TYPES = {
// Floors and walls
floor: {
draw_layer: DRAW_LAYERS.terrain,
on_arrive(me, level, other) {
if (other.type.name === 'blob') {
// Blobs spread slime onto floor
if (me.previous_cell && me.previous_cell.has('slime')) {
level.transmute_tile(me, 'slime');
}
}
},
},
floor_letter: {
draw_layer: DRAW_LAYERS.terrain,
@ -608,13 +616,19 @@ const TILE_TYPES = {
draw_layer: DRAW_LAYERS.terrain,
blocks_collision: COLLISION.monster_solid & ~COLLISION.fireball,
on_arrive(me, level, other) {
if (other.type.name === 'ice_block') {
if (other.type.name === 'ghost') {
// Ghosts with fire boots erase fire, otherwise are unaffected
if (other.has_item('fire_boots')) {
level.transmute_tile(me, 'floor');
}
}
else if (other.has_item('fire_boots')) {
return;
}
else if (other.type.name === 'ice_block') {
level.transmute_tile(other, 'explosion');
level.transmute_tile(me, 'water');
}
else if (other.type.name === 'ghost') {
return;
}
else if (other.type.is_real_player) {
level.fail('burned');
}
@ -1896,18 +1910,6 @@ const TILE_TYPES = {
let modifier = level.get_blob_modifier();
return [DIRECTION_ORDER[(level.prng() + modifier) % 4]];
},
on_step_on(me, level, cell) {
let terrain = cell.get_terrain();
if (! terrain)
return;
if (terrain.type.name === 'floor') {
// Blobs spread slime onto floor
if (me.previous_cell && me.previous_cell.has('slime')) {
level.transmute_tile(terrain, 'slime');
}
}
},
},
teeth: {
draw_layer: DRAW_LAYERS.actor,
@ -2001,18 +2003,6 @@ const TILE_TYPES = {
let d = DIRECTIONS[me.direction];
return [me.direction, d.left, d.right, d.opposite];
},
on_step_on(me, level, cell) {
let terrain = cell.get_terrain();
if (! terrain)
return;
if (terrain.type.name === 'fire') {
// Ghosts with fire boots erase fire
if (me.has_item('fire_boots')) {
level.transmute_tile(terrain, 'floor');
}
}
},
},
floor_mimic: {
draw_layer: DRAW_LAYERS.actor,
@ -2136,7 +2126,9 @@ const TILE_TYPES = {
is_item: true,
is_tool: true,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
item_ignores: new Set(['fire', 'flame_jet_on']),
// Note that these do NOT ignore fire because of the ghost interaction
// XXX starting to wonder if this is even useful really
item_ignores: new Set(['flame_jet_on']),
},
flippers: {
draw_layer: DRAW_LAYERS.item,