v19.1Help with an ability that skips every other turn.

This thread pertains to v19.1 of Pokémon Essentials.

A¹¹

Rookie
Member
Hi, I have a question about implementing an ability that skips every other turn (for stuff like Toxic and Leech Seed) and after some time on the Relic Castle Discord we have reached this point

Python:
BattleHandlers::EORTurnsAbility.add(:STALL,
proc { |ability,battler,battle|
battler.effects[PBEffects::Stall] += 1
if battler.turnCount > 0 && battler.effects[PBEffects::Stall]>=2
battle.pbDisplay(_INTL("{1} stalls for time.",battler.pbThis))
battle.pbEndOfRoundPhase
end
}
)

Right now I noticed this code loops because it adds a count for Stall every time, thus making it infinite, so how would I make it happen only once per turn?

The Case Manager

Rookie
Member
Have you tried resetting Stall's count afterwards?

A¹¹

Rookie
Member
Have you tried resetting Stall's count afterwards?
yes, but after you said it I noticed I was doing it wrong

Ruby:
BattleHandlers::EORTurnsAbility.add(:STALL,
proc { |ability,battler,battle|
battler.effects[PBEffects::Stall] += 1
if battler.turnCount > 0 && battler.effects[PBEffects::Stall]>=3
battler.effects[PBEffects::Stall] -= 3
elsif battler.turnCount > 0 && battler.effects[PBEffects::Stall]=2
battle.pbDisplay(_INTL("{1} stalls for time.",battler.pbThis))
battle.pbEndOfRoundPhase
end
}
)
This version is working as intended.