From c34aaadf066a7e804cff48700ae93992f7e6facb Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Mon, 14 Dec 2020 17:07:35 -0700 Subject: [PATCH] Attempt, unsuccessfully, to implement ice block melting --- js/game.js | 1 + js/tiletypes.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/js/game.js b/js/game.js index 28ccaee..542729a 100644 --- a/js/game.js +++ b/js/game.js @@ -1025,6 +1025,7 @@ export class Level { // Bump tiles that we're even attempting to move into; this mostly reveals // invisible walls, blue floors, etc. + // XXX how to guarantee this only happens once... if (tile.type.on_bump) { tile.type.on_bump(tile, this, actor); } diff --git a/js/tiletypes.js b/js/tiletypes.js index ad5dcc4..a505606 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -892,6 +892,18 @@ const TILE_TYPES = { ice_block: true, frame_block: true, }, + on_bump(me, level, other) { + // Fireballs melt ice blocks on regular floor + // XXX what if i'm in motion? + if (other.type.name === 'fireball') { + let terrain = me.cell.get_terrain(); + if (terrain.type.name === 'floor') { + level.remove_tile(me); + level.transmute_tile(terrain, 'water'); + // FIXME splash? + } + } + }, }, frame_block: { // TODO directional, obviously