implement x5 Bonus
also make it so bonuses of 1mil+ are rendered reasonably in-game (100bil+ starts breaking the results screen but I think that's lower priority)
This commit is contained in:
parent
f64302f324
commit
dece34f365
@ -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,
|
||||
|
||||
@ -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 = {
|
||||
|
||||
29
js/main.js
29
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');
|
||||
}
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user