Fix some leftover follow up messages and empty arsenal bugs
This commit is contained in:
parent
cd15a08e37
commit
7ebba3f61a
@ -41,8 +41,8 @@ let checkIfHackHasCooldown hackId attacker =
|
||||
let item = Armory.battleItems |> Array.find (fun i -> i.Id = hackId)
|
||||
Error $"{item.Name} is currently on cooldown, wait {cooldown} to use it again."
|
||||
|
||||
let checkIfInventoryIsEmpty attacker =
|
||||
match attacker.Arsenal with
|
||||
let checkIfHasEmptyHacks attacker =
|
||||
match Player.hacks attacker with
|
||||
| [||] -> Error $"You currently do not have any Hacks to steal 💰$GBT from others. Please go to the <#{GuildEnvironment.channelArmory}> and purchase one."
|
||||
| _ -> Ok attacker
|
||||
|
||||
@ -117,7 +117,7 @@ let attack (ctx : InteractionContext) (target : DiscordUser) =
|
||||
do! attacker
|
||||
|> Player.removeExpiredActions
|
||||
|> checkForExistingTarget defender.DiscordId
|
||||
>>= checkIfInventoryIsEmpty
|
||||
>>= checkIfHasEmptyHacks
|
||||
>>= checkIfTargetHasMoney defender
|
||||
>>= checkIfPlayerIsAttackingThemselves defender
|
||||
|> function
|
||||
@ -134,7 +134,7 @@ let attack (ctx : InteractionContext) (target : DiscordUser) =
|
||||
ctx.FollowUpAsync(builder)
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
| None -> do! sendSimpleResponse ctx "Your target is not connected to the network, they must join first by using the /redpill command"
|
||||
| None -> do! sendFollowUpMessageFromCtx ctx "Your target is not connected to the network, they must join first by using the /redpill command"
|
||||
})
|
||||
|
||||
let handleAttack (event : ComponentInteractionCreateEventArgs) =
|
||||
@ -168,7 +168,7 @@ let defend (ctx : InteractionContext) =
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
else
|
||||
let msg = $"You currently do not have any Shields to protect you. Please go to the <#{GuildEnvironment.channelArmory}> and purchase one."
|
||||
let msg = $"You currently do not have any Shields to protect yourself from hacks. Please go to the <#{GuildEnvironment.channelArmory}> and purchase one."
|
||||
do! Messaging.sendFollowUpMessageFromCtx ctx msg
|
||||
})
|
||||
|
||||
|
@ -54,7 +54,7 @@ let sell (ctx : InteractionContext) =
|
||||
|> Async.AwaitTask
|
||||
|> Async.Ignore
|
||||
else
|
||||
do! sendSimpleResponse ctx "You currently have no inventory to sell"
|
||||
do! sendFollowUpMessageFromCtx ctx "You currently have no inventory to sell"
|
||||
})
|
||||
|
||||
let handleBuyItem (ctx : InteractionContext) itemId =
|
||||
|
@ -30,7 +30,6 @@ let sendInitialEmbed (client : DiscordClient) =
|
||||
|
||||
let handleTrainerStep1 (event : ComponentInteractionCreateEventArgs) =
|
||||
Game.executePlayerEvent event (fun player -> async {
|
||||
|
||||
let shieldMessage , weaponName =
|
||||
if Player.shields player |> Array.isEmpty
|
||||
then $"You do not have any Shields in your arsenal, take this {defaultShield.Name}, you can use it for now.\n\n" , defaultShield.Name
|
||||
@ -40,7 +39,7 @@ let handleTrainerStep1 (event : ComponentInteractionCreateEventArgs) =
|
||||
|
||||
do! sendFollowUpMessage event
|
||||
("Beautopia© is a dangerous place...\n"
|
||||
+ "Quick, put up a SHIELD 🛡 before another Degen hacks you, and steals your 💰$GBT.\n"
|
||||
+ "Quick, put up a SHIELD 🛡 before another Degen hacks you, and steals your 💰$GBT.\n\n"
|
||||
+ shieldMessage
|
||||
+ "To enable it, you need to run the `/shield` slash command.\n\n"
|
||||
+ $"Type the `/shield` command now, then select - `{weaponName}`\n")
|
||||
@ -49,7 +48,7 @@ let handleTrainerStep1 (event : ComponentInteractionCreateEventArgs) =
|
||||
let defend (ctx : InteractionContext) =
|
||||
Game.executePlayerInteraction ctx (fun player -> async {
|
||||
let playerWithShields =
|
||||
match player.Arsenal with
|
||||
match Player.shields player with
|
||||
| [||] -> { player with Arsenal = [| defaultShield |] }
|
||||
| _ -> player
|
||||
|
||||
@ -86,7 +85,7 @@ let handleDefense (event : ComponentInteractionCreateEventArgs) =
|
||||
let handleTrainerStep3 (event : ComponentInteractionCreateEventArgs) =
|
||||
Game.executePlayerEvent event (fun player -> async {
|
||||
let hackMessage , weaponName =
|
||||
if Player.shields player |> Array.isEmpty
|
||||
if Player.hacks player |> Array.isEmpty
|
||||
then $"You do not have any Hacks in your arsenal, take this `{defaultHack.Name}`, you can use it for now.\n\n" , defaultHack.Name
|
||||
else
|
||||
let name = Player.hacks player |> Array.tryHead |> Option.defaultValue defaultHack |> fun w -> w.Name
|
||||
|
Loading…
x
Reference in New Issue
Block a user