Пример #1
0
        /*public override bool? ModifyNPCHostile(TerraGuardian guardian,NPC npc)
         * {
         *  if (Step >= 1)
         *      return true;
         *  return base.ModifyNPCHostile(guardian, npc);
         * }*/

        public override bool?ModifyPlayerHostile(TerraGuardian guardian, Player player)
        {
            if (Step >= 1)
            {
                if (guardian.IsPlayerBuddy(player))
                {
                    return(false);
                }
                return(true);
            }
            return(base.ModifyPlayerHostile(guardian, player));
        }
Пример #2
0
 public override bool?ModifyPlayerHostile(TerraGuardian guardian, Player player)
 {
     return(!guardian.IsPlayerBuddy(player) && Step < 200);
 }
Пример #3
0
        public override string NormalMessage(Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            if (guardian.IsSleeping)
            {
                Mes.Add("(She seems to be having a nightmare.)");
                Mes.Add("(She seems to be telling someone to stop. Did she say her own name?)");
                Mes.Add("(You see tears falling from her eyes.)");
            }
            else if (TriggerBeastState(guardian))
            {
                if (guardian.IsPlayerBuddy(player))
                {
                    Mes.Add("*Grrr.... Rrrr....*");
                    Mes.Add("*Rrrr.... Purrr... Rrr...*");
                }
                Mes.Add("*Grr!! Rawr!!*");
                Mes.Add("*Arrgh!! Grrr!! Rrr!!*");
            }
            else if (!guardian.IsStarter && guardian.FriendshipLevel < FriendsLevel)
            {
                Mes.Add("*Leave me alone... Please...*");
                if (guardian.FriendshipLevel > 0)
                {
                    Mes.Add("*You returned..*");
                }
                Mes.Add("*Don't stay around me. It's for your own safety.*");
                Mes.Add("*Please, stay away from me..*");
                Mes.Add("*I hurt someone in the past... I don't know how.. I couldn't stop either.. Please... Leave me alone..*");
                Mes.Add("*I'm nobody.. Go away, please..*");
                if (!Main.dayTime)
                {
                    Mes.Add("*You... Avoid the dark around me..*");
                    Mes.Add("*For your safety, please don't stay near me..*");
                }
            }
            else
            {
                Mes.Add("*I wonder how are things back home...*");
                Mes.Add("*You always came back to see me... Thank you..*");
                Mes.Add("*You came to see me?*");
                Mes.Add("*It's not that I don't like people... It's just... Safer for us if we don't stay close.*");
                Mes.Add("*...*");
                if (Main.dayTime)
                {
                    Mes.Add("*Are you finding it weird that I only eat fruits and bugs? Sorry, I'm avoiding touching meat.*");
                    if (!Main.raining)
                    {
                        Mes.Add("*It seems like a good day for running.*");
                        Mes.Add("*Do you want to race against me, [nickname]?*");
                    }
                    else
                    {
                        Mes.Add("*Aww... It's raining..*");
                    }
                    Mes.Add("*I think I can talk, while it's still daytime.*");
                }
                else
                {
                    Mes.Add("*Feeling tired..? Go home get some sleep.*");
                    Mes.Add("*I can't forget that night... What night? Forget that I said that.*");
                }
                if (guardian.IsPlayerRoomMate(player))
                {
                    Mes.Add("*I don't like the idea of sharing a room with you. What if I...*");
                }
                if (guardian.IsUsingToilet)
                {
                    Mes.Clear();
                    Mes.Add("*Is it really necessary of you to speak with me right now?*");
                    Mes.Add("*You're distracting me right now. Please, go away.*");
                    Mes.Add("*I can talk to you any other time than this.*");
                }
            }
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
Пример #4
0
        public override void GuardianUpdateScript(TerraGuardian guardian)
        {
            CilleData data = (CilleData)guardian.Data;

            if (data.InBeastState)
            {
                if (guardian.KnockedOut)
                {
                    data.InBeastState = false;
                }
                else if (!TriggerBeastState(guardian))
                {
                    data.InBeastState = false;
                    if (!guardian.KnockedOut && !guardian.Downed)
                    {
                        string Message = "";
                        switch (Main.rand.Next(3))
                        {
                        default:
                            Message = "*Huh? It's over... I hope I didn't hurt anyone.*";
                            break;

                        case 1:
                            Message = "*What happened? Did someone got hurt?*";
                            break;

                        case 2:
                            Message = "*I'm so glad it's over. I didn't hurt anyone, right?*";
                            break;
                        }
                        guardian.SaySomethingCanSchedule(Message, false, Main.rand.Next(30, 180));
                    }

                    /*if (!guardian.DoAction.InUse)
                     * {
                     *  data.InBeastState = false;
                     * }*/
                }
                else
                {
                    if (guardian.OwnerPos > -1 && !guardian.IsPlayerBuddy(Main.player[guardian.OwnerPos]))
                    {
                        if (!NpcMod.HasGuardianNPC(guardian.ID, guardian.ModID))
                        {
                            WorldMod.GuardianTownNPC.Add(guardian);
                        }
                        Main.player[guardian.OwnerPos].GetModPlayer <PlayerMod>().DismissGuardian(guardian.ID, guardian.ModID);
                    }
                }
            }
            else
            {
                if (TriggerBeastState(guardian))
                {
                    if (!guardian.DoAction.InUse)
                    {
                        guardian.StartNewGuardianAction(new Companions.Creatures.Cille.BeastStateAction(), BeastStateID);
                    }
                }
            }
        }
 public static void DrawBannerGame()
 {
     if (!ManagingGuardianHouses)
     {
         return;
     }
     try
     {
         string MouseText = "";
         for (int g = 0; g < WorldMod.MaxGuardianNpcsInWorld; g++)
         {
             WorldMod.GuardianTownNpcState townnpc = WorldMod.GuardianNPCsInWorld[g];
             if (townnpc != null && !townnpc.Homeless && WorldMod.IsGuardianNpcInWorld(townnpc.CharID))
             {
                 int BannerX = townnpc.HomeX, BannerY = townnpc.HomeY;
                 if (BannerX < 0 || BannerY < 0)
                 {
                     continue;
                 }
                 BannerY--;
                 if (Main.tile[BannerX, BannerY] == null)
                 {
                     continue;
                 }
                 bool EndsOnNullTile = false;
                 while (!Main.tile[BannerX, BannerY].active() || !Main.tileSolid[(int)Main.tile[BannerX, BannerY].type])
                 {
                     BannerY--;
                     if (BannerY < 10)
                     {
                         break;
                     }
                     if (Main.tile[BannerX, BannerY] == null)
                     {
                         EndsOnNullTile = true;
                         break;
                     }
                 }
                 if (EndsOnNullTile)
                 {
                     continue;
                 }
                 TerraGuardian guardian = null;
                 foreach (TerraGuardian tg in WorldMod.GuardianTownNPC)
                 {
                     if (townnpc.IsID(tg.ID, tg.ModID))
                     {
                         guardian = tg;
                         break;
                     }
                 }
                 if (guardian == null)
                 {
                     continue;
                 }
                 const int PaddingX = 8;
                 int       PaddingY = 18;
                 if (Main.tile[BannerX, BannerY].type == 19)
                 {
                     PaddingY -= 8;
                 }
                 BannerY++;
                 Vector2 BannerPosition = new Vector2(BannerX * 16 + PaddingX, BannerY * 16 + PaddingY) - Main.screenPosition;
                 DrawBanner(guardian, BannerPosition, Lighting.GetColor(BannerX, BannerY));
                 BannerPosition -= new Vector2(Main.HouseBannerTexture[1].Width * 0.5f, Main.HouseBannerTexture[1].Height * 0.5f);
                 if (Main.mouseX >= BannerPosition.X && Main.mouseX < BannerPosition.X + Main.HouseBannerTexture[1].Width &&
                     Main.mouseY >= BannerPosition.Y && Main.mouseY < BannerPosition.Y + Main.HouseBannerTexture[1].Height)
                 {
                     //MainPlayer.mouseInterface = true;
                     MouseText = guardian.Name;
                     if (Main.mouseRight && Main.mouseRightRelease)
                     {
                         if (!guardian.IsStarter && !guardian.IsPlayerBuddy(Main.LocalPlayer) && guardian.FriendshipLevel < guardian.Base.MoveInLevel)
                         {
                             Main.NewText(guardian.Name + (Main.rand.Next(2) == 0 ? " refuses to leave their house." : " doesn't want to be kicked out of their house."), Color.PaleVioletRed);
                         }
                         else
                         {
                             townnpc.Homeless  = true;
                             townnpc.HomeX     =
                                 townnpc.HomeY = -1;
                             townnpc.ValidateHouse();
                             Main.PlaySound(12, -1, -1, 1, 1f, 0f);
                         }
                     }
                 }
             }
         }
         if (MouseText != "")
         {
             Utils.DrawBorderString(Main.spriteBatch, MouseText, new Vector2(Main.mouseX, Main.mouseY + 16), Color.White, 1f, 0.5f);
         }
     }
     catch
     {
     }
 }
Пример #6
0
        public override void Update(TerraGuardian guardian)
        {
            switch (Step)
            {
            case 0:
            {
                const float DistanceBonus = 1;         //3
                if (Time == 0)
                {
                    if (guardian.PlayerMounted)
                    {
                        guardian.Dismount();
                    }
                    if (guardian.SittingOnPlayerMount)
                    {
                        guardian.DoSitOnPlayerMount(false);
                    }
                    if (guardian.UsingFurniture)
                    {
                        guardian.LeaveFurniture(false);
                    }
                    if (guardian.IsLeader)
                    {
                        guardian.RemoveFromCommanding();
                    }
                    string Message;
                    switch (Main.rand.Next(3))
                    {
                    default:
                        Message = "*No! Not again! Everyone, stay away from me!*";
                        break;

                    case 1:
                        Message = "*It's happening again! Don't follow me! Leave me alone!*";
                        break;

                    case 2:
                        Message = "*Save yourselves! I'm losing myself again!!*";
                        break;
                    }
                    guardian.SaySomethingCanSchedule(Message, false, Main.rand.Next(60, 180));
                    if (guardian.OwnerPos > -1 && !guardian.IsPlayerBuddy(Main.player[guardian.OwnerPos]))
                    {
                        if (!NpcMod.HasGuardianNPC(guardian.ID, guardian.ModID))
                        {
                            WorldMod.GuardianTownNPC.Add(guardian);
                        }
                        Main.player[guardian.OwnerPos].GetModPlayer <PlayerMod>().DismissGuardian(guardian.ID, guardian.ModID);
                    }
                }
                else
                {
                    bool  FleeToLeft = false;
                    float FarthestAllyLeft = 0, FarthestAllyRight = 0;
                    foreach (TerraGuardian tg in MainMod.ActiveGuardians.Values)
                    {
                        if (guardian.InPerceptionRange(tg.CenterPosition, DistanceBonus))
                        {
                            float Distance = Math.Abs(tg.Position.X - guardian.Position.X);
                            if (tg.Position.X < guardian.Position.X)
                            {
                                if (Distance > FarthestAllyLeft)
                                {
                                    FarthestAllyLeft = Distance;
                                }
                            }
                            else
                            {
                                if (Distance > FarthestAllyRight)
                                {
                                    FarthestAllyRight = Distance;
                                }
                            }
                        }
                    }
                    for (int p = 0; p < 255; p++)
                    {
                        if (Main.player[p].active && !Main.player[p].dead && guardian.InPerceptionRange(Main.player[p].Center, DistanceBonus))
                        {
                            float Distance = Math.Abs(Main.player[p].Center.X - guardian.Position.X);
                            if (Main.player[p].Center.X < guardian.Position.X)
                            {
                                if (Distance > FarthestAllyLeft)
                                {
                                    FarthestAllyLeft = Distance;
                                }
                            }
                            else
                            {
                                if (Distance > FarthestAllyRight)
                                {
                                    FarthestAllyRight = Distance;
                                }
                            }
                        }
                    }
                    FleeToLeft        = FarthestAllyLeft < FarthestAllyRight;  //Run to the position where allies have less distance from her.
                    guardian.MoveLeft = guardian.MoveRight = false;
                    guardian.WalkMode = false;
                    if (FleeToLeft)
                    {
                        guardian.MoveLeft = true;
                    }
                    else
                    {
                        guardian.MoveRight = true;
                    }
                    if (Time >= TimeUntilActivates)
                    {
                        ChangeStep();
                    }
                    IgnoreCombat = true;
                }
            }
            break;

            case 1:
            {
                IgnoreCombat = false;
                CilleBase.CilleData data = (CilleBase.CilleData)guardian.Data;
                if (CilleBase.TriggerBeastState(guardian))
                {
                    data.InBeastState = true;
                    ForcedTactic      = CombatTactic.Charge;
                    if (guardian.TargetID > -1)
                    {
                        guardian.AttackingTarget = true;
                    }
                    //InUse = false;
                }
                else
                {
                    data.InBeastState = false;
                    string Message;
                    switch (Main.rand.Next(3))
                    {
                    default:
                        Message = "*Huh? It's over... I hope I didn't hurt anyone.*";
                        break;

                    case 1:
                        Message = "*What happened? Did someone got hurt?*";
                        break;

                    case 2:
                        Message = "*I'm so glad it's over. I didn't hurt anyone, right?*";
                        break;
                    }
                    guardian.SaySomethingCanSchedule(Message, false, Main.rand.Next(30, 180));
                    InUse = false;
                }
            }
            break;
            }
        }
Пример #7
0
        public override string NormalMessage(Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            if (guardian.IsSleeping)
            {
                Mes.Add("(He's sleeping? I think he's sleeping. His eyes... Doesn't seems like his regular eyes.)");
                Mes.Add("(You try waving your hand in front of his eye, but see no reaction. He must be sleeping.)");
                Mes.Add("(You shiver while watching him sleeping.)");
            }
            else if (player.statLife < player.statLifeMax2 * 0.33f)
            {
                Mes.Add("*[nickname]! Hang on! You need medical help, right now.*");
                Mes.Add("*What happened to you? Hang on, sit down a bit.*");
                Mes.Add("*You're bleeding too much. Let's see if I can help you with those wounds.*");
            }
            else
            {
                Mes.Add("*I have treated many people in the Ether Realm. Let's see if I can do the same here.*");
                Mes.Add("*Why people seems scared of me? Is it because of my profession?*");
                Mes.Add("*Whatever wound you show me, probably isn't the gruesomest thing I've ever seen.*");
                Mes.Add("*Are you in need of a check up?*");
                Mes.Add("*In case your back is aching, I can solve that with ease.*");
                Mes.Add("*Do I look angry, or scary? Sorry, my face is just like that.*");

                if (Main.dayTime)
                {
                    if (Main.eclipse)
                    {
                        Mes.Add("*Please direct the injured to my room.*");
                        Mes.Add("*I wont rest this eclipse, right?*");
                        Mes.Add("*Are you hurt? Those monsters look tough.*");
                    }
                    else
                    {
                        Mes.Add("*Enjoying the time, [nickname]?*");
                        Mes.Add("*You visited me, that means either you are injured, sick, or wanted to check me out.*");
                        Mes.Add("*I'm not treating anyone right now, so I can spend some time talking.*");
                    }
                }
                else
                {
                    if (Main.bloodMoon)
                    {
                        Mes.Add("*What is wrong with the women here? They all look furious this night.*");
                        Mes.Add("*I don't know what's scarier this night: The monsters or the women.*");
                        Mes.Add("*I wont have a good night of sleep today, right?*");
                    }
                    else
                    {
                        Mes.Add("*I was about to get some sleep. Need something before I do so?*");
                        Mes.Add("*Feeling tired? Me too.*");
                        Mes.Add("*You would not believe your eyes, if ten million fireflies, lit up the world as I fall asleep.*");
                    }
                }

                if (guardian.IsPlayerRoomMate(player))
                {
                    Mes.Add("*There is enough space on my house for both of us, so I can share it with you.*");
                    Mes.Add("*I really hope I don't make you sick whenever I change my skin.*");
                }
                if (guardian.IsPlayerBuddy(player))
                {
                    Mes.Add("*Feeling fine, [nickname]? Just checking you up.*");
                }
                if (NpcMod.HasGuardianNPC(Sardine))
                {
                    Mes.Add("*It has been many times I've had [gn:" + Sardine + "] be brought by someone to my house, unconscious.*");
                    Mes.Add("*Everytime is the same: [gn:" + Sardine + "] is brought to me unconscious to me, I treat him, the he gets jump scared when he wakes up. He should have been used to my face.*");
                }
                if (NpcMod.HasGuardianNPC(Bree))
                {
                    Mes.Add("*Why [gn:" + Bree + "] takes so many vitamins?*");
                }
                if (NpcMod.HasGuardianNPC(Brutus))
                {
                    Mes.Add("*For someone who charges into fights, [gn:" + Brutus + "] only visits me with light wounds.*");
                    Mes.Add("*I can't help but notice that [gn:" + Brutus + "] has his left arm stronger than the right. Is it because he practices swinging his sword?*");
                }
                if (NpcMod.HasGuardianNPC(Mabel))
                {
                    Mes.Add("*Ever since [gn:" + Mabel + "] moved in, I had to get a new batch of tissues.*");
                    Mes.Add("*I tried recommending some diet for [gn:" + Mabel + "]. She didn't took that well.*");
                }
                if (NpcMod.HasGuardianNPC(Malisha))
                {
                    Mes.Add("*I'm glad that my old skins are being useful for [gn:" + Malisha + "]. I only wonder what she uses it for.*");
                }
                if (NpcMod.HasGuardianNPC(Cinnamon))
                {
                    Mes.Add("*Why does [gn:" + Cinnamon + "] thinks I will eat her?*");
                    Mes.Add("*In some extreme cases, I have to make [gn:" + Cinnamon + "] sleep in order to treat her disease or wounds.*");
                }
                if (NpcMod.HasGuardianNPC(Miguel))
                {
                    Mes.Add("*It seems like I managed to get into some synergy with [gn:" + Miguel + "]'s work. He gives exercises to people, while I help with their nutrition.*");
                }
                if (NpcMod.HasGuardianNPC(Cille))
                {
                    Mes.Add("*Ah, good that you came. Your friend [gn:" + Cille + "] has visited me earlier. She said that had something wrong with her, but I did a checkup, and I didn't found anything wrong.*");
                }
                if (FlufflesBase.IsHauntedByFluffles(player) && Main.rand.NextDouble() < 0.75)
                {
                    Mes.Clear();
                    Mes.Add("*Uh, [nickname]... There is a ghost on your shoulder.*");
                }
            }
            return(Mes[Main.rand.Next(Mes.Count)]);
        }