diff --git a/src/components/Match/Timeline.tsx b/src/components/Match/Timeline.tsx
index f189b19363f..445f8ef083a 100644
--- a/src/components/Match/Timeline.tsx
+++ b/src/components/Match/Timeline.tsx
@@ -312,6 +312,7 @@ const Timeline = ({
time: number;
team?: number;
player_slot?: number;
+ victim_player_slot?: number;
key?: number | null;
start?: number;
end?: number;
@@ -330,11 +331,32 @@ const Timeline = ({
type: "firstblood",
time: match.objectives[fbIndex].time,
player_slot: match.objectives[fbIndex].player_slot,
+ victim_player_slot: match.objectives[fbIndex].victim_player_slot,
key: killerLog && killerLog[0] ? killerLog[0].key : null,
},
];
}
+ // The victim from the objective when the API provides it; otherwise fall
+ // back to guessing from the killer's first kills_log entry, which misses
+ // first bloods not credited to a hero (e.g. a creep landing the blow)
+ const findFbVictim = (obj: (typeof fbArr)[number]) => {
+ if (obj.victim_player_slot !== undefined) {
+ return match.players.find(
+ (player) => player.player_slot === obj.victim_player_slot,
+ );
+ }
+ if (obj.key) {
+ return match.players.find((player) => {
+ const foundHero = heroesArr("find")(
+ (hero: any) => hero.name === obj.key,
+ );
+ return foundHero && player.hero_id === foundHero.id;
+ });
+ }
+ return undefined;
+ };
+
const events = fbArr
// Roshan kills, team 2 = radiant, 3 = dire
@@ -490,38 +512,31 @@ const Timeline = ({
effect="solid"
place="right"
>
- {obj.type === "firstblood" && (
-
- {match.players
- .filter(
- (player) =>
- player.player_slot === obj.player_slot,
- )
- .map((player) => (
-
- ))}
-
- {obj.key
- ? strings.timeline_firstblood_key
- : strings.timeline_firstblood}
-
- {obj.key && (
- {
- const foundHero = heroesArr("find")(
- (hero: any) => hero.name === obj.key,
- );
- return (
- foundHero && player.hero_id === foundHero.id
- );
- })}
- />
- )}
-
- )}
+ {obj.type === "firstblood" &&
+ (() => {
+ const victim = findFbVictim(obj);
+ return (
+
+ {match.players
+ .filter(
+ (player) =>
+ player.player_slot === obj.player_slot,
+ )
+ .map((player) => (
+
+ ))}
+
+ {victim
+ ? strings.timeline_firstblood_key
+ : strings.timeline_firstblood}
+
+ {victim && }
+
+ );
+ })()}
{obj.type === "roshan" &&
aegis[obj.key as number] &&
match.players