diff --git a/js/format-c2g.js b/js/format-c2g.js index 53ddcab..c1376f3 100644 --- a/js/format-c2g.js +++ b/js/format-c2g.js @@ -803,6 +803,11 @@ const TILE_ENCODING = { name: 'cracked_ice', is_extension: true, }, + 0xd4: { + name: 'score_5x', + has_next: true, + is_extension: true, + }, 0xe0: { name: 'gift_bow', has_next: true, diff --git a/js/main-editor.js b/js/main-editor.js index 89ed368..bbb9d08 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -1608,6 +1608,7 @@ const EDITOR_PALETTE = [{ 'hole', 'cracked_floor', 'cracked_ice', + 'score_5x' ], }]; @@ -2222,6 +2223,10 @@ const EDITOR_TILE_DESCRIPTIONS = { name: "Cracked Ice", desc: "Turns into water when something steps off of it (except ghosts).", }, + score_5x: { + name: "×5 bonus", + desc: "Quintuples the player's current bonus points. Can be collected by doppelgangers, rovers, and bowling balls, but will not grant bonus points.", + }, }; const SPECIAL_PALETTE_ENTRIES = { diff --git a/js/main.js b/js/main.js index e35942d..16c7446 100644 --- a/js/main.js +++ b/js/main.js @@ -25,6 +25,33 @@ function format_replay_duration(t) { return `${t} tics (${util.format_duration(t / TICS_PER_SECOND)})`; } +function simplify_number(number) { + if (number < 1e6) + { + return number.toString(); + } + else if (number < 1e9) + { + return (number/1e6).toPrecision(4) + "M"; + } + else if (number < 1e12) + { + return (number/1e9).toPrecision(4) + "B"; + } + else if (number < 1e15) + { + return (number/1e12).toPrecision(4) + "T"; + } + else if (number < 1e18) + { + return (number/1e15).toPrecision(4) + "Q"; + } + else + { + return number.toPrecision(2).replace("+","") + } +} + // TODO: // - level password, if any const ACTION_LABELS = { @@ -1568,7 +1595,7 @@ class Player extends PrimaryView { this.time_el.classList.toggle('--danger', this.level.time_remaining < 10 * TICS_PER_SECOND); } - this.bonus_el.textContent = this.level.bonus_points; + this.bonus_el.textContent = simplify_number(this.level.bonus_points); if (this.level.bonus_points > 0) { this.root.classList.add('--bonus-visible'); } diff --git a/js/tileset.js b/js/tileset.js index 04037b5..3f3648a 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -1062,6 +1062,7 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, { }, cracked_floor: [11, 43], cracked_ice: [7, 40], + score_5x: [10, 40], }); export const TILESET_LAYOUTS = { diff --git a/js/tiletypes.js b/js/tiletypes.js index f7c54ea..fc23969 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -3151,6 +3151,19 @@ const TILE_TYPES = { } }, }, + score_5x: { + layer: LAYERS.item, + blocks_collision: COLLISION.block_cc1 | COLLISION.monster_solid, + on_arrive(me, level, other) { + if (other.type.is_real_player) { + level.adjust_bonus(0, 5); + level.sfx.play_once('get-bonus2', me.cell); + } + if (other.type.is_player || other.type.name === 'rover' || other.type.name === 'bowling_ball') { + level.remove_tile(me); + } + }, + }, hint: { layer: LAYERS.terrain,