Read actual shield used in trainer, mention right hack target, slow things down

This commit is contained in:
Joseph Ferano 2022-02-03 18:42:49 +07:00
parent 3b5852bcfb
commit 36471195aa
3 changed files with 13 additions and 11 deletions

View File

@ -66,12 +66,12 @@ let pickHack actionId attacker defender =
.AddEmbed(embed.Build())
.AsEphemeral true
let responseSuccessfulHack (hack : BattleItem) =
let responseSuccessfulHack (targetId : uint64) (hack : BattleItem) =
let embed = DiscordEmbedBuilder()
embed.ImageUrl <- getHackGif (enum<HackId>(hack.Id))
DiscordFollowupMessageBuilder()
.WithContent($"You successfully hacked <@{GuildEnvironment.botHackerBattle}> using {hack.Name}, and stole 💰$GBT {Game.HackPrize} from them!")
.WithContent($"You successfully hacked <@{targetId}> using {hack.Name}, and stole 💰$GBT {Game.HackPrize} from them!")
.AddEmbed(embed.Build())
.AsEphemeral(true)

View File

@ -79,7 +79,7 @@ let successfulHack (event : ComponentInteractionCreateEventArgs) attacker defend
async {
do! updateCombatants attacker defender hack Game.HackPrize
let embed = Embeds.responseSuccessfulHack (Armory.getItem (int hack))
let embed = Embeds.responseSuccessfulHack (defender.DiscordId) (Armory.getItem (int hack))
do! event.Interaction.CreateFollowupMessageAsync(embed)
|> Async.AwaitTask
|> Async.Ignore

View File

@ -76,14 +76,16 @@ let handleDefenseMsg = {
let handleDefense (event : ComponentInteractionCreateEventArgs) =
Game.executePlayerEvent event (fun player -> async {
let sendMessage' = sendFollowUpMessage event
let shield = Player.shields player |> Array.tryHead |> Option.defaultValue defaultShield
let split = event.Id.Split("-")
let shieldId = enum<ShieldId>(int split.[2])
let shield = Armory.getItem (int shieldId)
let embed = Embeds.responseCreatedShieldTrainer shield
do! event.Interaction.CreateFollowupMessageAsync(embed) |> Async.AwaitTask |> Async.Ignore
do! Async.Sleep 2000
do! sendMessage' "Ok, good, let me make sure that worked.\n\nI'll try to **hack** you now"
do! Async.Sleep 4000
do! sendMessage' "Ok, good, let me make sure that worked.\n\nI'll try to **hack** you now"
do! Async.Sleep 5000
do! sendMessage' $"❌ HACKING FAILED!\n\n{player.Name} defended the hack from <@{GuildEnvironment.botHackerBattle}>, and stole 💰$GBT {Game.ShieldPrize} from them!"
do! Async.Sleep 3000
do! Async.Sleep 4000
do! sendFollowUpMessageWithButton event handleDefenseMsg
})
@ -134,16 +136,16 @@ let handleAttack (event : ComponentInteractionCreateEventArgs) =
let sendMessage' = sendFollowUpMessage event
do! Async.Sleep 1000
let hack = Player.hacks player |> Array.tryHead |> Option.defaultValue defaultHack
let embed = Embeds.responseSuccessfulHack hack
let embed = Embeds.responseSuccessfulHack GuildEnvironment.botHackerBattle hack
do! event.Interaction.CreateFollowupMessageAsync(embed) |> Async.AwaitTask |> Async.Ignore
do! Async.Sleep 3000
do! Async.Sleep 5000
do! sendMessage'
("🎉 **Congratulations**\n\n"
+ "You successfully **HACKED** me, and are now an **Elite Haxor!**\n\n"
+ "When you **HACK** other Degenz, you **STEAL** their 💰$GBT.\n"
+ "But remember, hacks take time to recover, so use them wisely.")
do! Async.Sleep 5000
do! Async.Sleep 6000
let membr = event.User :?> DiscordMember
let role = event.Guild.GetRole(GuildEnvironment.roleTrainee)
@ -154,7 +156,7 @@ let handleAttack (event : ComponentInteractionCreateEventArgs) =
("Your training is **complete!**\n\n"
+ "But, youre going to need more **HACKS & SHIELDS** 🛡 to survive in **Beautopia©...**\n"
+ $"You can purchase them from <@{GuildEnvironment.botArmory}> anytime you want...\n\n"
+ $"Go to the <#{GuildEnvironment.channelArmory}> **NOW** and type the `/buy-shield` slash command! 😱")
+ $"Go to the <#{GuildEnvironment.channelArmory}> **NOW** and type the `/buy-hack` slash command! 😱")
})
let handleButtonEvent (event : ComponentInteractionCreateEventArgs) =