ACR_CreatureBehavior.CreatureObject.TryToBuffAll C# (CSharp) Method

TryToBuffAll() public method

This will search for an ability to buff an ally, or oneself, which is not already applied to its target.
public TryToBuffAll ( ) : bool
return bool
        public bool TryToBuffAll()
        {
            NWTalent Buff;
            // We look for party buffs first if we have a party worth noting.
            if (this.Party.PartyMembers.Count() > 2)
            {
                Buff = _GetKnownPartyBuff();
                if (Script.GetIsTalentValid(Buff) == CLRScriptBase.FALSE)
                    Buff = _GetKnownSingleBuff();
            }
            // Otherwise we look for single-target buffs.
            else
            {
                Buff = _GetKnownSingleBuff();
                if (Script.GetIsTalentValid(Buff) == CLRScriptBase.FALSE)
                    Buff = _GetKnownPartyBuff();
            }
            if (Script.GetIsTalentValid(Buff) == CLRScriptBase.TRUE)
            {
                uint TargetId = _FindTargetForBuff(Buff);
                if (TargetId != OBJECT_INVALID)
                {
                    Script.ActionUseTalentOnObject(Buff, TargetId);
                    return true;
                }
            }

            // And if we haven't found anything, try buffing ourselves.
            if (Script.GetIsTalentValid(Buff) == CLRScriptBase.FALSE)
                Buff = _GetKnownSelfBuff();
            if (Script.GetIsTalentValid(Buff) == CLRScriptBase.TRUE)
            {
                int SpellId = Script.GetIdFromTalent(Buff);
                if (Script.GetHasSpellEffect(SpellId, ObjectId) == CLRScriptBase.FALSE)
                {
                    Script.ActionUseTalentOnObject(Buff, ObjectId);
                    return true;
                }
            }
            return false;
        }