Skip to content

Commit

Permalink
add command grabs to moves and attack id 0 test case
Browse files Browse the repository at this point in the history
  • Loading branch information
cnkeats committed Dec 15, 2021
1 parent 3081996 commit 7082492
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Binary file added slp/moveTest/id_0.slp
Binary file not shown.
2 changes: 1 addition & 1 deletion src/stats/combos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function handleComboCompute(
lastHitBy: indices.playerIndex,
};

if (opntIsGrabbed) {
if (opntIsGrabbed || opntIsCommandGrabbed) {
const grabMove = {
playerIndex: indices.playerIndex,
frame: currentFrameNumber,
Expand Down
2 changes: 1 addition & 1 deletion src/stats/conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function handleConversionCompute(
damage: 0,
};

if (opntIsGrabbed) {
if (opntIsGrabbed || opntIsCommandGrabbed) {
const grabMove = {
playerIndex: indices.playerIndex,
frame: currentFrameNumber,
Expand Down
20 changes: 15 additions & 5 deletions test/moves.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ import { SlippiGame } from "../src/SlippiGame";

describe("when calculating stats", () => {
it("the correct move ids should be determined", () => {
let moveIdCounter = 2;

let game = new SlippiGame("slp/moveTest/id_2_to_21.slp");
let game = new SlippiGame("slp/moveTest/id_0.slp");
let stats = game.getStats();

stats.conversions.forEach((c) => {
c.moves.forEach((m) => {
expect(m.moveId).toEqual(0);
});
});

let moveIdCounter = 2;
game = new SlippiGame("slp/moveTest/id_2_to_21.slp");
stats = game.getStats();

stats.conversions.forEach((c) => {
c.moves.forEach((m) => {
expect(m.moveId).toEqual(moveIdCounter);
Expand All @@ -22,6 +30,8 @@ describe("when calculating stats", () => {
expect(stats.conversions[1].moves[0].moveId).toEqual(moveIdCounter);
moveIdCounter++;

// Lasers cause no hitstun and do not register as combo or conversion starters
// As such, this test case should be adjusted to not rely on those
// Kirby-Fox
game = new SlippiGame("slp/moveTest/id_23.slp");
stats = game.getStats();
Expand Down Expand Up @@ -73,7 +83,7 @@ describe("when calculating stats", () => {
// Kirby-IceClimbers
game = new SlippiGame("slp/moveTest/id_31.slp");
stats = game.getStats();
//expect(stats.conversions[1].moves[0].moveId).toEqual(moveIdCounter);
expect(stats.conversions[1].moves[0].moveId).toEqual(moveIdCounter);
moveIdCounter++;

// Kirby-Pikachu
Expand All @@ -89,7 +99,7 @@ describe("when calculating stats", () => {
moveIdCounter++;

// Kirby-Yoshi
// Unused - Kirby-Yoshi's Neutral Special is the same as a normal Neutral Special (18)
// Unused - Kirby-Yoshi's Neutral Special's id is the same as a normal Neutral Special (18)
moveIdCounter++;

// Kirby-Jigglypuff
Expand Down

0 comments on commit 7082492

Please sign in to comment.