ACR_CreatureBehavior.CreatureObject.TryToDebuffCareful C# (CSharp) Method

TryToDebuffCareful() public method

This attempts to find a place to send an attack which either only harms enemies or which only harms single targets.
public TryToDebuffCareful ( ) : bool
return bool
        public bool TryToDebuffCareful()
        {
            NWTalent Debuff = Script.GetCreatureTalentBest(CLRScriptBase.TALENT_CATEGORY_HARMFUL_AREAEFFECT_DISCRIMINANT, 20, ObjectId, 0);
            CreatureObject Target = Party.GetNearest(this, Party.Enemies);
            
            // If there is no nearest enemy, might as well abort.
            if (Target == null)
                return false;

            if (Script.GetIsTalentValid(Debuff) == CLRScriptBase.TRUE)
            {
                Script.ActionUseTalentOnObject(Debuff, Target.ObjectId);
                return true;
            }

            Debuff = Script.GetCreatureTalentBest(CLRScriptBase.TALENT_CATEGORY_HARMFUL_RANGED, 20, ObjectId, 0);
            if (Script.GetIsTalentValid(Debuff) == CLRScriptBase.TRUE)
            {
                uint newTarget = _FindTargetForDispel();
                if (Script.GetIsObjectValid(newTarget) == CLRScriptBase.TRUE)
                {
                    Script.ActionUseTalentOnObject(Debuff, newTarget);
                    return true;
                }
                else
                {
                    Script.ActionUseTalentOnObject(Debuff, Target.ObjectId);
                    return true;
                }
            }

            Debuff = Script.GetCreatureTalentBest(CLRScriptBase.TALENT_CATEGORY_HARMFUL_TOUCH, 20, ObjectId, 0);
            if (Script.GetIsTalentValid(Debuff) == CLRScriptBase.TRUE)
            {
                Script.ActionUseTalentOnObject(Debuff, Target.ObjectId);
                return true;
            }
            return false;
        }