Trekiros / battleSim

A simple encounter simulator for TTRPG battles, to help game master plan fun games.
battlesim-zeta.vercel.app
51 stars 21 forks source link

Feature/Target random enemy or ally #8

Closed RKO closed 1 year ago

RKO commented 1 year ago

The default "enemy with lowest hp" assumes that the enemy (often players) will swap out who is in front and taking damage. In many scenarios, the battle is much more chaotic, so I added a random target option for both enemy and ally.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
battlesim ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2023 1:51pm
Trekiros commented 1 year ago

A random target would work as implemented here if we were using a statistics-based approach (running loads of simulations), but not for the current probabilities-based approach (running just once but calculating the average result)

RKOvlesenMerkle commented 1 year ago

A random target would work as implemented here if we were using a statistics-based approach (running loads of simulations), but not for the current probabilities-based approach (running just once but calculating the average result)

That makes sense. I think the problem I am trying to solve, is that "enemy with lowest/highest hp" will spread damage equally and "enemy with highest AC/DPR" will focus on a single target until dead. In a real encounter, it's more unpredictable.

But thinking about it, this implementation will give roughly the same result at "enemy with highest hp", which is an even spread of damage... One of the cases where I wanted this, is when I have multiple enemies of the same type with a debuff ability. As they have the same condition, they will all cast it on the same target(s) at the same time, which is a waste and not what would happen in a real encounter. So the problem is that I want something that can make each monster act a little randomly, but without it being random... The best existing condition I have found is "when this creature is under 50% heath", because that is different for each monster, but that runs the risk of not triggering if the monster is killed in one round.

Trekiros commented 1 year ago

Hmm, that's a good point. Since we already have a clause that says buffs/debuffs don't stack, it might be a good idea to make it so if the target is already affected by that buff, it automatically chooses the next target.

RKO commented 1 year ago

Oh yeah, I actually convinced myself that it was not an option (was probably thinking about spell slots not being implemented). I can try doing that instead.