Beispiel #1
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (firstButton)
     {
         if (HasBrutusRecruited)
         {
             NpcMod.AddGuardianMet(6);
             WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Brutus);
         }
         else
         {
             npc.target = Main.myPlayer;
             StartDamageTest();
             //Main.player[Main.myPlayer].talkNPC = -1;
         }
     }
     else
     {
         if (Main.player[Main.myPlayer].BuyItem(Item.buyPrice(0, HirePrice)))
         {
             Main.npcChatText = "*I accept the offer. I, " + Base.Name + ", will protect you until the end of my contract.*";
             PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
             PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
             NpcMod.AddGuardianMet(6);
             Main.NewText("You bought " + Base.Name + "'s help.", MainMod.RecruitColor);
             WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Brutus);
         }
         else
         {
             Main.npcChatText = "*He's saying that the only ways of hiring his blade is by either showing how strong you are, or how deep your pocket is.*";
         }
     }
 }
Beispiel #2
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            bool PlayerHasDomino = PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianBase.Domino);

            if (PlayerHasDomino || (DominoDismissed && !PlayerMod.PlayerHasGuardianSummoned(Main.player[Main.myPlayer], BrutusID)))
            {
                Main.npcChatText = "*Thanks mate.*";
                PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
                if (!PlayerHasDomino)
                {
                    PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
                }
                NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                //npc.Transform(ModContent.NPCType<GuardianNPC.List.DogGuardian>());
            }
            if (DialogueStep == 10)
            {
                AcceptedIn   = firstButton;
                DialogueTime = DialogueDelay;
                if (firstButton)
                {
                    Main.npcChatText = "*Wise choice, Terrarian.*";
                }
                else
                {
                    Main.npcChatText = "*Eh... Alright... Go Team Brutus... Happy now?*";
                }
            }
        }
Beispiel #3
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (firstButton)
     {
         NpcMod.AddGuardianMet(16);
         Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().AddNewGuardian(16);
         if (PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).FriendshipLevel == 0)
         {
             PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).IncreaseFriendshipProgress(1);
         }
         Main.npcChatText = "(She looks happy at you, sketches on the floor her name, " + PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).Name + ", then places her hand on your shoulder, telling you that you can count on her.)";
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, 16);
     }
     else
     {
         NpcMod.AddGuardianMet(16, "", false);
         Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().AddNewGuardian(16);
         if (PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).FriendshipLevel == 0)
         {
             PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).IncreaseFriendshipProgress(1);
         }
         Main.npcChatText = "(Her face suddenly changed to a sad look, she sketches her name on the floor, " + PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).Name + ", then signals saying that If you need her help, you just need to call.)";
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, 16);
     }
 }
Beispiel #4
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (PlayerHasRococo)
     {
         NpcMod.AddGuardianMet(GuardianID, GuardianModID);
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
         //npc.Transform(ModContent.NPCType<GuardianNPC.List.RaccoonGuardian>());
     }
     else if (!RejectedOnce && !AcceptedOnce)
     {
         if (firstButton) //Accept
         {
             AcceptedOnce     = true;
             Main.npcChatText = "*It got very happy after I said that It can move to my world, and said that his name is " + Base.Name + ".*";
             Jump             = true;
         }
         else
         {
             RejectedOnce     = true;
             Main.npcChatText = "*It got saddened after hearing my refusal. But says that wont feel bad for that. He told you that you can call him anytime, if you change your mind, and that his name is " + Base.Name + "*";
         }
         PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
         PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
         NpcMod.AddGuardianMet(GuardianID, GuardianModID, firstButton);
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
     }
     else if (AcceptedOnce)
     {
         //npc.Transform(ModContent.NPCType<GuardianNPC.List.RaccoonGuardian>());
     }
 }
Beispiel #5
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            if (MetPlayer)
            {
                return;
            }
            if (SpeakingToKnownPlayer > 0)
            {
                if (firstButton)
                {
                    if (SpeakingToKnownPlayer == 1)
                    {
                        Main.npcChatText = "*Huh.*";
                        SayMessage("(I'll follow them again by keeping some distance, maybe they know the way out.)");
                    }
                    else
                    {
                        Main.npcChatText = "*No, I actually lied. Please, let me go with you! Get me out of here!!*";
                    }
                    PlayerMod.AddPlayerGuardian(Main.LocalPlayer, GuardianBase.Fear);
                    NpcMod.AddGuardianMet(GuardianBase.Fear);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                }
                else
                {
                    Main.npcChatText = "*Uh.. Alright... Just- Just go away!*";
                    MetPlayer        = true;
                }
            }
            switch (DialogueStep)
            {
            case 0:
                DialogueStep++;
                Main.npcChatText = "*I don't trust you! You will try killing me like you did to those scary monsters!*";
                break;

            case 1:
                DialogueStep++;
                Main.npcChatText = "*Uh.. I guess you're right. BUT! Doesn't mean you can't still turn on me.*";
                break;

            case 2:
                DialogueStep++;
                if (firstButton)
                {
                    Main.npcChatText = "*I, ah... Okay.*";
                    SayMessage("(I'll trail behind them carefully for now, maybe they will help me get out of this horrible place.)");
                    PlayerMod.AddPlayerGuardian(Main.LocalPlayer, GuardianBase.Fear);
                    NpcMod.AddGuardianMet(GuardianBase.Fear);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                }
                else
                {
                    Main.npcChatText = "*Uh.. Alright... Just- Just go away!*";
                    MetPlayer        = true;
                }
                break;
            }
        }
Beispiel #6
0
 public void TurnNpcInTownNpc(bool MoveIn)
 {
     PlayerMod.AddPlayerGuardian(Main.player[npc.target], GuardianID, GuardianModID);
     NpcMod.AddGuardianMet(GuardianID, GuardianModID, MoveIn);
     if (PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).FriendshipLevel == 0)
     {
         PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
     }
     WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
 }
Beispiel #7
0
 private void TransformNPC()
 {
     //Transform into Bree guardian npc
     NpcMod.AddGuardianMet(7);
     Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().AddNewGuardian(7);
     if (PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 7).FriendshipLevel == 0)
     {
         PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 7).IncreaseFriendshipProgress(1);
     }
     WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Bree);
     //npc.Transform(ModContent.NPCType<GuardianNPC.List.FemaleCatGuardian>());
 }
Beispiel #8
0
        private void RecruitmentScripts()
        {
            bool PlayerHadBlue = PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianBase.Blue);

            PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianBase.Blue);
            if (!PlayerHadBlue)
            {
                PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianBase.Blue).IncreaseFriendshipProgress(1);
            }
            NpcMod.AddGuardianMet(GuardianBase.Blue, "", !Rejected);
            WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Blue);
        }
Beispiel #9
0
        public override string GetChat()
        {
            if (PlayerMod.PlayerHasGuardian(Main.LocalPlayer, GuardianBase.Liebre))
            {
                string Text = "*Ah, you're here too. Well, now you know I'm here too.*";
                Main.npcChatText = Text;
                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Liebre);
                NpcMod.AddGuardianMet(GuardianBase.Liebre);
                return("");
            }
            int EncounterTimes = LiebreNPC.EncounterTimes;

            if (FinishedTalking)
            {
                EncounterTimes--;
            }
            switch (EncounterTimes)
            {
            case 0:
                if (!FinishedTalking)
                {
                    return("*Please don't be affraid, I'm not after your soul or anything. I'm here because TerraGuardians have been moving here.*");
                }
                return("*I will be moving away from here soon, if you're worried.*");

            case 1:
                if (FinishedTalking)
                {
                    return("*I'm still intrigued about this place, so It may take a while before I leave.*");
                }
                return("*So, we meet again, Terrarian. What kind of place is this? " + (WorldGen.crimson ? "I feel the energy of a godly creature in this organic place" : "This place seems infested with sickness and parasites") + "*");

            case 2:
                if (FinishedTalking)
                {
                    return("*I still need some time to process this. I think better when I'm alone.*");
                }
                return("*What is this place? This place... It's so horrible.*");

            case 3:
                if (FinishedTalking)
                {
                    return("*Terrarian, haven't we introduced ourselves before?*");
                }
                return("*Terrarian, I have something to tell you.*");
            }
            return(base.GetChat());
        }
Beispiel #10
0
        public override string GetChat()
        {
            NpcMod.AddGuardianMet(GuardianID, GuardianModID);
            bool PlayerHasLeopold = PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);

            PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
            if (!PlayerHasLeopold)
            {
                PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
            }
            string Mes = "";

            if (SceneID == SceneIDs.LeopoldFreeForRecruit)
            {
                Mes = "*Why did you make me act like a fool in front of your TerraGuardians? That will make it harder for people to remember me as a wise sage.*";
            }
            else if (SocialAct)
            {
                Mes = "*You can talk?! Wait, why didn't you talked to me sooner then? I nearly thought you were... No... Nevermind... I'm Leopold, the Sage.*";
            }
            else if (FearAct)
            {
                Mes = "*Huh? You're friendly? And can talk?! Oh... Thank... No... I'm fine.. It's just... Uh... Pleased to meet you, by the way... I'm Leopold, the Sage.*";
            }
            else if (ScareAct)
            {
                Mes = "*What?! You can talk!? Why did you made me pass through all that you idiot! Ugh... I'm Leopold, the Sage, by the way. Do you... Do you have some spare leaves with you...?*";
            }
            else
            {
                Mes = "*You can understand what I say?! Wow! The book was right!!*";
            }
            Main.npcChatText = Mes;
            WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
            //GuardianMouseOverAndDialogueInterface.SetDialogue(Mes);
            return(Mes);
        }
Beispiel #11
0
        public override void AI()
        {
            TerraGuardian Brutustg = PlayerMod.GetPlayerSummonedGuardian(Main.player[Main.myPlayer], BrutusID);
            bool          PlayerHasBrutusSummoned = Brutustg != null;

            if (Brutustg == null)
            {
                foreach (TerraGuardian tg in WorldMod.GuardianTownNPC)
                {
                    if (tg.ID == BrutusID && tg.ModID == MainMod.mod.Name)
                    {
                        Brutustg = tg;
                        break;
                    }
                }
            }
            Player player          = Main.player[Main.myPlayer];
            bool   PlayerHasDomino = PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianBase.Domino);
            string BrutusChat      = "";

            if (PlayerHasBrutusSummoned && !DominoDismissed)
            {
                if (DialogueStep == -1 && Math.Abs(player.Center.X - npc.Center.X) < 128f)
                {
                    DialogueStep = 0;
                    DialogueTime = 0;
                    BrutusChat   = "*Halt! You there!*";
                }
            }
            if (DialogueStep == -1 && player.talkNPC != npc.whoAmI)
            {
                if (DialogueTime == 0)
                {
                    if (player.Center.X - npc.Center.X < 0)
                    {
                        npc.direction = -1;
                    }
                    else
                    {
                        npc.direction = 1;
                    }
                }
                Walk = true;
                if (DialogueTime <= 1401)
                {
                    if (npc.direction < 0)
                    {
                        MoveLeft = true;
                    }
                    else
                    {
                        MoveRight = true;
                    }
                }
                if (DialogueTime >= 1401)
                {
                    DialogueTime -= 1400;
                }
                DialogueTime++;
            }
            npc.npcSlots = 1;
            if (DialogueStep >= 0)
            {
                npc.npcSlots = 200;
                DialogueTime++;
                bool Trigger = false;
                if (DialogueTime >= DialogueDelay)
                {
                    Trigger      = true;
                    DialogueTime = 0;
                    DialogueStep++;
                }
                bool FacePlayer = false;
                if (PlayerHasDomino)
                {
                    FacePlayer = true;
                    switch (DialogueStep)
                    {
                    case 0:
                        if (DialogueTime >= 60)
                        {
                            SayMessage("*This again?!*");
                        }
                        if (DialogueTime >= 90)
                        {
                            DialogueTime = DialogueDelay;
                        }
                        break;

                    case 1:
                        if (Trigger)
                        {
                            if (PlayerHasBrutusSummoned)
                            {
                                BrutusChat = "*You have the audacity of showing up again.*";
                            }
                            else
                            {
                                SayMessage("*Ah, you're not with him... Good.*");
                            }
                        }
                        break;

                    case 2:
                        if (Trigger)
                        {
                            if (PlayerHasBrutusSummoned)
                            {
                                SayMessage("*Yeah right, like as If I'm happy for seeing you again.*");
                            }
                            else
                            {
                                SayMessage("*Since you're here too, I don't think you'll mind if I open my business here too.*");
                            }
                        }
                        break;

                    case 3:
                        if (Trigger)
                        {
                            if (PlayerHasBrutusSummoned)
                            {
                                SayMessage("*Terrarian, you know the drill. Need me for anything, I will be here.*");
                            }
                            else
                            {
                                SayMessage("*Or if you need my help for anything, you know where to find me.*");
                            }
                        }
                        break;

                    case 4:
                        if (Trigger)
                        {
                            if (PlayerHasBrutusSummoned)
                            {
                                BrutusChat = "*Ugh...*";
                            }
                            NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                            WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                            //npc.Transform(ModContent.NPCType<GuardianNPC.List.DogGuardian>());
                        }
                        break;
                    }
                }
                else if (!PlayerHasDomino && !PlayerHasBrutusSummoned && DialogueStep == -1)
                {
                    Idle         = true;
                    DialogueTime = 0;
                }
                else
                {
                    switch (DialogueStep)
                    {
                    case 0:
                        if (DialogueTime >= 60)
                        {
                            SayMessage("*Uh oh.*");
                            FacePlayer = true;
                        }
                        if (DialogueTime >= 90)
                        {
                            DialogueTime = DialogueDelay;
                        }
                        break;

                    case 1:
                    {
                        if (Trigger)
                        {
                            BrutusChat = "*After him! Don't let him escape!*";
                        }
                        if (player.Center.X - npc.Center.X >= 0)
                        {
                            MoveLeft = true;
                        }
                        else
                        {
                            MoveRight = true;
                        }
                        if (Math.Abs(player.Center.X - npc.Center.X) >= NPC.sWidth ||
                            Math.Abs(player.Center.Y - npc.Center.Y) >= NPC.sHeight)
                        {
                            npc.active = false;
                            BrutusChat = "*Blast it! He got away! He'll return, I'm sure.*";
                        }

                        DialogueTime = 5;
                        if (player.getRect().Intersects(npc.getRect()))
                        {
                            DialogueTime = DialogueDelay;
                        }
                    }
                    break;

                    case 2:
                    {
                        if (Trigger)
                        {
                            BrutusChat = "*Got you now! You wont run away anymore!*";
                        }
                    }
                    break;

                    case 3:
                    {
                        FacePlayer = true;
                        if (Trigger)
                        {
                            SayMessage("*Hey Brutus, didn't you lost your place as a Royal Guard on the Ether Realm?*");
                        }
                    }
                    break;

                    case 4:
                    {
                        FacePlayer = true;
                        if (Trigger)
                        {
                            BrutusChat = "*If It wasn't for you, I wouldn't have lost my job. Beside, I was already sick of that.*";
                        }
                    }
                    break;

                    case 5:
                    {
                        FacePlayer = true;
                        if (Trigger)
                        {
                            SayMessage("*You don't need to thank me for that.*");
                        }
                    }
                    break;

                    case 6:
                    {
                        FacePlayer = true;
                        if (Trigger)
                        {
                            BrutusChat = "*I'm going to have you locked behind bars forever for smuggling.*";
                        }
                    }
                    break;

                    case 7:
                    {
                        FacePlayer = true;
                        if (Trigger)
                        {
                            SayMessage("*You're no longer a guard or anything, so you can't arrest me.*");
                        }
                    }
                    break;

                    case 8:
                    {
                        FacePlayer = true;
                        if (Trigger)
                        {
                            BrutusChat = "*Ugh... Uh...*";
                            SayMessage("*See? You can't arrest me, and the laws of the Ether Realm aren't valid here.*");
                        }
                    }
                    break;

                    case 9:
                    {
                        FacePlayer = true;
                        if (Trigger)
                        {
                            SayMessage("*Now, If you don't mind, I have something to ask to this Terrarian.*");
                        }
                    }
                    break;

                    case 10:
                    {
                        if (Trigger)
                        {
                            SayMessage("*Terrarian, come talk to me.*");
                        }
                        FacePlayer   = true;
                        DialogueTime = 5;
                    }
                    break;
                    }
                    if (AcceptedIn)
                    {
                        switch (DialogueStep)
                        {
                        case 11:
                        {
                            FacePlayer = true;
                            if (Trigger)
                            {
                                SayMessage("*Looks like I will be staying here.*");
                            }
                        }
                        break;

                        case 12:
                        {
                            FacePlayer = true;
                            if (Trigger)
                            {
                                BrutusChat = "*Oh great! Now I will have to share the world with my most hated person.*";
                            }
                        }
                        break;

                        case 13:
                        {
                            FacePlayer = true;
                            if (Trigger)
                            {
                                SayMessage("*Now If you don't mind, I have some things to move in to this world.*");
                            }
                        }
                        break;

                        case 14:
                        {
                            FacePlayer = true;
                            if (Trigger)
                            {
                                BrutusChat = "*Mark my words, slide just a little bit, and I will put you behind bars!*";
                            }
                        }
                        break;

                        case 15:
                        {
                            FacePlayer = true;
                            if (Trigger)
                            {
                                SayMessage("*Yeah, right. I also love having you as a neighbor or something.*");
                            }
                        }
                        break;

                        case 16:
                        {
                            if (Trigger)
                            {
                                PlayerMod.AddPlayerGuardian(player, GuardianID, GuardianModID);
                                NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                                //npc.Transform(ModContent.NPCType<GuardianNPC.List.DogGuardian>());
                                return;
                            }
                        }
                        break;
                        }
                    }
                    else
                    {
                        switch (DialogueStep)
                        {
                        case 11:
                        {
                            if (Trigger)
                            {
                                FacePlayer = true;
                                BrutusChat = "*Hah! The Terrarian said it! Now go away!*";
                            }
                        }
                        break;

                        case 12:
                        {
                            if (Trigger)
                            {
                                FacePlayer = true;
                                SayMessage("*Sigh... Well, I'm a man of word, anyway. Goodbye.*");
                            }
                        }
                        break;

                        case 13:
                        {
                            if (Trigger)
                            {
                                DominoDismissed = true;
                                BrutusChat      = "*Good riddance.*";
                                for (int i = 0; i < 5; i++)
                                {
                                    Gore.NewGore(npc.Center, new Microsoft.Xna.Framework.Vector2(Main.rand.Next(-40, 40) * 0.01f, Main.rand.Next(-40, 40) * 0.01f), Main.rand.Next(11, 14));
                                }
                                npc.active = false;
                            }
                        }
                        break;
                        }
                    }
                }
                if (FacePlayer)
                {
                    if (player.Center.X - npc.Center.X >= 0)
                    {
                        npc.direction = 1;
                    }
                    else
                    {
                        npc.direction = -1;
                    }
                    if (Math.Abs(player.Center.X - npc.Center.X) >= 64)
                    {
                        if (player.Center.X - npc.Center.X >= 0)
                        {
                            MoveRight = true;
                        }
                        else
                        {
                            MoveLeft = true;
                        }
                    }
                }
            }
            if (Math.Abs(player.Center.X - npc.Center.X) >= NPC.sWidth + 64 ||
                Math.Abs(player.Center.Y - npc.Center.Y) >= NPC.sHeight + 64)
            {
                npc.active = false;
            }
            if (BrutusChat != "" && Brutustg != null)
            {
                Brutustg.SaySomething(BrutusChat);
            }
            base.AI();
        }
Beispiel #12
0
        public override void AI()
        {
            LeftArmFrame  = -1;
            RightArmFrame = -1;
            BodyFrame     = -1;
            //AI Work here
            npc.homeTileX = npc.homeTileY = -1;
            if (Main.player[Main.myPlayer].talkNPC == npc.whoAmI)
            {
                npc.direction = Main.player[Main.myPlayer].Center.X < npc.Center.X ? -1 : 1;
            }
            if (!WarnedAboutBrutus)
            {
                Main.NewText("<Brutus> I'm still looking for someone to hire me as a bodyguard. Find me by your towns if you want to hire me.", MainMod.MysteryCloseColor);
                WarnedAboutBrutus = true;
            }
            if (SteelTestingTime > 0)
            {
                bool CaughtADebuff = false;
                for (int i = 0; i < npc.buffType.Length; i++)
                {
                    if (npc.buffType[i] > 0 && Main.debuff[npc.buffType[i]])
                    {
                        CaughtADebuff = true;
                        break;
                    }
                }
                if (CaughtADebuff)
                {
                    EndDamageTest();
                    PlayScene(SCENE_PLAYERCHEATS);
                }
            }
            if (SteelTestingTime > 0)
            {
                SteelTestingTime--;
                npc.TargetClosest(true);
                if (SteelTestingTime <= 0)
                {
                    SayMessage("*Growl! Time's up.*");
                    EndDamageTest();
                    PlayScene(0);
                }
            }
            npc.npcSlots = 1;
            switch (Scene)
            {
            default:
            {
                SceneTime++;
                Idle = true;
                if (false && SteelTestingTime <= 0 && SceneTime >= 600 && npc.velocity.X == 0 && npc.velocity.Y == 0)
                {
                    BodyFrame = LeftArmFrame = RightArmFrame = Base.DuckingFrame;
                }
            }
            break;

            case SCENE_PLAYERWINS:
                npc.npcSlots = 200;
                if (SceneTime == 0)
                {
                    npc.FaceTarget();
                    npc.velocity.X -= npc.direction * 7.5f;
                    npc.velocity.Y -= 7.5f;
                    SayMessage("*Rooow!! Ugh... Urgh...*");
                    SceneTime = 1;
                }
                else if (SceneTime >= 1)
                {
                    if (npc.velocity.X == 0 && npc.velocity.Y == 0)
                    {
                        int LastSceneTime = SceneTime;
                        SceneTime++;
                        int Frame = Base.DuckingFrame;
                        if (SceneTime == 180)
                        {
                            SayMessage("*I guess I got a bit rusty.*");
                        }
                        if (SceneTime == 480)
                        {
                            SayMessage("*Maybe helping you on your quest will help making me tougher again.*");
                        }
                        if (SceneTime >= 480)
                        {
                            Frame = Base.StandingFrame;
                        }
                        if (SceneTime == 780)
                        {
                            SayMessage("*I am " + Base.Name + ". Your body guard, from now on.*");
                        }
                        if (SceneTime >= 1080)
                        {
                            NpcMod.AddGuardianMet(6);
                            Player player = Main.player[npc.target];
                            PlayerMod.AddPlayerGuardian(player, GuardianBase.Brutus);
                            PlayerMod.GetPlayerGuardian(player, GuardianBase.Brutus).IncreaseFriendshipProgress(1);
                            GuardianData gd = PlayerMod.GetPlayerGuardian(player, GuardianBase.Brutus);
                            if (gd.FriendshipLevel == 0)
                            {
                                gd.IncreaseFriendshipProgress(1);
                            }
                            WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Brutus);
                            //npc.Transform(ModContent.NPCType<GuardianNPC.List.LionGuardian>());
                        }
                        BodyFrame = LeftArmFrame = RightArmFrame = Frame;
                    }
                }
                break;

            case SCENE_PLAYERCHEATS:
            {
                npc.npcSlots = 200;
                if (SceneTime == 0)
                {
                    SteelTestingTime = 0;
                    SayMessage("*ROAR*");
                    npc.velocity.Y = -5.5f;
                    npc.FaceTarget();
                    SceneTime = 1;
                }
                else
                {
                    ModTargetting target = new ModTargetting();
                    target.TargettingPlayer = true;
                    if (Main.player[npc.target].GetModPlayer <PlayerMod>().Guardian.Active&& Main.player[npc.target].GetModPlayer <PlayerMod>().Guardian.PlayerControl)
                    {
                        target.TargettingPlayer = false;
                    }
                    target.SetTargetToPlayer(Main.player[npc.target]);
                    if (npc.velocity.Y == 0 && npc.velocity.X == 0)
                    {
                        //Player player = Main.player[npc.target];
                        SceneTime++;
                        bool PlayerPickedUp = false;
                        int  RightHandFrame = 0;
                        if (SceneTime >= 30)
                        {
                            PlayerPickedUp = true;
                        }

                        if (SceneTime == 30)
                        {
                            SayMessage("*I said no tricks, idiot.*");
                        }
                        int       t         = 0;
                        const int FrameTime = 8;
                        if (SceneTime >= 60 + t * FrameTime && SceneTime < 60 + (t + 1) * FrameTime)
                        {
                            RightHandFrame = Base.ItemUseFrames[0];
                        }
                        t++;
                        if (SceneTime >= 60 + t * FrameTime && SceneTime < 60 + (t + 1) * FrameTime)
                        {
                            RightHandFrame = Base.ItemUseFrames[1];
                        }
                        t++;
                        if (SceneTime >= 60 + t * FrameTime && SceneTime < 60 + (t + 1) * FrameTime)
                        {
                            RightHandFrame = Base.ItemUseFrames[2];
                            if (SceneTime == 60 + t * FrameTime + FrameTime / 2)
                            {
                                int Damage = (int)((70f / target.MaxHealthBonus) * target.MaxLife);
                                target.Hurt(Damage, npc.direction, " has got what deserved.");
                            }
                        }
                        t++;
                        if (SceneTime >= 60 + t * FrameTime && SceneTime < 60 + (t + 1) * FrameTime)
                        {
                            RightHandFrame = Base.ItemUseFrames[1];
                        }
                        t++;
                        if (SceneTime >= 60 + t * FrameTime && SceneTime < 60 + (t + 1) * FrameTime)
                        {
                            RightHandFrame = Base.ItemUseFrames[0];
                        }
                        t++;
                        if (SceneTime >= 60 + t * FrameTime)
                        {
                            PlayScene(0);
                        }

                        if (PlayerPickedUp)
                        {
                            int hx, hy;
                            Base.LeftHandPoints.GetPositionFromFrame(Base.ItemUseFrames[2], out hx, out hy);
                            LeftArmFrame = Base.ItemUseFrames[2];
                            Vector2 Pos = new Vector2(hx, Base.SpriteHeight - hy);
                            if (npc.direction < 0)
                            {
                                Pos.X = Base.SpriteWidth - Pos.X;
                            }
                            Pos.X           += npc.width * 0.5f - Base.SpriteWidth * 0.5f;
                            Pos.Y           += npc.height - Base.SpriteHeight;
                            Pos             += npc.position;
                            target.Center    = Pos;
                            target.FallStart = (int)(target.Position.Y / 16);
                        }
                        RightArmFrame = RightHandFrame;
                    }
                }
            }
            break;
            }
            base.AI(); //Never.Remove
            if (!Main.dayTime)
            {
                bool PlayerInRange = false;
                for (int p = 0; p < 255; p++)
                {
                    if (!Main.player[p].active)
                    {
                        continue;
                    }
                    Vector2 PositionDifference = npc.Center - Main.player[p].Center;
                    if (Math.Abs(PositionDifference.X) < NPC.sWidth * 0.5f + NPC.safeRangeX &&
                        Math.Abs(PositionDifference.Y) < NPC.sHeight * 0.5f + NPC.safeRangeY)
                    {
                        PlayerInRange = true;
                        break;
                    }
                }
                if (!PlayerInRange)
                {
                    Main.NewText("The Lion Guardian has returned to the Ether Realm.", Color.OrangeRed);
                    npc.active = false;
                    npc.life   = 0;
                }
            }
        }
Beispiel #13
0
        public override void AI()
        {
            if (DialogueStep > 0)
            {
                if (!Main.player[npc.target].active)
                {
                    SayMessage("*And " + (Main.player[npc.target].Male ? "he's" : "she's") + " gone. Oh well, until we meet again.*");
                    DialogueStep = 0;
                }
                else if (Main.player[npc.target].dead)
                {
                    SayMessage("*That was really horrible!*");
                    if (DialogueStep >= 5)
                    {
                        DialogueStep = 5;
                    }
                    else
                    {
                        DialogueStep = 0;
                    }
                }
                else if (npc.velocity.X == 0 && npc.velocity.Y == 0)
                {
                    if (DialogueStep >= 5)
                    {
                        if (!PlayerMovedAway)
                        {
                            if (Math.Abs(Main.player[npc.target].Center.X - npc.Center.X) >= 400 ||
                                Math.Abs(Main.player[npc.target].Center.Y - npc.Center.Y) >= 300)
                            {
                                PlayerMovedAway = true;
                                SayMessage("*And " + (Main.player[npc.target].Male ? "he" : "she") + " went away.*");
                                DialogueStep = 5;
                            }
                        }
                        else
                        {
                            npc.TargetClosest(false);
                            if (Math.Abs(Main.player[npc.target].Center.X - npc.Center.X) < 200 &&
                                Math.Abs(Main.player[npc.target].Center.Y - npc.Center.Y) < 100)
                            {
                                PlayerMovedAway = false;
                                SayMessage("*Returned? Now you can try jumping " + (25 - JumpTimes) + ", right?*");
                                DialogueStep = 6;
                            }
                        }
                    }
                    if (Main.player[npc.target].Center.X < npc.Center.X)
                    {
                        npc.direction = -1;
                    }
                    else
                    {
                        npc.direction = 1;
                    }
                }
            }
            switch (DialogueStep)
            {
            case 0:     //Looking for Player
                npc.TargetClosest(false);
                Idle = true;
                Rectangle SeekingRectangle = new Rectangle((int)npc.Center.X, (int)npc.Center.Y, 400, 300);
                if (npc.direction < 0)
                {
                    SeekingRectangle.X -= SeekingRectangle.Width;
                }
                SeekingRectangle.Y -= (int)(SeekingRectangle.Height * 0.5f);
                if (Main.player[npc.target].active && !Main.player[npc.target].dead && Main.player[npc.target].getRect().Intersects(SeekingRectangle))
                {
                    Idle         = false;
                    DialogueStep = 1;
                    SayMessage("*Hey, you!*", true);
                    PlayerHasMiguelRecruited = PlayerMod.PlayerHasGuardian(Main.player[npc.target], GuardianID);
                }
                break;

            case 1:
            {
                if (MessageTime <= 0)
                {
                    if (PlayerHasMiguelRecruited)
                    {
                        SayMessage("*Don't you go thinking that just because you changed worlds, you'll slack on the exercises!*", true);
                    }
                    else
                    {
                        SayMessage("*Are you carrying many loots in that pouch of yours?*", true);
                    }
                    DialogueStep = 2;
                }
            }
            break;

            case 2:
            {
                if (MessageTime <= 0)
                {
                    if (PlayerHasMiguelRecruited)
                    {
                        SayMessage("*I will be here to give you a new batch of exercises.*", true);
                        NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                        WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                    }
                    else
                    {
                        SayMessage("*Or is that because you haven't been doing abdominal exercises?*", true);
                    }
                    DialogueStep = 3;
                }
            }
            break;

            case 3:
            {
                if (MessageTime <= 0)
                {
                    SayMessage("*Hahahaha.*");
                    DialogueStep = 4;
                }
            }
            break;

            case 4:
            {
                if (MessageTime <= 0)
                {
                    SayMessage("*Don't worry, though, I will help you take carry of that belly.*", true);
                    DialogueStep = 5;
                }
            }
            break;

            case 5:
            {
                if (!PlayerMovedAway && MessageTime <= 0 && Main.player[npc.target].talkNPC != npc.whoAmI)
                {
                    SayMessage("*Why don't you try jumping 25 times.*", true);
                    DialogueStep = 6;
                }
            }
            break;

            case 6:
            {
                if (!PlayerMovedAway && Main.player[npc.target].justJumped)
                {
                    JumpTimes++;
                    if (JumpTimes >= 25)
                    {
                        SayMessage("*Nice job. As you can see, you got a little more fit for jumping all those times.*");
                        Main.player[npc.target].AddBuff(Terraria.ModLoader.ModContent.BuffType <Buffs.Fit>(), 5 * 60 * 60);
                        DialogueStep++;
                    }
                    else
                    {
                        if (JumpTimes % 5 == 0)
                        {
                            if (JumpTimes > 10)
                            {
                                SayMessage("*" + JumpTimes + "! Good job!*");
                            }
                            else
                            {
                                SayMessage("*" + JumpTimes + "! Nice!*");
                            }
                        }
                        else
                        {
                            SayMessage("*" + JumpTimes + "!*");
                        }
                    }
                }
            }
            break;

            case 7:
            {
                if (MessageTime <= 0)
                {
                    SayMessage("*Don't worry, by the way. The great " + Base.Name + " will handle your training from now on.*");
                    DialogueStep++;
                }
            }
            break;

            case 8:
            {
                if (MessageTime <= 0)
                {
                    SayMessage("*And don't you dare to deny my training.*");
                    PlayerMod.AddPlayerGuardian(Main.player[npc.target], GuardianID, GuardianModID);
                    NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                    PlayerMod.GetPlayerGuardian(Main.player[npc.target], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
                    return;
                }
            }
            break;
            }
            base.AI();
        }
Beispiel #14
0
        public override void AI()
        {
            switch (MeetStep)
            {
            case 0:
            {
                Rectangle rect = new Rectangle((int)npc.Center.X, (int)npc.Center.Y, 300, 300);
                if (npc.direction < 0)
                {
                    rect.X -= rect.Width;
                }
                rect.Y -= rect.Height / 2;
                Idle    = true;
                for (int p = 0; p < 255; p++)
                {
                    if (Main.player[p].active &&
                        rect.Intersects(Main.player[p].getRect()) &&
                        Collision.CanHit(Main.player[p].position, Main.player[p].width, Main.player[p].height,
                                         npc.position, npc.width, npc.height))
                    {
                        npc.target = p;
                        MeetStep   = 1;
                        break;
                    }
                }
            }
            break;

            case 1:
            {
                if (!Main.player[npc.target].active || Main.player[npc.target].dead)
                {
                    MeetStep = 0;
                }
                else
                {
                    if (Math.Abs(Main.player[npc.target].Center.X - npc.Center.X) > 80)
                    {
                        if (Main.player[npc.target].Center.X < npc.Center.X)
                        {
                            MoveLeft = true;
                        }
                        else
                        {
                            MoveRight = true;
                        }
                    }
                    else
                    {
                        MeetStep = 2;
                        Time     = 0;
                    }
                }
            }
            break;

            case 2:
            {
                if (!Main.player[npc.target].active || Main.player[npc.target].dead)
                {
                    MeetStep = 0;
                }
                else
                {
                    if (npc.velocity.Length() == 0)
                    {
                        if (Main.player[npc.target].Center.X < npc.Center.X)
                        {
                            npc.direction = -1;
                        }
                        else
                        {
                            npc.direction = 1;
                        }
                    }
                    Time++;
                    if (Time == 20)
                    {
                        SayMessage("Bark! Bark! *Wags tail.*");
                    }
                    if (Time >= 180)
                    {
                        NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                        PlayerMod.AddPlayerGuardian(Main.player[npc.target], GuardianID, GuardianModID);
                        WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                        return;
                    }
                }
            }
            break;
            }
            base.AI();
        }
Beispiel #15
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            switch (Step)
            {
            case 5:
                Step             = 6;
                Timer            = 0;
                Main.npcChatText = "*Yes, we TerraGuardians speaks mostly from ways out of the conventional. Gladly seems like the bond let us understand each other.*";
                break;

            case 6:
                if (firstButton)
                {
                    if (Timer > 0)
                    {
                        Step  = 7;
                        Timer = 2;
                    }
                    else
                    {
                        Timer = 1;
                    }
                    Main.npcChatText = "*I'm a medic from the Ether Realm. I have treated many patients there, but right now I'm exploring this world.*";
                }
                else
                {
                    if (Timer > 0)
                    {
                        Step  = 7;
                        Timer = 1;
                    }
                    else
                    {
                        Timer = 2;
                    }
                    Main.npcChatText = "*I was exploring this world, until I was getting tired of wandering, so I went atop that tree to sleep, until you put it all down.*";
                }
                break;

            case 7:
                if (firstButton)
                {
                    Main.npcChatText = "*Believe it or not. Even though my face may look intimidating, I take my job very seriously.*";
                }
                else
                {
                    Main.npcChatText = "*I lived on the Ether Realm since I was an egg, literally. I wanted to see how this \"new world\" looks.*";
                }
                Step  = 8;
                Timer = 0;
                break;

            case 8:
                Main.npcChatText = "*Since you demolished my slumber spot, there isn't much I can do. But meeting you has just made me curious about you...*";
                Step             = 9;
                break;

            case 9:
                Main.npcChatText = "*Not in the sense you are thinking... Hm... Say, would you mind if I stayed here, and studied your people? I may end up being helpful in case you ever feel injured or sick, once I discover how your bodies work.*";
                Step             = 10;
                break;

            case 10:
                PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID);
                NpcMod.AddGuardianMet(GuardianID, GuardianModID, firstButton);
                if (firstButton)
                {
                    Main.npcChatText = "*Thank you, this is of great importance to me. My name is Jochen Green, but you can call me Dr. Green, instead.*";
                }
                else
                {
                    Main.npcChatText = "*Well, that's sad. Anyways, you can keep contact of me in case you change your mind. My name is Jochen Green. You can call me Dr. Green, instead.*";
                }
                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                break;
            }
        }
Beispiel #16
0
 public override void AI()
 {
     if (AiStage > 1)
     {
         if (npc.target == -1 || npc.target == 256)
         {
             AiStage = 1;
             SayMessage("*Funny, where did the Terrarian I was talking with to went?*");
         }
         else if (!Main.player[npc.target].active)
         {
             AiStage = 1;
             SayMessage("*Funny, where did the Terrarian I was talking with to went?*");
         }
         else if (Main.player[npc.target].dead)
         {
             AiStage = 1;
             SayMessage("*Well, that was an awful sight.*");
         }
     }
     if (AiStage == 0)
     {
         Idle          = true;
         AiStage       = 1;
         npc.direction = (Main.rand.NextDouble() < 0.5 ? -1 : 1);
         Main.NewText("Something appeared to the " + GuardianBountyQuest.GetDirectionText(npc.Center - Main.player[Main.myPlayer].Center) + " of " + Main.player[Main.myPlayer].name + ".", MainMod.MysteryCloseColor);
     }
     else if (AiStage == 1)
     {
         Idle = true;
         Rectangle FoV = new Rectangle(0, -150, 250, 300);
         if (npc.direction < 0)
         {
             FoV.X = -FoV.Width;
         }
         FoV.X += (int)npc.Center.X;
         FoV.Y += (int)npc.Center.Y;
         for (int p = 0; p < 255; p++)
         {
             if (Main.player[p].active && !Main.player[p].dead && Main.player[p].getRect().Intersects(FoV) && Collision.CanHitLine(npc.position, npc.width, npc.height, Main.player[p].position, Main.player[p].width, Main.player[p].height))
             {
                 //Player found!
                 npc.target = p;
                 if (PlayerMod.PlayerHasGuardian(Main.player[p], GuardianBase.Malisha))
                 {
                     DialogueTime = SayMessage("*Hey, It's you again.*"); //Add later the dialogue
                     AiStage      = 150;
                 }
                 else
                 {
                     AiStage      = 2;
                     DialogueTime = SayMessage("*A Terrarian! I must have really arrived.*");
                 }
                 if (npc.Center.X - Main.player[p].Center.X > 0)
                 {
                     npc.direction = -1;
                 }
                 else
                 {
                     npc.direction = 1;
                 }
                 break;
             }
         }
     }
     else if (AiStage == 2)
     {
         Player player = Main.player[npc.target];
         if (npc.Center.X - player.Center.X > 0)
         {
             npc.direction = -1;
         }
         else
         {
             npc.direction = 1;
         }
         if (DialogueTime > 0)
         {
             DialogueTime--;
         }
         else
         {
             if (PlayerUsingDryadSet(player))
             {
                 DialogueTime = SayMessage("*Look at how It's dressed! This must be the right place.*");
             }
             else
             {
                 DialogueTime = SayMessage("*Wait, why is It using clothes?*");
             }
             AiStage = 3;
         }
     }
     else if (AiStage == 3)
     {
         Player player = Main.player[npc.target];
         if (npc.Center.X - player.Center.X > 0)
         {
             npc.direction = -1;
         }
         else
         {
             npc.direction = 1;
         }
         if (DialogueTime > 0)
         {
             DialogueTime--;
         }
         else
         {
             float Distance = player.Center.X - npc.Center.X;
             if (Math.Abs(Distance) > 96)
             {
                 if (Distance > 0)
                 {
                     MoveRight = true;
                 }
                 else
                 {
                     MoveLeft = true;
                 }
             }
             else
             {
             }
         }
     }
     else if (AiStage == 100)
     {
         npc.TargetClosest(false);
         Player player = Main.player[npc.target];
         Idle = true;
     }
     else if (AiStage == 150)
     {
         Player player = Main.player[npc.target];
         if (npc.Center.X - player.Center.X > 0)
         {
             npc.direction = -1;
         }
         else
         {
             npc.direction = 1;
         }
         if (DialogueTime > 0)
         {
             DialogueTime--;
         }
         else
         {
             DialogueTime = SayMessage("*I think this isn't a naturalist colony, either, right?*");
             AiStage      = 151;
         }
     }
     else if (AiStage == 151)
     {
         Player player = Main.player[npc.target];
         if (npc.Center.X - player.Center.X > 0)
         {
             npc.direction = -1;
         }
         else
         {
             npc.direction = 1;
         }
         if (DialogueTime > 0)
         {
             DialogueTime--;
         }
         else
         {
             DialogueTime = SayMessage("*Well, whatever. I'm here If you need my knowledge. Or feel like wanting to be a guinea pig. You pick.*");
             AiStage      = 152;
         }
     }
     else if (AiStage == 152)
     {
         Player player = Main.player[npc.target];
         if (npc.Center.X - player.Center.X > 0)
         {
             npc.direction = -1;
         }
         else
         {
             npc.direction = 1;
         }
         if (DialogueTime > 0)
         {
             DialogueTime--;
         }
         else
         {
             PlayerMod.AddPlayerGuardian(Main.player[npc.target], GuardianBase.Malisha);
             NpcMod.AddGuardianMet(GuardianBase.Malisha);
             WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
             //npc.Transform(ModContent.NPCType<GuardianNPC.List.PantherGuardian>());
         }
     }
     else
     {
         Player player = Main.player[npc.target];
         //Dialogue Checks
         if (player.talkNPC != npc.whoAmI)
         {
             DialogueTime = SayMessage("*How rude! Speak to me when possible then.*");
             AiStage      = 100;
         }
     }
     base.AI();
 }
Beispiel #17
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            string NewDialogueMessage = null;

            switch (TalkTimes)
            {
            case 0:
            {
                switch (DialogueStep)
                {
                case 0:
                    if (PlayerMetCille)
                    {
                        NewDialogueMessage = "*Yes.. Still, please leave me be.*";
                        DialogueStep       = 0;
                        TalkTimes          = 8;
                    }
                    else
                    {
                        NewDialogueMessage = "*Nobody. Please, go away..*";
                        DialogueStep++;
                    }
                    MetAtLeastOnce = true;
                    break;
                }
            }
            break;

            case 1:
            {
                switch (DialogueStep)
                {
                case 0:
                    NewDialogueMessage = "*...Because I might hurt you..*";
                    DialogueStep++;
                    break;

                case 1:
                    NewDialogueMessage = "*No... It's not that... I tend to end up hurting people I'm close to...*";
                    DialogueStep++;
                    break;

                case 2:
                    NewDialogueMessage = "*I really don't want to talk to you.. Please, leave me alone.*";
                    DialogueStep++;
                    break;
                }
            }
            break;

            case 2:
            {
                switch (DialogueStep)
                {
                case 0:
                    NewDialogueMessage = "*Okay. What about this. I really miss racing against someone. Could you beat me on a race?*";
                    DialogueStep++;
                    break;

                case 1:
                    if (firstButton)
                    {
                        NewDialogueMessage = "*It's really simple. If you run ahead of me enough time so I can't catch up, you win. I win if I manage to do that to you. What do you say?*";
                    }
                    else
                    {
                        NewDialogueMessage = "*Back then, I used to love racing against other people.. It's just a simple race, if you manage to run ahead of me enough so I can't catch up, you win. I win if I do the that to you. Would you race against me?*";
                    }
                    DialogueStep++;
                    break;

                case 2:
                    if (firstButton)
                    {
                        TalkTimes          = 3;
                        DialogueStep       = 0;
                        RaceStartDelay     = 3 * 60;
                        NewDialogueMessage = "*Once you stop talking to me, I'll start the race in 3 seconds.*";
                    }
                    else
                    {
                        NewDialogueMessage = "*Then leave me alone.*";
                        DialogueStep++;
                    }
                    break;
                }
            }
            break;

            case 6:
            {
                switch (DialogueStep)
                {
                case 0:
                {
                    DialogueStep++;
                    NewDialogueMessage = "*No. Please, leave me alone.*";
                    NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                    TalkTimes = 7;
                    PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
                }
                break;
                }
            }
            break;

            case 7:
            {
                switch (DialogueStep)
                {
                case 0:
                {
                    DialogueStep++;
                    NewDialogueMessage = "*Cille...*";
                }
                break;
                }
            }
            break;

            case 8:
            {
                NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                TalkTimes        = 9;
                Main.npcChatText = "*... Sorry... You're not safe while close to me..*";
                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
            }
            break;
            }
            if (NewDialogueMessage != null)
            {
                Main.npcChatText = NewDialogueMessage;
            }
        }
Beispiel #18
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            if (firstButton)
            {
                switch (AiStage)
                {
                default:
                    AiStage++;
                    break;

                case 1:
                    AiStage = 4;
                    break;

                case 3:
                case 4:
                    if (PlayerUsingDryadSet(Main.player[npc.target]))
                    {
                        AiStage = 6;
                    }
                    else
                    {
                        if (!PlayerMod.GetPlayerMainGuardian(Main.player[npc.target]).Active)
                        {
                            AiStage = 9;
                        }
                        else
                        {
                            AiStage = 5;
                        }
                    }
                    break;

                case 5:
                    AiStage = 8;
                    break;

                case 6:
                    if (!PlayerMod.GetPlayerMainGuardian(Main.player[npc.target]).Active)
                    {
                        AiStage = 9;
                    }
                    else
                    {
                        AiStage++;
                    }
                    break;

                case 7:
                    AiStage = 9;
                    break;

                case 11:
                    Main.npcChatText = "*I'm Malisha, by the way. I'll try enjoying my time here.*";
                    PlayerMod.AddPlayerGuardian(Main.player[npc.target], GuardianBase.Malisha);
                    PlayerMod.GetPlayerGuardian(Main.player[npc.target], GuardianBase.Malisha).IncreaseFriendshipProgress(1);
                    NpcMod.AddGuardianMet(GuardianBase.Malisha);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                    //npc.Transform(ModContent.NPCType<GuardianNPC.List.PantherGuardian>());
                    return;
                }
                Main.npcChatText = GetStepMessage();
            }
        }
Beispiel #19
0
        public string GetDialogueMessage(int DialogueID, out string Button1, out string Button2)
        {
            Button1 = Button2 = "";
            string Mes = "";

            switch (DialogueID)
            {
            case 0:
                Mes     = "*Thanks for helping me.*";
                Button1 = "Did you just fall from the sky?";
                break;

            case 1:
                Mes     = "*Yes, I tried to see If I could fly like a Reindeer. It didn't worked well...*";
                Button1 = "You doesn't look like a reindeer.";
                break;

            case 2:
                Mes     = "*And I'm not. My name is " + Base.Name + ", by the way.*";
                Button1 = "I'm " + Main.player[Main.myPlayer].name;
                break;

            case 3:
                Mes = "*Hello. I have to practice for Miss North Pole, It's going to happen soon, close to when the Xmas you people celebrates happen.*";
                if (IsntXmasClose)
                {
                    Button1 = "But the the holiday has passed";
                }
                else
                {
                    Button1 = "The holiday will happen in some days.";
                }
                break;

            case 4:
                if (IsntXmasClose)
                {
                    Mes = "*What?! It has already passed? Nooooooooo!!! Well... I guess I can practice for next year?*";
                }
                else
                {
                    Mes = "*It's close to that day?! Oh my... I have so much to practice.*";
                }
                Button1 = "(Continue)";
                break;

            case 5:
                Mes     = "*Do you mind If I stay on your world for a while, while I practice?*";
                Button1 = "Yes, you can stay.";
                Button2 = "This world? No.";
                break;

            case 6:
                if (!Rejected)
                {
                    Mes = "*Thank you! I wonder if the people here are nice like you, too.*";
                }
                else
                {
                    Mes = "*Aww... By the way, If you change your mind, feel free to call me. Bye.*";
                }
                Main.npcChatText = Mes;
                PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], 8);
                PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 8).IncreaseFriendshipProgress(1);
                NpcMod.AddGuardianMet(8, "", !Rejected);
                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                return("");

            case 100:
                Mes     = "*Oh, hello. It's you again.*";
                Button1 = "Still trying to fly?";
                break;

            case 101:
                Mes     = "*Yes, but I'm still trying to fly...*";
                Button1 = "Why don't you stop doing that?";
                break;

            case 102:
                Mes     = "*I just can't give up being a model.*";
                Button1 = "You can try being a model without flying";
                break;

            case 103:
                Mes     = "*I can try... Since I'm here, I guess I'll hang around.*";
                Button1 = "Be welcome";
                break;

            case 104:
                NpcMod.AddGuardianMet(8);
                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                break;
            }
            return(Mes);
        }
Beispiel #20
0
        public override void AI()
        {
            if (GhostFoxHauntLifted)
            {
                SetPassive();
            }
            RevivingSomeone = false;
            YOffset         = ((float)Math.Sin(Main.GlobalTime * 2)) * 3;
            bool ReduceOpacity = Main.dayTime && !Main.eclipse && npc.position.Y < Main.worldSurface * 16 && Main.tile[(int)(npc.Center.X) / 16, (int)(npc.Center.Y / 16)].wall == 0;

            if (ReduceOpacity)
            {
                float MinOpacity = !PostBossKillDialogue ? 0 : 0.2f;
                if (Opacity > MinOpacity)
                {
                    Opacity -= 0.005f;
                    if (Opacity <= 0)
                    {
                        npc.active = false;
                        return;
                    }
                    if (Opacity > 0 && Opacity < MinOpacity)
                    {
                        Opacity = MinOpacity;
                    }
                }
            }
            else
            {
                if (Opacity < 1)
                {
                    Opacity += 0.005f;
                    if (Opacity > 1)
                    {
                        Opacity = 1;
                        return;
                    }
                }
            }
            if (PassiveAI)
            {
                Idle = true;
            }
            else if (PostBossKillDialogue)
            {
                if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 48)
                {
                    if (npc.Center.X < Main.player[npc.target].Center.X)
                    {
                        MoveRight = true;
                    }
                    else
                    {
                        MoveLeft = true;
                    }
                }
                else
                {
                    if (Main.player[npc.target].GetModPlayer <PlayerMod>().KnockedOut)
                    {
                        Main.player[npc.target].GetModPlayer <PlayerMod>().ReviveBoost += 2;
                        if (npc.Center.X < Main.player[npc.target].Center.X)
                        {
                            npc.direction = 1;
                        }
                        else
                        {
                            npc.direction = -1;
                        }
                    }
                }
            }
            else if (PlayerChaseTime == 0)
            {
                Idle = true;
                npc.TargetClosest(false);
                Player player = Main.player[npc.target];
                if (((npc.direction == -1 && player.Center.X < npc.Center.X) || (npc.direction == 1 && player.Center.X > npc.Center.X)) && IsInPerceptionRange(player, 400, 300) && Collision.CanHitLine(npc.position, npc.width, npc.height, player.position, player.width, player.height))
                {
                    PlayerChaseTime = 200;
                }
            }
            else
            {
                Player player = Main.player[npc.target];
                if (Collision.CanHitLine(npc.position, npc.width, npc.height, player.position, player.width, player.height))
                {
                    PlayerChaseTime = 200;
                }
                else
                {
                    PlayerChaseTime--;
                }
                if (PlayerChaseTime > 0)
                {
                    if (player.Center.X < npc.Center.X)
                    {
                        MoveLeft = true;
                    }
                    else
                    {
                        MoveRight = true;
                    }
                    if (player.position.Y < npc.position.Y)
                    {
                        if (JumpTime > 0 || (npc.velocity.Y == 0 && JumpTime == 0))
                        {
                            Jump = true;
                        }
                    }
                    else if (player.position.Y + player.height > npc.position.Y + npc.height && npc.velocity.Y == 0)
                    {
                        npc.position.Y += 8;
                    }
                    Microsoft.Xna.Framework.Rectangle rect = new Microsoft.Xna.Framework.Rectangle((int)npc.Center.X, (int)npc.position.Y + npc.height, Base.Width, Base.Height);
                    rect.X -= (int)(rect.Width * 0.5f);
                    rect.Y -= rect.Height;
                    if (player.getRect().Intersects(rect))
                    {
                        if (PlayerMod.PlayerHasGuardian(player, GuardianBase.Fluffles))
                        {
                            SayMessage(Main.rand.NextDouble() <= 0.5 ? "(She seems to have missed your company.)" : "(She seems really happy for seeing you.)");
                            WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                            //npc.active = false;
                            //Main.NewText(PlayerMod.GetPlayerGuardian(player, GuardianBase.Fluffles).Name + " fades away.");
                            return;
                        }
                        else
                        {
                            List <int> CurseIDs = new List <int>();
                            CurseIDs.Add(ModContent.BuffType <Buffs.GhostFoxHaunts.SkullHaunt>());
                            if (NPC.downedBoss2)
                            {
                                CurseIDs.Add(ModContent.BuffType <Buffs.GhostFoxHaunts.BeeHaunt>());
                            }
                            if (Main.hardMode)
                            {
                                CurseIDs.Add(ModContent.BuffType <Buffs.GhostFoxHaunts.MeatHaunt>());
                                CurseIDs.Add(ModContent.BuffType <Buffs.GhostFoxHaunts.SawHaunt>());
                            }
                            if (NPC.downedPlantBoss)
                            {
                                CurseIDs.Add(ModContent.BuffType <Buffs.GhostFoxHaunts.ConstructHaunt>());
                            }
                            player.AddBuff(CurseIDs[Main.rand.Next(CurseIDs.Count)], 5);
                            //player.GetModPlayer<PlayerMod>().EnterDownedState(true);
                            if (player.statLife == 1)
                            {
                                player.statLife++;
                            }
                            player.Hurt(Terraria.DataStructures.PlayerDeathReason.ByCustomReason(" didn't survived the haunt..."), 1, 0, false, true, false);
                            player.GetModPlayer <PlayerMod>().EnterDownedState(true);
                            player.statLife = 1;

                            /*for (int n = 0; n < 200; n++)
                             * {
                             *  if (Main.npc[n].active && !Main.npc[n].friendly)
                             *  {
                             *      Main.npc[n].active = false;
                             *  }
                             * }*/
                            MainMod.DoBlackoutPlayer();
                            WorldMod.SkipTime(Main.rand.Next(40, 85) * 0.1f);
                            //WorldMod.SkipTimeUntilMorning();
                            npc.active = false;
                            return;
                            //WorldGen.SaveAndQuit();
                        }
                    }
                }
            }
            base.AI();
        }
Beispiel #21
0
        public override void AI()
        {
            Idle = false;
            if (FirstFrame)
            {
                int tileX = (int)(npc.Center.X * (1f / 16)), tileY = (int)(npc.Center.Y * (1f / 16));
                for (int y = 0; y >= -4; y--)
                {
                    for (int x = -2; x < 3; x++)
                    {
                        int TileX = tileX + x, TileY = tileY + y;
                        if (Main.tile[TileX, TileY].active() && Main.tile[TileX, TileY].type == Terraria.ID.TileID.Trees)
                        {
                            int SizeCount = 0;
                            while (Main.tile[TileX, TileY].active() && Main.tile[TileX, TileY].type == Terraria.ID.TileID.Trees)
                            {
                                TileY--;
                                SizeCount++;
                            }
                            TileY += 3;
                            if (SizeCount >= 9 && Main.tile[TileX, TileY].active() && Main.tile[TileX, TileY].type == Terraria.ID.TileID.Trees)
                            {
                                npc.position.X = TileX * 16 + 8 - npc.width * 0.25f;
                                npc.position.Y = TileY * 16 - npc.height * 0.5f;
                                return;
                            }
                        }
                    }
                }
            }
            if (Sleeping)
            {
                npc.velocity  = Vector2.Zero;
                npc.noGravity = true;
                int  TileCenterX     = (int)((npc.position.X + npc.width * 0.25f) * (1f / 16));
                int  TileCenterY     = (int)(npc.Center.Y * (1f / 16));
                bool SuspendedByTree = false;
                Tile tile            = Framing.GetTileSafely(TileCenterX, TileCenterY);
                if (tile != null && tile.active())
                {
                    SuspendedByTree = true;
                }
                if (!SuspendedByTree)
                {
                    Sleeping = false;
                    SayMessage("*W-what?!*", true);
                    npc.TargetClosest();
                }
                return;
            }
            npc.noGravity = false;
            bool PlayerKnowsGuardian = PlayerMod.PlayerHasGuardian(Main.player[npc.target], GuardianID);

            if (Step > 0)
            {
                if (Step < 5 && Math.Abs(Main.player[npc.target].Center.X - npc.Center.X) >= 1200)
                {
                    SayMessage("*Hey! I'm talking to you!*");
                    Step            = 1;
                    Timer           = 0;
                    Idle            = true;
                    PlayerMovedAway = true;
                }
                else
                {
                    if (PlayerMovedAway)
                    {
                        SayMessage("*You returned, now you have to listen to me.*");
                        Timer           = -120;
                        PlayerMovedAway = false;
                    }
                    if (Main.player[npc.target].Center.X < npc.Center.X)
                    {
                        npc.direction = -1;
                    }
                    else
                    {
                        npc.direction = 1;
                    }
                }
            }
            switch (Step)
            {
            case 0:
                if (npc.velocity.Y == 0)
                {
                    Timer++;
                    if (Timer >= 150)
                    {
                        Timer = 0;
                        Step++;
                    }
                }
                break;

            case 1:
                if (Timer == 50)
                {
                    if (PlayerKnowsGuardian)
                    {
                        SayMessage("*Again you destroyed the tree I was sleeping on.*", true);
                    }
                    else
                    {
                        SayMessage("*What is your problem? Didn't see me there?*", true);
                    }
                }
                Timer++;
                if (Timer >= 260)
                {
                    Timer = 0;
                    Step++;
                }
                break;

            case 2:
                if (Timer == 0)
                {
                    if (PlayerKnowsGuardian)
                    {
                        SayMessage("*Do you have anything against me sleeping on trees or something.*", true);
                    }
                    else
                    {
                        SayMessage("*Next time you want to get some lumber, look up-!*", true);
                    }
                }
                Timer++;
                if (Timer >= 210)
                {
                    Timer = 0;
                    Step++;
                }
                break;

            case 3:
                if (Timer == 0)
                {
                    if (PlayerKnowsGuardian)
                    {
                        SayMessage("*Ugh... Whatever...*", true);
                    }
                    else
                    {
                        SayMessage("*Wait a minute, aren't you a Terrarian.*", true);
                    }
                }
                Timer++;
                if (Timer >= 180)
                {
                    Timer = 0;
                    Step++;
                }
                break;

            case 4:
                if (Timer == 0)
                {
                    if (PlayerKnowsGuardian)
                    {
                        SayMessage("*I'm here if you ever need a medic... Now I need to look for a safe place for a nap.*", true);
                        NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                        WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                        return;
                    }
                    else
                    {
                        SayMessage("*Hm... I wonder if...*", true);
                    }
                }
                Timer++;
                if (Timer >= 180)
                {
                    Timer = 0;
                    Step++;
                }
                break;

            case 5:
                if (Timer == 0)
                {
                    SayMessage("*If you can understand me, could you try speaking to me?*", true);
                    Timer++;
                }
                break;

            default:
                if (Step >= 6)
                {
                    bool AnyoneSpeakingToMe = false;
                    for (int i = 0; i < 255; i++)
                    {
                        if (Main.player[i].active && Main.player[i].talkNPC == npc.whoAmI)
                        {
                            AnyoneSpeakingToMe = true;
                            break;
                        }
                    }
                    if (!AnyoneSpeakingToMe)
                    {
                        Step  = 5;
                        Timer = 1;
                        SayMessage("*I still would like if we could speak some more, Terrarian.*");
                    }
                }
                break;
            }
            base.AI();
        }
Beispiel #22
0
        public override void AI()
        {
            int NextStep = NpcRecruitStep;

            switch (NpcRecruitStep)
            {
            case IdleStep:
            {
                Idle = true;
                Rectangle SightRange = new Rectangle((int)npc.Center.X, (int)npc.Center.Y, 300, 300);
                SightRange.Y -= (int)(SightRange.Height * 0.5f);
                if (npc.direction < 0)
                {
                    SightRange.X -= SightRange.Width;
                }
                DialogueDuration++;
                if (DialogueDuration >= 600)
                {
                    DialogueDuration -= 600;
                    switch (Main.rand.Next(5))
                    {
                    case 0:
                        SayMessage("*Hm... It must be around here somewhere...*");
                        break;

                    case 1:
                        SayMessage("*Come on... Show up...*");
                        break;

                    case 2:
                        SayMessage("*...It's around here... I smell It.*");
                        break;

                    case 3:
                        SayMessage("*Terrarian, where are you...*");
                        break;

                    case 4:
                        SayMessage("*Once I catch that Terrarian.... Ugh...*");
                        break;
                    }
                }
                for (int p = 0; p < 255; p++)
                {
                    if (Main.player[p].active && !Main.player[p].dead)
                    {
                        if (Main.player[p].getRect().Intersects(SightRange) && Collision.CanHitLine(npc.position, npc.width, npc.height, Main.player[p].position, Main.player[p].width, Main.player[p].height) &&
                            !Main.player[p].GetModPlayer <PlayerMod>().ControllingGuardian)
                        {
                            npc.target = p;
                            NextStep   = CallingOutPlayerStep;
                            break;
                        }
                    }
                }
            }
            break;

            case CallingOutPlayerStep:
            {
                Idle = false;
                if (DialogueDuration == 0)
                {
                    if (PlayerMod.PlayerHasGuardian(Main.player[npc.target], GuardianID, GuardianModID))
                    {
                        SayMessage("*Hey, Terrarian! Over here!*");
                    }
                    else if (Main.player[npc.target].GetModPlayer <PlayerMod>().KnockedOut)
                    {
                        SayMessage("*You there! Hang on!*");
                    }
                    else
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            SayMessage("*Hey! You there! Stop!*");
                        }
                        else
                        {
                            SayMessage("*Hey! You! Don't move!*");
                        }
                    }
                }
                if (DialogueDuration >= 120)
                {
                    NextStep = ChasingPlayerStep;
                }
                else
                {
                    DialogueDuration++;
                }
                if (Main.player[npc.target].Center.X < npc.Center.X)
                {
                    npc.direction = -1;
                }
                else
                {
                    npc.direction = 1;
                }
                if (!Main.player[npc.target].active)
                {
                    NextStep = IdleStep;
                    SayMessage("*Hm... " + (Main.player[npc.target].Male ? "He" : "She") + " disappeared...*");
                }
                else if (Main.player[npc.target].dead)
                {
                    NextStep = IdleStep;
                    SayMessage("*Well... That's... Horrible...*");
                }
            }
            break;

            case ChasingPlayerStep:
            {
                Player player = Main.player[npc.target];
                if (player.Center.X < npc.Center.X)
                {
                    MoveLeft = true;
                }
                else
                {
                    MoveRight = true;
                }
                if (!player.GetModPlayer <PlayerMod>().KnockedOut&& npc.velocity.Y == 0 && player.velocity.Y != 0)
                {
                    Jump = true;
                }
                if (PlayerMod.PlayerHasGuardian(Main.player[npc.target], GuardianID, GuardianModID) && Math.Abs(player.Center.X - npc.Center.X) < 80)
                {
                    NextStep = SpeakingToAlreadyKnownPlayer;
                }
                else if (player.getRect().Intersects(npc.getRect()))
                {
                    if (Main.halloween)
                    {
                        MainMod.TriggerCompanionJS(GuardianID);
                    }
                    if (PlayerMod.PlayerHasGuardian(Main.player[npc.target], GuardianID, GuardianModID))
                    {
                        NextStep = SpeakingToAlreadyKnownPlayer;
                    }
                    else
                    {
                        NextStep = InvestigatingPlayerStep;
                    }
                }
                if (!player.active)
                {
                    NextStep = IdleStep;
                    SayMessage("*Hm... " + (Main.player[npc.target].Male ? "He" : "She") + " disappeared...*");
                }
                else if (player.dead)
                {
                    NextStep = IdleStep;
                    SayMessage("*Damn, I'm too late...*");
                }
            }
            break;

            case InvestigatingPlayerStep:
            {
                if (DialogueDuration == 0)
                {
                    FindFrame(0);
                }
                Player player = Main.player[npc.target];
                if (player.mount.Active)
                {
                    player.mount.Dismount(player);
                }
                if (player.GetModPlayer <PlayerMod>().MountedOnGuardian)
                {
                    foreach (TerraGuardian tg in player.GetModPlayer <PlayerMod>().GetAllGuardianFollowers)
                    {
                        if (tg.Active && tg.PlayerMounted)
                        {
                            tg.ToggleMount(true, false);
                        }
                    }
                }
                player.immuneTime    = 90;
                player.immuneNoBlink = true;
                Vector2 PlayerPosition = new Vector2(npc.Center.X + 32 * npc.direction, npc.position.Y + npc.height);
                player.fullRotationOrigin = new Vector2(player.width, player.height) * 0.5f;
                player.aggro = -99999;
                if (npc.direction > 0)
                {
                    player.fullRotation = 1.570796f;
                    player.direction    = -1;
                }
                else
                {
                    player.fullRotation = -1.570796f;
                    //PlayerPosition.X *= -1;
                    player.direction = 1;
                }
                DrawInFrontOfPlayers.Add(npc.whoAmI);
                player.velocity = Vector2.Zero;
                player.Center   = PlayerPosition;
                player.statLife++;
                if (player.mount.Active)
                {
                    player.mount.Dismount(player);
                }
                player.gfxOffY = -2;
                player.AddBuff(Terraria.ID.BuffID.Cursed, 5);
                if (npc.velocity.X != 0 || npc.velocity.Y != 0)
                {
                }
                else if (player.GetModPlayer <PlayerMod>().KnockedOut)
                {
                    if (DialogueDuration == 0)
                    {
                        SayMessage("*Better I take care of those wounds first.*");
                        DialogueDuration++;
                    }
                    player.GetModPlayer <PlayerMod>().ReviveBoost++;
                }
                else
                {
                    if (DialogueDuration % 210 == 0)
                    {
                        switch (DialogueDuration / 210)
                        {
                        case 0:
                            SayMessage("*Got you! Now don't move.*");
                            break;

                        case 1:
                            SayMessage("*Hm...*");
                            break;

                        case 2:
                            SayMessage("*Interesting...*");
                            break;

                        case 3:
                            SayMessage("*Uh huh...*");
                            break;

                        case 4:
                            SayMessage("*But you're not the one I'm looking for...*");
                            break;

                        case 5:
                            NextStep                  = IntroductingToPlayerStep;
                            player.fullRotation       = 0;
                            player.fullRotationOrigin = new Vector2(40, 56) * 0.5f;
                            player.position           = npc.Bottom;
                            player.position.Y        -= player.height;
                            player.immuneNoBlink      = false;
                            break;
                        }
                    }
                    DialogueDuration++;
                }
                if (!player.active)
                {
                    NextStep = IdleStep;
                    SayMessage("*" + (Main.player[npc.target].Male ? "He" : "She") + " disappeared!*");
                }
            }
            break;

            case IntroductingToPlayerStep:
            {
                if (DialogueDuration == 0)
                {
                    Main.player[npc.target].talkNPC = npc.whoAmI;
                    DialogueDuration = 1;
                    Main.npcChatText = GetChat();
                }
                if (!Main.player[npc.target].active)
                {
                    npc.TargetClosest(false);
                    DialogueDuration = 1;
                }
                if (DialogueDuration > 1 && Main.player[npc.target].talkNPC != npc.whoAmI)
                {
                    DialogueDuration = 1;
                }
            }
            break;

            case SpeakingToAlreadyKnownPlayer:
            {
                if (DialogueDuration % 180 == 0)
                {
                    switch (DialogueDuration / 180)
                    {
                    case 0:
                        SayMessage("*I didn't expected to see you here.*");
                        break;

                    case 1:
                        SayMessage("*I think I may have caught that Terrarian's scent around here.*");
                        break;

                    case 2:
                        SayMessage("*Or maybe I accidentally caught your scent again.*");
                        break;

                    case 3:
                        SayMessage("*Anyway, If you need me, I'll be around.*");
                        break;

                    case 4:
                    {
                        NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                        WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                    }
                        return;
                    }
                }
                if (Math.Abs(Main.player[npc.target].Center.X - npc.Center.X) >= 30)
                {
                    Walk = true;
                    if (Main.player[npc.target].Center.X < npc.Center.X)
                    {
                        MoveLeft = true;
                    }
                    else
                    {
                        MoveRight = true;
                    }
                }
                else
                {
                    if (Main.player[npc.target].Center.X < npc.Center.X)
                    {
                        npc.direction = -1;
                    }
                    else
                    {
                        npc.direction = 1;
                    }
                }
                if (!Main.player[npc.target].active)
                {
                    NextStep = IdleStep;
                    SayMessage("*" + (Main.player[npc.target].Male ? "He" : "She") + " disappeared!*");
                }
                DialogueDuration++;
            }
            break;
            }
            if (NextStep != NpcRecruitStep)
            {
                NpcRecruitStep   = NextStep;
                DialogueDuration = 0;
            }
            base.AI();
        }
Beispiel #23
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            if (RequestComplete)
            {
                if (firstButton)
                {
                    if (HugPassed)
                    {
                        int HuggedPlayer = HuggingPlayer;
                        WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                        //npc.Transform(ModContent.NPCType<GuardianNPC.List.BearNPC>());
                        bool PlayerHasVladimir = PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianID);
                        PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID);
                        if (!PlayerHasVladimir)
                        {
                            PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID).IncreaseFriendshipProgress(1);
                        }
                        NpcMod.AddGuardianMet(GuardianID);
                        if (HuggedPlayer > -1)
                        {
                            Player player = Main.player[HuggedPlayer];
                            foreach (TerraGuardian tg in MainMod.ActiveGuardians.Values)
                            {
                                if (tg.ID == GuardianID && tg.ModID == GuardianModID)
                                {
                                    if (tg.StartNewGuardianAction(new Companions.Vladimir.HugAction(Main.player[HuggedPlayer]), 0))
                                    {
                                        Main.npcChatText = "*Thank you! I will try finding me a empty house to move in, but first, I will wait until ask me to stop hugging you.*";
                                    }
                                    else
                                    {
                                        Main.npcChatText = "*Thank you! I could hug you more, but for some reason I can't. Just tell me whenever you need one. Now I will try looking for a house to live.*";
                                    }
                                    break;
                                }
                            }
                        }
                        else
                        {
                            Main.npcChatText = "*Thank you! I will try looking for a house for me to live. I see you another time.*";
                        }
                        return;
                    }
                    else if (HuggingPlayer == -1)
                    {
                        npc.ai[0]     = 0;
                        HuggingPlayer = Main.myPlayer;
                        if (PlayerHasVladimir)
                        {
                            Main.npcChatText = "*Please be patient, this wont take long.*";
                        }
                        else
                        {
                            Main.npcChatText = "*It wont take too long.*";
                        }
                    }
                    else if (HuggingPlayer == Main.myPlayer)
                    {
                        Main.npcChatText      = "*Aww... I wanted some more hug...*";
                        HuggingPlayer         = -1;
                        HasHugCommentHappened = false;
                    }
                }
                else
                {
                    if (HugPassed)
                    {
                        Main.npcChatText = "*Oh! Alright, alright. Say... Can I move in to your world? Maybe there are people who need hugs here.*";
                        if (HuggingPlayer > -1)
                        {
                            Main.player[HuggingPlayer].Center = npc.Center;
                            HuggingPlayer = -1;
                        }
                    }
                    else
                    {
                        if (PlayerHasVladimir)
                        {
                            switch (Main.rand.Next(5))
                            {
                            case 0:
                                Main.npcChatText = "*We have done that before, give me a hug.*";
                                break;

                            case 1:
                                Main.npcChatText = "*Don't be like that, you know I wont hurt you.*";
                                break;

                            case 2:
                                Main.npcChatText = "*That gives me flashbacks of when we first met. Or was It another Terrarian?*";
                                break;

                            case 3:
                                Main.npcChatText = "*You will refuse my hug? I'm sad now.*";
                                break;

                            case 4:
                                Main.npcChatText = "*I've been walking for long, would be nice to hug someone friendly.*";
                                break;
                            }
                        }
                        else
                        {
                            switch (Main.rand.Next(6))
                            {
                            case 0:
                                Main.npcChatText = "*Come on, It's just a hug. Are you scared of me?*";
                                break;

                            case 1:
                                Main.npcChatText = "*I need that to make me feel better. It's been a long time since I last saw a person.*";
                                break;

                            case 2:
                                Main.npcChatText = "*I wont eat you or something. Come on, give me a hug.*";
                                break;

                            case 3:
                                Main.npcChatText = "*I'm not a bad person, I wont hurt you either, trust me.*";
                                break;

                            case 4:
                                Main.npcChatText = "*That saddens me, why don't you give me a hug?*";
                                break;

                            case 5:
                                Main.npcChatText = "*You wont end up like the fishs, I just want a hug.*";
                                break;
                            }
                        }
                    }
                }
            }
            else if (RequestTaken)
            {
                if (firstButton)
                {
                    int Fish = Main.player[Main.myPlayer].CountItem(FishID);
                    for (int i = 0; i < 50; i++)
                    {
                        if (Main.player[Main.myPlayer].inventory[i].type == FishID)
                        {
                            Main.player[Main.myPlayer].inventory[i].SetDefaults(0, true);
                        }
                    }
                    if (FishsTaken + Fish > 255)
                    {
                        FishsTaken = 255;
                    }
                    else
                    {
                        FishsTaken += (byte)Fish;
                    }
                    if (FishsTaken >= FishsToTake)
                    {
                        Main.npcChatText = "*I'm stuffed. Thank you friend. You helped me, and I can help you if you give me a hug.*";
                        RequestComplete  = true;
                    }
                    else
                    {
                        Main.npcChatText = "*Amazing! (He eats them) I'm still hungry... Could you get some more " + FishName + " for me?*";
                    }
                }
                else
                {
                }
            }
            else
            {
                if (firstButton)
                {
                    RequestTaken     = true;
                    FishsToTake      = (byte)Main.rand.Next(7, 13);
                    Main.npcChatText = "*Thank you! I need some Honeyfins. Please be fast, I'm so hungry...*";
                }
                else
                {
                    Main.npcChatText = "*Oh... I'll get back to trying to get some fish then... (Stomach growling) Be quiet, I know I'm hungry.*";
                }
            }
        }
Beispiel #24
0
        public override void AI()
        {
            AlexRecruitScripts.AlexNPCPosition = npc.whoAmI;
            const int Distance = 1024;
            int       SpawnPosX = AlexRecruitScripts.TombstoneTileX * 16, SpawnPosY = AlexRecruitScripts.TombstoneTileY * 16;
            bool      MoveLeft = false, MoveRight = false, Jump = false, Dash = false;
            string    TextToSay     = "";
            bool      PlayerOnFloor = false;

            npc.npcSlots = 1;
            switch ((int)npc.ai[AI_TYPE])
            {
            case 0:     //Wait for Player
                npc.TargetClosest(true);
                bool TeleportToSpawn = false;
                if (npc.target > -1)
                {
                    Player player = Main.player[npc.target];
                    PlayerIsMale = player.Male;
                    Rectangle FoV = new Rectangle(0, -150, 250, 300);
                    if (npc.direction < 0)
                    {
                        FoV.X -= FoV.Width;
                    }
                    FoV.X += (int)npc.Center.X;
                    FoV.Y += (int)npc.Center.Y;
                    if (FoV.Intersects(player.getRect()) && Collision.CanHitLine(npc.position, npc.width, npc.height, player.position, player.width, player.height))
                    {
                        //Chase Player
                        npc.ai[AI_TYPE]  = 1;
                        npc.ai[AI_TIMER] = 0;
                    }
                    else
                    {
                        //Keep looking for player
                        float XDifference = SpawnPosX - npc.Center.X, YDifference = SpawnPosY - npc.Center.Y;
                        if (Math.Abs(XDifference) >= NPC.sWidth || Math.Abs(YDifference) >= NPC.sHeight)
                        {
                            TeleportToSpawn = true;
                        }
                        else if (Math.Abs(XDifference) >= 16 || Math.Abs(YDifference) >= npc.height)
                        {
                            if (XDifference < 0)
                            {
                                MoveLeft = true;
                            }
                            else
                            {
                                MoveRight = true;
                            }
                        }
                    }
                }
                else
                {
                    TeleportToSpawn = Math.Abs(npc.Center.X - SpawnPosX) >= 16 || Math.Abs(npc.Center.Y - SpawnPosY) >= npc.height;
                }
                if (TeleportToSpawn)
                {
                    npc.position.X = AlexRecruitScripts.TombstoneTileX - npc.width * 0.5f;
                    npc.position.Y = AlexRecruitScripts.TombstoneTileY - npc.height;
                }
                break;

            case 1:
                if (npc.target == -1)
                {
                    npc.ai[AI_TYPE]  = 0;
                    npc.ai[AI_TIMER] = 0;
                }
                else
                {
                    Player player = Main.player[npc.target];
                    float  XDifference = player.Center.X - npc.Center.X, YDifference = player.Center.Y - npc.Center.Y;
                    if (Math.Abs(XDifference) >= NPC.sWidth || Math.Abs(YDifference) >= NPC.sHeight)
                    {
                        //TeleportToSpawn = true;
                        npc.ai[AI_TYPE]  = 0;
                        npc.ai[AI_TIMER] = 0;
                    }
                    else
                    {
                        if (XDifference < 0)
                        {
                            MoveLeft = true;
                        }
                        else
                        {
                            MoveRight = true;
                        }
                        if (npc.velocity.Y == 0 && Math.Abs(XDifference) <= AlexGuardianBase.Width * 2 + AlexGuardianBase.JumpSpeed * 2)
                        {
                            Jump = true;
                        }
                        if (npc.Hitbox.Intersects(player.getRect()))
                        {
                            npc.ai[AI_TYPE]  = 2;
                            npc.ai[AI_TIMER] = 0;
                            MessageTime      = 30;
                            if (Main.halloween)
                            {
                                MainMod.TriggerAlexJS();
                            }
                            if (!PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], AlexID))
                            {
                                PlayerOnFloor = true;
                            }
                            if (PlayerMod.PlayerMountedOnGuardian(Main.player[Main.myPlayer]))
                            {
                                Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().MountGuardian.ToggleMount(true, false);
                            }
                        }
                    }
                }
                break;

            case 2:     //Speaks with player
            {
                npc.npcSlots = 200;
                if (npc.target == -1)
                {
                    //Go to the chat where he asks where the player went, then return to AI 0;
                    npc.ai[AI_TYPE]  = 3;
                    npc.ai[AI_TIMER] = 0;
                }
                else
                {
                    if (npc.velocity.X != 0 || npc.velocity.Y != 0)         //Only chat when lands.
                    {
                        break;
                    }
                    int  DialogueTimer      = (int)npc.ai[AI_TIMER] / 30;
                    bool Trigger            = npc.ai[AI_TIMER] % 30 == 15;
                    bool HasAlreadyGuardian = false;
                    if (PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], AlexID))
                    {
                        HasAlreadyGuardian = true;
                    }
                    if (Trigger)
                    {
                        if (HasAlreadyGuardian)
                        {
                            switch (DialogueTimer / 5)
                            {
                            case 0:
                                TextToSay = "Hey buddy-buddy!";
                                break;

                            case 1:
                                TextToSay = "It's good to see your face again.";
                                break;

                            case 2:
                                TextToSay = "Anything you want, I'm here to protect you.";
                                break;

                            case 3:
                                NpcMod.AddGuardianMet(AlexID);
                                WorldMod.TurnNpcIntoGuardianTownNpc(npc, AlexID);
                                //npc.Transform(ModContent.NPCType<GuardianNPC.List.GiantDogGuardian>());
                                break;
                            }
                        }
                        else
                        {
                            switch (DialogueTimer)
                            {
                            case 0:
                                TextToSay = "Hello! Who are you?";
                                break;

                            case 5:
                                TextToSay = "Are you my new friend? Do you want to be my friend?";
                                break;

                            case 10:
                                TextToSay = "You're saying that I'm crushing your chest? Oh! My bad!";
                                break;

                            case 12:
                                npc.velocity.X -= 15f * npc.direction;
                                npc.velocity.Y -= AlexGuardianBase.JumpSpeed;
                                break;

                            case 15:
                                TextToSay = "By the way, I'm " + AlexGuardianBase.Name + ", let's go on an adventure.";
                                break;

                            case 20:
                                //Guardian GET!
                                PlayerMod.AddPlayerGuardian(Main.player[npc.target], AlexID);
                                PlayerMod.GetPlayerGuardian(Main.player[npc.target], AlexID).IncreaseFriendshipProgress(1);
                                WorldMod.TurnNpcIntoGuardianTownNpc(npc, AlexID);
                                NpcMod.AddGuardianMet(AlexID);
                                break;
                            }
                        }
                    }
                    if (!HasAlreadyGuardian && DialogueTimer < 12)
                    {
                        PlayerOnFloor = true;
                    }
                    if (HasAlreadyGuardian)
                    {
                        float XDifference = Main.player[Main.myPlayer].Center.X - npc.Center.X;
                        if (Math.Abs(XDifference) > AlexGuardianBase.Width)
                        {
                            if (XDifference > 0)
                            {
                                MoveRight = true;
                            }
                            else
                            {
                                MoveLeft = true;
                            }
                        }
                    }
                    npc.ai[AI_TIMER]++;
                }
            }
            break;

            case 3:     //Player disappeared/is missing chat
            {
                int  DialogueTimer = (int)npc.ai[AI_TIMER] / 30;
                bool Trigger       = npc.ai[AI_TIMER] % 30 == 15;
                if (Trigger)
                {
                    if (DialogueTimer == 3)
                    {
                        TextToSay = "Where did " + (PlayerIsMale ? "he" : "she") + " go?";
                    }
                    if (DialogueTimer == 7)
                    {
                        TextToSay = "Better I go guard the tombstone then...";
                    }
                    if (DialogueTimer == 13)
                    {
                        npc.ai[AI_TYPE]  = 0;
                        npc.ai[AI_TIMER] = 0;
                    }
                }
                npc.ai[AI_TIMER]++;
            }
            break;
            }
            if (npc.target > -1)
            {
                Player        player   = Main.player[npc.target];
                TerraGuardian guardian = player.GetModPlayer <PlayerMod>().Guardian;
                if (PlayerOnFloor)
                {
                    Vector2 NewPlayerPosition = Vector2.Zero;
                    NewPlayerPosition.X         = npc.Center.X + (26) * npc.direction;
                    NewPlayerPosition.Y         = npc.position.Y + npc.height;
                    player.fullRotationOrigin.X = player.width * 0.5f;
                    player.fullRotationOrigin.Y = player.height * 0.5f;
                    player.velocity             = Vector2.Zero;
                    if (player.mount.Active)
                    {
                        player.mount.Dismount(player);
                    }
                    if (npc.velocity.Y != 0)
                    {
                        player.fullRotation = npc.direction * MathHelper.ToRadians(45);
                    }
                    else
                    {
                        player.fullRotation = npc.direction * MathHelper.ToRadians(90);
                    }
                    player.gfxOffY       = -2;
                    player.Center        = NewPlayerPosition;
                    player.direction     = -npc.direction;
                    player.immuneTime    = 30;
                    player.immuneNoBlink = true;
                    player.fallStart     = (int)player.position.Y / 16;
                    player.breath        = player.breathMax;
                    player.statLife++;
                    if (player.statLife > player.statLifeMax2)
                    {
                        player.statLife = player.statLifeMax2;
                    }
                    if (guardian.Active)
                    {
                        if (guardian.PlayerMounted)
                        {
                            guardian.PlayerMounted = false;
                        }
                        if (guardian.PlayerControl)
                        {
                            guardian.ImmuneTime = 5;
                            guardian.Rotation   = player.fullRotation;
                            guardian.Position.X = player.position.X - guardian.Height * 0.5f * npc.direction;
                            guardian.Position.Y = player.position.Y + guardian.Width * 0.25f;// -guardian.Width * 0.5f;
                        }
                    }
                }
                else if (LastOnFloor)
                {
                    player.fullRotation       = 0;
                    player.velocity.Y        -= 6.5f;
                    player.direction          = -npc.direction;
                    player.fullRotationOrigin = Vector2.Zero;
                    if (guardian.Active)
                    {
                        if (guardian.PlayerControl)
                        {
                            guardian.Rotation   = player.fullRotation;
                            guardian.Position.X = player.position.X;
                            guardian.Position.Y = player.position.Y;// -guardian.Height * 0.5f;
                            guardian.Velocity   = player.velocity;
                        }
                    }
                }
            }
            LastOnFloor = PlayerOnFloor;
            float Acceleration = AlexGuardianBase.Acceleration, MaxSpeed = AlexGuardianBase.MaxSpeed, Deceleration = AlexGuardianBase.SlowDown,
                  JumpSpeed = AlexGuardianBase.JumpSpeed;

            if (Dash)
            {
                MaxSpeed     *= 2;
                Acceleration *= 2;
            }
            int MaxJumpHeight = AlexGuardianBase.MaxJumpHeight;

            if (MoveLeft)
            {
                npc.direction   = -1;
                npc.velocity.X -= Acceleration;
                if (npc.velocity.X < -MaxSpeed)
                {
                    npc.velocity.X = -MaxSpeed;
                }
                if (npc.collideX && npc.velocity.Y == 0)
                {
                    Jump = true;
                }
            }
            if (MoveRight)
            {
                npc.direction   = 1;
                npc.velocity.X += Acceleration;
                if (npc.velocity.X > MaxSpeed)
                {
                    npc.velocity.X = MaxSpeed;
                }
                if (npc.collideX && npc.velocity.Y == 0)
                {
                    Jump = true;
                }
            }
            if (!MoveRight && !MoveLeft)
            {
                if (npc.velocity.X > 0)
                {
                    npc.velocity.X -= Deceleration;
                    if (npc.velocity.X < 0)
                    {
                        npc.velocity.X = 0;
                    }
                }
                if (npc.velocity.X < 0)
                {
                    npc.velocity.X += Deceleration;
                    if (npc.velocity.X > 0)
                    {
                        npc.velocity.X = 0;
                    }
                }
            }
            if (Jump)
            {
                if (JumpTime == 0)
                {
                    if (npc.velocity.Y == 0)
                    {
                        JumpTime        = MaxJumpHeight;
                        npc.velocity.Y -= JumpSpeed;
                    }
                }
                else
                {
                    if (npc.collideY)
                    {
                        JumpTime = 0;
                    }
                    else
                    {
                        JumpTime--;
                        npc.velocity.Y -= JumpSpeed;
                    }
                }
            }
            else
            {
                if (JumpTime != 0)
                {
                    JumpTime = 0;
                }
            }
            float StepSpeed = 2f, gfxOffY = 0f;

            Collision.StepUp(ref npc.position, ref npc.velocity, npc.width, npc.height, ref StepSpeed, ref gfxOffY);
            Vector4 SlopedCollision = Collision.SlopeCollision(npc.position, npc.velocity, npc.width, npc.height, 1f, false);

            npc.position = SlopedCollision.XY();
            npc.velocity = SlopedCollision.ZW();
            if (TextToSay != "")
            {
                MessageTime = 300;
                MessageText = TextToSay;

                /*if (Main.netMode == 0)
                 * {
                 *  Main.NewText("Giant Dog: " + TextToSay);
                 * }
                 * else
                 * {
                 *
                 * }*/
            }
        }
Beispiel #25
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            switch (DialogueStep)
            {
            case 1:
                if (MetBefore)
                {
                    NpcMod.AddGuardianMet(GuardianBase.CaptainStench);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.CaptainStench);
                }
                else
                {
                    DialogueStep     = 2;
                    Main.npcChatText = GetChat();
                }
                break;

            case 2:
                DialogueStep     = 3;
                Main.npcChatText = GetChat();
                break;

            case 3:
                DialogueStep     = 4;
                Main.npcChatText = GetChat();
                break;

            case 4:
                if (firstButton && HasMaterials)
                {
                    Main.npcChatText = "Thank you, these materials will be put to good use. Rest assured you won't be disappointed. Now then im ready for adventure when you are.";
                    int    BarsLeftToRemove = BarCount;
                    Player player           = Main.player[Main.myPlayer];
                    if (Main.player[Main.myPlayer].CountItem(Terraria.ID.ItemID.GoldBar) >= BarCount)
                    {
                        const int ToRemoveItemID = Terraria.ID.ItemID.GoldBar;
                        for (int i = 0; i < 50; i++)
                        {
                            if (player.inventory[i].type == ToRemoveItemID)
                            {
                                int ToDiscount = BarsLeftToRemove;
                                if (ToDiscount > player.inventory[i].stack)
                                {
                                    ToDiscount = player.inventory[i].stack;
                                }
                                player.inventory[i].stack -= ToDiscount;
                                BarsLeftToRemove          -= ToDiscount;
                                if (player.inventory[i].stack == 0)
                                {
                                    player.inventory[i].SetDefaults(0, true);
                                }
                                if (BarsLeftToRemove <= 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        const int ToRemoveItemID = Terraria.ID.ItemID.PlatinumBar;
                        for (int i = 0; i < 50; i++)
                        {
                            if (player.inventory[i].type == ToRemoveItemID)
                            {
                                int ToDiscount = BarsLeftToRemove;
                                if (ToDiscount > player.inventory[i].stack)
                                {
                                    ToDiscount = player.inventory[i].stack;
                                }
                                player.inventory[i].stack -= ToDiscount;
                                BarsLeftToRemove          -= ToDiscount;
                                if (player.inventory[i].stack == 0)
                                {
                                    player.inventory[i].SetDefaults(0, true);
                                }
                                if (BarsLeftToRemove <= 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    PlayerMod.AddPlayerGuardian(player, GuardianBase.CaptainStench);
                    NpcMod.AddGuardianMet(GuardianBase.CaptainStench);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.CaptainStench);
                }
                else
                {
                    Main.npcChatText = "Oh that's unfortunate. IF you ever stumble apon the metals please consider supplying them to me as I will be left stranded and defenseless here on a foriegn planet.";
                    DialogueStep     = 5;
                }
                break;
            }
        }
Beispiel #26
0
        public override void AI()
        {
            Idle = true;
            if (DialogueStep == 0)
            {
                Rectangle VisionPosition = new Rectangle(0, 0, 400, 300);
                VisionPosition.X = (int)npc.Center.X;
                VisionPosition.Y = (int)(npc.Center.Y - VisionPosition.Height * 0.5f);
                if (npc.direction < 0)
                {
                    VisionPosition.X -= VisionPosition.Width;
                }
                for (int p = 0; p < 255; p++)
                {
                    if (Main.player[p].active && !Main.player[p].dead && Main.player[p].getRect().Intersects(VisionPosition))
                    {
                        npc.target        = p;
                        DialogueStep      = 1;
                        PlayerHasMetGlenn = PlayerMod.PlayerHasGuardian(Main.player[p], GuardianID);
                        StareAt(Main.player[p]);
                        break;
                    }
                }
            }
            else
            {
                if (npc.target < 0 || npc.target > 255)
                {
                    DialogueStep = 0;
                    SayMessage("...");
                }
                else if (!Main.player[npc.target].active)
                {
                    DialogueStep = 0;
                    SayMessage((Main.player[npc.target].Male ? "He's" : "She's") + " gone. How?");
                }
                else if (Main.player[npc.target].dead)
                {
                    DialogueStep = 0;
                    SayMessage("I really didn't wanted to witness that.");
                }
                else
                {
                    Player player = Main.player[npc.target];
                    Idle = false;
                    bool HasBree    = PlayerMod.PlayerHasGuardianSummoned(player, GuardianBase.Bree),
                         HasSardine = PlayerMod.PlayerHasGuardianSummoned(player, GuardianBase.Sardine),
                         HasZacks   = PlayerMod.PlayerHasGuardianSummoned(player, GuardianBase.Zacks);
                    if (HasSardine)
                    {
                        PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine).LookAt(npc.Center);
                    }
                    if (HasBree)
                    {
                        PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree).LookAt(npc.Center);
                    }
                    if (HasZacks && (!HasBree && !HasSardine))
                    {
                        PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Zacks).LookAt(npc.Center);
                    }
                    if (Delay > 0)
                    {
                        Delay--;
                    }
                    else
                    {
                        switch (DialogueStep)
                        {
                        case 1:
                        {
                            if (PlayerHasMetGlenn)
                            {
                                StareAt(player);
                                Delay = SayMessage("Hey Terrarian, over here!");
                            }
                            else if (HasBree && HasSardine)
                            {
                                if (Main.rand.Next(2) == 0)
                                {
                                    StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree));
                                }
                                else
                                {
                                    StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine));
                                }
                                Delay = SayMessage("Mom! Dad! I'm glad you're alright.");
                            }
                            else if (HasBree)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree));
                                Delay = SayMessage("Mom! I'm glad you're safe, but... Where's dad?");
                            }
                            else if (HasSardine)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine));
                                Delay = SayMessage("Dad! I'm glad you're safe, but... Where's mom?");
                            }
                            else
                            {
                                StareAt(player);
                                Delay = SayMessage("Hey, Terrarian. Can you help me?");
                            }
                            DialogueStep = 2;
                        }
                        break;

                        case 2:
                        {
                            if (PlayerHasMetGlenn)
                            {
                                StareAt(player);
                                Delay = SayMessage("Since you moved out of the world, I was trying to look for where my house is at.");
                            }
                            else if (HasBree && HasSardine)
                            {
                                PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree).SaySomething("Glenn!!");
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine).SaySomething("Glenn, what are you doing here?");
                            }
                            else if (HasBree)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree).SaySomething("Glenn!! I'm glad you're safe. You didn't found your dad, either?");
                            }
                            else if (HasSardine)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine).SaySomething("Glenn, what are you doing here? And what you're saying about your mom? Wasn't she with you?");
                            }
                            else
                            {
                                if (Math.Abs(player.Center.X - npc.Center.X) >= 600 ||
                                    Math.Abs(player.Center.Y - npc.Center.Y) >= 400)
                                {
                                    Delay        = SayMessage("And " + (player.Male ? "he" : "she") + "'s gone....");
                                    DialogueStep = 0;
                                    //npc.target = -1;
                                }
                                else
                                {
                                    StareAt(player);
                                }
                                break;
                            }
                            DialogueStep = 3;
                        }
                        break;

                        case 3:
                        {
                            if (PlayerHasMetGlenn)
                            {
                                StareAt(player);
                                Delay = SayMessage("So far, I didn't had any luck with that...");
                            }
                            else if (HasBree && HasSardine)
                            {
                                Delay = SayMessage("I came here looking for you.");
                            }
                            else if (HasBree)
                            {
                                Delay = SayMessage("No, I didn't. I came here looking for both of you.");
                            }
                            else if (HasSardine)
                            {
                                Delay = SayMessage("She came looking for you, but It has been a long time. I'm glad that I found you.");
                            }
                            else if (HasZacks)         //Deactivated for now
                            {
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Zacks).SaySomething(
                                    "**");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 4;
                        }
                        break;

                        case 4:
                        {
                            if (PlayerHasMetGlenn)
                            {
                                StareAt(player);
                                Delay = SayMessage("Anyways, I'm here, if you need me.");
                                NpcMod.AddGuardianMet(GuardianID);
                                PlayerMod.AddPlayerGuardian(player, GuardianID);
                                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID);
                                return;
                            }
                            else if (HasBree)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree).SaySomething("But, It's too dangerous for you to be travelling alone.");
                            }
                            else if (HasSardine)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine).SaySomething("You should have waited for us at home.");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 5;
                        }
                        break;

                        case 5:
                        {
                            if (HasBree || HasSardine)
                            {
                                Delay = SayMessage("I know... But it has been a long time since I last saw you two.");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 6;
                        }
                        break;

                        case 6:
                        {
                            if (HasSardine)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine).SaySomething("At least you managed to get here safe. So, do you remember which world we came from?");
                            }
                            else if (HasBree)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree).SaySomething("I feel a bit better for seeing you again... Do you know our way back home?");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 7;
                        }
                        break;

                        case 7:
                        {
                            if (HasSardine || HasBree)
                            {
                                Delay = SayMessage("I... Forgot...");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 8;
                        }
                        break;

                        case 8:
                        {
                            if (HasBree)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree).SaySomething("...");
                            }
                            else if (HasSardine)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine).SaySomething("Well... Looks like you'll have to stay here meanwhile.");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 9;
                        }
                        break;

                        case 9:
                        {
                            if (HasBree)
                            {
                                Delay = SayMessage("What do we do now?");
                            }
                            else if (HasSardine)
                            {
                                Delay = SayMessage("Stay here? Do you think it will be fine?");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 10;
                        }
                        break;

                        case 10:
                        {
                            if (HasBree)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Bree).SaySomething("It seems like we'll have to live here for longer, until we remember where our home is.");
                            }
                            else if (HasSardine)
                            {
                                StareAt(PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine));
                                Delay = PlayerMod.GetPlayerSummonedGuardian(player, GuardianBase.Sardine).SaySomething("Don't worry about It, the people here are very nice.");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            DialogueStep = 11;
                        }
                        break;

                        case 11:
                        {
                            StareAt(player);
                            if (HasBree)
                            {
                                Delay = SayMessage("Alright. My name is " + Base.Name + ", I hope you don't mind if I stay with my parents.");
                            }
                            else if (HasSardine)
                            {
                                Delay = SayMessage("That's cool! My name is " + Base.Name + ", I hope you don't mind my stay here.");
                            }
                            else
                            {
                                Delay        = SayMessage("Wait, where did they go?");
                                DialogueStep = 2;
                                break;
                            }
                            NpcMod.AddGuardianMet(GuardianID, "", true);
                            PlayerMod.AddPlayerGuardian(player, GuardianID);
                            WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID);
                        }
                        break;
                        }
                    }
                }
            }
            base.AI();
        }
Beispiel #27
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            if (FinishedTalking)
            {
                return;
            }
            switch (EncounterTimes)
            {
            case 0:
                switch (DialogueStep)
                {
                case 0:
                    DialogueStep     = 1;
                    Main.npcChatText = "*Yes, I must ensure that in the case some of them ends up having their time up, I can take them where they belong.*";
                    break;

                case 1:
                    DialogueStep     = 2;
                    Main.npcChatText = "*Yes. Just like you, there is some place you'll be taken when you die. In the TerraGuardians case, it's a different place.*";
                    break;

                case 2:
                    DialogueStep     = 3;
                    Main.npcChatText = "*I will not tell you. Anyways, I hope you don't mind if I stay around your world for the time being.*";
                    break;

                case 3:
                    DialogueStep = 4;
                    if (firstButton)
                    {
                        Main.npcChatText = "*Thank you. You will probably not even notice me around, or at least see me few times.*";
                    }
                    else
                    {
                        Main.npcChatText = "*Hmph. Don't worry, you wont notice me around. Maybe sometimes. Be sure to not stay wherever has a TerraGuardian about to die, then.*";
                    }
                    FinishedTalking = true;
                    EncounterTimes++;
                    break;
                }
                break;

            case 1:
                switch (DialogueStep)
                {
                case 0:
                    DialogueStep = 1;
                    if (WorldGen.crimson)
                    {
                        Main.npcChatText = "*The Crimson? Hm, the name actually makes sense.*";
                    }
                    else
                    {
                        Main.npcChatText = "*The Corruption? Hm, interesting choice of name.*";
                    }
                    break;

                case 1:
                    DialogueStep     = 2;
                    Main.npcChatText = "*I was exploring this world, since there isn't a need for me to take any action right now.*";
                    break;

                case 2:
                    DialogueStep     = 3;
                    Main.npcChatText = "*Yes. Whenever I'm not necessary, I like to explore the world I will harvest from. That way I don't feel bored.*";
                    break;

                case 3:
                    DialogueStep     = 4;
                    Main.npcChatText = "*Indeed it is. Anyways, I will return to my travels.*";
                    FinishedTalking  = true;
                    EncounterTimes++;
                    break;
                }
                break;

            case 2:
                switch (DialogueStep)
                {
                case 0:
                    DialogueStep     = 1;
                    Main.npcChatText = "*Who built this place?*";
                    break;

                case 1:
                    DialogueStep     = 2;
                    Main.npcChatText = "*Can't you feel? The grudge, the horrors, the despair... All those souls...*";
                    break;

                case 2:
                    DialogueStep     = 3;
                    Main.npcChatText = "*I can understand that... You're not like me anyways...*";
                    break;

                case 3:
                    DialogueStep     = 4;
                    Main.npcChatText = "*I'm sorry... But leave me be for a while... I need to process all this..*";
                    FinishedTalking  = true;
                    EncounterTimes++;
                    break;
                }
                break;

            case 3:
                switch (DialogueStep)
                {
                case 0:
                    DialogueStep     = 1;
                    Main.npcChatText = "*At ease, Terrarian, It isn't particularly about you, beside It will involve you.*";
                    break;

                case 1:
                    DialogueStep     = 2;
                    Main.npcChatText = "*I spoke to the ones who sent me here about the dungeon, and they appointed me to act in this entire world.*";
                    break;

                case 2:
                    DialogueStep     = 3;
                    Main.npcChatText = "*Yes. They want to avoid more souls from being twisted, by whatever caused that in the dungeon, so I will be making delivery of souls of the deceased from here, includding Terrarians.*";
                    break;

                case 3:
                    DialogueStep     = 4;
                    Main.npcChatText = "*Don't worry, I will not harm anyone, at least unless something threatens to attack me.*";
                    break;

                case 4:
                    EncounterTimes++;
                    DialogueStep     = 5;
                    Main.npcChatText = "*I guess we will have enough time to know each other. You can call me Liebre, which was my name. I am now Terra Realm's reaper.*";
                    PlayerMod.AddPlayerGuardian(Main.LocalPlayer, GuardianBase.Liebre);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Liebre);
                    NpcMod.AddGuardianMet(GuardianBase.Liebre);
                    return;
                }
                break;
            }
        }
Beispiel #28
0
        public override void AI()
        {
            if (npc.direction == 0)
            {
                npc.direction = Main.rand.NextDouble() < 0.5 ? -1 : 1;
            }
            if (SceneID == SceneIDs.NoScene)
            {
                Idle = true;
                npc.TargetClosest(false);
                if (Main.player[npc.target].Distance(npc.Center) < 200)
                {
                    PlayerHasLeopold = false;
                    if (PlayerMod.PlayerHasGuardian(Main.player[npc.target], 10))
                    {
                        PlayerHasLeopold = true;
                        ChangeScene(SceneIDs.KnownPlayerSpottedByLeopold);
                        SayMessage("*Aaahhh!!! What is that?!**");
                    }
                    else
                    {
                        ChangeScene(SceneIDs.LeopoldSpotsThePlayer);
                        SayMessage("*Ack! W-what is that?!*");
                    }
                }
            }
            else
            {
                if (SceneID != SceneIDs.LeopoldFreeForRecruit && SceneID != SceneIDs.Flee)
                {
                    npc.npcSlots = 100;
                }
                Player player = Main.player[npc.target];
                if (SceneID < SceneIDs.ThinksAboutTryingToTalk)
                {
                    if (player.Distance(npc.Center) < 150)
                    {
                        SayMessage("*Ah!! It approached.*");
                        ChangeScene(SceneIDs.WondersIfPlayerWillAttackHim);
                        Jump = true;
                    }
                }
                if (SceneID >= SceneIDs.GotScaredUponPlayerApproach && SceneID < SceneIDs.PlayerDoesNothing)
                {
                    if (player.Distance(npc.Center) < 150)
                    {
                        if (player.Center.X - npc.Center.X < 0)
                        {
                            MoveRight = true;
                        }
                        else
                        {
                            MoveLeft = true;
                        }
                    }
                }
                if (SceneID >= SceneIDs.GotScaredUponPlayerApproach && SceneID < SceneIDs.AttemptsToRunAway1)
                {
                    if (player.Distance(npc.Center) < 100)
                    {
                        SayMessage("*Yaah!!! Please, Don't kill me...*");
                        ChangeScene(SceneIDs.Crying1);
                        Jump = true;
                    }
                }
                npc.FaceTarget();
                if (SceneTime <= 0)
                {
                    switch (SceneID)
                    {
                    case SceneIDs.LeopoldSpotsThePlayer:
                        SayMessage("*It's a funny kind of creature.*");
                        ChangeScene(SceneIDs.LeopoldSaysNeverSawAnythingLikeThat);
                        break;

                    case SceneIDs.LeopoldSaysNeverSawAnythingLikeThat:
                        SayMessage("*I've never seen something like that.*");
                        ChangeScene(SceneIDs.LeopoldQuestionsHimselfAboutCreature);
                        break;

                    case SceneIDs.LeopoldQuestionsHimselfAboutCreature:
                        SayMessage("*What kind of creature is it?*");
                        ChangeScene(SceneIDs.IsItTerrarian);
                        break;

                    case SceneIDs.IsItTerrarian:
                        SayMessage("*Could It be a Terrarian?*");
                        ChangeScene(SceneIDs.NoticesOutfit);
                        break;

                    case SceneIDs.NoticesOutfit:
                        SayMessage("*It surelly have unusual outfit...*");
                        ChangeScene(SceneIDs.QuestionsIfIsReallyATerrarian);
                        break;

                    case SceneIDs.QuestionsIfIsReallyATerrarian:
                        SayMessage("*Maybe, It is said that they inhabit this world.*");
                        if (player.GetModPlayer <PlayerMod>().Guardian.Active&& player.GetModPlayer <PlayerMod>().Guardian.Base.IsTerraGuardian)
                        {
                            ChangeScene(SceneIDs.NoticesOtherGuardians);
                        }
                        else
                        {
                            ChangeScene(SceneIDs.NoticesPlayerLooking);
                        }
                        break;

                    case SceneIDs.NoticesPlayerLooking:
                        SayMessage("*It is looking at me.*");
                        ChangeScene(SceneIDs.WondersPlayerReaction);
                        break;

                    case SceneIDs.WondersPlayerReaction:
                        SayMessage("*What is it planning to do?*");
                        ChangeScene(SceneIDs.IsPreparingAttack);
                        break;

                    case SceneIDs.IsPreparingAttack:
                        SayMessage("*Is it preparing to attack?*");
                        ChangeScene(SceneIDs.ThreatenUseSpell);
                        break;

                    case SceneIDs.ThreatenUseSpell:
                        SayMessage("*If It tries to attack, I will blow It with my spells.*");
                        ChangeScene(SceneIDs.FindsWeirdTheNoReaction, true);
                        break;

                    case SceneIDs.FindsWeirdTheNoReaction:
                        SayMessage("*Weird, It isn't doing anything.*");
                        ChangeScene(SceneIDs.ThinksAboutTryingToTalk);
                        break;

                    case SceneIDs.ThinksAboutTryingToTalk:
                        SayMessage("*Maybe If I try talking...*");
                        ChangeScene(SceneIDs.WondersIftheySpeak);
                        break;

                    case SceneIDs.WondersIftheySpeak:
                        SayMessage("*No... Wait, I don't even know if they can speak.*");
                        ChangeScene(SceneIDs.MentionsABook);
                        break;

                    case SceneIDs.MentionsABook:
                        SayMessage("*There is a book that theorizes that but...*");
                        ChangeScene(SceneIDs.ThinksAboutTrying);
                        break;

                    case SceneIDs.ThinksAboutTrying:
                        SayMessage("*Maybe If I try...*");
                        ChangeScene(SceneIDs.TriesTalking);
                        break;

                    case SceneIDs.TriesTalking:
                        SayMessage("*H-hey... Can you hear me?*");
                        ChangeScene(SceneIDs.WondersIfIsScared, true);
                        break;

                    case SceneIDs.WondersIfIsScared:
                        SayMessage("*(Maybe It's scared...)*");
                        ChangeScene(SceneIDs.SaysWontHurt);
                        break;

                    case SceneIDs.SaysWontHurt:
                        SayMessage("*Come here.. I wont hurt you...*");
                        ChangeScene(SceneIDs.TriesHidingFear, true);
                        break;

                    case SceneIDs.TriesHidingFear:
                        SayMessage("*(..Don't shake... You don't want to scare it...)*");
                        ChangeScene(SceneIDs.NoticesDidntWorked);
                        break;

                    case SceneIDs.NoticesDidntWorked:
                        SayMessage("*(Huh? Didn't worked? Maybe If...)*");
                        ChangeScene(SceneIDs.TriesGivingFood);
                        break;

                    case SceneIDs.TriesGivingFood:
                        SayMessage("*Uh... I... Got some food.. Do you want it...?*");
                        ChangeScene(SceneIDs.WondersHowStupidHisActionWas);
                        break;

                    case SceneIDs.WondersHowStupidHisActionWas:
                        SayMessage("*(Got some food?! What am I thinking?!)*");
                        ChangeScene(SceneIDs.WaitsAFewMoments);
                        break;

                    case SceneIDs.WaitsAFewMoments:
                        SayMessage("*...*");
                        ChangeScene(SceneIDs.ThinksThePlayerDidntUnderstandHim);
                        break;

                    case SceneIDs.ThinksThePlayerDidntUnderstandHim:
                        SayMessage("*I guess It can't understand me at all.*");
                        ChangeScene(SceneIDs.TalksAboutWalkingAway);
                        break;

                    case SceneIDs.TalksAboutWalkingAway:
                        SayMessage("*Maybe If I just walk away...*");
                        ChangeScene(SceneIDs.Flee);
                        break;

                    ////////////////////
                    case SceneIDs.GotScaredUponPlayerApproach:
                        SayMessage("*Ah!! It approached.*");
                        ChangeScene(SceneIDs.WondersIfPlayerWillAttackHim);
                        break;

                    case SceneIDs.WondersIfPlayerWillAttackHim:
                        SayMessage("*Is it going to attack me?!*");
                        ChangeScene(SceneIDs.FearPlayerAttack1);
                        break;

                    case SceneIDs.FearPlayerAttack1:
                        SayMessage("*No!! I'm too young to die!!*");
                        ChangeScene(SceneIDs.FearPlayerAttack2);
                        break;

                    case SceneIDs.FearPlayerAttack2:
                        SayMessage("*I didn't even finished the mysteries of the Terra Realm.*");
                        ChangeScene(SceneIDs.FearPlayerAttack3);
                        break;

                    case SceneIDs.FearPlayerAttack3:
                        SayMessage("*This... This is how I'm going to die?!*");
                        ChangeScene(SceneIDs.FearPlayerAttack4);
                        break;

                    case SceneIDs.FearPlayerAttack4:
                        SayMessage("*The great Leopold... Devoured by a Terrarian...*");
                        ChangeScene(SceneIDs.FearPlayerAttack5);
                        break;

                    case SceneIDs.FearPlayerAttack5:
                        SayMessage("*Oh... What a cruel world...*");
                        ChangeScene(SceneIDs.PlayerDoesNothing, true);
                        break;

                    case SceneIDs.PlayerDoesNothing:
                        SayMessage("....");
                        ChangeScene(SceneIDs.PlayerDoesNothing2);
                        break;

                    case SceneIDs.PlayerDoesNothing2:
                        SayMessage("*Uh...*");
                        ChangeScene(SceneIDs.WondersIfPlayerWillAttack);
                        break;

                    case SceneIDs.WondersIfPlayerWillAttack:
                        SayMessage("*Is... It going to try attacking me?*");
                        ChangeScene(SceneIDs.WondersIfScaredPlayer);
                        break;

                    case SceneIDs.WondersIfScaredPlayer:
                        SayMessage("*Maybe... I scared it?*");
                        ChangeScene(SceneIDs.ThreatensPlayer);
                        break;

                    case SceneIDs.ThreatensPlayer:
                        SayMessage("*Yeah!! Don't you dare get near me, or I'll show you some thing!*");
                        ChangeScene(SceneIDs.RealizesHowStupidWhatHeSaidWas);
                        break;

                    case SceneIDs.RealizesHowStupidWhatHeSaidWas:
                        SayMessage("*(Show It something?! What were I thinking?)*");
                        ChangeScene(SceneIDs.SeesIfPlayerReacts, true);
                        break;

                    case SceneIDs.SeesIfPlayerReacts:
                        SayMessage("...");
                        ChangeScene(SceneIDs.WonderIfAngeredPlayer);
                        break;

                    case SceneIDs.WonderIfAngeredPlayer:
                        SayMessage("*(Did I anger it?)*");
                        ChangeScene(SceneIDs.SeesIfPlayerReactsAgain, true);
                        break;

                    case SceneIDs.SeesIfPlayerReactsAgain:
                        SayMessage("...");
                        ChangeScene(SceneIDs.WonderIfPlayerIsFrozenInFear);
                        break;

                    case SceneIDs.WonderIfPlayerIsFrozenInFear:
                        SayMessage("*(Maybe It's frozen in fear?)*");
                        ChangeScene(SceneIDs.SeesIfPlayerReactsAgainAgain, true);
                        break;

                    case SceneIDs.SeesIfPlayerReactsAgainAgain:
                        SayMessage("...");
                        ChangeScene(SceneIDs.AttemptsToRunAway1);
                        break;

                    case SceneIDs.AttemptsToRunAway1:
                        SayMessage("*I... Kind of have more things to do... so...*");
                        ChangeScene(SceneIDs.AttemptsToRunAway2);
                        break;

                    case SceneIDs.AttemptsToRunAway2:
                        SayMessage("*Well, I'm gone!*");
                        ChangeScene(SceneIDs.Flee);
                        break;

                    //////////////////////////////
                    case SceneIDs.FearsAboutPlayerAttackingHim:
                        SayMessage("*Yaah!!! Please, Don't kill me...*");
                        ChangeScene(SceneIDs.Crying1);
                        break;

                    case SceneIDs.Crying1:
                        SayMessage("*(Sniffle... Sob...)*");
                        ChangeScene(SceneIDs.Crying2);
                        break;

                    case SceneIDs.Crying2:
                        SayMessage("*(Snif...)*");
                        ChangeScene(SceneIDs.WaitingForReaction, true);
                        break;

                    case SceneIDs.WaitingForReaction:
                        SayMessage("...");
                        ChangeScene(SceneIDs.AsksIfPlayerIsGoingToAttackHim);
                        break;

                    case SceneIDs.AsksIfPlayerIsGoingToAttackHim:
                        SayMessage("*You... Aren't going to attack me... Right...?*");
                        ChangeScene(SceneIDs.AsksIfPlayerUnderstandWhatHeSays);
                        break;

                    case SceneIDs.AsksIfPlayerUnderstandWhatHeSays:
                        SayMessage("*Can... You even understand me...?*");
                        ChangeScene(SceneIDs.WaitingForReactionAgain, true);
                        break;

                    case SceneIDs.WaitingForReactionAgain:
                        SayMessage("*...*");
                        ChangeScene(SceneIDs.TellsThatIsgoingToFlee);
                        break;

                    case SceneIDs.TellsThatIsgoingToFlee:
                        SayMessage("*I'm.. Going to... Walk... Backaway... *");
                        ChangeScene(SceneIDs.RunsWhileScreaming);
                        break;

                    case SceneIDs.RunsWhileScreaming:
                        SayMessage("*Waaaaaaaaaahhh!!!*");
                        ChangeScene(SceneIDs.Flee);
                        break;

                    /////////////////////////////////
                    case SceneIDs.NoticesOtherGuardians:
                        SayMessage("*Wait, are those... TerraGuardians?*");
                        ChangeScene(SceneIDs.WondersWhyGuardiansFollowsPlayer);
                        break;

                    case SceneIDs.WondersWhyGuardiansFollowsPlayer:
                        SayMessage("*Why are those TerraGuardians with that Terrarian?*");
                        ChangeScene(SceneIDs.ThinksPlayerIsGuardiansPet);
                        break;

                    case SceneIDs.ThinksPlayerIsGuardiansPet:
                        SayMessage("*Maybe It's their little pet?*");
                        ChangeScene(SceneIDs.IgnoresTheAboveIdea);
                        break;

                    case SceneIDs.IgnoresTheAboveIdea:
                        SayMessage("*It... Doesn't look like it...*");
                        ChangeScene(SceneIDs.ThinksPlayerEnslavedGuardians);
                        break;

                    case SceneIDs.ThinksPlayerEnslavedGuardians:
                        SayMessage("*Maybe... Oh no... The Terrarian enslaved them!*");
                        ChangeScene(SceneIDs.YellsThatIsGoingToSaveGuardians);
                        break;

                    case SceneIDs.YellsThatIsGoingToSaveGuardians:
                        SayMessage("*Don't worry friends, I will save you all!*");
                        ChangeScene(SceneIDs.WondersHowToSaveGuardians);
                        break;

                    case SceneIDs.WondersHowToSaveGuardians:
                        SayMessage("*I should save them, but how...*");
                        ChangeScene(SceneIDs.PlayerMainGuardianTalksToLeopold);
                        break;

                    case SceneIDs.PlayerMainGuardianTalksToLeopold:
                    {
                        TerraGuardian Guardian = PlayerMod.GetPlayerMainGuardian(player);
                        string        Message  = "";
                        if (Guardian.ModID == MainMod.mod.Name)
                        {
                            switch (Guardian.ID)         //What about moving those dialogues to a separate method, so It's easier to find them.
                            {
                            default:
                                Message = Guardian.GetMessage(GuardianBase.MessageIDs.LeopoldMessage1, "*" + Guardian.Name + " is saying that you're It's friend.*");
                                break;

                            case GuardianBase.Rococo:
                                Message = "*" + Guardian.Name + " looks very confused.*";
                                break;

                            case GuardianBase.Blue:
                                Message = "*" + Guardian.Name + " seems to be enjoying the show.*";
                                break;

                            case GuardianBase.Sardine:
                                Message = "I think the way we met isn't that weird now, right pal?";
                                break;

                            case GuardianBase.Zacks:
                                Message = "*Boss, can I eat that stupid bunny?*";
                                break;

                            case GuardianBase.Alex:
                                Message = "Save me? Save me from what? Who's threatening me and my friend?!";
                                break;

                            case GuardianBase.Brutus:
                                Message = "*Are you missing some rivets, long eared guy?*";
                                break;

                            case GuardianBase.Bree:
                                Message = "Have you finished making yourself into a fool.";
                                break;

                            case GuardianBase.Mabel:
                                Message = "*Hello, Teehee. Do you have a problem, bunny guy?*";
                                break;

                            case GuardianBase.Domino:
                                Message = "*Don't look at me, I stopped selling the kind of merchandise that caused that long ago.*";
                                break;

                            case GuardianBase.Vladimir:
                                Message = "*I think that guy needs a hug. Maybe It will end up fixing his head, I guess.*";
                                break;

                            case GuardianBase.Malisha:
                                Message = "*And he still fears even his own shadow.*";
                                break;
                            }
                        }
                        Guardian.SaySomething(Message);
                    }
                        ChangeScene(SceneIDs.LeopoldAnswersTheGuardian);
                        break;

                    case SceneIDs.LeopoldAnswersTheGuardian:
                    {
                        TerraGuardian Guardian = PlayerMod.GetPlayerMainGuardian(player);
                        string        Message  = "";
                        if (Guardian.ModID == MainMod.mod.Name)
                        {
                            switch (Guardian.ID)
                            {
                            default:
                                Message = Guardian.GetMessage(GuardianBase.MessageIDs.LeopoldMessage2, "*You're friends of that Terrarian?*");
                                break;

                            case GuardianBase.Rococo:
                                Message = "*Uh... What is it with the look in your face?*";
                                break;

                            case GuardianBase.Blue:
                                Message = "*Wait, why are you laughing?*";
                                break;

                            case GuardianBase.Sardine:
                                Message = "*Wait, \"pal\"? You're that Terrarian's friend?!*";
                                break;

                            case GuardianBase.Zacks:
                                Message = "*Wait, you...Yaaaaaah!! It's a zombie!!!*";
                                break;

                            case GuardianBase.Alex:
                                Message = "*F..Friend?!*";
                                break;

                            case GuardianBase.Brutus:
                                Message = "*I...I'm not crazy?! What are you doing with that Terrarian?*";
                                break;

                            case GuardianBase.Bree:
                                Message = "*Hey! I'm not a fool!*";
                                break;

                            case GuardianBase.Mabel:
                                Message = "*Ah... Uh... No... Uh... Just... I'm... Fine...*";
                                break;

                            case GuardianBase.Domino:
                                Message = "*H-hey! I would never use such thing!*";
                                break;

                            case GuardianBase.Vladimir:
                                Message = "*How can you think of hugs at a moment like this?*";
                                break;

                            case GuardianBase.Malisha:
                                Message = "*W-what the! What are you doing here? And who's that?*";
                                break;
                            }
                        }
                        SayMessage(Message);
                    }
                        ChangeScene(SceneIDs.MainGuardianSaysThatPlayerHasBeenHearingAllTheTime);
                        break;

                    case SceneIDs.MainGuardianSaysThatPlayerHasBeenHearingAllTheTime:
                    {
                        TerraGuardian Guardian = PlayerMod.GetPlayerMainGuardian(player);
                        string        Message  = "";
                        if (Guardian.ModID == MainMod.mod.Name)
                        {
                            switch (Guardian.ID)
                            {
                            default:
                                Message = Guardian.GetMessage(GuardianBase.MessageIDs.LeopoldMessage3, "*" + Guardian.Name + " also said that you heard everything he said.*");
                                break;

                            case GuardianBase.Rococo:
                                Message = "*" + Guardian.Name + " is asking you what is his problem.*";
                                break;

                            case GuardianBase.Blue:
                                Message = "*" + Guardian.Name + " explains that you're her friend, and that you can understand what they are talking about.*";
                                break;

                            case GuardianBase.Sardine:
                                Message = "Yes, and It heard everything you said as clear as day.";
                                break;

                            case GuardianBase.Zacks:
                                Message = "*That guy is making me sick, my boss isn't a troglodyte, do you hear?*";
                                break;

                            case GuardianBase.Alex:
                                Message = "Yes, me and my friend here were watching you talking to self all that time.";
                                break;

                            case GuardianBase.Brutus:
                                Message = "*I was hired by it to be his bodyguard, you fool.*";
                                break;

                            case GuardianBase.Bree:
                                Message = "Of course you are, how can you think that the Terrarian is a fool?";
                                break;

                            case GuardianBase.Mabel:
                                Message = "*Hey friend, I can't understand that guy, can you explain to me what is his problem?*";
                                break;

                            case GuardianBase.Domino:
                                Message = "*Then why were you fooling yourself a while ago? Terrarians aren't stupid.*";
                                break;

                            case GuardianBase.Vladimir:
                                Message = "*What moment like this, the Terrarian is my buddy. And can understand what we are talking.*";
                                break;

                            case GuardianBase.Malisha:
                                Message = "*I moved to here for a vacation, then this Terrarian let me live here.*";
                                break;
                            }
                        }
                        Guardian.SaySomething(Message);
                    }
                        ChangeScene(SceneIDs.LeopoldGetsSurprisedThatPlayerHasBeenHearingAllTime);
                        break;

                    case SceneIDs.LeopoldGetsSurprisedThatPlayerHasBeenHearingAllTime:
                        SayMessage("*What?! That Terrarian can understand what we are saying?!*");
                        ChangeScene(SceneIDs.LeopoldTellsToForgetEverything);
                        break;

                    case SceneIDs.LeopoldTellsToForgetEverything:
                        SayMessage("*I nearly thought... Oh... Nevermind... Does It matter anyway?*");
                        ChangeScene(SceneIDs.LeopoldPresentsHimself);
                        break;

                    case SceneIDs.LeopoldPresentsHimself:
                        SayMessage("*I'm Leopold, the Sage. Please disconsider what I debated with myself earlier. If you can.*");
                        ChangeScene(SceneIDs.LeopoldFreeForRecruit);
                        break;

                    case SceneIDs.KnownPlayerSpottedByLeopold:
                        SayMessage("*Wait... I know that face...*");
                        ChangeScene(SceneIDs.LeopoldRecognizesTerrarian);
                        break;

                    case SceneIDs.LeopoldRecognizesTerrarian:
                        SayMessage("*Oh, It is that Terrarian again.*");
                        ChangeScene(SceneIDs.LeopoldGreetsPlayer);
                        break;

                    case SceneIDs.LeopoldGreetsPlayer:
                        SayMessage("*Hello, I didn't expected to see you here.*");
                        ChangeScene(SceneIDs.LeopoldTellsThatIsGoingToPlayerTown);
                        break;

                    case SceneIDs.LeopoldTellsThatIsGoingToPlayerTown:
                        SayMessage("*Since you're here, I think you have some town around this world, so... See you there.*");
                        ChangeScene(SceneIDs.LeopoldTurnsToTownNPC, true);
                        break;

                    case SceneIDs.LeopoldTurnsToTownNPC:
                        NpcMod.AddGuardianMet(10);
                        PlayerMod.AddPlayerGuardian(player, GuardianID, GuardianModID);
                        PlayerMod.GetPlayerGuardian(player, GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
                        WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                        //npc.Transform(ModContent.NPCType<GuardianNPC.List.BunnyGuardian>());
                        break;

                    //////////////////////////////////
                    case SceneIDs.Flee:
                    {
                    }
                    break;
                    }
                }
                if (SceneID == SceneIDs.Flee)
                {
                    if (player.Center.X - npc.Center.X < 0)
                    {
                        MoveRight = true;
                    }
                    else
                    {
                        MoveLeft = true;
                    }
                    if (player.Distance(npc.Center) >= Main.screenWidth)
                    {
                        npc.active = false;
                        Main.NewText("The Bunny Guardian has escaped.", Microsoft.Xna.Framework.Color.Red);
                        return;
                    }
                }
                SceneTime--;
            }
            base.AI();
        }