Check if the target has funds and improve the embed for training
This commit is contained in:
parent
ad17e139c6
commit
0804c1a409
@ -75,14 +75,16 @@ let pickDefense actionId player isTrainer =
|
||||
let pickHack actionId attacker defender isTrainer =
|
||||
let buttons = constructButtons actionId $"{defender.DiscordId}-{defender.Name}" attacker ItemType.Hack isTrainer
|
||||
|
||||
let stealMsg = if not isTrainer then $"{defender.Name} has **{defender.Bank} $GBT** we can take from them. " else ""
|
||||
let embed =
|
||||
DiscordEmbedBuilder()
|
||||
.WithTitle("Hack Attack")
|
||||
.WithDescription($"{defender.Name} has **{defender.Bank} $GBT** we can take from them. Pick the hack you want to use.")
|
||||
.WithDescription($"{stealMsg}Pick the hack you want to use.")
|
||||
|
||||
for h in Player.getHacks attacker |> Array.sortBy (fun i -> i.Power) do
|
||||
let amount = if h.Power > int defender.Bank then int defender.Bank else h.Power
|
||||
embed.AddField(h.Name, $"Extract {amount}", true) |> ignore
|
||||
if not isTrainer then
|
||||
for h in Player.getHacks attacker |> Array.sortBy (fun i -> i.Power) do
|
||||
let amount = if h.Power > int defender.Bank then int defender.Bank else h.Power
|
||||
embed.AddField(h.Name, $"Cooldown {h.Cooldown} mins\nExtract {amount} $GBT", true) |> ignore
|
||||
|
||||
DiscordFollowupMessageBuilder()
|
||||
.AddComponents(buttons)
|
||||
|
@ -140,6 +140,7 @@ let hack (target : DiscordUser) (ctx : IDiscordContext) =
|
||||
do! attacker
|
||||
|> Player.removeExpiredActions
|
||||
|> checkAlreadyHackedTarget defender
|
||||
>>= checkTargetHasFunds defender
|
||||
>>= checkHasEmptyHacks
|
||||
>>= checkPlayerIsAttackingThemselves defender
|
||||
|> function
|
||||
|
11
Bot/Thief.fs
11
Bot/Thief.fs
@ -85,6 +85,11 @@ let checkTargetHasFunds target player =
|
||||
| true -> Error $"Looks like the poor bastard has no $GBT... pick a different victim."
|
||||
| false -> Ok player
|
||||
|
||||
let checkPrizeRequestZero request player =
|
||||
match request <= 0 with
|
||||
| true -> Error $"You don't want to steal anything? Were you dropped on your head as a kid? Pick a different amount"
|
||||
| false -> Ok player
|
||||
|
||||
let checkThiefCooldown attacker =
|
||||
attacker
|
||||
|> Player.removeExpiredActions
|
||||
@ -118,6 +123,8 @@ let steal target amount (ctx : IDiscordContext) =
|
||||
thief
|
||||
|> checkPlayerIsAttackingThemselves victim
|
||||
// |> checkVictimStealingCooldown victim
|
||||
>>= checkTargetHasFunds victim
|
||||
>>= checkPrizeRequestZero amount
|
||||
|> handleResultWithResponse ctx (fun _ -> async {
|
||||
let cappedPrize , winPercentage , wasCapped =
|
||||
calculateWinPercentage amount (int victim.Bank) thief.Traits.Strength victim.Traits.Strength
|
||||
@ -244,9 +251,9 @@ type StealGame() =
|
||||
|
||||
[<SlashCommand("steal", "Steal some money from another player, but you might go to prison if caught")>]
|
||||
member this.Steal (ctx : InteractionContext,
|
||||
[<Option("amount", "How much you would like to steal")>] amount : double,
|
||||
[<Option("amount", "How much you would like to steal")>] amount : int64,
|
||||
[<Option("target", "Who do you want to steal from?")>] target : DiscordUser) =
|
||||
// enforceChannel (DiscordInteractionContext ctx) (steal target amount)
|
||||
steal target amount (DiscordInteractionContext ctx)
|
||||
steal target (int amount) (DiscordInteractionContext ctx)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user