namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Power of Alchemy is an ability that copies the ability of a fainted ally.
///
/// Bulbapedia - Power of Alchemy
///
[Script(ScriptCategory.Ability, "power_of_alchemy")]
public class PowerOfAlchemy : Script, IScriptOnAllyFaint
{
///
public void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
{
if (faintedPokemon.ActiveAbility?.HasFlag("cant_be_copied") != true)
return;
ally.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(ally));
ally.ChangeAbility(faintedPokemon.ActiveAbility);
}
}