Exemplo n.º 1
0
        private void CheckExerciseButtonAction()
        {
            TerraGuardian tg = Dialogue.GetSpeaker;
            PlayerMod     pm = Main.player[Main.myPlayer].GetModPlayer <PlayerMod>();

            if (pm.CurrentExercise == ExerciseTypes.WaitUntilNextDay)
            {
                Dialogue.ShowEndDialogueMessage("*There is no other exercise for you today. For your muscles to recover from today's exercise, wait until tomorrow.*", false);
            }
            else if (pm.ExerciseCounter <= 0)
            {
                int FitBuffID   = Terraria.ModLoader.ModContent.BuffType <Buffs.Fit>();
                int NewBuffTime = 30 * 60 * 60;
                if (pm.player.HasBuff(FitBuffID))
                {
                    for (int b = 0; b < pm.player.buffType.Length; b++)
                    {
                        if (pm.player.buffType[b] == FitBuffID)
                        {
                            NewBuffTime += pm.player.buffTime[b];
                            if (NewBuffTime > 60 * 60 * 60)
                            {
                                NewBuffTime = 60 * 60 * 60;
                            }
                            break;
                        }
                    }
                }
                pm.player.AddBuff(FitBuffID, NewBuffTime);
                pm.ExercisesDone++;
                if (pm.ExercisesDone >= 10)
                {
                    pm.ExercisesDone = 0;
                    tg.IncreaseFriendshipProgress(1);
                    Dialogue.ShowEndDialogueMessage("*Good job, [nickname]. You have really impressed me those days. Let your muscles take a rest until tomorrow and then I will give you another exercise.*");
                }
                else
                {
                    Dialogue.ShowEndDialogueMessage("*Good job, [nickname]. Now take a rest and return to me tomorrow for another exercise.*");
                }
                pm.CurrentExercise = ExerciseTypes.WaitUntilNextDay;
            }
            else
            {
                switch (pm.CurrentExercise)
                {
                case ExerciseTypes.AttackTimes:
                    Dialogue.ShowEndDialogueMessage("*I tasked you into attacking anything a number of times. It seems like you still need to hit anything " + (int)pm.ExerciseCounter + " times. I'm sure you know how you will do that.*", false);
                    break;

                case ExerciseTypes.JumpTimes:
                    Dialogue.ShowEndDialogueMessage("*I told you to jump a number of times. You still need to jump " + (int)pm.ExerciseCounter + " more times to complete this exercise.*", false);
                    break;

                case ExerciseTypes.TravelDistance:
                    Dialogue.ShowEndDialogueMessage("*You need to travel " + (int)(pm.ExerciseCounter * 0.5f) + " feets more to complete this exercise.*", false);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public bool CompleteRequest(Player player, TerraGuardian gd, byte RewardToGet)
        {
            if (ObjectiveCount < MaxObjectiveCount)
            {
                return(false);
            }
            if (state != RequestState.Active)
            {
                return(false);
            }
            if (RewardToGet > 2)
            {
                RewardToGet = 2;
            }
            Base.OnCompleteRequest(player, this);
            ThisRequestReward reward = Rewards[RewardToGet];

            Item.NewItem(player.getRect(), reward.item.type, reward.item.stack, true, reward.item.prefix, true);
            int p = 0, g = 0, s = 0, c = reward.value;

            if (c >= 100)
            {
                s += c / 100;
                c -= s * 100;
            }
            if (s >= 100)
            {
                g += s / 100;
                s -= g * 100;
            }
            if (g >= 100)
            {
                p += g / 100;
                g -= p * 100;
            }
            if (p > 0)
            {
                Item.NewItem(player.getRect(), Terraria.ID.ItemID.PlatinumCoin, p, true, 0, true);
            }
            if (g > 0)
            {
                Item.NewItem(player.getRect(), Terraria.ID.ItemID.GoldCoin, g, true, 0, true);
            }
            if (s > 0)
            {
                Item.NewItem(player.getRect(), Terraria.ID.ItemID.SilverCoin, s, true, 0, true);
            }
            if (c > 0)
            {
                Item.NewItem(player.getRect(), Terraria.ID.ItemID.CopperCoin, c, true, 0, true);
            }
            gd.IncreaseFriendshipProgress(1);
            SetRequestOnCooldown();
            if (Compatibility.NExperienceCompatibility.IsModActive)
            {
                Compatibility.NExperienceCompatibility.GiveExpRewardToPlayer(player, (Main.hardMode ? 15 : 3) + (float)reward.value / 10000, 0.05f, true, 5); //NExperience.ExpReceivedPopText.ExpSource.Quest
            }
            return(true);
        }
Exemplo n.º 3
0
        public override void Update(TerraGuardian guardian)
        {
            IgnoreCombat   = true;
            AvoidItemUsage = true;
            if (guardian.UsingFurniture)
            {
                guardian.LeaveFurniture();
            }
            switch (Step)
            {
            case 0:
                if (StepStart)
                {
                    if (Main.rand.NextDouble() < 0.01f)
                    {
                        Main.PlaySound(29, (int)guardian.Position.X, (int)guardian.CenterY, 89);
                    }
                    guardian.DisplayEmotion(TerraGuardian.Emotions.Question);
                    int ItemPosition = BoxPosition;
                    BoxID = guardian.Inventory[BoxPosition].type;
                    guardian.Inventory[ItemPosition].SetDefaults(0, true);
                }
                if (Time >= 120)
                {
                    ChangeStep();
                }
                break;

            case 1:
                if (StepStart)
                {
                    guardian.DisplayEmotion(TerraGuardian.Emotions.Alarmed);
                }
                if (Time % 20 == 0)
                {
                    //Spawn item every 5 ticks;
                    int ItemID = Terraria.ID.ItemID.CopperCoin, Stack = Main.rand.Next(10, 26);
                    if (Main.rand.Next(100) == 0)
                    {
                        ItemID = Terraria.ID.ItemID.PlatinumCoin;
                        Stack  = Main.rand.Next(1, 3);
                    }
                    else if (Main.rand.Next(25) == 0)
                    {
                        ItemID = Terraria.ID.ItemID.GoldCoin;
                        Stack  = Main.rand.Next(3, 5);
                    }
                    else if (Main.rand.Next(5) == 0)
                    {
                        ItemID = Terraria.ID.ItemID.SilverCoin;
                        Stack  = Main.rand.Next(5, 20);
                    }
                    else if (Main.rand.Next(5) == 0)
                    {
                        ItemID = Terraria.ID.ItemID.WoodenCrate;
                        Stack  = Main.rand.Next(3, 6);
                    }
                    else if (Main.rand.Next(15) == 0)
                    {
                        ItemID = Terraria.ID.ItemID.IronCrate;
                        Stack  = Main.rand.Next(2, 4);
                    }
                    else if (Main.rand.Next(25) == 0)
                    {
                        ItemID = Terraria.ID.ItemID.GoldenCrate;
                        Stack  = Main.rand.Next(1, 3);
                    }
                    else if (Main.rand.Next(3) == 0)
                    {
                        ItemID = Terraria.ID.ItemID.HerbBag;
                        Stack  = 1;
                    }
                    Item.NewItem(guardian.CenterPosition, ItemID, Stack);
                }
                if (Time >= 120)
                {
                    ChangeStep();
                }
                break;

            case 2:
                if (StepStart)
                {
                    guardian.DisplayEmotion(TerraGuardian.Emotions.Happy);
                    guardian.IncreaseFriendshipProgress(5);
                    guardian.Data.GiftGiven = true;
                    InUse = false;
                }
                break;
            }
        }
Exemplo n.º 4
0
        public static void UponDeliveringToZacksDialogue()
        {
            if (!PlayerMod.HasGuardianSummoned(Main.player[Main.myPlayer], GuardianBase.Blue))
            {
                Dialogue.ShowEndDialogueMessage("*You say that Blue and You have something for me? But where is Blue? She's part of that too, right?*", true);
                return;
            }
            Dialogue.IsImportantDialogue();
            ZacksOutfitQuestData data = (ZacksOutfitQuestData)Data;
            TerraGuardian        Blue = null, Zacks = null;

            for (int i = 0; i < Dialogue.DialogueParticipants.Length; i++)
            {
                if (Dialogue.DialogueParticipants[i].ModID == MainMod.mod.Name)
                {
                    if (Dialogue.DialogueParticipants[i].ID == GuardianBase.Blue)
                    {
                        Blue = Dialogue.DialogueParticipants[i];
                    }
                    if (Dialogue.DialogueParticipants[i].ID == GuardianBase.Zacks)
                    {
                        Zacks = Dialogue.DialogueParticipants[i];
                    }
                }
            }
            bool ZacksIsInTheTeam = PlayerMod.HasGuardianSummoned(Main.LocalPlayer, GuardianBase.Zacks);

            if (Blue == null)
            {
                Blue = NpcMod.GetGuardianNPCCharacter(GuardianBase.Blue);
            }
            if (Zacks == null)
            {
                Zacks = NpcMod.GetGuardianNPCCharacter(GuardianBase.Zacks);
            }
            if (!Dialogue.HasParticipant(Blue.ID, Blue.ModID))
            {
                Dialogue.AddParticipant(Blue);
            }
            if (!Dialogue.HasParticipant(Zacks.ID, Zacks.ModID))
            {
                Dialogue.AddParticipant(Zacks);
            }
            Dialogue.GatherAroundGuardian(Zacks);
            if (Zacks.UsingFurniture)
            {
                Zacks.LeaveFurniture(false);
            }
            bool ZacksKnow = data.QuestStep % 2 == 1;

            Dialogue.ShowDialogueWithContinue("*Zacks, we brought something for you.*", Blue);
            if (!ZacksKnow)
            {
                if (ZacksIsInTheTeam)
                {
                    Dialogue.ShowDialogueWithContinue("*What is it that you two brought me?*", Zacks);
                }
                else
                {
                    Dialogue.ShowDialogueWithContinue("*Something for me? What is It?*", Zacks);
                }
                Dialogue.ShowDialogueWithContinue("*We brought you bandages and a shirt.*", Blue);
                Dialogue.ShowDialogueWithContinue("*Bandages and a shirt? Why?*", Zacks);
                Dialogue.ShowDialogueWithContinue("*It's so we can cover those wounds of yours.*", Blue);
                Dialogue.ShowDialogueWithContinue("*Oh, that is actually... nice of you two.*", Zacks);
            }
            else
            {
                if (ZacksIsInTheTeam)
                {
                    Dialogue.ShowDialogueWithContinue("*Finally managed to get everything, right?*", Zacks);
                }
                else
                {
                    Dialogue.ShowDialogueWithContinue("*Finally managed to get everything you two were trying to get?*", Zacks);
                }
                Dialogue.ShowDialogueWithContinue("*Yes, everything is here.*", Blue);
            }
            Dialogue.ShowDialogueWithContinue("*Now let's patch up those wounds...*", Blue);
            Dialogue.ShowDialogueWithContinue("*Those bandages will surelly help covering the wounds.*", Zacks);
            Dialogue.ShowDialogueWithContinue("*...Blue... Why it's written \"Meat Bag\" in this shirt?*", Zacks);
            Dialogue.ShowDialogueWithContinue("*I don't know, it looked fitting.*", Blue);
            Dialogue.ShowDialogueWithContinue("*How fitting? Do I look like a meat bag?*", Zacks);
            Dialogue.ShowDialogueWithContinue("*A rotten one (giggles).*", Blue);
            Dialogue.ShowDialogueWithContinue("*I wont wear this.*", Zacks);
            Dialogue.ShowDialogueWithContinue("*Come on, don't be a child. I got all those things for you, just wear it, please.*", Blue);
            Dialogue.ShowDialogueWithContinue("*... Okay...*", Zacks);

            /*MainMod.ScreenColor = Microsoft.Xna.Framework.Color.Black;
             * MainMod.ScreenColorAlpha = 1;
             * Dialogue.ShowDialogueTimed("(Some washing, patching and cuff wearing later...)",null, 2500);
             * //System.Threading.Thread.Sleep(2500);*/
            Zacks.OutfitID = Companions.ZacksBase.MeatBagOutfitID;
            //MainMod.ScreenColorAlpha = 0;
            data.QuestStep = (byte)(ZacksKnow ? 9 : 8);
            QuestCompletedNotification(data);
            Dialogue.ShowDialogueWithContinue("*... How do I look?*", Zacks);
            Dialogue.ShowDialogueWithContinue("*Perfect! Now you look less half eaten and gross.*", Blue);
            Blue.IncreaseFriendshipProgress(2);
            Zacks.IncreaseFriendshipProgress(2);
            Main.NewText("Zacks [Meat Bag] Outfit unlocked.");
            Dialogue.ShowEndDialogueMessage("*... I really hope you didn't helped her pick this shirt, [nickname].*", true, Zacks);
        }
Exemplo n.º 5
0
        public override void Update(TerraGuardian guardian)
        {
            ProceedIdleAIDuringDialogue = true;
            NpcCanFacePlayer            = false;
            guardian.AddDrawMomentToPlayer(Target);
            const int BuffRefreshTime = 10 * 60;

            if (Time >= BuffRefreshTime && Time % BuffRefreshTime == 0)
            {
                int Stack = Time / BuffRefreshTime;
                if (Stack > 3)
                {
                    Stack = 3;
                }
                Target.AddBuff(ModContent.BuffType <Buffs.WellBeing>(), 3600 * 30 * Stack);
                PlayerMod pm = Target.GetModPlayer <PlayerMod>();
                if (pm.ControllingGuardian)
                {
                    pm.Guardian.AddBuff(ModContent.BuffType <Buffs.WellBeing>(), 3600 * 30 * Stack);
                }
            }
            VladimirBase.VladimirData data = (VladimirBase.VladimirData)guardian.Data;
            bool End = Target.controlJump;

            //if (PlayerMod.PlayerHasGuardianSummoned(player, guardian.ID, guardian.ModID))
            //    End = true;
            if (Main.bloodMoon)
            {
                End = false;
            }
            if (End)
            {
                InUse         = false;
                Target.Bottom = guardian.Position;
                if (guardian.BodyAnimationFrame == guardian.Base.ChairSittingFrame)
                {
                    Target.position.Y -= guardian.SpriteHeight - guardian.Base.SittingPoint.Y * guardian.Scale;
                }
                PlayerMod pm = Target.GetModPlayer <PlayerMod>();
                if (pm.ControllingGuardian)
                {
                    pm.Guardian.Position = guardian.Position;
                }
                guardian.SaySomething(((Companions.VladimirBase)guardian.Base).GetEndHugMessage(guardian));
            }
            else
            {
                if (Target.mount.Active)
                {
                    Target.mount.Dismount(Target);
                }
                PlayerMod pm       = Target.GetModPlayer <PlayerMod>();
                bool      FaceBear = (guardian.BodyAnimationFrame != 20 && guardian.BodyAnimationFrame != 21) || guardian.BodyAnimationFrame == 25;
                if (pm.ControllingGuardian)
                {
                    pm.Guardian.Position    = guardian.GetGuardianShoulderPosition;
                    pm.Guardian.Position.Y += guardian.Height * 0.5f;
                    pm.Guardian.Velocity.Y  = -pm.Guardian.Mass;
                    if (data.CarrySomeone)
                    {
                        pm.Guardian.Position.X -= 6 * guardian.Direction;
                    }
                    pm.Guardian.FallStart = (int)pm.Guardian.Position.Y / 16;
                    if (pm.Guardian.ItemAnimationTime == 0 && !pm.Guardian.MoveLeft && !pm.Guardian.MoveRight)
                    {
                        pm.Guardian.FaceDirection((guardian.Direction * (FaceBear ? -1 : 1)) == -1);
                    }
                    pm.Guardian.AddBuff(ModContent.BuffType <Buffs.Hug>(), 5, true);
                    if (pm.Guardian.KnockedOut)
                    {
                        pm.Guardian.ReviveBoost += 3;
                    }
                    if (!Main.bloodMoon)
                    {
                        pm.Guardian.ImmuneTime    = 3;
                        pm.Guardian.ImmuneNoBlink = true;
                    }
                }
                else
                {
                    Target.gfxOffY    = 0;
                    Target.Center     = guardian.GetGuardianShoulderPosition;
                    Target.velocity.Y = -Player.defaultGravity;
                    Target.fallStart  = (int)Target.Center.Y / 16;
                    if (data.CarrySomeone)
                    {
                        Target.position.X -= 6 * guardian.Direction;
                    }
                    if (Target.itemAnimation == 0 && !Target.controlLeft && !Target.controlRight)
                    {
                        Target.ChangeDir(guardian.Direction * (FaceBear ? -1 : 1));
                    }
                    Target.AddBuff(ModContent.BuffType <Buffs.Hug>(), 5);
                    if (pm.KnockedOut)
                    {
                        pm.ReviveBoost += 3;
                    }
                    if (!Main.bloodMoon)
                    {
                        Target.immuneTime    = 3;
                        Target.immuneNoBlink = true;
                    }
                }
                if ((guardian.MessageTime == 0 || Main.bloodMoon) && (Target.controlLeft || Target.controlRight || Target.controlUp || Target.controlDown || (Main.bloodMoon && Target.controlJump)))
                {
                    if (Main.bloodMoon)
                    {
                        Target.controlJump = false;
                        bool Defeated = false, Hurt = false;
                        if (pm.ControllingGuardian)
                        {
                            pm.Guardian.FriendlyDuelDefeat = true;
                            Hurt = 0 != pm.Guardian.Hurt((int)(pm.Guardian.MHP * 0.22f), guardian.Direction, false, true, " were crushed by " + guardian.Name + "'s arms.");
                            if (pm.Guardian.Downed)
                            {
                                Defeated = true;
                            }
                        }
                        else
                        {
                            Target.GetModPlayer <PlayerMod>().FriendlyDuelDefeat = true;
                            Hurt = 0 != Target.Hurt(Terraria.DataStructures.PlayerDeathReason.ByCustomReason(Target.name + " were crushed by " + guardian.Name + "'s arms."), (int)(Target.statLifeMax2 * 0.22f), guardian.Direction);
                            if (Target.dead)
                            {
                                Defeated = true;
                            }
                        }
                        if (Hurt)
                        {
                            if (!Defeated)
                            {
                                if (guardian.BodyAnimationFrame == guardian.Base.ChairSittingFrame)
                                {
                                    switch (Main.rand.Next(5))
                                    {
                                    case 0:
                                        guardian.SaySomething("*I'll crush you if you move again!*");
                                        break;

                                    case 1:
                                        guardian.SaySomething("*I'll hurt you worser than those monsters would If you keep moving!*");
                                        break;

                                    case 2:
                                        guardian.SaySomething("*I can crush you with my arms or my legs, you pick!*");
                                        break;

                                    case 3:
                                        guardian.SaySomething("*Want me to turn your bones to dust?*");
                                        break;

                                    case 4:
                                        guardian.SaySomething("*You are angering me, more than this night does!*");
                                        break;
                                    }
                                }
                                else
                                {
                                    switch (Main.rand.Next(5))
                                    {
                                    case 0:
                                        guardian.SaySomething("*Stay quiet!*");
                                        break;

                                    case 1:
                                        guardian.SaySomething("*I'll crush your bones If you continue doing that!*");
                                        break;

                                    case 2:
                                        guardian.SaySomething("*I have my arms around you, I can pull them against my body, and you wont like it!*");
                                        break;

                                    case 3:
                                        guardian.SaySomething("*Want to try that again?*");
                                        break;

                                    case 4:
                                        guardian.SaySomething("*This is what you want?*");
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                switch (Main.rand.Next(5))
                                {
                                case 0:
                                    guardian.SaySomething("*Finally! You got quiet!*");
                                    break;

                                case 1:
                                    guardian.SaySomething("*See what you made me do?!*");
                                    break;

                                case 2:
                                    guardian.SaySomething("*My mood is already bad, you didn't helped either!*");
                                    break;

                                case 3:
                                    guardian.SaySomething("*At least you stopped moving around!*");
                                    break;

                                case 4:
                                    guardian.SaySomething("*You behave better when unconscious!*");
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        guardian.SaySomething("*Press Jump button If that's enough.*");
                    }
                }
                if (Target.whoAmI == Main.myPlayer)
                {
                    MainMod.FocusCameraPosition    = guardian.CenterPosition;
                    MainMod.FocusCameraPosition.X -= Main.screenWidth * 0.5f;
                    MainMod.FocusCameraPosition.Y -= Main.screenHeight * 0.5f;
                    ChatTime--;
                    const int InitialTime = 300;
                    if (ChatTime == -1)
                    {
                        ChatTime = InitialTime;
                    }
                    else if (ChatTime < 1)
                    {
                        ChatTime = 60 * 10; // + Main.rand.Next(InitialTime)
                        FriendshipPoints++;
                        if (FriendshipPoints >= 10 + guardian.FriendshipLevel / 3)
                        {
                            FriendshipPoints = 0;
                            guardian.IncreaseFriendshipProgress(1);
                        }
                        string Message = GuardianMouseOverAndDialogueInterface.MessageParser(Main.rand.Next(10) == 0 ? guardian.Base.TalkMessage(Target, guardian) : guardian.Base.NormalMessage(Target, guardian), guardian);
                        //if (Target.talkNPC > -1 && Main.npc[Target.talkNPC].type == ModContent.NPCType<GuardianNPC.List.BearNPC>())
                        //PlayerMod pm = Target.GetModPlayer<PlayerMod>();
                        if (pm.IsTalkingToAGuardian && pm.TalkingGuardianPosition == guardian.WhoAmID)
                        {
                            GuardianMouseOverAndDialogueInterface.SetDialogue(Message);
                        }
                        else
                        {
                            //guardian.SaySomething(Message);
                        }
                    }
                    else
                    {
                    }
                }
            }
        }