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)
|
let item = Armory.battleItems |> Array.find (fun i -> i.Id = hackId)
|
||||||
Error $"{item.Name} is currently on cooldown, wait {cooldown} to use it again."
|
Error $"{item.Name} is currently on cooldown, wait {cooldown} to use it again."
|
||||||
|
|
||||||
let checkIfInventoryIsEmpty attacker =
|
let checkIfHasEmptyHacks attacker =
|
||||||
match attacker.Arsenal with
|
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."
|
| [||] -> Error $"You currently do not have any Hacks to steal 💰$GBT from others. Please go to the <#{GuildEnvironment.channelArmory}> and purchase one."
|
||||||
| _ -> Ok attacker
|
| _ -> Ok attacker
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ let attack (ctx : InteractionContext) (target : DiscordUser) =
|
|||||||
do! attacker
|
do! attacker
|
||||||
|> Player.removeExpiredActions
|
|> Player.removeExpiredActions
|
||||||
|> checkForExistingTarget defender.DiscordId
|
|> checkForExistingTarget defender.DiscordId
|
||||||
>>= checkIfInventoryIsEmpty
|
>>= checkIfHasEmptyHacks
|
||||||
>>= checkIfTargetHasMoney defender
|
>>= checkIfTargetHasMoney defender
|
||||||
>>= checkIfPlayerIsAttackingThemselves defender
|
>>= checkIfPlayerIsAttackingThemselves defender
|
||||||
|> function
|
|> function
|
||||||
@ -134,7 +134,7 @@ let attack (ctx : InteractionContext) (target : DiscordUser) =
|
|||||||
ctx.FollowUpAsync(builder)
|
ctx.FollowUpAsync(builder)
|
||||||
|> Async.AwaitTask
|
|> Async.AwaitTask
|
||||||
|> Async.Ignore
|
|> 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) =
|
let handleAttack (event : ComponentInteractionCreateEventArgs) =
|
||||||
@ -168,7 +168,7 @@ let defend (ctx : InteractionContext) =
|
|||||||
|> Async.AwaitTask
|
|> Async.AwaitTask
|
||||||
|> Async.Ignore
|
|> Async.Ignore
|
||||||
else
|
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
|
do! Messaging.sendFollowUpMessageFromCtx ctx msg
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ let sell (ctx : InteractionContext) =
|
|||||||
|> Async.AwaitTask
|
|> Async.AwaitTask
|
||||||
|> Async.Ignore
|
|> Async.Ignore
|
||||||
else
|
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 =
|
let handleBuyItem (ctx : InteractionContext) itemId =
|
||||||
|
@ -30,7 +30,6 @@ let sendInitialEmbed (client : DiscordClient) =
|
|||||||
|
|
||||||
let handleTrainerStep1 (event : ComponentInteractionCreateEventArgs) =
|
let handleTrainerStep1 (event : ComponentInteractionCreateEventArgs) =
|
||||||
Game.executePlayerEvent event (fun player -> async {
|
Game.executePlayerEvent event (fun player -> async {
|
||||||
|
|
||||||
let shieldMessage , weaponName =
|
let shieldMessage , weaponName =
|
||||||
if Player.shields player |> Array.isEmpty
|
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
|
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
|
do! sendFollowUpMessage event
|
||||||
("Beautopia© is a dangerous place...\n"
|
("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
|
+ shieldMessage
|
||||||
+ "To enable it, you need to run the `/shield` slash command.\n\n"
|
+ "To enable it, you need to run the `/shield` slash command.\n\n"
|
||||||
+ $"Type the `/shield` command now, then select - `{weaponName}`\n")
|
+ $"Type the `/shield` command now, then select - `{weaponName}`\n")
|
||||||
@ -49,7 +48,7 @@ let handleTrainerStep1 (event : ComponentInteractionCreateEventArgs) =
|
|||||||
let defend (ctx : InteractionContext) =
|
let defend (ctx : InteractionContext) =
|
||||||
Game.executePlayerInteraction ctx (fun player -> async {
|
Game.executePlayerInteraction ctx (fun player -> async {
|
||||||
let playerWithShields =
|
let playerWithShields =
|
||||||
match player.Arsenal with
|
match Player.shields player with
|
||||||
| [||] -> { player with Arsenal = [| defaultShield |] }
|
| [||] -> { player with Arsenal = [| defaultShield |] }
|
||||||
| _ -> player
|
| _ -> player
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ let handleDefense (event : ComponentInteractionCreateEventArgs) =
|
|||||||
let handleTrainerStep3 (event : ComponentInteractionCreateEventArgs) =
|
let handleTrainerStep3 (event : ComponentInteractionCreateEventArgs) =
|
||||||
Game.executePlayerEvent event (fun player -> async {
|
Game.executePlayerEvent event (fun player -> async {
|
||||||
let hackMessage , weaponName =
|
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
|
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
|
else
|
||||||
let name = Player.hacks player |> Array.tryHead |> Option.defaultValue defaultHack |> fun w -> w.Name
|
let name = Player.hacks player |> Array.tryHead |> Option.defaultValue defaultHack |> fun w -> w.Name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user