If it's the trainer bot, don't disable hack/shield buttons
This commit is contained in:
parent
8f8aebd6ac
commit
7676981499
@ -33,16 +33,16 @@ let getShieldGif = function
|
||||
| ShieldId.Cypher -> "https://s10.gifyu.com/images/Cypher-Smaller.gif"
|
||||
| _ -> shieldGif
|
||||
|
||||
let constructButtons (actionType: string) (player: PlayerData) (buttonId : string) (items: BattleItem array) =
|
||||
let constructButtons (actionType: string) (player: PlayerData) (buttonId : string) (items: BattleItem array) isTrainer =
|
||||
items
|
||||
|> Array.map (fun item ->
|
||||
match player.Actions |> Array.exists (fun i -> i.ActionId = item.Id) with
|
||||
match player.Actions |> Array.exists (fun i -> i.ActionId = item.Id) && not isTrainer with
|
||||
| true -> DiscordButtonComponent(Game.getClassButtonColor item.Class, $"{actionType}-{item.Id}", $"{item.Name} (on cooldown)", true)
|
||||
| false -> DiscordButtonComponent(Game.getClassButtonColor item.Class, $"{actionType}-{item.Id}-{buttonId}", $"{item.Name}"))
|
||||
|
||||
let pickDefense actionId player =
|
||||
let pickDefense actionId player isTrainer =
|
||||
let buttons =
|
||||
constructButtons actionId player (string player.DiscordId) (Player.shields player)
|
||||
constructButtons actionId player (string player.DiscordId) (Player.shields player) isTrainer
|
||||
|> Seq.cast<DiscordComponent>
|
||||
|
||||
let embed =
|
||||
@ -56,10 +56,10 @@ let pickDefense actionId player =
|
||||
.AddEmbed(embed)
|
||||
.AsEphemeral(true)
|
||||
|
||||
let pickHack actionId attacker defender =
|
||||
let pickHack actionId attacker defender isTrainer =
|
||||
let buttons =
|
||||
let hacks = Player.hacks attacker
|
||||
constructButtons actionId attacker $"{defender.DiscordId}-{defender.Name}" hacks
|
||||
constructButtons actionId attacker $"{defender.DiscordId}-{defender.Name}" hacks isTrainer
|
||||
|> Seq.cast<DiscordComponent>
|
||||
|
||||
let embed =
|
||||
|
@ -119,7 +119,7 @@ let attack (target : DiscordUser) (ctx : InteractionContext) =
|
||||
>>= checkPlayerIsAttackingThemselves defender
|
||||
|> function
|
||||
| Ok _ ->
|
||||
let embed = Embeds.pickHack "Attack" attacker defender
|
||||
let embed = Embeds.pickHack "Attack" attacker defender false
|
||||
ctx.FollowUpAsync(embed)
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
@ -157,7 +157,7 @@ let handleAttack (event : ComponentInteractionCreateEventArgs) =
|
||||
let defend (ctx : InteractionContext) =
|
||||
Game.executePlayerInteraction ctx (fun player -> async {
|
||||
if Player.shields player |> Array.length > 0 then
|
||||
let embed = Embeds.pickDefense "Defend" player
|
||||
let embed = Embeds.pickDefense "Defend" player false
|
||||
do! ctx.FollowUpAsync(embed)
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
|
@ -60,7 +60,7 @@ let defend (ctx : InteractionContext) =
|
||||
| [||] -> { player with Arsenal = [| defaultShield |] }
|
||||
| _ -> player
|
||||
|
||||
let embed = Embeds.pickDefense "Trainer-2" playerWithShields
|
||||
let embed = Embeds.pickDefense "Trainer-2" playerWithShields true
|
||||
|
||||
do! ctx.FollowUpAsync(embed)
|
||||
|> Async.AwaitTask
|
||||
@ -118,7 +118,7 @@ let attack (target : DiscordUser) (ctx : InteractionContext) =
|
||||
match Player.hacks player with
|
||||
| [||] -> { player with Arsenal = [| defaultHack |] }
|
||||
| _ -> player
|
||||
let embed = Embeds.pickHack "Trainer-4" playerWithAttacks player
|
||||
let embed = Embeds.pickHack "Trainer-4" playerWithAttacks player true
|
||||
|
||||
do! ctx.FollowUpAsync(embed)
|
||||
|> Async.AwaitTask
|
||||
|
Loading…
x
Reference in New Issue
Block a user