Tales-of-PKMN/game/battle/abilities/pinch_boost_ability.gd

16 lines
533 B
GDScript

class_name PinchBoostAbility
extends BattleEffect
#Engrais, Brasier, Torrent, Essaim : capacites d'un type x1.5 quand les PV sont a 1/3 ou moins
var boosted_type : String
func _init(p_type : String) -> void:
id = &"pinch_boost"
boosted_type = p_type
func modify_outgoing_damage(attacker : BattleMon, _defender : BattleMon, move : MoveData, damage : float) -> float:
if move.type.to_lower() != boosted_type: return damage
if attacker.pokemon.current_hp * 3 <= attacker.pokemon.get_max_hp(): return damage * 1.5
return damage