using UnityEngine;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Abstract base for wrestling moves.
    /// </summary>
    public abstract class Move : ScriptableObject
    {
        /// <summary>
        /// Enumeration of move collider modes.
        /// </summary>
        public enum ColliderMode
        {
            /// <summary>
            /// No move collider is not used at all.
            /// </summary>
            None,

            /// <summary>
            /// The move collider depenetrates only based on the character's capsules.
            /// </summary>
            Capsules,

            /// <summary>
            /// The move collider depenetrates only based on the character's ragdolls.
            /// </summary>
            Ragdolls,
        }

        /// <summary>
        /// Tells whether this move is a blockable strike.
        /// </summary>
        public virtual bool IsBlockableStrike => false;

        [Header("Information")]
        [Tooltip("The move's display name.")]
        public string DisplayName;

        [Tooltip("Can this move be selected in CAW mode?")]
        public bool Selectable;

        [Header("Collisions")]
        [Tooltip("How to move the wrestlers from world collisions during the move.")]
        public ColliderMode MoveColliderMode;

        [Tooltip("If true, character capsule collisions are allowed during the move.")]
        public bool CharacterCollisionsEnabled;

        [Tooltip("If true, gravity is applied to characters during the move. Only works if character collisions are enabled.")]
        public bool GravityEnabled;

        [Header("Settings")]
        [Tooltip("If true, the participants' movement will be set to zero immediately, as opposed to it decelerating.")]
        public bool InstantMovementReset = true;

        [Tooltip("If true, dizziness of wrestlers does not tick during this move.")]
        public bool FreezeDizzyStates;

        [Tooltip("If true, wrestlers do not drop their weapons when the move starts..")]
        public bool HoldOnToWeapons;

        [Tooltip("If the move doesn't finish within this many seconds, timeout (0 = default).")]
        public float Timeout;

        /// <summary>
        /// The default state to go to after the move is finished.
        /// </summary>
        public virtual TargetState DefaultFollowupState => TargetState.Ragdoll;

        protected virtual void Reset()
        {
            MoveColliderMode = ColliderMode.Ragdolls;
            CharacterCollisionsEnabled = false;
            GravityEnabled = false;
            InstantMovementReset = true;
            FreezeDizzyStates = false;
            Timeout = 0;
        }
    }
}
