class_name ContactStatusAbility extends BattleEffect #Statik, Point Poison, Corps Ardent : chance d'infliger un statut a l'attaquant qui touche au contact. #PokeAPI ne dit pas si une capacite fait contact : on considere que toutes les capacites physiques le font. var ailment : String var chance : int func _init(p_ailment : String, p_chance : int = 30) -> void: id = &"contact_status" ailment = p_ailment chance = p_chance 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 var status : int = StatusRegistry.from_ailment(ailment) if attacker.mon.pokemon.status != PokemonInstance.Status.NONE: return if StatusRegistry.is_immune(attacker.mon.get_types(), status): return if battle.rng.randi_range(1, 100) > chance: return await battle.announce_ability(defender) await battle.inflict_status(defender, attacker, ailment, null, false)