A rudimentary battle simulator for the Troika! TTRPG, written in Lua.
While individually it's pretty easy to guage the relative strength of a player vs an NPC, it can be a little complicated to do that with large group encounters. I made a quick and dirty battle sim to help understand the general difficulty of a battle. Use this to help understand the survivability of an encounter between your players and a group of NPCs.
First, edit the fight.json file to put in the stats of the players and enemies. Treat player skill as base skill + highest weapon advanced skill. Basically, treat them like NPCs.
Example:
[
{
"id": "Player 1",
"team": "Player",
"skill": 6,
"stamina": 17,
"armor": 1,
"initiative": 2,
"weapon": "sword"
},
{
"id": "Enemy 1",
"team": "Enemy",
"skill": 6,
"stamina": 5,
"armor": 0,
"initiative": 2,
"weapon": "small"
}
]Then, run the program from the command line:
lua54 Troika.lua
And you get the results out of 100 simulated encounters:
Out of 1000 battles, the players won 74% of the time.
- Ranged weapons can now be dodged, and do not cause reciprocal damage
- Magic weapons like firebolt, jolt, and dragonfire now automatically hit.
- Detailing average survivability of players.
- Detailing average number of rounds.