Ejemplo n.º 1
0
    public override bool OnHeartbeat(GameObject attachee, GameObject triggerer)
    {
        if ((!GameSystems.Combat.IsCombatActive()))
        {
            foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC))
            {
                if ((!attachee.HasMet(obj)))
                {
                    if ((Utilities.is_safe_to_talk(attachee, obj)))
                    {
                        ScriptDaemon.record_time_stamp(517);
                        if ((triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8031))))
                        {
                            // Thrommel in Party
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 700);
                        }
                        else if ((triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8040)) && (!GetGlobalFlag(192))))
                        {
                            // Ashrem in Party
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 860);
                        }
                        else if (((GetGlobalFlag(104)) || (GetGlobalFlag(105)) || (GetGlobalFlag(106))))
                        {
                            // Killed one of the other priests
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 730);
                        }
                        else if ((GetGlobalFlag(92)))
                        {
                            // Recruited by Wat
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 200);
                        }
                        else
                        {
                            obj.TurnTowards(attachee); // added by Livonya
                            attachee.TurnTowards(obj); // added by Livonya
                            obj.BeginDialog(attachee, 1);
                        }
                    }
                }
            }
        }

        // game.new_sid = 0			## removed by Livonya
        // Prebuffing self and Underpriests			#
        // Added by Livonya, modified by S.A. Oct-2009		#
        if ((GetGlobalVar(713) == 2 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.ResistElements, attachee);
            attachee.PendingSpellsToMemorized();
        }

        if ((GetGlobalVar(713) == 6 && !GameSystems.Combat.IsCombatActive()))
        {
            var Tubal = Utilities.find_npc_near(attachee, 14212);
            if (Tubal != null && Tubal.GetLeader() == null)
            {
                Tubal.CastSpell(WellKnownSpells.ResistElements, Tubal);
                Tubal.PendingSpellsToMemorized();
            }

            var Antonio = Utilities.find_npc_near(attachee, 14211);
            if (Antonio != null && Antonio.GetLeader() == null)
            {
                Antonio.CastSpell(WellKnownSpells.ResistElements, Antonio);
                Antonio.PendingSpellsToMemorized();
            }
        }

        if ((GetGlobalVar(713) == 8 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.ProtectionFromElements, attachee);
            attachee.PendingSpellsToMemorized();
        }

        if ((GetGlobalVar(713) == 10 && !GameSystems.Combat.IsCombatActive()))
        {
            var Tubal = Utilities.find_npc_near(attachee, 14212);
            if (Tubal != null && Tubal.GetLeader() == null)
            {
                Tubal.CastSpell(WellKnownSpells.EndureElements, Tubal);
                Tubal.PendingSpellsToMemorized();
            }
        }

        if ((GetGlobalVar(713) == 11 && !GameSystems.Combat.IsCombatActive()))
        {
            var Antonio = Utilities.find_npc_near(attachee, 14211);
            if (Antonio != null && Antonio.GetLeader() == null)
            {
                Antonio.CastSpell(WellKnownSpells.EndureElements, Antonio);
                Antonio.PendingSpellsToMemorized();
            }
        }

        if ((GetGlobalVar(713) == 12 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
        {
            attachee.CastSpell(WellKnownSpells.FreedomOfMovement, attachee);
            attachee.PendingSpellsToMemorized();
        }

        // Prebuffing other critters when on Fire Temple Alert	#
        // Added by S.A. Oct-2009				#
        if ((ScriptDaemon.get_v(454) & 8) != 0 && GetGlobalVar(713) > 12 && GetGlobalVar(713) < 100)
        {
            if ((GetGlobalVar(713) == 16 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.FreedomOfMovement, mang1);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 17 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var Tubal     = Utilities.find_npc_near(attachee, 14212);
                var mang1     = ScriptDaemon.buffee(Tubal.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                if (Tubal != null && Tubal.GetLeader() == null)
                {
                    Tubal.CastSpell(WellKnownSpells.EndureElements, mang1);
                    Tubal.PendingSpellsToMemorized();
                }
            }

            if ((GetGlobalVar(713) == 18 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14224 }; // Werewolf, Aern
                var Antonio   = Utilities.find_npc_near(attachee, 14211);
                var mang1     = ScriptDaemon.buffee(Antonio.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                if (Antonio != null && Antonio.GetLeader() == null)
                {
                    Antonio.CastSpell(WellKnownSpells.EndureElements, mang1);
                    Antonio.PendingSpellsToMemorized();
                }
            }

            if ((GetGlobalVar(713) == 20 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.ResistElements, mang1);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 24 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var Tubal = Utilities.find_npc_near(attachee, 14212);
                Tubal.TurnTowards(attachee);
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                if (mang1 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.MagicCircleAgainstGood, mang1);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 28 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var buff_list = new[] { 14344, 14195, 14343 }; // Werewolf, Oohlgrist, Hydra
                var mang1     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new List <GameObject>());
                var mang2     = ScriptDaemon.buffee(attachee.GetLocation(), 20, buff_list, new[] { mang1 });
                if (mang2 == null)
                {
                    SetGlobalVar(713, GetGlobalVar(713) + 1);
                    return(RunDefault);
                }

                attachee.CastSpell(WellKnownSpells.EndureElements, mang2);
                attachee.PendingSpellsToMemorized();
            }

            if ((GetGlobalVar(713) == 32 && attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive()))
            {
                var Antonio = Utilities.find_npc_near(attachee, 14211);
                if (Antonio != null)
                {
                    attachee.TurnTowards(Antonio);
                }
            }
        }

        // End of section					#
        SetGlobalVar(713, GetGlobalVar(713) + 1);
        return(RunDefault);
    }