Esempio n. 1
0
        /// <summary>Called on every SpellEffect, after initialization</summary>
        internal static void DecideDefaultTargetHandlerDefintion(SpellEffect effect)
        {
            if (effect.AITargetHandlerDefintion != null || effect.AITargetEvaluator != null ||
                (effect.HarmType != HarmType.Beneficial || effect.HasTarget(ImplicitSpellTargetType.Self)))
            {
                return;
            }
            if (!effect.IsAreaEffect)
            {
                effect.Spell.MaxTargets = 1U;
                effect.SetAITargetDefinition(DefaultTargetAdders.AddAreaSource,
                                             DefaultTargetFilters.IsFriendly);
            }
            else
            {
                effect.SetAITargetDefinition(DefaultTargetAdders.AddAreaSource,
                                             DefaultTargetFilters.IsFriendly);
            }

            if (effect.IsHealEffect)
            {
                effect.AITargetEvaluator = DefaultTargetEvaluators.MostWoundedEvaluator;
            }
            else
            {
                effect.AITargetEvaluator = DefaultTargetEvaluators.RandomEvaluator;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Called on every SpellEffect, after initialization
        /// </summary>
        internal static void DecideDefaultTargetHandlerDefintion(SpellEffect effect)
        {
            // ignore effects that already have custom settings
            if (effect.AITargetHandlerDefintion != null || effect.AITargetEvaluator != null)
            {
                return;
            }

            //var dflt = DefaultTargetDefinitions.GetTargetDefinition(effect.ImplicitTargetA);

            if (effect.HarmType == HarmType.Beneficial && !effect.HasTarget(ImplicitSpellTargetType.Self))
            {
                // single target beneficial spells need special attention, since else AI would never correctly select a target

                if (!effect.IsAreaEffect)
                {
                    effect.Spell.MaxTargets = 1;
                    effect.SetAITargetDefinition(DefaultTargetAdders.AddAreaSource,                                                     // Adder
                                                 DefaultTargetFilters.IsFriendly);                                                      // Filters
                }
                else
                {
                    effect.SetAITargetDefinition(DefaultTargetAdders.AddAreaSource,                                                     // Adder
                                                 DefaultTargetFilters.IsFriendly);                                                      // Filters
                }

                // choose evaluator
                if (effect.IsHealEffect)
                {
                    // select most wounded
                    effect.AITargetEvaluator = DefaultTargetEvaluators.MostWoundedEvaluator;
                }
                else
                {
                    // buff random person
                    effect.AITargetEvaluator = DefaultTargetEvaluators.RandomEvaluator;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Called on every SpellEffect, after initialization
        /// </summary>
        internal static void DecideDefaultTargetHandlerDefintion(SpellEffect effect)
        {
            // ignore effects that already have custom settings
            if (effect.AITargetHandlerDefintion != null || effect.AITargetEvaluator != null) return;

            //var dflt = DefaultTargetDefinitions.GetTargetDefinition(effect.ImplicitTargetA);

            if (effect.HarmType == HarmType.Beneficial && !effect.HasTarget(ImplicitSpellTargetType.Self))
            {
                // single target beneficial spells need special attention, since else AI would never correctly select a target

                if (!effect.IsAreaEffect)
                {
                    effect.Spell.MaxTargets = 1;
                    effect.SetAITargetDefinition(DefaultTargetAdders.AddAreaSource,					// Adder
                                                 DefaultTargetFilters.IsFriendly);					// Filters
                }
                else
                {
                    effect.SetAITargetDefinition(DefaultTargetAdders.AddAreaSource,					// Adder
                                                 DefaultTargetFilters.IsFriendly);					// Filters
                }

                // choose evaluator
                if (effect.IsHealEffect)
                {
                    // select most wounded
                    effect.AITargetEvaluator = DefaultTargetEvaluators.MostWoundedEvaluator;
                }
                else
                {
                    // buff random person
                    effect.AITargetEvaluator = DefaultTargetEvaluators.RandomEvaluator;
                }
            }
        }