Skip to content

Commit

Permalink
refactor: use 'count' instead of 'counts'
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceau committed Apr 14, 2021
1 parent fdb7ce8 commit b8b9a2f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/stats/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export class ActionsComputer implements StatComputer<ActionCountsType[]> {
success: 0,
fail: 0,
},
grabCounts: {
grabCount: {
success: 0,
fail: 0,
},
throwCounts: {
throwCount: {
up: 0,
forward: 0,
back: 0,
Expand Down Expand Up @@ -159,14 +159,14 @@ function handleActionCompute(state: PlayerActionState, playerIndex: number, fram
incrementCount("ledgegrabCount", didGrabLedge);

const didGrabSucceed = didStartGrabSuccess(currentAnimation, prevAnimation);
incrementCount("grabCounts.success", didGrabSucceed);
incrementCount("grabCount.success", didGrabSucceed);
const didGrabFail = didStartGrabFail(currentAnimation, prevAnimation);
incrementCount("grabCounts.fail", didGrabFail);
incrementCount("grabCount.fail", didGrabFail);

incrementCount("throwCounts.up", currentAnimation === State.THROW_UP && newAnimation);
incrementCount("throwCounts.forward", currentAnimation === State.THROW_FORWARD && newAnimation);
incrementCount("throwCounts.down", currentAnimation === State.THROW_DOWN && newAnimation);
incrementCount("throwCounts.back", currentAnimation === State.THROW_BACK && newAnimation);
incrementCount("throwCount.up", currentAnimation === State.THROW_UP && newAnimation);
incrementCount("throwCount.forward", currentAnimation === State.THROW_FORWARD && newAnimation);
incrementCount("throwCount.down", currentAnimation === State.THROW_DOWN && newAnimation);
incrementCount("throwCount.back", currentAnimation === State.THROW_BACK && newAnimation);

if (isAerialAttack(currentAnimation)) {
incrementCount("lCancelCount.success", playerFrame.lCancelStatus === 1);
Expand Down
4 changes: 2 additions & 2 deletions src/stats/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ export interface ActionCountsType {
success: number;
fail: number;
};
grabCounts: {
grabCount: {
success: number;
fail: number;
};
throwCounts: {
throwCount: {
up: number;
forward: number;
back: number;
Expand Down
4 changes: 2 additions & 2 deletions test/stats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ describe("when calculating stats", () => {
it("should correctly calculate throw counts", () => {
const game = new SlippiGame("slp/throwGrab.slp");
const stats = game.getStats();
const p2Throws = stats.actionCounts[1].throwCounts;
const p2Throws = stats.actionCounts[1].throwCount;
expect(p2Throws).toEqual(expectedThrow);
});

it("should correctly calculate grab counts", () => {
const game = new SlippiGame("slp/throwGrab.slp");
const stats = game.getStats();
const p2Grabs = stats.actionCounts[1].grabCounts;
const p2Grabs = stats.actionCounts[1].grabCount;
expect(p2Grabs).toEqual(expectedGrab);
});

Expand Down

0 comments on commit b8b9a2f

Please sign in to comment.