Skip to content

Commit

Permalink
Added taunt count to action counts
Browse files Browse the repository at this point in the history
  • Loading branch information
OGMilkbone committed Jan 25, 2022
1 parent beb2061 commit 50da023
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/stats/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class ActionsComputer implements StatComputer<ActionCountsType[]> {
spotDodgeCount: 0,
ledgegrabCount: 0,
rollCount: 0,
tauntCount: 0,
lCancelCount: {
success: 0,
fail: 0,
Expand Down Expand Up @@ -137,6 +138,17 @@ function didStartLedgegrab(currentAnimation: State, previousAnimation: State): b
return isCurrentlyGrabbingLedge && !wasPreviouslyGrabbingLedge;
}

function isTaunting(animation: State): boolean {
return animation === State.TAUNT_LEFT || animation === State.TAUNT_RIGHT;
}

function didStartTaunt(currentAnimation: State, previousAnimation: State): boolean {
const isCurrentlyTaunting = isTaunting(currentAnimation);
const wasPreviouslyTaunting = isTaunting(previousAnimation);

return isCurrentlyTaunting && !wasPreviouslyTaunting;
}

function handleActionCompute(state: PlayerActionState, indices: PlayerIndexedType, frame: FrameEntryType): void {
const playerFrame = frame.players[indices.playerIndex]!.post;
const opponentFrame = frame.players[indices.opponentIndex]!.post;
Expand Down Expand Up @@ -174,6 +186,9 @@ function handleActionCompute(state: PlayerActionState, indices: PlayerIndexedTyp
const didGrabLedge = didStartLedgegrab(currentAnimation, prevAnimation);
incrementCount("ledgegrabCount", didGrabLedge);

const didTuant = didStartTaunt(currentAnimation, prevAnimation);
incrementCount("tauntCount", didTuant);

const didGrabSucceed = didStartGrabSuccess(currentAnimation, prevAnimation);
incrementCount("grabCount.success", didGrabSucceed);
const didGrabFail = didStartGrabFail(currentAnimation, prevAnimation);
Expand Down
4 changes: 4 additions & 0 deletions src/stats/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ export enum State {

COMMAND_GRAB_RANGE2_START = 0x147,
COMMAND_GRAB_RANGE2_END = 0x152,

// Taunts
TAUNT_RIGHT = 0x108
TAUNT_LEFT = 0x109
}

export const Timers = {
Expand Down

0 comments on commit 50da023

Please sign in to comment.