UNPKG

slp-enforcer

Version:

Finds violations of the Melee Controller Ruleset by inspecting SLP files

34 lines (33 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("./index"); function hasIllegalUptiltRounding(game, playerIndex, coords) { // If we're on ditigal, then it always passes if (index_1.isBoxController(coords)) { return new index_1.CheckResult(false); } return getUptiltCheck(game, playerIndex, coords); } exports.hasIllegalUptiltRounding = hasIllegalUptiltRounding; function getUptiltCheck(game, playerIndex, coords) { // y in range 0.2 - 0.275 for (let coord of coords) { // Only consider coords in the x deadzone if (Math.abs(coord.x) < 0.2876 && coord.y > 0.199 && coord.y < 0.2749) { return new index_1.CheckResult(false); } } // Now let's count up how many coords in the uptilt zone are on the exact boundary let boundaryCount = 0; for (let coord of coords) { if (Math.abs(coord.x) < 0.2876 && index_1.FloatEquals(coord.y, 0.2875)) { boundaryCount++; } } if (boundaryCount < 5) { return new index_1.CheckResult(false); } // Insert all coords here as evidence, for visualization return new index_1.CheckResult(true, [new index_1.Violation(0, "Uptilt rounding observed. No coordinates seen below uptilt area.", index_1.getUniqueCoords(coords))]); } exports.getUptiltCheck = getUptiltCheck;