C++er, attempting a DnD/SW (e.g. KotOR). A how it looks for you/plural, see the vid below
and a how it works for me
UENUM()
enum class EDieType : uint8
{
Invalid = 0x0,
d2 = 0x2,
d3 = 0x3,
d4 = 0x4,
d6 = 0x6,
d8 = 0x8,
d10 = 0xA,
d12 = 0xC,
d20 = 0x14,
d100 = 0x64,
};
and roll it
static FORCEINLINE int32 RollDice(EDieType DieType, int32 Roll = 1)
{
check(DieType!=EDieType::Invalid);
int32 dice = 0;
for (int i = 1; i <= Roll; ++i)
{
dice += rand() % static_cast<int>(DieType) + 1;
}
return dice;
}
edit, to clarify: visually, as it's some kinda omelet, the project uses already existing ingredients. I, as a developer, write C++ code and use the visuals as an aid when making a point, so how it looks for you, and how it works for me. The code I write is inspired mainly by Bioware old/er games, primarily Knights of The Old Republic and Dragon Age...