- 1,541
- Posts
- 11
- Years
- Seen today
Alternatively, rather than enduring the hit with one HP, they could actually faint still, but after fainting and switching out, the ability heals them to half the max HP so they can re-enter battle.
This is kinda just Regenerator, but it only triggers upon fainting. I like the idea of having more abilities that trigger upon fainting, but its really tricky to implement them once the user is no longer on the field. You could probably accomplish this though by having a check at the end of each round that searches through each party for any fainted Pokemon with this ability, and then setting the HP of those party members to half. You can probably just put this at the end of pbEndOfRoundPhase.
Or alternatively, if you want the ability to trigger upon fainting, but BEFORE switching out, you could do something like this:
Code:
BattleHandlers::TargetAbilityOnHit.add(:TEMPORALREWIND,
proc { |ability,user,target,move,battle|
next if !target.fainted?
next if user.hasMoldBreaker?
next if target.effects[PBEffects::TemporalRewindUsed]
battle.pbShowAbilitySplash(target)
target.pbRecoverHP(target.damageState.hpLost,false)
target.effects[PBEffects::TemporalRewindUsed] = true
battle.pbDisplay(_INTL("{1} warped back in time to undo damage taken from the attack!",target.pbThis))
battle.pbHideAbilitySplash(target)
}
)
I set this up by introducing a new effect, "TemporalRewindUsed", so that the ability may only trigger once per switch-in. So if you're KO'd a second time while out on the field, the ability will no longer activate. You'll have to switch out and in again to reset the use of this ability. So you'll have to add the TemporalRewindUsed effect to your PBEffects and initialize the effects in pbInitEffects.
Alternatively, if you want this ability to trigger based on HP (like only at full HP or something) instead of the once-per switch-in effect, then remove the "TemporalRewindUsed" lines and add in your desired HP thresholds instead. Something like:
Code:
next if target.damageState.hpLost<target.totalhp