Should count defenses only

This commit is contained in:
Joseph Ferano 2022-02-10 00:59:16 +07:00
parent d311423ca2
commit 213f9be2ee
3 changed files with 5 additions and 5 deletions

View File

@ -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 =

View File

@ -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

View File

@ -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) =