diff --git a/Bot/Game.fs b/Bot/Game.fs index fc5551b..2ae2c29 100644 --- a/Bot/Game.fs +++ b/Bot/Game.fs @@ -59,7 +59,7 @@ module Player = let attacks player = player.Actions |> Array.filter (fun act -> match act.Type with Attack _ -> true | _ -> false) - let defenses player = player.Actions |> Array.filter (fun act -> match act.Type with Defense -> true | _ -> false) + let getDefenses player = player.Actions |> Array.filter (fun act -> match act.Type with Defense -> true | _ -> false) let removeExpiredActions filterByAttackCooldown player = let actions = diff --git a/Bot/HackerBattle.fs b/Bot/HackerBattle.fs index 2923b75..5c214dc 100644 --- a/Bot/HackerBattle.fs +++ b/Bot/HackerBattle.fs @@ -58,8 +58,8 @@ let checkTargetHasMoney (target : PlayerData) attacker = let checkPlayerHasShieldSlotsAvailable shield player = let updatedPlayer = player |> Player.removeExpiredActions false - let defenses = updatedPlayer |> fun p -> p.Actions - match defenses |> Array.length > 2 with + let defenses = Player.getDefenses updatedPlayer + match defenses |> Array.length >= 2 with | true -> let timestamp = defenses |> Array.rev |> Array.head |> fun a -> a.Timestamp // This should be the next expiring timestamp let cooldown = getTimeText true (TimeSpan.FromMinutes(int shield.Cooldown)) timestamp @@ -74,7 +74,7 @@ let calculateDamage (hack : BattleItem) (shield : BattleItem) = let runHackerBattle defender hack = defender |> Player.removeExpiredActions false - |> Player.defenses + |> Player.getDefenses |> Array.map (fun dfn -> Armory.battleItems |> Array.find (fun w -> w.Id = dfn.ActionId)) |> Array.map (calculateDamage (hack)) |> Array.contains Weak diff --git a/Bot/Store.fs b/Bot/Store.fs index d0bf9c5..25eef98 100644 --- a/Bot/Store.fs +++ b/Bot/Store.fs @@ -57,7 +57,7 @@ let statusFormat p = $"**Hacks:** {Player.hacks p |> battleItemFormat}\n **Shields:** {Player.getShields p |> battleItemFormat}\n **Hack Attacks:**\n{Player.attacks p |> actionFormat}\n -**Active Shields:**\n{Player.defenses p |> actionFormat}" +**Active Shields:**\n{Player.getDefenses p |> actionFormat}" // TODO: There's a 1000 character limit for embeds, so you need to filter by N last actions let arsenal (ctx : InteractionContext) =