Trekiros / battleSim

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

Feature/Added conditions for enemy count 1 and enemy count > 2 #9

Closed RKO closed 1 year ago

RKO commented 1 year ago

It would be nice if we could make it a configurable condition, with enemy/ally count </>, = x, but that's a lot more complicated. For now though, I'm not sure if it should be; count = 1 and >2 or count <= 2 and >2 or count = 1 and >1, or count =1, and =2 and >2

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 2:14pm
Trekiros commented 1 year ago

I think it'll be cleaner to implement "x enemies remaining" from the start here, rather than flood the select button with a bunch of mostly identical options. Because people are already using this tool, each update has to be backwards compatible, so the moment we add a "1 enemy remaining" option, we'll have to live with that option in the system for a long long time, despite the fact we know we have plans to make a "x enemies remaining" option.

I have not started, but this was one of the things I was planning on working on. There's a lot of "dynamic" targeting options that people have asked for, like the ability to manually choose which enemy to target. To handle those, my plan was to transform the Target type into a union type between the old enum, and a new object type which we'll then be able to give parameters to. Something like this:

const EnemyTargetSchema = z.enum([... /* the old enum here */ ]).or(z.discriminatedUnion('type', [
    z.object({ type: z.literal('x enemies remaining', enemies: z.number().min(0) }),
    ...
    // New target options here, along with their parameters
])
RKOvlesenMerkle commented 1 year ago

Okay, it sounds like you already know what you want to do and it's a bit more complicated than what I want to commit to right now. I'll probably close this and let you do the correct implementation :)