Skip to content

Commit ade2a3b

Browse files
committed
Fix play-by-play
1 parent ed13037 commit ade2a3b

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

TODO

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ allow undoing a trade
66
shootouts
77
- hockey
88
- need football/baseball scoringSummary style - build up from events?
9-
- flavor?
10-
- separate attempt from result
11-
- fix play-by-play text
129
- scoring summary
1310
- isScoringPlay -> formatScoringSummaryEvent
1411
- confirm for all sports

src/ui/util/processLiveGameEvents.hockey.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ const getText = (
163163
);
164164
} else if (event.type === "shootoutStart") {
165165
text = `The game will now be decided by a shootout with ${event.rounds} rounds!`;
166+
} else if (event.type === "shootoutTeam") {
167+
text = `${event.names[0]} takes the puck`;
166168
} else if (event.type === "shootoutShot") {
167-
text = `Kick ${event.att}: ${event.made ? `Shot by ${event.names[0]} - saved by ${event.names[1]}` : `Shot by ${event.names[0]}`}`;
169+
text = event.made ? "" : `Saved by ${event.names[0]}`;
168170
} else if (event.type === "shootoutTie") {
169171
text = `The shootout is tied! Teams will alternate penalty shots until there is a winner`;
170172
}

src/worker/core/GameSim.hockey/PlayByPlayLogger.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ type PlayByPlayEventInputScore =
1515
type: "shootoutShot";
1616
clock: number;
1717
t: TeamNum;
18-
names: [string, string];
18+
names: [string];
1919
made: boolean;
20-
att: number;
2120
goalType: "pn";
2221
shotType: string;
2322
};
@@ -106,6 +105,12 @@ type PlayByPlayEventInput =
106105
rounds: number;
107106
clock: number;
108107
}
108+
| {
109+
type: "shootoutTeam";
110+
t: TeamNum;
111+
names: [string];
112+
clock: number;
113+
}
109114
| {
110115
type: "shootoutTie";
111116
clock: number;

src/worker/core/GameSim.hockey/index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,15 +475,23 @@ class GameSim extends GameSimBase {
475475
}
476476

477477
doShootoutShot(t: TeamNum, p: PlayerGameSim, goalie: PlayerGameSim) {
478-
// 20% to 80%
479-
const skaterProb = 0.2 + 0.6 * p.compositeRating.scoring;
480-
const goalieProb = 0.8 - 0.6 * goalie.compositeRating.goalkeeping;
478+
// 50% to 100%
479+
const skaterProb = 0.5 + 0.5 * p.compositeRating.scoring;
480+
const goalieProb = 1 - 0.5 * goalie.compositeRating.goalkeeping;
481481

482482
const probMake = skaterProb * goalieProb;
483483

484484
const made = Math.random() < probMake;
485485

486486
this.recordStat(t, undefined, "sAtt");
487+
488+
this.playByPlay.logEvent({
489+
type: "shootoutTeam",
490+
clock: this.clock,
491+
t,
492+
names: [p.name],
493+
});
494+
487495
if (made) {
488496
this.recordStat(t, undefined, "sPts");
489497
}
@@ -492,8 +500,7 @@ class GameSim extends GameSimBase {
492500
type: "shootoutShot",
493501
clock: this.clock,
494502
t,
495-
names: [p.name, goalie.name],
496-
att: this.team[t].stat.sAtt,
503+
names: [goalie.name],
497504
made,
498505
goalType: "pn",
499506
shotType: "penalty",

0 commit comments

Comments
 (0)