From c94f74e25bcda0fc3139f2879124a81537153f0b Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Mon, 18 Apr 2022 13:57:43 +0700 Subject: [PATCH] Remove expired actions for scan --- Bot/Games/HackerBattle.fs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Bot/Games/HackerBattle.fs b/Bot/Games/HackerBattle.fs index 1b8cf03..18745bf 100644 --- a/Bot/Games/HackerBattle.fs +++ b/Bot/Games/HackerBattle.fs @@ -232,9 +232,10 @@ let scan (ctx : IDiscordContext) = let! targets = DbService.getRandomHackablePlayers (ctx.GetDiscordMember().Id) let targets = let hackedIds = - player.Events - |> List.choose (fun e -> - match e.Type with | Hacking hack -> Some hack.Adversary.Id | _ -> None) + player + |> Player.removeExpiredActions + |> fun p -> p.Events + |> List.choose (fun e -> match e.Type with | Hacking hack -> Some hack.Adversary.Id | _ -> None) targets |> List.filter (fun t -> hackedIds |> List.exists (fun hid -> hid = t.Id) |> not) |> List.truncate 5