Ejemplo n.º 1
0
        public override void Activate(Vector2 position, params object[] args)
        {
            if (!Main.gameMenu)
            {
                TUAPlayer p = Main.LocalPlayer.GetModPlayer <TUAPlayer>();
                if (p != null)
                {
                    if (p.currentDimension == "solar")
                    {
                        isActive = true;
                    }
                    for (int i = 0; i < 50; i++)
                    {
                        zDistance[i] = Main.rand.NextFloat(0.1f, 0.7f);               // get a random 3rd Dimension distance
                        xPos[i]      = (Main.rand.NextFloat(0, Main.maxTilesX)) * 16; //makes so that objects dont spawn outside of the world
                        yPos[i]      = (Main.rand.NextFloat(50, 51));                 //same for Y
                    }
                }
            }

            /*for (int i = 0; i < Main.npc.Length; i++) {
             *  if (Main.npc[i].active && Main.npc[i].type == NPCID.EyeofCthulhu) {
             *      EoCUp = true;
             *  }
             * }*/
        }
Ejemplo n.º 2
0
        public override void EditSpawnPool(IDictionary <int, float> pool, NPCSpawnInfo spawnInfo)
        {
            TUAPlayer p = Main.LocalPlayer.GetModPlayer <TUAPlayer>();

            if (p.currentDimension == "solar")
            {
                pool.Clear();
                pool.Add(npcList[1][0], 10f);
                pool.Add(npcList[1][1], 1f);
                pool.Add(npcList[1][2], 5f);
                pool.Add(npcList[1][3], 9f);
            }
        }
Ejemplo n.º 3
0
        private void UpdateCamera(FrameEventData evt)
        {
            Vector2 cameraPosition = Main.screenPosition;

            //Vector2 difference = cameraPosition - _CameraTarget;
            //difference = Vector2.Normalize(difference);
            //var dif = difference * (float) TUA.gameTime.ElapsedGameTime.TotalSeconds;
            cameraPosition = Vector2.Lerp(cameraPosition, _CameraTarget, 0.6f);
            //cameraPosition += difference * (float) TUA.gameTime.ElapsedGameTime.TotalSeconds * 0.4f;
            if ((cameraPosition - _CameraTarget).Length() < _speed)
            {
                cameraPosition = _CameraTarget;
            }
            TUAPlayer.LockPlayerCamera(cameraPosition, true);
        }
Ejemplo n.º 4
0
        public override void PostUpdate()
        {
            TUAPlayer plr = Main.LocalPlayer.GetModPlayer <TUAPlayer>();

            if (plr.currentDimension == "solar")
            {
                Player p = Main.LocalPlayer;

                if (solarRainCooldown == 0)
                {
                    Vector2 spawnPosition = new Vector2(p.Center.X + Main.rand.NextFloat(-300f, 300f), p.Center.Y - 400f);
                    NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, NPCID.SolarFlare);
                    spawnPosition = new Vector2(p.Center.X + Main.rand.NextFloat(-300f, 300f), p.Center.Y - 400f);
                    NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, NPCID.SolarFlare);
                    spawnPosition = new Vector2(p.Center.X + Main.rand.NextFloat(-300f, 300f), p.Center.Y - 400f);
                    NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, NPCID.SolarFlare);
                    solarRainCooldown = 150;
                }
                solarRainCooldown--;
            }
        }
Ejemplo n.º 5
0
        public override bool UseItem(Player player)
        {
            TUAPlayer p = player.GetModPlayer <TUAPlayer>(mod);

            FieldInfo info = typeof(FileData).GetField("_path", BindingFlags.Instance | BindingFlags.NonPublic);
            string    get  = (string)info.GetValue(Main.ActiveWorldFileData);

            if (itemUseCooldown == 0)
            {
                WorldFile.saveWorld(false, true);
                if (p.currentDimension != "solar")
                {
                    p.currentDimension = "solar";
                    Main.NewText("You are entering into the solar dimension...", Color.Orange);



                    if (!File.Exists(Main.SavePath + "/World/Solar/" + Main.worldName + ".wld"))
                    {
                        info.SetValue(Main.ActiveWorldFileData, Main.SavePath + "/World/Solar/" + Main.worldName + ".wld");
                        generateDimension();
                        p.player.Spawn();
                        return(true);
                    }

                    info.SetValue(Main.ActiveWorldFileData, Main.SavePath + "/World/Solar/" + Main.worldName + ".wld");
                    itemUseCooldown = 500;
                    WorldGen.EveryTileFrame();
                    WorldGen.playWorld();
                    return(true);
                }
                info.SetValue(Main.ActiveWorldFileData, Main.SavePath + "/World/" + Main.worldName + ".wld");
                p.currentDimension = "overworld";
                itemUseCooldown    = 500;
                WorldGen.playWorld();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        public override void AI()
        {
            if (npc.localAI[0] != 1f)
            {
                RotateToPlayer();

                if (cutscenePhase != 7)
                {
                    if (cutscenePhase >= 1)
                    {
                        SpawnCircleDust(10 * 16, DustID.Shadowflame);
                    }

                    ExecuteCutscene();
                    return;
                }
                TUAPlayer.LockPlayerCamera(null, false);
                Main.musicVolume = previousMusicVolume;
                if (npc.ai[1] == 0)
                {
                }
            }
        }
Ejemplo n.º 7
0
 public void InitLoreUI(TUAPlayer instance)
 {
     this.instance = instance;
 }
Ejemplo n.º 8
0
        private void ExecuteCutscene()
        {
            Vector2 centerPosition = new Vector2(npc.position.X + 300, npc.Center.Y);

            npc.velocity = Vector2.Zero;

            TUAPlayer.LockPlayerCamera(new Vector2(npc.position.X + 300 - Main.screenWidth / 2, npc.Center.Y - Main.screenHeight / 2), true);



            if (CutsceneTimer == 0)
            {
                switch (CutscenePhase)
                {
                case 0:
                    npc.GivenName = "Eye of Cthulhu";
                    TUA.BroadcastMessage("<Eye of Cthulhu> I'm sorry, I failed you master... The terrarian are much more stronger than I thought");
                    CutsceneTimer = 200;
                    CutscenePhase++;
                    break;

                case 1:
                    TUA.BroadcastMessage("<???> You failure of a minion, you can't even do your job properly. I was sealed for 1000 year ago and when I wake up I find that the terrarian are more strong than what they were during the god reign time.");
                    CutsceneTimer = 300;
                    CutscenePhase++;
                    break;

                case 2:
                    TUA.BroadcastMessage("<Eye of Cthulhu> But master, those are not the same from 1000 year ago, those area new race.");
                    CutsceneTimer = 250;
                    CutscenePhase++;
                    break;

                case 3:
                    TUA.BroadcastMessage("<???> I do not care about what they are or what they became, I can still smell the presence of the traveler around the world, the one that made us perish.");
                    TUA.BroadcastMessage("<???> Anyway, enough talking for now, I'll give you one last chance and don't fail on me. Here is a fraction of my power");
                    CutsceneTimer = 400;
                    CutscenePhase++;
                    break;

                case 4:
                    TUA.BroadcastMessage("<Ultra Eye of Cthulhu> Master, I promise I will do this request, the terrarian will be destroyed.");
                    TUA.instance.SetTitle("Ultra Eye of Cthulhu", "Not what you were expecting?", Color.White, Color.DarkRed, Main.fontDeathText, 600, 0.8f, true);
                    TUAPlayer.LockPlayerCamera(null, false);
                    IsCutsceneExecuting = false;
                    CutscenePhase++;
                    npc.GivenName = "Ultra Eye of Cthulhu";
                    break;
                }
            }

            if (CutscenePhase == 4)
            {
                npc.rotation -= 0.5f;
                if (CutsceneDustTimer == 0)
                {
                    Dust.NewDust(npc.Center, 2, 2, DustID.Shadowflame, Main.rand.Next(-4, 4), Main.rand.Next(-4, 4),
                                 0, Color.White, 2f);
                    CutsceneDustTimer = 2;
                }

                CutsceneDustTimer--;
            }
            else
            {
                rotateToPosition(centerPosition);
            }

            CutsceneTimer--;
        }
Ejemplo n.º 9
0
        private void ExecuteCutscene()
        {
            if (previousMusicVolume == -1f)
            {
                previousMusicVolume = Main.musicVolume;
            }

            Main.musicVolume = 0f;
            cutscenetimer--;
            if (cutscenetimer == 0)
            {
                cutscenetimer = 300;
                opacity      += 0.3f;
                npc.Opacity   = opacity;
                switch (cutscenePhase)
                {
                case 0:
                    TUA.instance.SetTitle("Eye of Azathoth", "The god of destruction", Color.Red, Color.Black, Main.fontDeathText, 300, 1, true);
                    TUA.BroadcastMessage("<???> Who hath summoned this to this wretched world? " +
                                         "It will be a pleasure to destroy them, like I did a years ago.", Color.Black);
                    npc.GivenName = "???";
                    break;

                case 1:
                    TUA.BroadcastMessage("<???> Humans sealed me eons ago, but now I'm finally free " +
                                         "and I'll bring this world back to its most glorious stage, the era of destruction!");
                    break;

                case 2:
                    npc.GivenName = "Eye of Azathoth";
                    TUA.BroadcastMessage($"<{npc.GivenName}> I, the Eye of Azathoth, the divine incarnation of destruction, " +
                                         "will bring the world back to the times when humanity was nothing more than a speck on the earth.");
                    break;

                case 3:
                    TUA.BroadcastMessage($"<{npc.GivenName}> Once I reigned supreme over all other gods of this world , " +
                                         "but that despicable man completely defeated me, impossibly, " +
                                         "and somehow me and my brotherhood was rendered powerless and trapped in another dimension.");
                    break;

                case 4:
                    TUA.BroadcastMessage($"<{npc.GivenName}> I'll never forgive that human, never.");
                    break;

                case 5:
                    TUA.BroadcastMessage($"<{npc.GivenName}> But now I am back to seek revenge on the humans, " +
                                         "their worthless spells and so-called \"technology\" won't be able to stop me this time " +
                                         "and everyone will perish under the plagues! I will allow all of humanity to be crushed by " +
                                         "our divine power!");
                    break;

                case 6:
                    TUA.instance.SetTitle("Eye of Azathoth", "The god of destruction", Color.Red, Color.Black, Main.fontDeathText, 300, 1, true);
                    TUA.BroadcastMessage($"<{npc.GivenName}> We are taking our throne back " +
                                         "and we will conquer the world like we did a millenia ago, I hope you're ready to fight Terraria, " +
                                         "otherwise it would be boring for me.");
                    break;
                }
                cutscenePhase++;
            }


            TUAPlayer.LockPlayerCamera(new Vector2(npc.Center.X - Main.screenWidth / 2, npc.Center.Y - Main.screenHeight / 2), true);

            Dust.NewDust(npc.Center, 5, 5, DustID.Electric, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 255,
                         Color.White * opacity, 1f);
        }
Ejemplo n.º 10
0
 private void FreeLock(FrameEventData evt)
 {
     TUAPlayer.LockPlayerCamera(null, false);
 }