refactor speed shoes so they stack with dash floor/sand instead of overriding

This commit is contained in:
Timothy Stiles 2021-02-16 15:59:34 +11:00
parent e0004fb840
commit b7cedc2426
3 changed files with 9 additions and 6 deletions

View File

@ -1567,12 +1567,15 @@ export class Level extends LevelInterface {
// FIXME this feels clunky
let goal_cell = this.get_neighboring_cell(actor.cell, direction);
let terrain = goal_cell.get_terrain();
if (actor.has_item('speed_boots')) {
speed /= 2;
}
else if (terrain && terrain.type.speed_factor && ! actor.ignores(terrain.type.name) && !actor.slide_ignores(terrain.type.name)) {
if (terrain && terrain.type.speed_factor && ! actor.ignores(terrain.type.name) && !actor.slide_ignores(terrain.type.name)) {
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;
this._set_tile_prop(actor, 'previous_cell', orig_cell);

View File

@ -2250,7 +2250,7 @@ const EDITOR_TILE_DESCRIPTIONS = {
},
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!",
},
};

View File

@ -711,7 +711,7 @@ const TILE_TYPES = {
blocks_collision: COLLISION.block_cc1 | COLLISION.block_cc2,
speed_factor: 0.5,
},
dash_floor: {
dash_floor: {
layer: LAYERS.terrain,
speed_factor: 2,
},