refactor speed shoes so they stack with dash floor/sand instead of overriding
This commit is contained in:
parent
e0004fb840
commit
b7cedc2426
11
js/game.js
11
js/game.js
@ -1567,12 +1567,15 @@ export class Level extends LevelInterface {
|
|||||||
// FIXME this feels clunky
|
// FIXME this feels clunky
|
||||||
let goal_cell = this.get_neighboring_cell(actor.cell, direction);
|
let goal_cell = this.get_neighboring_cell(actor.cell, direction);
|
||||||
let terrain = goal_cell.get_terrain();
|
let terrain = goal_cell.get_terrain();
|
||||||
if (actor.has_item('speed_boots')) {
|
if (terrain && terrain.type.speed_factor && ! actor.ignores(terrain.type.name) && !actor.slide_ignores(terrain.type.name)) {
|
||||||
speed /= 2;
|
|
||||||
}
|
|
||||||
else if (terrain && terrain.type.speed_factor && ! actor.ignores(terrain.type.name) && !actor.slide_ignores(terrain.type.name)) {
|
|
||||||
speed /= terrain.type.speed_factor;
|
speed /= terrain.type.speed_factor;
|
||||||
}
|
}
|
||||||
|
//speed boots speed us up UNLESS we're on terrain that speeds us up AND it has a slide mode AND we're sliding (so e.g. we gain 2x on teleports, ice + ice skates, force floors + suction boots, sand and dash floors, but we don't gain 2x sliding on ice or force floors unless it's the turn we're leaving them)
|
||||||
|
if (actor.has_item('speed_boots')
|
||||||
|
&& !(terrain.type.speed_factor && terrain.type.slide_mode && actor.slide_mode === terrain.type.slide_mode))
|
||||||
|
{
|
||||||
|
speed /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
let orig_cell = actor.cell;
|
let orig_cell = actor.cell;
|
||||||
this._set_tile_prop(actor, 'previous_cell', orig_cell);
|
this._set_tile_prop(actor, 'previous_cell', orig_cell);
|
||||||
|
|||||||
@ -2250,7 +2250,7 @@ const EDITOR_TILE_DESCRIPTIONS = {
|
|||||||
},
|
},
|
||||||
dash_floor: {
|
dash_floor: {
|
||||||
name: "Dash Floor",
|
name: "Dash Floor",
|
||||||
desc: "Anything walking on it moves at double speed.",
|
desc: "Anything walking on it moves at double speed. Stacks with speed shoes!",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -711,7 +711,7 @@ const TILE_TYPES = {
|
|||||||
blocks_collision: COLLISION.block_cc1 | COLLISION.block_cc2,
|
blocks_collision: COLLISION.block_cc1 | COLLISION.block_cc2,
|
||||||
speed_factor: 0.5,
|
speed_factor: 0.5,
|
||||||
},
|
},
|
||||||
dash_floor: {
|
dash_floor: {
|
||||||
layer: LAYERS.terrain,
|
layer: LAYERS.terrain,
|
||||||
speed_factor: 2,
|
speed_factor: 2,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user