namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Magic Bounce is an ability that reflects status moves back to the user.
///
/// Bulbapedia - Magic Bounce
///
[Script(ScriptCategory.Ability, "magic_bounce")]
public class MagicBounce : Script
{
///
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList targets)
{
if (moveChoice.ChosenMove.MoveData.HasFlag("reflectable"))
{
var target = targets[0];
target?.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
targets = [moveChoice.User];
}
}
}