UNPKG

slp-enforcer

Version:

Finds violations of the Melee Controller Ruleset by inspecting SLP files

31 lines (30 loc) 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("./index"); function isGoomwave(game, playerIndex, coords) { // If we're on box, then it always passes if (index_1.isBoxController(coords)) { return new index_1.CheckResult(false); } if (hasGoomwaveClamping(coords)) { return new index_1.CheckResult(true, [new index_1.Violation(0, "Evidence of cardinal clamping", coords)]); } return new index_1.CheckResult(false); } exports.isGoomwave = isGoomwave; function hasGoomwaveClamping(coords) { // Goomwaves seem to clamp anything under 0.0875 to the cardinal let CLAMP_MAXIMUM = 0.08; for (let coord of coords) { // Ignore coords on the cardinals. They don't count if (index_1.FloatEquals(coord.x, 0) || index_1.FloatEquals(coord.y, 0)) { continue; } // If there's a coord inside CLAMP_MAXIMUM, then it's not doing goomwave clamping if (Math.abs(coord.x) < CLAMP_MAXIMUM || Math.abs(coord.y) < CLAMP_MAXIMUM) { return false; } } return true; } exports.hasGoomwaveClamping = hasGoomwaveClamping;