axc450 / pbs

Battle Pet Combat Scripting
MIT License
27 stars 10 forks source link

[Feature Request] "Every N Rounds" condition #92

Closed icbat closed 4 months ago

icbat commented 4 months ago

What's the use case?

I'd love to be able to set something up like

ability(Dodge) [round % 5 = 0]

it's slower than Dodge's 4 round cooldown, but you could use this to match something like Patchu's Anubisath Idol's Sandstorm move (on a 5 round cooldown).

How might it be implemented?

It feels a lot like modulo to me, which lua has (and works within WoW's scripting)

math.fmod(x,y)

That doesn't really account for "every 5th round starting in round 2" out of the box, and I'm not really sure how to easily handle that.

GurliGebis commented 4 months ago

Wouldn't starting from 2 just be: Round % 5 == 2 ?

bloerwald commented 4 months ago

Okay, so the evil part is the enemy's first rotation: it doesn't instantly cast weather but only after a few rounds. Afterwards, it will always cast weather if it is not up and off cooldown.

The strategy you're trying to write is already possible without any new condition:

use(dodge:312) [ round = 4 & self.speed.fast ]
use(dodge:312) [ round = 3 & self.speed.slow ]
use(dodge:312) [ enemy.ability(big:453).duration = 1 & self.speed.slow ]
use(dodge:312) [ enemy.ability(big:453).usable & round > 4 ]
standby
change(next)

This still has the annoying round based start, but doesn't need anything else for the "every 5th round" part after it. My randomly assembled team of dodgers survived until round 38 with this.

I deeply hate round based strategies since they are so wonky when it comes to speed differences and random noise from early death etc. I would probably prefer not adding more round based logic and continue my quest to educate people to write semantics based conditions.

I'm more than welcome to adding it though, if you can come up with enemies/fights where this is not possible :)

icbat commented 4 months ago

Ah, I was unaware of .usable, thank you! That definitely answers what I'm looking for, more elegantly (with some re-learning/re-training of my brain).

It's definitely a mindset shift; when I'm trying to breakdown a fight, one of my first ports of call is just to write down what they're doing each round to try to figure out how to fight it.