From f52cbc86460e20f5127eaf1d90bb7f91bc7c4941 Mon Sep 17 00:00:00 2001 From: hgw Date: Tue, 10 Oct 2023 11:05:33 +0000 Subject: [PATCH] Grant winners 10 points on royal rumble wins --- src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.rs b/src/main.rs index e253765..e5b3ff9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -140,6 +140,13 @@ impl HallOfFame { }; *winner += 3; } + pub fn add_rumble_champion(&mut self, nick: &str) { + let winner = match self.entry(nick.to_owned()) { + std::collections::hash_map::Entry::Occupied(o) => o.into_mut(), + std::collections::hash_map::Entry::Vacant(v) => v.insert(0), + }; + *winner += 10; + } pub fn add_fucking_looser(&mut self, nick: &str) { let fucking_looser = match self.entry(nick.to_owned()) { std::collections::hash_map::Entry::Occupied(o) => o.into_mut(), @@ -330,6 +337,9 @@ fn fight( if fight.kind == FightKind::DeathMatch { hall_of_fame.add_winner(&winners[0].nick); } + if fight.kind == FightKind::RoyalRumble { + hall_of_fame.add_rumble_champion(&winners[0].nick); + } } else { ctx.privmsg( &fight.channel, @@ -354,6 +364,9 @@ fn fight( if fight.kind == FightKind::DeathMatch { hall_of_fame.add_winner(&w.nick); } + if fight.kind == FightKind::RoyalRumble { + hall_of_fame.add_rumble_champion(&w.nick); + } } }