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

13 lines
552 B
GDScript

class_name RoughSkinAbility
extends BattleEffect
#Peau Dure : l'attaquant au contact perd 1/8 de ses PV
func _init() -> void:
id = &"rough_skin"
func on_after_hit(battle : Battle, attacker : BattleSlot, defender : BattleSlot, move : MoveData, damage : int) -> void:
if damage <= 0 or move.category != "physical" or attacker == defender or !attacker.is_active(): return
await battle.announce_ability(defender)
await battle.hurt(attacker, maxi(1, floori(attacker.mon.pokemon.get_max_hp() / 8.0)), "%s est blessé !" % attacker.mon.display_name())