slp-enforcer
Version:
Finds violations of the Melee Controller Ruleset by inspecting SLP files
34 lines (33 loc) • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
function hasIllegalCrouchUptilt(game, playerIndex, coords) {
let violations = [];
// If we're on analog, then it always passes
if (!index_1.isBoxController(coords)) {
return new index_1.CheckResult(false);
}
let actions = [];
// For this one, we use a different strategy,
// we just look at the game states, rather than inputs
let frames = game.getFrames();
let lastCrouch = -124;
for (let i = -123; i < game.getStats().lastFrame; i++) {
if (!(playerIndex in frames[i].players)) {
continue;
}
let actionState = frames[i].players[playerIndex].post.actionStateId;
// Crouching
if (actionState == 0x28) {
lastCrouch = i;
}
// Uptilt
if (actionState == 0x38) {
if (i - lastCrouch <= 3) {
violations.push(new index_1.Violation(lastCrouch, "Crouch-uptilt occurred within three frames", coords.slice(lastCrouch + 123, lastCrouch + 123 + 4)));
}
}
}
return new index_1.CheckResult(violations.length !== 0, violations);
}
exports.hasIllegalCrouchUptilt = hasIllegalCrouchUptilt;