Strength bonus
This commit is contained in:
parent
ef8120e9c4
commit
f555b2f95a
@ -102,6 +102,9 @@ let asdf _ (event : DSharpPlus.EventArgs.InteractionCreateEventArgs) =
|
||||
:> Task
|
||||
//hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf))
|
||||
|
||||
hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botClientHacker <- Some hackerBattleBot
|
||||
|
||||
adminBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
|
||||
inviterBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
@ -113,9 +116,6 @@ GuildEnvironment.botClientStore <- Some storeBot
|
||||
jpegBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botClientJpeg <- Some jpegBot
|
||||
|
||||
hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botClientHacker <- Some hackerBattleBot
|
||||
|
||||
slotsBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||
GuildEnvironment.botClientSlots <- Some slotsBot
|
||||
|
||||
|
@ -83,8 +83,6 @@ let runHackerBattle defender (hack : HackItem) =
|
||||
| _ -> false)
|
||||
|
||||
let updateCombatants successfulHack (attacker : PlayerData) (defender : PlayerData) (hack : HackItem) prize =
|
||||
let updatePlayer amount attack p =
|
||||
{ p with Events = attack::p.Events ; Bank = max (p.Bank + amount) 0<GBT> }
|
||||
let event isDefenderEvent =
|
||||
let hackEvent = {
|
||||
HackId = hack.Id
|
||||
@ -104,8 +102,16 @@ let updateCombatants successfulHack (attacker : PlayerData) (defender : PlayerDa
|
||||
|> Async.Ignore
|
||||
|
||||
let successfulHack (ctx : IDiscordContext) attacker defender (hack : HackItem) =
|
||||
let strengthBonus attacker defender =
|
||||
attacker - defender
|
||||
|> max 0
|
||||
|> float
|
||||
|> (*) 0.01
|
||||
|> (*) 200.0 // Bonus
|
||||
|> int
|
||||
async {
|
||||
let prizeAmount = if hack.Power < int defender.Bank then hack.Power else int defender.Bank
|
||||
let bonus = strengthBonus attacker.Stats.Strength.Amount defender.Stats.Strength.Amount
|
||||
let prizeAmount = if hack.Power + bonus < int defender.Bank then hack.Power + bonus else int defender.Bank
|
||||
do! updateCombatants true attacker defender hack (prizeAmount * 1<GBT>)
|
||||
|
||||
let embed = Embeds.responseSuccessfulHack true defender.DiscordId prizeAmount hack
|
||||
|
Loading…
x
Reference in New Issue
Block a user