namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "psych_up")]
public class PsychUp : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var targetStats = target.StatBoost;
        var userStats = move.User.StatBoost;
        foreach (var stat in StatisticHelper.GetStandardStatistics())
        {
            var targetStat = targetStats.GetStatistic(stat);
            var userStat = userStats.GetStatistic(stat);
            if (targetStat != userStat)
            {
                userStats.SetStatistic(stat, targetStat);
            }
        }
        move.User.RecalculateBoostedStats();
    }
}