예제 #1
0
        public static void TrySpawningBrutus()
        {
            if (Main.netMode == 1 || NpcMod.HasMetGuardian(6, "") || WorldMod.IsGuardianNpcInWorld(GuardianBase.Brutus))
            {
                return;
            }
            const int SpawnTime = 3 * 3600;

            if (Main.fastForwardTime || Main.eclipse || !Main.dayTime || (Main.time < SpawnTime || WorldMod.LastTime >= 7.5))
            {
                return;
            }
            if (Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0)
            {
                return;
            }
            int NpcCount = (int)(NpcMod.GetCompanionNPCCount() * 0.5f);

            for (int n = 0; n < 200; n++)
            {
                if (Main.npc[n].active && Main.npc[n].townNPC)
                {
                    NpcCount++;
                }
            }
            if (NpcCount < TownNpcsForBrutusToBeginAppearing)
            {
                return;
            }
            int SpawnChance = 20 - ChanceCounter() / 2;

            if (SpawnChance > 0 && Main.rand.Next(SpawnChance) > (NpcCount - TownNpcsForBrutusToBeginAppearing) * 0.5f)
            {
                return;
            }
            List <int> NpcsToSpawnOn = new List <int>();

            for (int i = 0; i < 200; i++)
            {
                if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <BrutusNPC>())
                {
                    return;
                }
                if (Main.npc[i].active && Main.npc[i].townNPC && !Main.npc[i].homeless && Main.npc[i].type != 37)
                {
                    byte PickedPlayer = Player.FindClosest(Main.npc[i].position, Main.npc[i].width, Main.npc[i].height);
                    if (Math.Abs(Main.player[PickedPlayer].Center.X - Main.npc[i].Center.X) >= NPC.sWidth * 0.5f ||
                        Math.Abs(Main.player[PickedPlayer].Center.Y - Main.npc[i].Center.Y) >= NPC.sHeight * 0.5f)
                    {
                        NpcsToSpawnOn.Add(i);
                    }
                }
            }
            if (NpcsToSpawnOn.Count == 0)
            {
                return;
            }
            int PickedNPC = NpcsToSpawnOn[Main.rand.Next(NpcsToSpawnOn.Count)];
            int SpawnPosX = (int)Main.npc[PickedNPC].Center.X,
                SpawnPosY = (int)(Main.npc[PickedNPC].position.Y + Main.npc[PickedNPC].height);
            int    npcPos = NPC.NewNPC(SpawnPosX, SpawnPosY, ModContent.NPCType <BrutusNPC>());
            string Text   = "<Brutus> *If someone is interessed in having a body guard, come see me near " + Main.npc[PickedNPC].GivenOrTypeName + ".*";

            if (Main.netMode == 0)
            {
                Main.NewText(Text, MainMod.MysteryCloseColor);
            }
            else
            {
                NetMessage.SendData(25, -1, -1, Terraria.Localization.NetworkText.FromLiteral(Text), MainMod.MysteryCloseColor.R, MainMod.MysteryCloseColor.G, MainMod.MysteryCloseColor.B, 255);
            }
            WarnedAboutBrutus = true;
        }
예제 #2
0
        public static string GetRandomTip()
        {
            Player        player   = Main.LocalPlayer;
            List <string> Messages = new List <string>();

            if (!HasMetGuardian(GuardianBase.Rococo))
            {
                Messages.Add("*I've met a friendly TerraGuardian looking for a place to live. He may end up appearing anytime during your adventure.*");
            }
            if (!HasMetGuardian(GuardianBase.Blue))
            {
                Messages.Add("*I've met once a TerraGuardian who liked camping. Maybe she'll stop by if there be a campfire.*");
            }
            if (!HasMetGuardian(GuardianBase.Sardine))
            {
                Messages.Add("*There was that cat... I don't remember his name... He said he was pursuing his highest bounty: The King Slime. I wonder If he were successfull.*");
            }
            if (!HasMetGuardian(GuardianBase.Zacks))
            {
                if (HasMetGuardian(GuardianBase.Blue))
                {
                    Messages.Add("*I can't forget one Blood Moon I survived. I was very far in the world, while being attacked by zombies from all the sides, until a big wolf zombie TerraGuardian appeared. Now that I'm thinking, that zombie looked a lot like " + NpcMod.GetGuardianNPCName(1) + ".*");
                }
                else
                {
                    Messages.Add("*I can't forget one Blood Moon I survived. I was very far in the world, while being attacked by zombies from all the sides, until a big wolf zombie TerraGuardian appeared. I managed to dispatch it, but It was scary.*");
                }
            }
            if (!HasMetGuardian(GuardianBase.Nemesis) && Main.hardMode)
            {
                Messages.Add("*The other day, I was barring my door, because there was a Possessed Armor repeatedly saying \"I'll be your shadow\". I don't know what It was talking about, but was really terrifying.*");
            }
            if (!HasMetGuardian(GuardianBase.Alex))
            {
                Messages.Add("*In the Ether Realm, there is a popular story about a Giant Dog and a Terrarian Woman. They lived happy, went into adventures and played together everyday, until one day she died. Legends says that the Giant Dog buried his owner, and still guards her tombstone since that day. I wonder if those legends are true.*");
            }
            if (!HasMetGuardian(GuardianBase.Brutus))
            {
                int TownNpcCount = (int)(NpcMod.GetCompanionNPCCount() * 0.5f);
                for (int n = 0; n < 200; n++)
                {
                    if (Main.npc[n].active && Main.npc[n].townNPC)
                    {
                        TownNpcCount++;
                    }
                }
                if (TownNpcCount >= Npcs.BrutusNPC.TownNpcsForBrutusToBeginAppearing)
                {
                    Messages.Add("*I've been hearing stories of a Royal Guard from Ether Realm who lost his job, and is now roaming through worlds looking to work as a bodyguard. I think there's a chance that he may be appearing here.*");
                }
                else
                {
                    Messages.Add("*I've been hearing stories of a Royal Guard from Ether Realm who lost his job, and is now roaming through worlds looking to work as a bodyguard. Is said that he has higher chances of appearing in places with many people living.*");
                }
            }
            if (!HasMetGuardian(GuardianBase.Bree))
            {
                Messages.Add("*I've bumped into a white cat earlier, who said she was looking for her husband. She said that she was travelling world by world trying to look for him, and she looked a bit worn out the last time I saw her. I tried convincing her to stay for a while, but she didn't accepted. If you find her, can you convince her to stay for a while?*");
            }
            if (!HasMetGuardian(GuardianBase.Mabel) && Npcs.MabelNPC.CanSpawnMabel)
            {
                Messages.Add("*I've met a TerraGuardian who wanted to try flying like a reindeer. The problem, is that not only reindeers can't fly, but she's not a reindeer. Can you please find her before she gets hurt?*");
            }
            if (!HasMetGuardian(GuardianBase.Domino) && Npcs.DominoNPC.CanSpawnDomino(player))
            {
                if (HasGuardianNPC(GuardianBase.Brutus))
                {
                    Messages.Add("*There is a shady TerraGuardian roaming this world. He seems to be running away from something. Maybe you should bring " + NpcMod.GetGuardianNPCName(GuardianBase.Brutus) + " with you in case you bump with him.*");
                }
                else
                {
                    Messages.Add("*There is a shady TerraGuardian roaming this world. He seems to be running away from something. You can try talking to him, but I don't know if will result into anything fruitful.*");
                }
            }
            if (!HasMetGuardian(10) && Npcs.LeopoldNPC.CanSpawnLeopold)
            {
                Messages.Add("*Did you hear? Leopold is visiting this world! You don't know who he is? He's a famous sage from Ether Realm. I managed to bump into him the other day when I was picking up flowers. I think you may end up finding him any time during your travels.");
            }
            if (!HasMetGuardian(11) && Npcs.VladimirNPC.CanRecruitVladimir)
            {
                Messages.Add("*I heard a weird rumor from a Terrarian who said that found a \"giant bear\" when exploring the Underground Jungle. They said that the bear were saying that was hungry and that wanted them to give him a hug. I think that may be another TerraGuardian, and I recommend you to check that out, since that person seems to be in trouble, and please don't freak out like the other Terrarian.");
            }
            if (!HasMetGuardian(12) && Npcs.MalishaNPC.MalishaCanSpawn)
            {
                Messages.Add("*I heard that we should be careful, since a witch seems to be taking vacation on this world. Who told me that? Well... You wont believe me, but the warning was given by a Bunny.*");
            }
            if (!HasMetGuardian(GuardianBase.Wrath) && Npcs.WrathNPC.WrathCanSpawn)
            {
                Messages.Add("*A person was attacked last night in the forest. They were brought unconscious to the town, and when woke up, said that a \"" +
                             (player.GetModPlayer <PlayerMod>().PigGuardianCloudForm[Companions.PigGuardianFragmentBase.AngerPigGuardianID] ?
                              "kind of cloud in form of a red pig" :
                              "angry red pig") + "\" attacked them. You need to check that out.*");
            }
            if (!HasMetGuardian(GuardianBase.Fluffles) && Npcs.GhostFoxGuardianNPC.CanGhostFoxSpawn(player))
            {
                Messages.Add("*Watch out, [nickname]. I've been hearing that there's a ghost chasing people in the dark. Better not let it catch you.*");
            }
            if (!HasMetGuardian(GuardianBase.Minerva))
            {
                Messages.Add("*I've met a friendly TerraGuardian who seems to be travelling this world. I don't think you may end up convincing her to stay at first, but she may visit often if she finds out there's a place she can visit.*");
            }
            if (!HasMetGuardian(GuardianBase.Alexander) && Npcs.AlexanderNPC.AlexanderConditionMet)
            {
                Messages.Add("*I heard that there's a TerraGuardian jumping and sleuthing people who tries exploring the dungeon. Based on the what people said, every time ends up with him saying it's not who they're looking for. I wonder who that TerraGuardian is looking for.*");
            }
            if (!HasMetGuardian(GuardianBase.Cinnamon))
            {
                Messages.Add("*There's a cute TerraGuardian sometimes follows Travelling Merchants on their travels. I think she may end up arriving here if that's true.*");
            }
            if (!HasMetGuardian(GuardianBase.Miguel) && Npcs.MiguelNPC.CanSpawnMe())
            {
                Messages.Add("*There's a really buff TerraGuardian exploring this world. He also likes to insult people who don't have \"proper body building\". I know because he did that to me...*");
            }
            if (!HasMetGuardian(GuardianBase.Quentin) && NPC.downedBoss3)
            {
                Messages.Add("*A person told me that they heard someone crying, when exploring the dungeon. Whoever that is, they definitelly seems to need help.*");
            }
            if (!HasMetGuardian(GuardianBase.Fear) && NPC.downedBoss3)
            {
                Messages.Add("*It is said that screams can be heard inside the dungeon. I don't actually screams of ghosts, wraiths or anything like that, but actually someone screaming out of terror. I think there's someone in trouble there.*");
            }
            if (!HasMetGuardian(GuardianBase.Green) && Npcs.GreenNPC.CanSpawnGreen())
            {
                Messages.Add("*I heard people saying that a intimidating giant snake is roaming this world. The person said that It climbed some tree to sleep. I really can't believe that, but it doesn't hurt to look that.*");
            }
            if (!HasMetGuardian(GuardianBase.Liebre) && Npcs.LiebreNPC.CanSpawn)
            {
                switch (Npcs.LiebreNPC.EncounterTimes)
                {
                case 0:
                    Messages.Add("*Someone told me that found a grim reaper when they were exploring the forest. The person said that ran away very fast when It said that wanted to talk to them.*");
                    break;

                case 1:
                    Messages.Add("*You know that grim reaper you've found? People says they found it exploring the " + (WorldGen.crimson ? "Crimson" : "Corruption") + ".*");
                    break;

                case 2:
                    Messages.Add("*I heard that the grim reaper you met some time ago has entered the dungeon. What could it be doing there?*");
                    break;

                case 3:
                    Messages.Add("*I haven't heard about the grim reaper since you last found them in the dungeon. I wonder what could have happened.*");
                    break;
                }
            }
            if (!HasMetGuardian(GuardianBase.Cille))
            {
                if (Npcs.CilleNPC.CanSpawn())
                {
                    Messages.Add("*There is a Cheetah TerraGuardian wandering around this world. She kind of have a horrible sense of fashion, and refuses to talk to anyone. Maybe you can check out what's with her. She's never seen during New Moon or Full Moon days.*");
                }
            }
            else
            {
                if (GuardianSpawningScripts.CilleShelterX == -1)
                {
                    Messages.Add("*I didn't heard anymore about that Cheetah TerraGuardian you met some time ago.*");
                }
                else
                {
                    Messages.Add("*It seems like that Cheetah TerraGuardian is living " + (GuardianSpawningScripts.CilleShelterX * 16 - Main.player[Main.myPlayer].Center.X < 0 ? "west" : "east") + " of here.*");
                }
            }
            if (Messages.Count == 0)
            {
                return("*I didn't heard about anything latelly.*");
            }
            return(Messages[Main.rand.Next(Messages.Count)]);
        }