using System;
using UnityEngine;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// A moveset entry of two moves from which the player can choose
    /// by tapping or holding a button.
    /// </summary>
    [Serializable]
    public class AnyDirectionMovesetEntry : MovesetEntry<AnyDirectionMovesetEntry>
    {
        [Tooltip("The move chosen if the analog stick is left in the middle.")]
        public AssetAddress Middle;

        [Tooltip("The move chosen if the analog stick is pointing into any direction.")]
        public AssetAddress AnyDirection;

        public override AssetAddress[] Moves => new AssetAddress[] { Middle, AnyDirection };

        public AnyDirectionMovesetEntry()
        {
        }

        public AnyDirectionMovesetEntry(AnyDirectionMovesetEntry other)
        {
            Middle = other.Middle;
            AnyDirection = other.AnyDirection;
        }

        public override void Merge(AnyDirectionMovesetEntry other)
        {
            Middle = OverrideIfValid(Middle, other.Middle);
            AnyDirection = OverrideIfValid(AnyDirection, other.AnyDirection);
        }
    }
}
