Ejemplo n.º 1
0
        /// <summary>
        /// Returns all <see cref="IAction"/> which match the <paramref name="actionDescription"/> which the <paramref name="aggressor"/> can undertake.
        /// </summary>
        /// <param name="aggressor"></param>
        /// <param name="actionDescription"></param>
        /// <param name="mustHaveTargets">True to only return actions where there is a viable target</param>
        /// <returns></returns>
        public List <IAction> GetInstances(IActor aggressor, ActionDescription actionDescription, bool mustHaveTargets)
        {
            if (actionDescription == null)
            {
                return(new List <IAction>());
            }

            return(aggressor.GetFinalActions(aggressor)
                   .Where(a => !mustHaveTargets || a.HasTargets(aggressor))
                   .Where(actionDescription.Matches).ToList());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Equality based on <see cref="Name"/> and <see cref="HotKey"/>
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 protected bool Equals(ActionDescription other)
 {
     return(HotKey == other.HotKey && Name == other.Name);
 }