- 19
- Posts
- 2
- Years
- Age 22
- He/Him
- Seen yesterday
Okay, so, I've been working on a custom ability called Inflation for a Pokemon called Squicopter (Lame name I know but it'll probably change). Basically, the Pokemon inflates and deflates like a balloon depending on its HP, and as a result will take a certain amount of damage each time, like Multiscale. However, whenever a Pokemon tries to hit Squicopter with the ability active, an error message pops up. I checked the backtrace, and this is the only plausible area for where there could be an issue. Here's said script.
Basically the idea is that it takes x2 less damage at 4/4 health, x1.6 at 3/4 health, x1.2 at 2/4 health, and x0.8 at 1/4 health. But what's the issue? I tried to copying code from both Multiscale and other form changing abilities like Zen Mode, but I'm still unsure if this is actually the correct way of doing this.
Code:
Battle::AbilityEffects::DamageCalcFromTarget.add(:INFLATION,
proc { |ability, user, target, move, mults, baseDmg, type|
mults[:final_damage_multiplier] /= 2 if battle.isSpecies?(:SQUICOPTER) && target.hp > taget.totalhp / 1.5
}
)
Battle::AbilityEffects::DamageCalcFromTarget.add(:INFLATION,
proc { |ability, user, target, move, mults, baseDmg, type|
mults[:final_damage_multiplier] /= 1.6 if battler.isSpecies?(:SQUICOPTER) && target.hp <= taget.totalhp / 1.5
}
)
Battle::AbilityEffects::DamageCalcFromTarget.add(:INFLATION,
proc { |ability, user, target, move, mults, baseDmg, type|
mults[:final_damage_multiplier] /= 1.2 if battler.isSpecies?(:SQUICOPTER) && target.hp <= target.totalhp / 2
}
)
Battle::AbilityEffects::DamageCalcFromTarget.add(:INFLATION,
proc { |ability, user, target, move, mults, baseDmg, type|
mults[:final_damage_multiplier] /= 0.8 if battler.isSpecies?(:SQUICOPTER) && target.hp <= target.totalhp / 4
}
)
Basically the idea is that it takes x2 less damage at 4/4 health, x1.6 at 3/4 health, x1.2 at 2/4 health, and x0.8 at 1/4 health. But what's the issue? I tried to copying code from both Multiscale and other form changing abilities like Zen Mode, but I'm still unsure if this is actually the correct way of doing this.