From 059a5233470edb0fb0090bec3932e60838050f60 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sat, 26 Dec 2020 04:23:23 -0700 Subject: [PATCH] Make ghosts erase fire even if they just got the boots from the same cell --- js/game.js | 7 ------- js/tiletypes.js | 50 +++++++++++++++++++++---------------------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/js/game.js b/js/game.js index 90e719d..afb3244 100644 --- a/js/game.js +++ b/js/game.js @@ -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) diff --git a/js/tiletypes.js b/js/tiletypes.js index d49d521..b78ab2f 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -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,