Pet Battle Scripts

Pet Battle Scripts

265k Downloads

[Feature Request] "Every N Rounds" condition

icbat opened this issue · 3 comments

commented

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.

commented

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

commented

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 :)

commented

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.