diff --git a/Bot/Thief.fs b/Bot/Thief.fs index 30fc35a..4bbf55f 100644 --- a/Bot/Thief.fs +++ b/Bot/Thief.fs @@ -9,12 +9,11 @@ open DSharpPlus.SlashCommands open Degenz.Messaging let ThiefCooldown = TimeSpan.FromMinutes(1) -let VictimRecovery = TimeSpan.FromHours(4) +let VictimRecovery = TimeSpan.FromHours(1) type StealResult = | Success | WentToPrison - | VictimRanAway //let getRandomStealBtnLabels () = // let rand = Random(Guid.NewGuid().GetHashCode()) @@ -41,24 +40,6 @@ let payout defenderBank chance = let randomAmount = baseAmount + randomBonus |> int max 1 randomAmount -let getStealEmbed amount (chance : double) prize (target : PlayerData) = - let chance = int (chance * 100.0) - let buttons = - let btnId = $"Steal-yes-{target.DiscordId}-{target.Name}-{amount}" - [ DiscordButtonComponent(ButtonStyle.Success, btnId, "Do it") ] - |> Seq.cast - let embed = - DiscordEmbedBuilder() - .AddField("Chance of Success", $"{chance}%%", true) - .AddField("Payout", $"{prize}", true) - .WithTitle($"Steal $GBT from {target.Name}") - - DiscordFollowupMessageBuilder() - .AddEmbed(embed) - .AddComponents(buttons) - .AsEphemeral(true) - - let getResultEmbed chance prize (bank : int) thief (victim : DiscordPlayer) result = let embed = DiscordEmbedBuilder() @@ -74,11 +55,6 @@ let getResultEmbed chance prize (bank : int) thief (victim : DiscordPlayer) + "Your mean ugly face and athletic physique intimidated your poor victim into giving you their money") , "https://f8n-production-collection-assets.imgix.net/0x3B3ee1931Dc30C1957379FAc9aba94D1C48a5405/127502/QmPLPg1CLovKzS7mP8QkrMoHws1D4VZTzpfbZBALLwKZ5b/nft.png" , DiscordColor.Green - | VictimRanAway -> - embed.AddField("Result" , $"Ran Away", true) |> ignore - $"Target **ran away**...\n\n{thief.Name} saw a shadowy figure and got nervous so they ran in the opposite direction" - , "https://i.imgur.com/NLHMvVK.jpg" - , DiscordColor.Grayple | WentToPrison -> embed.AddField("Result" , $"Imprisoned", true) |> ignore $"You're going to **PRISON**...\n\n{thief.Name} knows Karate and elbowed you in the nose. While unconscious, they called the cops." @@ -130,7 +106,6 @@ let steal target amount (ctx : IDiscordContext) = Game.executePlayerActionWithTarget target ctx (fun thief victim -> async { do! thief |> checkVictimStealingCooldown victim - >>= checkThiefCooldown |> handleResultWithResponse ctx (fun _ -> async { let cappedPrize , winPercentage , wasCapped = calculateWinPercentage amount (int victim.Bank) thief.Traits.Strength victim.Traits.Strength @@ -172,7 +147,6 @@ let handleSteal (ctx : IDiscordContext) = let rand = Random(Guid.NewGuid().GetHashCode()) let num = rand.NextDouble() - let result = winPercentage >= num , rand.Next(0,3) = 0 let dp = { DiscordPlayer.Id = targetId ; DiscordPlayer.Name = targetName } let stealAction result = { ItemId = -1 @@ -186,11 +160,9 @@ let handleSteal (ctx : IDiscordContext) = let getResultEmbed' = getResultEmbed winPercentage prize thief.Bank thief dp // TODO: Send event to the hall of privacy // TODO: We need to check if the player is on cooldown - match result with - | true , _ -> + match winPercentage >= num with + | true -> let embed = getResultEmbed' Success -// let xp = 25 -// embed.AddField("XP Gained", $"{xp}") |> ignore do! Messaging.sendFollowUpEmbed ctx (embed.Build()) match! DbService.tryFindPlayer targetId with | Some t -> @@ -217,14 +189,8 @@ let handleSteal (ctx : IDiscordContext) = Cooldown = ThiefCooldown.Minutes * 1 } let actions = thief |> Player.removeExpiredActions |> fun p -> Array.append [| stole |] p.Events - do! DbService.updatePlayer { thief with Bank = thief.Bank + prize ; XP = thief.XP + 0 ; Events = actions } -// do! Async.Sleep 2000 -// do! ctx.FollowUp (XP.getRewardsEmbed 1 player) |> Async.AwaitTask - | false , false -> - let embed = getResultEmbed' VictimRanAway - do! DbService.updatePlayer { thief with Events = Array.append [| stealAction PlayerEventResult.Neutral |] thief.Events } - do! Messaging.sendFollowUpEmbed ctx (embed.Build()) - | false , true -> + do! DbService.updatePlayer { thief with Bank = thief.Bank + prize ; Events = actions } + | false -> let embed = getResultEmbed' WentToPrison do! DbService.updatePlayer { thief with Events = Array.append [| stealAction PlayerEventResult.Neutral |] thief.Events } do! Messaging.sendFollowUpEmbed ctx (embed.Build())