This repository has been archived on 2024-12-22. You can view files and clone it, but cannot push or open issues or pull requests.
elliebot/src/EllieBot/_common/Gambling/Slot/SlotGame.cs
Toastie 66870f6859
added .rakeback to get a part of the house edge back. Rakeback is accumulated by betting (not winning or losing in particular). All games have manually specified rakeback values
slot now has 1 more icon (wheat!), and multipliers have been modified to even out the gains
betroll is improved (around 2% better payout), as 66 is now a winning number, not a losing one
2024-11-07 18:28:18 +13:00

116 lines
No EOL
2.7 KiB
C#

namespace EllieBot.Modules.Gambling;
//here is a payout chart
//https://lh6.googleusercontent.com/-i1hjAJy_kN4/UswKxmhrbPI/AAAAAAAAB1U/82wq_4ZZc-Y/DE6B0895-6FC1-48BE-AC4F-14D1B91AB75B.jpg
//thanks to judge for helping me with this
public class SlotGame
{
private static readonly EllieRandom _rng = new EllieRandom();
public SlotResult Spin(decimal bet)
{
var rolls = new[]
{
(byte)_rng.Next(0, 7),
(byte)_rng.Next(0, 7),
(byte)_rng.Next(0, 7)
};
ref var a = ref rolls[0];
ref var b = ref rolls[1];
ref var c = ref rolls[2];
var multi = 0;
var winType = SlotWinType.None;
if (a == b && b == c)
{
if (a == 6)
{
winType = SlotWinType.TrippleJoker;
multi = 25;
}
else
{
winType = SlotWinType.TrippleNormal;
multi = 15;
}
}
else if (a == 6 && (b == 6 || c == 6)
|| (b == 6 && c == 6))
{
winType = SlotWinType.DoubleJoker;
multi = 6;
}
else if (a == 6 || b == 6 || c == 6)
{
winType = SlotWinType.SingleJoker;
multi = 1;
}
return new()
{
Won = bet * multi,
WinType = winType,
Multiplier = multi,
Rolls = rolls,
};
}
}
public enum SlotWinType : byte
{
None,
SingleJoker,
DoubleJoker,
TrippleNormal,
TrippleJoker,
}
/*
var rolls = new[]
{
_rng.Next(default(byte), 6),
_rng.Next(default(byte), 6),
_rng.Next(default(byte), 6)
};
var multi = 0;
var winType = SlotWinType.None;
ref var a = ref rolls[0];
ref var b = ref rolls[1];
ref var c = ref rolls[2];
if (a == b && b == c)
{
if (a == 5)
{
winType = SlotWinType.TrippleJoker;
multi = 30;
}
else
{
winType = SlotWinType.TrippleNormal;
multi = 10;
}
}
else if (a == 5 && (b == 5 || c == 5)
|| (b == 5 && c == 5))
{
winType = SlotWinType.DoubleJoker;
multi = 4;
}
else if (rolls.Any(x => x == 5))
{
winType = SlotWinType.SingleJoker;
multi = 1;
}
return new()
{
Won = bet * multi,
WinType = winType,
Multiplier = multi,
Rolls = rolls,
};
}
*/