From fa12fcea58dc4f1cf8f4f52d78b59ba477bbf248 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 5 Nov 2024 04:17:52 +0000 Subject: [PATCH] change: .race will now have 82-94% payout rate based on the number of players playign (1-12, x0.01 per player). Any player over 12 won't increase payout --- CHANGELOG.md | 2 ++ .../Gambling/AnimalRacing/AnimalRace.cs | 12 +++++++++-- .../AnimalRacing/AnimalRacingCommands.cs | 20 +++++++++++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83c0512b5..1566397a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except da ### Changed - `.plant/pick` password font size will be slightly bigger +- `.race` will now have 82-94% payout rate based on the number of players playing (1-12, x0.01 per player). + - Any player over 12 won't increase payout ### Fixed diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRace.cs b/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRace.cs index e82f622e1..5b5e439f3 100644 --- a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRace.cs +++ b/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRace.cs @@ -6,6 +6,10 @@ namespace NadekoBot.Modules.Gambling.Common.AnimalRacing; public sealed class AnimalRace : IDisposable { + public const double BASE_MULTIPLIER = 0.82; + public const double MAX_MULTIPLIER = 0.94; + public const double MULTI_PER_USER = 0.01; + public enum Phase { WaitingForPlayers, @@ -100,7 +104,7 @@ public sealed class AnimalRace : IDisposable foreach (var user in _users) { if (user.Bet > 0) - await _currency.AddAsync(user.UserId, user.Bet, new("animalrace", "refund")); + await _currency.AddAsync(user.UserId, (long)(user.Bet * BASE_MULTIPLIER), new("animalrace", "refund")); } _ = OnStartingFailed?.Invoke(this); @@ -131,8 +135,10 @@ public sealed class AnimalRace : IDisposable if (FinishedUsers[0].Bet > 0) { + Multi = FinishedUsers.Count + * Math.Min(MAX_MULTIPLIER, BASE_MULTIPLIER + (MULTI_PER_USER * FinishedUsers.Count)); await _currency.AddAsync(FinishedUsers[0].UserId, - FinishedUsers[0].Bet * (_users.Count - 1), + (long)(FinishedUsers[0].Bet * Multi), new("animalrace", "win")); } @@ -140,6 +146,8 @@ public sealed class AnimalRace : IDisposable }); } + public double Multi { get; set; } = BASE_MULTIPLIER; + public void Dispose() { CurrentPhase = Phase.Ended; diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs b/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs index 48bc21c4e..01523c064 100644 --- a/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs +++ b/src/NadekoBot/Modules/Gambling/AnimalRacing/AnimalRacingCommands.cs @@ -74,10 +74,14 @@ public partial class Gambling if (race.FinishedUsers[0].Bet > 0) { return Response() - .Confirm(GetText(strs.animal_race), - GetText(strs.animal_race_won_money(Format.Bold(winner.Username), - winner.Animal.Icon, - (race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign))) + .Embed(_sender.CreateEmbed() + .WithOkColor() + .WithTitle(GetText(strs.animal_race)) + .WithDescription(GetText(strs.animal_race_won_money( + Format.Bold(winner.Username), + winner.Animal.Icon, + N(race.FinishedUsers[0].Bet * race.Multi)))) + .WithFooter($"x{race.Multi:F2}")) .SendAsync(); } @@ -129,10 +133,10 @@ public partial class Gambling else { await msg.ModifyAsync(x => x.Embed = _sender.CreateEmbed() - .WithTitle(GetText(strs.animal_race)) - .WithDescription(text) - .WithOkColor() - .Build()); + .WithTitle(GetText(strs.animal_race)) + .WithDescription(text) + .WithOkColor() + .Build()); } }