Exemplo n.º 1
0
        public static bool CheckThinkTrigger(BaseCreature bc)
        {
            var combatant = bc.Combatant;

            if (combatant is Mobile)
            {
                var profile = PetTrainingHelper.GetAbilityProfile(bc);

                if (profile != null)
                {
                    AreaEffect effect = null;

                    var effects = profile.GetAreaEffects().Where(a => !a.IsInCooldown(bc)).ToArray();

                    if (effects != null && effects.Length > 0)
                    {
                        effect = effects[Utility.Random(effects.Length)];
                    }

                    if (effect != null)
                    {
                        return(effect.Trigger(bc, (Mobile)combatant));
                    }
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public static bool CheckThinkTrigger(BaseCreature bc)
        {
            AbilityProfile profile = PetTrainingHelper.GetAbilityProfile(bc);

            if (profile != null)
            {
                AreaEffect effect = null;

                List <AreaEffect> list = new List <AreaEffect>();

                var af = profile.GetAreaEffects();

                for (var index = 0; index < af.Length; index++)
                {
                    var a = af[index];

                    if (!a.IsInCooldown(bc))
                    {
                        list.Add(a);
                    }
                }

                AreaEffect[] effects = list.ToArray();

                if (effects.Length > 0)
                {
                    effect = effects[Utility.Random(effects.Length)];
                }

                if (effect != null)
                {
                    return(effect.Trigger(bc, bc.Combatant as Mobile));
                }
            }

            return(false);
        }