Пример #1
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((!GetGlobalFlag(361)))
        {
            SetGlobalFlag(361, true);
        }

        // game.particles( "mon-iuz", attachee )
        if ((!GameSystems.Combat.IsCombatActive()))
        {
            foreach (var pc in GameSystems.Party.PartyMembers)
            {
                if (pc.type == ObjectType.pc)
                {
                    if ((pc.GetPartyMembers().Any(o => o.HasItemByName(2203))))
                    {
                        // party has golden skull
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(1).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(1).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(1));
                            GameSystems.Party.GetPartyGroupMemberN(1).BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(2).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(2).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(2));
                            GameSystems.Party.GetPartyGroupMemberN(2).BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(3).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(3).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(3));
                            GameSystems.Party.GetPartyGroupMemberN(3).BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(4).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(4).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(4));
                            GameSystems.Party.GetPartyGroupMemberN(4).BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(5).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(5).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(5));
                            GameSystems.Party.GetPartyGroupMemberN(5).BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(6).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(6).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(6).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(6));
                            GameSystems.Party.GetPartyGroupMemberN(6).BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(7).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(7).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(7).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(7));
                            GameSystems.Party.GetPartyGroupMemberN(7).BeginDialog(attachee, 1);
                            DetachScript();
                            return(SkipDefault);
                        }
                    }
                    else if ((Utilities.find_npc_near(attachee, 8032) != null))
                    {
                        // hedrack is alive and near
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            PartyLeader.BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(1).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(1).TurnTowards(attachee);
                            GameSystems.Party.GetPartyGroupMemberN(1).BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(2).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(2).TurnTowards(attachee);
                            GameSystems.Party.GetPartyGroupMemberN(2).BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(3).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(3).TurnTowards(attachee);
                            GameSystems.Party.GetPartyGroupMemberN(3).BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(4).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(4).TurnTowards(attachee);
                            GameSystems.Party.GetPartyGroupMemberN(4).BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(5).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(5).TurnTowards(attachee);
                            GameSystems.Party.GetPartyGroupMemberN(5).BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(6).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(6).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(6).TurnTowards(attachee);
                            GameSystems.Party.GetPartyGroupMemberN(6).BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(7).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(7).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(7).TurnTowards(attachee);
                            GameSystems.Party.GetPartyGroupMemberN(7).BeginDialog(attachee, 100);
                            DetachScript();
                            return(SkipDefault);
                        }
                    }
                    else
                    {
                        // hedrack is dead or not near and party does not have golden skull
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(1).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(1).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(1));
                            GameSystems.Party.GetPartyGroupMemberN(1).BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(2).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(2).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(2));
                            GameSystems.Party.GetPartyGroupMemberN(2).BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(3).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(3).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(3));
                            GameSystems.Party.GetPartyGroupMemberN(3).BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(4).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(4).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(4));
                            GameSystems.Party.GetPartyGroupMemberN(4).BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(5).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(5).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(5));
                            GameSystems.Party.GetPartyGroupMemberN(5).BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(6).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(6).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(6).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(6));
                            GameSystems.Party.GetPartyGroupMemberN(6).BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                        else if ((GameSystems.Party.GetPartyGroupMemberN(7).GetStat(Stat.hp_current) >= 1 && !GameSystems.Party.GetPartyGroupMemberN(7).D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            GameSystems.Party.GetPartyGroupMemberN(7).TurnTowards(attachee);
                            attachee.TurnTowards(GameSystems.Party.GetPartyGroupMemberN(7));
                            GameSystems.Party.GetPartyGroupMemberN(7).BeginDialog(attachee, 130);
                            DetachScript();
                            return(SkipDefault);
                        }
                    }
                }
            }
        }

        return(RunDefault);
    }
Пример #2
0
    public static void air_reg()
    {
        var kelno = rnt(545, 497, 8092, 700, 480, 494, 1.5f, 5);
        // The kitchen dwellers
        var k1 = rnt(560, 468, 14161, 721, 501, 504, 4.2f, 2);
        var k2 = rnt(553, 469, 14216, 722, 477, 509, 2.3f, 2);
        var k3 = rnt(559, 465, 14159, 723, 495, 497, 4.1f, 2);
        var k4 = rnt(551, 474, 14184, 724, 470, 508, 3, 2);

        if (k4 == null)
        {
            k4 = rnt(561, 470, 14184, 724, 470, 508, 3, 2);
        }

        var k5 = rnt(559, 464, 14185, 725, 497, 507, 3, 2);

        if (k5 == null)
        {
            k5 = rnt(564, 472, 14185, 725, 497, 507, 3, 2);
        }

        var k6 = rnt(553, 480, 14216, 726, 485, 516, 2.35f, 2); // greeter, SE door, female bugbear

        if (k6 == null)
        {
            k6 = rnt(564, 469, 14216, 726, 485, 516, 2.35f, 2);
        }

        if (k6 != null)
        {
            k6.SetScriptId(ObjScriptEvent.EnterCombat, 445);
        }

        // k6.scripts[19] = 445
        var k7 = rnt(552, 478, 14159, 727, 499, 494, 4, 2); // greeter, SW door, bugbear

        if (k7 != null)
        {
            k7.SetScriptId(ObjScriptEvent.EnterCombat, 445);
        }

        // k7.scripts[19] = 445
        var k8  = rnt(561, 479, 14079, 728, 495, 490, 3.7f, 2);
        var k9  = rnt(561, 474, 14079, 729, 502, 513, 4, 2);
        var k10 = rnt(558, 477, 14080, 730, 497, 511, 1, 2);
        var k11 = rnt(564, 474, 14080, 731, 474, 502, 1, 2); // greeter, NE door, gnoll

        if (k11 != null)
        {
            k11.SetScriptId(ObjScriptEvent.EnterCombat, 445);
        }

        // k11.scripts[19] = 445
        var k12 = rnt(564, 480, 14187, 732, 496, 513, 1, 2);

        if (k12 == null)
        {
            k12 = rnt(557, 468, 14187, 732, 496, 513, 1, 2);
        }

        var k13 = rnt(558, 474, 14067, 733, 496, 515, 1, 2);
        var k14 = rnt(563, 477, 14067, 734, 503, 510, 4.5f, 2);
        var k15 = rnt(558, 480, 14067, 735, 496, 485, 4, 2);

        // k16 = rnt(445, 444, 14185, 736, 482, 417, 5.5, 2)
        // The 12 bugbears just outside Kelno's office
        if (k6 != null)
        {
            var g1 = rnt(564, 492, 14159, 701, 477, 496, 1.3f, 2);
        }
        else
        {
            var g1 = rnt(564, 492, 14159, 726, 485, 516, 2.35f, 2); // SE sentry
            if (g1 != null)
            {
                g1.SetScriptId(ObjScriptEvent.EnterCombat, 445);
            }
        }

        // g1.scripts[19] = 445
        var g2 = rnt(556, 499, 14158, 702, 475, 506, 2, 2);
        var g3 = rnt(570, 489, 14160, 703, 482, 500, 2, 2);
        var g4 = rnt(570, 501, 14160, 704, 484, 498, 3, 2);
        var g5 = rnt(568, 498, 14161, 705, 475, 497, 2, 2);
        var g6 = rnt(565, 499, 14158, 706, 472, 499, 1.5f, 2);
        var g7 = rnt(558, 501, 14215, 707, 474, 489, 3, 2);
        var g8 = rnt(566, 501, 14216, 708, 481, 487, 2, 2);

        if (g8 == null)
        {
            g8 = rnt(563, 501, 14216, 708, 481, 487, 2, 2);
        }

        if (k7 != null)
        {
            var g9 = rnt(567, 494, 14161, 709, 488, 496, 4, 2);
            if (g9 == null)
            {
                g9 = rnt(560, 500, 14161, 709, 488, 496, 4, 2);
            }
        }
        else
        {
            var g9 = rnt(567, 494, 14161, 727, 499, 494, 4, 2); // SW sentry
            if (g9 == null)
            {
                g9 = rnt(560, 500, 14161, 727, 499, 494, 4, 2);
            }

            if (g9 != null)
            {
                g9.SetScriptId(ObjScriptEvent.EnterCombat, 445);
            }
        }

        // g9.scripts[19] = 445
        var g10 = rnt(567, 490, 14159, 710, 491, 493, 4, 2);
        var g11 = rnt(568, 492, 14161, 711, 484, 493, 3, 2);
        var g12 = rnt(562, 490, 14161, 712, 487, 488, 4, 2);

        // Bugbear defectors
        if (GetGlobalFlag(108) || PartyLeader.GetStat(Stat.constitution) >= 50)
        {
            var d1        = rnt(566, 519, 14247, 713, 486, 495, 4.5f, 2);
            var d2        = rnt(559, 520, 14247, 714, 488, 492, 3.5f, 2);
            var d3        = rnt(561, 512, 14247, 715, 475, 492, 1.9f, 2);
            var d4        = rnt(556, 514, 14247, 716, 480, 516, 2.4f, 2);
            var d5_leader = rnt(549, 512, 14231, 717, 492, 486, 3.6f, 5);
        }

        // Air Elementals
        var ae1        = rnt(498, 504, 14380, 718, 478, 494, 5.5f, 3);
        var ae2        = rnt(477, 504, 14380, 719, 483, 490, 5.5f, 3);
        var ae3_large  = rnt(486, 493, 14292, 720, 495, 504, 5.5f, 50);
        var kelnochest = rct(541, 495, 1014, 475, 487, 2.9f);

        foreach (var obj1 in ObjList.ListVicinity(new locXY(518, 485), ObjectListFilter.OLC_PORTAL))
        {
            var(x1, y1) = obj1.GetLocation();
            if (x1 == 518 && y1 == 485)
            {
                obj1.SetSecretDoorFlags(0);
                if (((obj1.GetPortalFlags() & PortalFlag.LOCKED)) != 0)
                {
                    obj1.ClearPortalFlag(PortalFlag.LOCKED);
                }
            }
        }

        // if not ( obj1.portal_flags_get() & OPF_OPEN ):
        // obj1.portal_toggle_open()
        // # obj1.portal_flag_set(OPF_OPEN) - didn't work
        return;
    }
Пример #3
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((GameSystems.Combat.IsCombatActive()))
        {
            return(RunDefault);
        }
        else
        {
            Logger.Info("Hedrack Heartbeat");
            var closest_jones = Utilities.party_closest(attachee);
            if ((attachee.DistanceTo(closest_jones) <= 100))
            {
                SetGlobalVar(719, GetGlobalVar(719) + 1);
                if ((attachee.GetLeader() == null))
                {
                    if ((GetGlobalVar(719) == 4))
                    {
                        attachee.CastSpell(WellKnownSpells.FreedomOfMovement, attachee);
                        attachee.PendingSpellsToMemorized();
                    }

                    if ((GetGlobalVar(719) == 8))
                    {
                        attachee.CastSpell(WellKnownSpells.OwlsWisdom, attachee);
                        attachee.PendingSpellsToMemorized();
                    }

                    if ((GetGlobalVar(719) == 12))
                    {
                        attachee.CastSpell(WellKnownSpells.ShieldOfFaith, attachee);
                        attachee.PendingSpellsToMemorized();
                    }

                    if ((GetGlobalVar(719) == 16))
                    {
                        attachee.CastSpell(WellKnownSpells.ProtectionFromGood, attachee);
                        attachee.PendingSpellsToMemorized();
                    }

                    if ((GetGlobalVar(719) == 20))
                    {
                        attachee.CastSpell(WellKnownSpells.ProtectionFromLaw, attachee);
                        attachee.PendingSpellsToMemorized();
                    }
                }

                if ((GetGlobalVar(719) >= 400))
                {
                    SetGlobalVar(719, 0);
                }
            }

            foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
            {
                if ((is_28_and_under(attachee, obj) && !GetGlobalFlag(812)))
                {
                    if ((GetQuestState(58) != QuestState.Unknown))
                    {
                        SetGlobalFlag(812, true);
                        return(SkipDefault);
                    }
                    else if ((GetGlobalVar(691) == 3))
                    {
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 40);
                        }
                        else
                        {
                            obj.TurnTowards(attachee);
                            attachee.TurnTowards(obj);
                            obj.BeginDialog(attachee, 40);
                        }
                    }
                    else if ((GetGlobalVar(691) == 2))
                    {
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 30);
                        }
                        else
                        {
                            obj.TurnTowards(attachee);
                            attachee.TurnTowards(obj);
                            obj.BeginDialog(attachee, 30);
                        }
                    }
                    else if ((GetGlobalVar(691) == 1))
                    {
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 20);
                        }
                        else
                        {
                            obj.TurnTowards(attachee);
                            attachee.TurnTowards(obj);
                            obj.BeginDialog(attachee, 20);
                        }
                    }
                    else if ((GetGlobalFlag(144)))
                    {
                        if ((!attachee.HasMet(obj)))
                        {
                            if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                            {
                                PartyLeader.TurnTowards(attachee);
                                attachee.TurnTowards(PartyLeader);
                                PartyLeader.BeginDialog(attachee, 10);
                            }
                            else
                            {
                                obj.TurnTowards(attachee);
                                attachee.TurnTowards(obj);
                                obj.BeginDialog(attachee, 10);
                            }
                        }
                        else
                        {
                            if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                            {
                                PartyLeader.TurnTowards(attachee);
                                attachee.TurnTowards(PartyLeader);
                                PartyLeader.BeginDialog(attachee, 290);
                            }
                            else
                            {
                                obj.TurnTowards(attachee);
                                attachee.TurnTowards(obj);
                                obj.BeginDialog(attachee, 290);
                            }
                        }
                    }
                    else if ((GetQuestState(58) >= QuestState.Accepted))
                    {
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 480);
                        }
                        else
                        {
                            obj.TurnTowards(attachee);
                            attachee.TurnTowards(obj);
                            obj.BeginDialog(attachee, 480);
                        }
                    }
                    else if ((attachee.HasMet(obj)))
                    {
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 490);
                        }
                        else
                        {
                            obj.TurnTowards(attachee);
                            attachee.TurnTowards(obj);
                            obj.BeginDialog(attachee, 490);
                        }
                    }
                    else
                    {
                        if ((PartyLeader.GetStat(Stat.hp_current) >= 1 && !PartyLeader.D20Query(D20DispatcherKey.QUE_Prone)))
                        {
                            PartyLeader.TurnTowards(attachee);
                            attachee.TurnTowards(PartyLeader);
                            PartyLeader.BeginDialog(attachee, 1);
                        }
                        else
                        {
                            obj.TurnTowards(attachee);
                            attachee.TurnTowards(obj);
                            obj.BeginDialog(attachee, 1);
                        }
                    }

                    SetGlobalFlag(812, true);
                }
            }
        }

        return(RunDefault);
    }
    public override bool OnStartCombat(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.GetLeader() != null && !ScriptDaemon.npc_get(attachee, 2)))
        {
            var leader = attachee.GetLeader();
            if ((Utilities.group_pc_percent_hp(attachee, leader) <= 40))
            {
                attachee.SetInt(obj_f.critter_strategy, 462);
            }
            else if ((GameSystems.Party.NPCFollowersSize + GameSystems.Party.PlayerCharactersSize == 8))
            {
                for (var pp = 0; pp < 8; pp++)
                {
                    if ((GameSystems.Party.GetPartyGroupMemberN(pp) != null))
                    {
                        if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(pp)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(pp).GetStat(Stat.hp_current) >= -9))
                        {
                            SetGlobalFlag(250 + pp, true);
                            SetGlobalFlag(258, true);
                        }
                    }
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(251)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(1))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(252)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(2))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(253)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(3))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(254)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(4))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(255)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(5))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(256)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(6))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(257)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(7))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
            else if ((GameSystems.Party.NPCFollowersSize + GameSystems.Party.PlayerCharactersSize == 7))
            {
                if ((Utilities.obj_percent_hp(PartyLeader) <= 50 && PartyLeader.GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(250, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(1)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(251, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(2)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(252, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(3)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(253, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(4)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(254, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(5)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(255, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(6)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(6).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(256, true);
                    SetGlobalFlag(258, true);
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(251)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(1))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(252)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(2))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(253)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(3))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(254)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(4))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(255)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(5))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(256)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(6))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
            else if ((GameSystems.Party.NPCFollowersSize + GameSystems.Party.PlayerCharactersSize == 6))
            {
                if ((Utilities.obj_percent_hp(PartyLeader) <= 50 && PartyLeader.GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(250, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(1)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(251, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(2)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(252, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(3)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(253, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(4)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(254, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(5)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(5).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(255, true);
                    SetGlobalFlag(258, true);
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(251)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(1))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(252)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(2))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(253)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(3))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(254)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(4))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(255)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(5))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
            else if ((GameSystems.Party.NPCFollowersSize + GameSystems.Party.PlayerCharactersSize == 5))
            {
                if ((Utilities.obj_percent_hp(PartyLeader) <= 50 && PartyLeader.GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(250, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(1)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(251, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(2)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(252, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(3)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(253, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(4)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(4).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(254, true);
                    SetGlobalFlag(258, true);
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(251)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(1))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(252)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(2))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(253)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(3))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(254)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(4))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
            else if ((GameSystems.Party.NPCFollowersSize + GameSystems.Party.PlayerCharactersSize == 4))
            {
                if ((Utilities.obj_percent_hp(PartyLeader) <= 50 && PartyLeader.GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(250, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(1)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(251, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(2)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(252, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(3)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(3).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(253, true);
                    SetGlobalFlag(258, true);
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(251)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(1))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(252)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(2))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(253)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(3))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
            else if ((GameSystems.Party.NPCFollowersSize + GameSystems.Party.PlayerCharactersSize == 3))
            {
                if ((Utilities.obj_percent_hp(PartyLeader) <= 50 && PartyLeader.GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(250, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(1)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(251, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(2)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(2).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(252, true);
                    SetGlobalFlag(258, true);
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(251)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(1))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(252)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(2))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
            else if ((GameSystems.Party.NPCFollowersSize + GameSystems.Party.PlayerCharactersSize == 2))
            {
                if ((Utilities.obj_percent_hp(PartyLeader) <= 50 && PartyLeader.GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(250, true);
                    SetGlobalFlag(258, true);
                }

                if ((Utilities.obj_percent_hp(GameSystems.Party.GetPartyGroupMemberN(1)) <= 50 && GameSystems.Party.GetPartyGroupMemberN(1).GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(251, true);
                    SetGlobalFlag(258, true);
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(251)))
                {
                    if ((adjacent(attachee, GameSystems.Party.GetPartyGroupMemberN(1))))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
            else if ((GameSystems.Party.PlayerCharactersSize == 1))
            {
                if ((Utilities.obj_percent_hp(PartyLeader) <= 50 && PartyLeader.GetStat(Stat.hp_current) >= -9))
                {
                    SetGlobalFlag(250, true);
                    SetGlobalFlag(258, true);
                }

                if ((GetGlobalFlag(250)))
                {
                    if ((adjacent(attachee, PartyLeader)))
                    {
                        SetGlobalFlag(259, true);
                    }
                }

                if ((GetGlobalFlag(258)))
                {
                    if ((GetGlobalFlag(259)))
                    {
                        attachee.SetInt(obj_f.critter_strategy, 464);
                        if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                        {
                            attachee.TurnTowards(triggerer);
                        }
                        else
                        {
                            foreach (var pc in GameSystems.Party.PartyMembers)
                            {
                                if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                                {
                                    attachee.TurnTowards(pc);
                                }
                                else
                                {
                                    attachee.TurnTowards(PartyLeader);
                                }
                            }
                        }
                    }
                    else
                    {
                        attachee.SetInt(obj_f.critter_strategy, 463);
                    }
                }
                else
                {
                    attachee.SetInt(obj_f.critter_strategy, 464);
                    if ((triggerer.type == ObjectType.npc && triggerer.GetLeader() == null))
                    {
                        attachee.TurnTowards(triggerer);
                    }
                    else
                    {
                        foreach (var pc in GameSystems.Party.PartyMembers)
                        {
                            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
                            {
                                attachee.TurnTowards(pc);
                            }
                            else
                            {
                                attachee.TurnTowards(PartyLeader);
                            }
                        }
                    }
                }
            }
        }

        SetGlobalFlag(250, false);
        SetGlobalFlag(251, false);
        SetGlobalFlag(252, false);
        SetGlobalFlag(253, false);
        SetGlobalFlag(254, false);
        SetGlobalFlag(255, false);
        SetGlobalFlag(256, false);
        SetGlobalFlag(257, false);
        SetGlobalFlag(258, false);
        SetGlobalFlag(259, false);
        return(RunDefault);
    }