﻿using System;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Attribute to tag damage reaction scripts.
    ///
    /// Damage reaction scripts must be static coroutines (ie, return <see cref="System.Collections.IEnumerator"/> and accept an <see cref="IStrikeReaction"/> parameter.
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class StrikeReactionScriptAttribute : Attribute
    {
        /// <summary>
        /// The name of the damage type this script controls a reaction for, located in the same bundle.
        ///
        /// This may be null - then the name is the same as the tagged method.
        /// </summary>
        public string DamageTypeName { get; private set; }

        /// <summary>
        /// Declares the damage reaction script for the damage type with the same name as the tagged method.
        /// </summary>
        public StrikeReactionScriptAttribute()
        {
            DamageTypeName = null;
        }

        /// <summary>
        /// Declares a damage reaction script.
        /// </summary>
        /// <param name="damTypeName">the name of the damage type this script controls a reaction for, which must be in the same bundle</param>
        public StrikeReactionScriptAttribute(string damTypeName)
        {
            DamageTypeName = damTypeName;
        }
    }
}
