コード例 #1
0
 public override void NPCLoot()
 {
     if (Math.Abs(npc.ai[2]) > 200)
     {
         if (npc.ai[0] > 6)
         {
             npc.type = oldtype;
             NPC myguy = Main.npc[(int)npc.ai[1]];
             myguy.active = false;
             Achivements.SGAAchivements.UnlockAchivement("Harbinger", Main.LocalPlayer);
             if (SGAWorld.downedHarbinger == false)
             {
                 Idglib.Chat("Your end is nigh...", 15, 15, 150);
                 Idglib.Chat("Robbed figures have been seen near the dungeon.", 20, 20, 125);
                 SGAWorld.downedHarbinger = true;
             }
         }
         else
         {
             npc.boss = false;
         }
     }
     else
     {
         npc.boss = false;
         Idglib.Chat("You are not ready for this...", 15, 15, 150);
         for (int i = 180; i <= 361; i += 180)
         {
             int harbinger2 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type);
             Main.npc[harbinger2].ai[2]     = i;
             Main.npc[harbinger2].netUpdate = true;
         }
     }
 }
コード例 #2
0
ファイル: Cirno.cs プロジェクト: IDGCaptainRussia94/SGAmod
        public override void NPCLoot()
        {
            if (npc.boss)
            {
                List <Projectile> itz = Idglib.Shattershots(npc.Center - new Vector2(npc.spriteDirection * 20, 100), npc.Center - new Vector2(npc.spriteDirection * 20, 100), new Vector2(0, 0), mod.ProjectileType("SnowCloud"), 40, 4f, 0, 1, true, 0, false, 1000);

                if (Main.expertMode)
                {
                    npc.DropBossBags();
                }
                else
                {
                    string [] dropitems = { "Starburster", "Snowfall", "IceScepter", "RubiedBlade", "IcicleFall" };
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType(dropitems[Main.rand.Next(0, dropitems.Length)]));
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryostalBar"), Main.rand.Next(15, 25));
                }
            }
            Achivements.SGAAchivements.UnlockAchivement("Cirno", Main.LocalPlayer);
            if (SGAWorld.downedCirno == false)
            {
                SGAWorld.downedCirno = true;
                Idglib.Chat("The snowflakes have thawed from your wings", 50, 200, 255);
            }
            //float targetX = npc.Center.X;
            //float targetY = npc.Center.Y;
            //NPC.NewNPC((int)npc.Center.X + 13, (int)npc.Center.Y - 2, mod.NPCType("GraySlime6"));
            //NPC.NewNPC((int)npc.Center.X - 13, (int)npc.Center.Y - 2, mod.NPCType("GraySlime6"));
        }
コード例 #3
0
        //this and the next one were based off BlushieMagic's code, god bless!
        public static void GenVirulent()
        {
            if (Main.netMode == 1 || WorldGen.noTileActions || WorldGen.gen || !Main.hardMode || GennedVirulent)
            {
                return;
            }

            //WorldGen.TileRunner(x, y, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), TileType<ExampleOre>(), false, 0f, 0f, false, true);
            for (double k = 0; k < (Main.maxTilesX - 200) * (Main.maxTilesY - 150 - (int)Main.rockLayer) / 25.0 / 1.0; k += 1.0)
            {
                int  genx   = WorldGen.genRand.Next(100, Main.maxTilesX - 100);
                int  geny   = WorldGen.genRand.Next((int)Main.rockLayer, (int)Main.maxTilesY - 150);
                Tile tile   = Framing.GetTileSafely(genx, geny);
                int  chance = 0;
                if (tile.active() && (tile.type == TileID.Mud))
                {
                    chance = 3;
                }

                if (Main.rand.Next(0, 100) < chance)
                {
                    WorldGen.TileRunner(genx, geny, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(5, 16), TileType <VirulentOre>(), false, 0f, 0f, false, true);
                }
            }
            if (Main.netMode == NetmodeID.Server)
            {
                NetMessage.SendData(MessageID.WorldData);
            }
            GennedVirulent = true;
            Idglib.Chat("The raw power of the empowered Murk has seeped into the jungle underground!", 75, 225, 75);
        }
コード例 #4
0
        public override void SpawnMoreExpert()
        {
            Idglib.Chat("Turn.... baacckk...", 5, 5, 60);
            int newguy = NPC.NewNPC((int)npc.position.X + 400, (int)npc.position.Y, mod.NPCType(level > 0 ? "CobaltArmorChainmail" : "CopperArmorChainmail")); NPC newguy2 = Main.npc[newguy]; CopperArmorPiece newguy3 = newguy2.modNPC as CopperArmorPiece; newguy3.attachedID = npc.whoAmI; newguy2.lifeMax = (int)(npc.lifeMax * 1.5f); newguy2.life = (int)(npc.lifeMax * (1.5f)); newguy2.knockBackResist = 1f; newguy2.netUpdate = true;

            raged = true;
            createarmorthings();
        }
コード例 #5
0
 public static void QuestCheck(int questtype, Player ply)
 {
     ply.GetModPlayer <SGAPlayer>().UpgradeTF2();
     if (tf2cratedrops == false)
     {
         tf2cratedrops = true;
         Idglib.Chat("<Contracker> Crates have began to drop for everyone!", 255, 255, 255);
     }
 }
コード例 #6
0
 public override void NPCLoot()
 {
     Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TerrariacoCrateKey"));
     Achivements.SGAAchivements.UnlockAchivement("Cratrosity", Main.LocalPlayer);
     if (SGAWorld.downedCratrosity == false)
     {
         Idglib.Chat("The hungry video game industry has been tamed! New items are available for buying", 244, 179, 66);
     }
     SGAWorld.downedCratrosity = true;
 }
コード例 #7
0
        public override void NPCLoot()
        {
            /*WorldGen.oreTier1 = 107;
            *  WorldGen.oreTier3 = 111;*/


            List <int> types = new List <int>();

            types.Insert(types.Count, mod.ItemType("WraithFragment4"));
            int ammount = 0;

            for (ammount = 0; ammount < 1; ammount += 1)
            {
                types.Insert(types.Count, ItemID.Hellstone);
            }
            for (ammount = 0; ammount < 3; ammount += 1)
            {
                types.Insert(types.Count, SGAmod.WorldOres[4, WorldGen.oreTier1 == 107 ? 1 : 0]);
            }
            for (ammount = 0; ammount < 2; ammount += 1)
            {
                types.Insert(types.Count, SGAmod.WorldOres[5, WorldGen.oreTier2 == 108 ? 1 : 0]);
            }
            for (ammount = 0; ammount < 1; ammount += 1)
            {
                types.Insert(types.Count, ItemID.SoulofLight);
            }
            for (ammount = 0; ammount < 1; ammount += 1)
            {
                types.Insert(types.Count, SGAmod.WorldOres[6, WorldGen.oreTier3 == 111 ? 1 : 0]);
            }
            for (ammount = 0; ammount < 1; ammount += 1)
            {
                types.Insert(types.Count, ItemID.SoulofNight);
            }

            for (int f = 0; f < (Main.expertMode ? 200 : 100); f = f + 1)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, types[Main.rand.Next(0, types.Count)]);
            }

            for (int f = 0; f < (Main.expertMode ? 25 : 10); f = f + 1)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WraithFragment4"));
            }

            Achivements.SGAAchivements.UnlockAchivement("Cobalt Wraith", Main.LocalPlayer);
            if (SGAWorld.downedWraiths < 2)
            {
                SGAWorld.downedWraiths = 2;
                Idglib.Chat("You have regained the knowledge to craft a hardmode anvil!", 20, 60, 220);
            }
        }
コード例 #8
0
 public static void QuestCheck(int questtype, Player ply)
 {
     ply.GetModPlayer <SGAPlayer>().upgradetf2();
     if (tf2cratedrops == false)
     {
         tf2cratedrops = true;
         Idglib.Chat("<Contracker> Crates have began to drop for everyone!", 255, 255, 255);
     }
     if (tf2questcounter < 1)
     {
         if (questtype == 0)
         {
             if (tf2quest < 1 && GetInstance <SGAConfig>().Contracker)
             {
                 tf2quest = 1;
                 Idglib.Chat("<Contracker> The TF2 questline has began!", 255, 255, 255);
             }
             if (tf2quest == 2)
             {
                 if (questvars[0] < 1000)
                 {
                     SgaLib.Chat("<Contracker> You have killed " + questvars[0] + "/1000 enemies", 255, 255, 255);
                 }
                 else
                 {
                     questvars[0] = 0;
                     tf2quest     = 3;
                 }
             }
             if (tf2quest == 4)
             {
                 int goldcount = ply.CountItem(ItemID.GoldBar);
                 if (goldcount < 100)
                 {
                     Idglib.Chat("<Contracker> You have " + goldcount + "/100 Gold Bars", 255, 255, 255);
                 }
                 else
                 {
                     for (int x = 0; x < 100; x++)
                     {
                         ply.ConsumeItem(ItemID.GoldBar);
                     }
                     tf2quest = 5;
                     Idglib.Chat("Your world has been blessed with Australium!", 255, 255, 102);
                     GenAustralium();
                 }
             }
         }
     }
 }
コード例 #9
0
        public static void Release(Vector2 center, bool caliburn = false, Vector2 speed = default)
        {
            if (speed == default)
            {
                speed = new Vector2(8f, 8f);
            }
            if ((!SGAWorld.darknessVision) || !caliburn)
            {
                if (caliburn)
                {
                    Idglib.Chat("The Darkness grows restless...", 180, 25, 25);
                }

                int proj = Projectile.NewProjectile(center, Vector2.One.RotatedByRandom(Math.PI) * speed, ModContent.ProjectileType <SpookyDarkSectorEye>(), 1, 0, ai1: caliburn ? 1 : 0);
                Main.projectile[proj].ai[1]     = caliburn ? 1 : 0;
                Main.projectile[proj].netUpdate = true;
            }
        }
コード例 #10
0
        public override void NPCLoot()
        {
            List <int> types = new List <int>();

            /*WorldGen.CopperTierOre = 7;
             * WorldGen.IronTierOre = 6;
             * WorldGen.SilverTierOre = 9;
             * WorldGen.GoldTierOre = 8;*/

            int shardtype = mod.ItemType("WraithFragment");

            if (SGAWorld.WorldIsTin)
            {
                shardtype = mod.ItemType("WraithFragment2");
                //npc.GivenName = "Tin Wraith";
            }

            types.Insert(types.Count, shardtype);
            types.Insert(types.Count, SGAmod.WorldOres[0, WorldGen.CopperTierOre == TileID.Copper ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[0, WorldGen.CopperTierOre == TileID.Copper ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[1, WorldGen.IronTierOre == TileID.Iron ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[1, WorldGen.IronTierOre == TileID.Iron ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[2, WorldGen.SilverTierOre == TileID.Silver ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[2, WorldGen.SilverTierOre == TileID.Silver ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[3, WorldGen.GoldTierOre == TileID.Gold ? 1 : 0]);


            if (shardtype > 0)
            {
                for (int f = 0; f < (Main.expertMode ? 40 : 25); f = f + 1)
                {
                    Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, shardtype);
                }
            }

            for (int f = 0; f < (Main.expertMode ? 200 : 100); f = f + 1)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, types[Main.rand.Next(0, types.Count)]);
            }

            Achivements.SGAAchivements.UnlockAchivement("Copper Wraith", Main.LocalPlayer);
            if (SGAWorld.downedWraiths < 1)
            {
                SGAWorld.downedWraiths = 1;
                Idglib.Chat("You have regained the knowledge to craft a furnace!", 150, 150, 70);
            }
        }
コード例 #11
0
        public override void NPCLoot()
        {
            for (int i = 0; i < (Main.hardMode ? 2 : 1); i += 1)
            {
                if (Main.expertMode)
                {
                    npc.DropBossBags();
                }
                else
                {
                    for (int f = 0; f < (Main.rand.Next(30, 45)); f = f + 1)
                    {
                        Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyGel"));
                    }

                    int choice = Main.rand.Next(4);
                    if (choice == 0)
                    {
                        Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkFlail"));
                    }
                    else if (choice == 1)
                    {
                        Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Mossthorn"));
                    }
                    else if (choice == 2)
                    {
                        Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Landslide"));
                    }
                    else if (choice == 3)
                    {
                        Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Mudmore"));
                    }
                }
            }
            Achivements.SGAAchivements.UnlockAchivement("Murk", Main.LocalPlayer);
            if (SGAWorld.downedMurk == 0)
            {
                Idglib.Chat("The Moist Stone around Dank Shrines has weakened and can be broken.", 75, 225, 75);
            }
            SGAWorld.downedMurk = Main.hardMode ? 2 : 1;
            SGAWorld.GenVirulent();
        }
コード例 #12
0
 public override void FalseDeath(int phase)
 {
     pmlphase      = pmlphase + 1;
     pmlphasetimer = 1100;
     if (pmlphase == 2)
     {
         pmlphasetimer = 3000;
     }
     Idglib.Chat("Impressive, but not good enough", 144, 79, 16);
     if (pmlphase == 1)
     {
         summons.Insert(0, mod.NPCType("CratrosityCrateOfSlowing"));
     }
     if (pmlphase == 2)
     {
         summons.Insert(0, mod.NPCType("CratrosityCrateOfSlowing"));
         summons.Insert(0, mod.NPCType("CratrosityCrateOfPoisoned"));
     }
     if (pmlphase == 3)
     {
         summons.Insert(0, mod.NPCType("CratrosityCrateOfWitheredArmor"));
         summons.Insert(0, mod.NPCType("CratrosityCrateOfWitheredWeapon"));
     }
     if (pmlphase > 3)
     {
         summons.Insert(0, mod.NPCType("CratrosityCrateOfPoisoned"));
         summons.Insert(0, mod.NPCType("CratrosityCrateOfSlowing"));
         summons.Insert(0, mod.NPCType("CratrosityCrateOfWitheredArmor"));
         summons.Insert(0, mod.NPCType("CratrosityCrateOfWitheredWeapon"));
     }
     for (int ii = 0; ii < summons.Count; ii += 1)
     {
         int spawnedint = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, summons[0]); summons.RemoveAt(0);
         NPC him        = Main.npc[spawnedint];
         him.life    = (int)(npc.life * 0.75f);
         him.lifeMax = (int)(npc.lifeMax * 0.75f);
     }
 }
コード例 #13
0
        public override void AI()
        {
            if (oldtype < 1)
            {
                oldtype = npc.type;
            }
            npc.netUpdate = true;
            Player P = Main.player[npc.target];

            if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active || Main.dayTime)
            {
                npc.TargetClosest(false);
                P = Main.player[npc.target];
                if (!P.active || P.dead || Main.dayTime)
                {
                    npc.active = false;
                    Main.npc[(int)npc.ai[1]].active = false;
                }
            }
            else
            {
                Double  angleval = MathHelper.ToRadians(npc.ai[2]);
                Vector2 itt      = P.Center + new Vector2((float)Math.Cos(angleval), (float)Math.Sin(angleval)) * 300f;

                if (Math.Abs(npc.ai[2]) > 0)
                {
                    npc.ai[2]    += 1f;
                    npc.GivenName = "Doom Harbingers";
                    float   speedz = Main.npc[(int)npc.ai[1]].velocity.Length();
                    Vector2 poz    = Main.npc[(int)npc.ai[1]].position;
                    if (NPC.CountNPCS(npc.type) > 1)
                    {
                        Main.npc[(int)npc.ai[1]].position += (((itt - poz) / 10f) * (speedz / 30f));
                    }
                }



                npc.ai[0] += 1;
                if (npc.ai[0] == 2)
                {
                    //npc.ai[2]=NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.MoonLordHead);
                    //Main.npc[(int)npc.ai[2]].aiStyle=-1;
                    //Main.npc[(int)npc.ai[2]].timeLeft=999999;
                    //Main.npc[(int)npc.ai[2]].dontTakeDamage=true;
                    //Main.npc[(int)npc.ai[2]].boss=false;
                    npc.type  = NPCID.MoonLordCore;
                    npc.ai[1] = NPC.NewNPC((int)P.Center.X, (int)P.Center.Y - 200, NPCID.MoonLordFreeEye);
                    Main.npc[(int)npc.ai[1]].ai[3]      = npc.whoAmI;
                    Main.npc[(int)npc.ai[1]].lifeMax    = npc.lifeMax;
                    Main.npc[(int)npc.ai[1]].life       = npc.lifeMax;
                    Main.npc[(int)npc.ai[1]].defense    = npc.defense;
                    Main.npc[(int)npc.ai[1]].defDefense = npc.defDefense;
                    Main.npc[(int)npc.ai[1]].netUpdate  = true;
                }
                //Main.npc[(int)npc.ai[1]].active=true;
                //Main.npc[(int)npc.ai[1]].aiStyle=1;
                NPC myguy = Main.npc[(int)npc.ai[1]];
                if (myguy.active == false)
                {
                    npc.type = oldtype;
                    npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false);
                }
                else
                {
                    if (npc.ai[0] > 1)
                    {
                        if (npc.life > (int)(npc.lifeMax / 1.5) || NPC.CountNPCS(npc.type) > 1)
                        {
                            npc.ai[0] = Math.Min(npc.ai[0] + 1, 5);
                        }
                        if (npc.ai[0] > 60)
                        {
                            if (npc.ai[0] == 65)
                            {
                                Idglib.Chat(npc.ai[2] > 0 ? "VERY Impressive, you just might stand a chance..." : "Most impressive child...", 15, 15, 150);
                                if (npc.ai[2] > 0)
                                {
                                    myguy.life = (int)(npc.lifeMax / 1.55);
                                }
                            }

                            if (npc.ai[0] % 600 == 62)
                            {
                                for (int i = 0; i < 5; i++)
                                {
                                    int newb = Projectile.NewProjectile(npc.Center, npc.Center, ProjectileID.PhantasmalSphere, 60, 5, Main.myPlayer, 0f, (float)npc.whoAmI);
                                    orbitors[i] = newb;
                                    Main.projectile[orbitors[i]].timeLeft = 1000;
                                }
                            }


                            if (npc.ai[0] > 65)
                            {
                                for (int i = 0; i < 5; i++)
                                {
                                    if (orbitors[i] > 0 && Main.projectile[orbitors[i]].active)
                                    {
                                        if (orbitors[i] > 0 && Main.projectile[orbitors[i]] != null && Main.projectile[orbitors[i]].timeLeft > 120)
                                        {
                                            double angle    = (npc.ai[0] / 5) + 2.0 * Math.PI * (i / ((double)5f));
                                            float  timeleft = Main.projectile[orbitors[i]].timeLeft;
                                            Main.projectile[orbitors[i]].Center   = npc.Center + new Vector2((float)(Math.Cos(angle) * (150f - (150f / (timeleft - 1450f)))), (float)(Math.Sin(angle) * (150f - (150f / (timeleft - 1450f)))));
                                            Main.projectile[orbitors[i]].velocity = new Vector2((float)(Math.Cos(angle) * 8f), (float)(Math.Sin(angle) * 8f));
                                        }
                                    }
                                }
                            }


                            if (npc.ai[0] % 600 == 62 && npc.ai[2] > 5)
                            {
                                for (int i = 6; i <= 10; i++)
                                {
                                    int newb = Projectile.NewProjectile(npc.Center, npc.Center, ProjectileID.PhantasmalSphere, 60, 5, Main.myPlayer, 0f, (float)npc.whoAmI);
                                    orbitors[i] = newb;
                                    Main.projectile[orbitors[i]].timeLeft = 1000;
                                }
                            }

                            if (npc.ai[0] > 65 && npc.ai[2] > 5)
                            {
                                for (int i = 6; i <= 10; i++)
                                {
                                    if (orbitors[i] > 0 && Main.projectile[orbitors[i]].active)
                                    {
                                        if (orbitors[i] > 0 && Main.projectile[orbitors[i]] != null && Main.projectile[orbitors[i]].timeLeft > 120)
                                        {
                                            double angle    = (-npc.ai[0] / 45f) + 2.0 * Math.PI * (i / ((double)5f));
                                            float  timeleft = Main.projectile[orbitors[i]].timeLeft;
                                            Main.projectile[orbitors[i]].Center   = npc.Center + new Vector2((float)(Math.Cos(angle) * (550f - (550f / (timeleft - 1450f)))), (float)(Math.Sin(angle) * (550f - (550f / (timeleft - 1450f)))));
                                            Main.projectile[orbitors[i]].velocity = new Vector2((float)(Math.Cos(angle) * 24f), (float)(Math.Sin(angle) * 24f));
                                        }
                                    }
                                }
                            }


                            for (int k = 0; k < Main.maxPlayers; k++)
                            {
                                Player player = Main.player[k];
                                if (player != null && player.active)
                                {
                                    player.AddBuff(BuffID.MoonLeech, 30, true);
                                }
                            }
                        }


                        npc.position         = myguy.Center;
                        npc.life             = System.Math.Max(myguy.life, 200);
                        myguy.dontTakeDamage = false;
                        myguy.aiStyle        = 81;
                        //myguy.Name="Doom Harbinger";
                    }
                    npc.timeLeft = 30;
                }
            }
        }
コード例 #14
0
        public override void PostUpdate()
        {
            if ((Main.netMode < 1 || Main.myPlayer == 0) && Main.expertMode)
            {
                NightmareHardcore = Main.LocalPlayer.GetModPlayer <SGAPlayer>().nightmareplayer ? 1 : 0;
            }

            WorldIsTin         = (WorldGen.CopperTierOre == 7 ? false : true);
            SGAWorld.modtimer += 1;
            if (Main.dayTime == true)
            {
                harbingercounter = 0;
            }
            if (NPC.CountNPCS(NPCID.Golem) > 0 && SGAConfig.Instance.GolemImprovement)
            {
                golemchecker = 1;
                if (NPC.CountNPCS(mod.NPCType("SGAGolemBoss")) < 1)
                {
                    NPC myowner = Main.npc[NPC.FindFirstNPC(NPCID.Golem)];
                    NPC.NewNPC((int)myowner.position.X, (int)myowner.position.Y, mod.NPCType("SGAGolemBoss"));
                    //Main.NewText("Test: modded golem npc spawned", 25, 25, 80);
                }
            }
            else
            {
                golemchecker = 0;
            }

            harbingercounter += 1;
            if (NPC.downedAncientCultist)
            {
                stolecrafting += 1;
            }
            if (Main.netMode < 1)
            {
                if (harbingercounter == 5)
                {
                    if (Main.rand.Next(0, 10) < 5 && bossprgressor == 1 && downedHarbinger == false && DD2Event.DownedInvasionT3 && NPC.downedMartians)
                    {
                        harbingercounter = -600;
                        Idglib.Chat("You feel a darker presence watching over you...", 0, 0, 75);
                    }
                }
                if (harbingercounter == -5)
                {
                    harbingercounter = 6;
                    SGAmod.CalamityNoRevengenceNoDeathNoU();
                    NPC.SpawnOnPlayer(Main.rand.Next(0, Main.PlayerList.Count), mod.NPCType("Harbinger"));
                }
            }

            questvars[11] = Math.Max(questvars[11] - 1, 0);
            if (questvars[10] > 100 && questvars[10] < 1000)
            {
                questvars[10] += 1;
                questvars[11]  = 120;
                Hellion hellinstance = new Hellion();
                if (questvars[10] == 250)
                {
                    hellinstance.HellionTaunt("...");
                }
                if (questvars[10] == 400)
                {
                    hellinstance.HellionTaunt("I see...");
                }
                if (questvars[10] == 600)
                {
                    hellinstance.HellionTaunt("A new challenger rises...");
                }
                if (questvars[10] == 800)
                {
                    hellinstance.HellionTaunt("Curious...");
                }
            }

            if (questvars[10] > 1100 && questvars[10] < 2300)
            {
                questvars[10] += 1;
                questvars[11]  = 120;
                Hellion hellinstance = new Hellion();
                if (questvars[10] == 1200)
                {
                    hellinstance.HellionTaunt("Another emmessary...");
                }
                if (questvars[10] == 1400)
                {
                    hellinstance.HellionTaunt("Fallen. hmp...?");
                }
                if (questvars[10] == 1600)
                {
                    hellinstance.HellionTaunt("The dragon?");
                }
                if (questvars[10] == 1800)
                {
                    hellinstance.HellionTaunt("'Planets.System.FindDraken'");
                }
                if (questvars[10] == 2000)
                {
                    hellinstance.HellionTaunt("Who is this who is slaying my emissaries?");
                }
                if (questvars[10] == 2200)
                {
                    hellinstance.HellionTaunt("No matter... We'll be meeting soon enough...");
                }
            }

            if (questvars[10] > 2400 && questvars[10] < 3750)
            {
                questvars[10] += 1;
                questvars[11]  = 120;
                Hellion hellinstance = new Hellion();
                if (questvars[10] == 2400)
                {
                    hellinstance.HellionTaunt("There is no mistake");
                }
                if (questvars[10] == 2600)
                {
                    hellinstance.HellionTaunt("the failures found the dragon");
                }
                if (questvars[10] == 2800)
                {
                    hellinstance.HellionTaunt("You there, human");
                }
                if (questvars[10] == 3000)
                {
                    hellinstance.HellionTaunt("Hand over the dragon, and I'll spare your world");
                }
                if (questvars[10] == 3200)
                {
                    hellinstance.HellionTaunt("After all, we're old acquaintances");
                }
                if (questvars[10] == 3400)
                {
                    hellinstance.HellionTaunt("And thanks to the incompetence of my minions, my mission will finally be complete");
                }
                if (questvars[10] == 3600)
                {
                    hellinstance.HellionTaunt("I'm sure your dragon will have something to say about this");
                }
                if (questvars[10] == 3700)
                {
                    Main.PlaySound(29, -1, -1, 105, 1f, -0.6f);
                    hellinstance.HellionTaunt("I'll be waiting...");
                }
            }

            if (stolecrafting == -400)
            {
                Idglib.Chat("Bet you were expecting him to drop an Ancient Manipulator huh?", 25, 25, 80);
            }
            if (stolecrafting == -200)
            {
                Idglib.Chat("Welp, we stole that from him, come fight us if you want it", 25, 25, 80);
            }
            if (stolecrafting == -50)
            {
                Idglib.Chat("We want our wraith core fragments back you son of a bitch...", 25, 25, 80);
            }

            if (tf2quest == 1)
            {
                tf2questcounter = tf2questcounter + 1;
                if (tf2questcounter == 60)
                {
                    SgaLib.Chat("<Administrator> Greeting mercenary", 150, 150, 150);
                }
                if (tf2questcounter == 150)
                {
                    SgaLib.Chat("<Administrator> You have just agreed to our contract terms", 150, 150, 150);
                }
                if (tf2questcounter == 280)
                {
                    SgaLib.Chat("<Administrator> To fight for our new division, Terraria Co", 150, 150, 150);
                }
                if (tf2questcounter == 510)
                {
                    SgaLib.Chat("<Administrator> I'll spare you the details, other than your first job", 150, 150, 150);
                }
                if (tf2questcounter == 640)
                {
                    SgaLib.Chat("<Administrator> Kill a total of 1000 enemies; prove your even worth looking at", 150, 150, 150);
                }
                if (tf2questcounter == 770)
                {
                    SgaLib.Chat("<Administrator> When your done, check your contracter. DO NOT Disapointment me...", 150, 150, 150);
                }
                if (tf2questcounter == 850)
                {
                    tf2quest = 2; tf2questcounter = 0;
                }
            }
            if (tf2quest == 3)
            {
                tf2questcounter = tf2questcounter + 1;
                if (tf2questcounter == 60)
                {
                    SgaLib.Chat("<Administrator> Very good", 150, 150, 150);
                }
                if (tf2questcounter == 150)
                {
                    SgaLib.Chat("<Administrator> You've proven your, somewhat confident in your work", 150, 150, 150);
                }
                if (tf2questcounter == 280)
                {
                    SgaLib.Chat("<Administrator> Now then, if I am to take back Mann Co I need resources", 150, 150, 150);
                }
                if (tf2questcounter == 510)
                {
                    SgaLib.Chat("<Administrator> Most effectively... Australium...", 150, 150, 150);
                }
                if (tf2questcounter == 640)
                {
                    SgaLib.Chat("<Administrator> I have added functions to your contracker, it will reveal veins of Australium in this world when used", 150, 150, 150);
                }
                if (tf2questcounter == 770)
                {
                    SgaLib.Chat("<Administrator> You need to have 100 Gold Ingots in your inventory for it to work; it will not take Platinum!", 150, 150, 150);
                }
                if (tf2questcounter == 900)
                {
                    SgaLib.Chat("<Administrator> However accessing this function may attract unwanted attention too early, I'm sure it's nothing you can't handle", 150, 150, 150);
                }
                if (tf2questcounter == 1030)
                {
                    SgaLib.Chat("<Administrator> When your done, check your contracter. Try not to be a Disapointment.", 150, 150, 150);
                }
                if (tf2questcounter == 1050)
                {
                    tf2quest = 4; tf2questcounter = 0;
                }
            }
            if (tf2quest == 5)
            {
                tf2questcounter = tf2questcounter + 1;
                if (tf2questcounter == 60)
                {
                    SgaLib.Chat("<Administrator> Australium... A bountiful ammount of 100 veins", 150, 150, 150);
                }
                if (tf2questcounter == 150)
                {
                    SgaLib.Chat("<Administrator> My plan is going accordingly", 150, 150, 150);
                }
                if (tf2questcounter == 280)
                {
                    SgaLib.Chat("<Administrator> I think your due a promotion, to Commando", 150, 150, 150);
                }
                if (tf2questcounter == 510)
                {
                    SgaLib.Chat("<Administrator> You have been granted knowledge of how to make higher tier items, including more TF2 emblems", 150, 150, 150);
                }
                if (tf2questcounter == 640)
                {
                    SgaLib.Chat("<Administrator> Now for the next phase. I need 50 Australium bars", 150, 150, 150);
                }
                if (tf2questcounter == 770)
                {
                    SgaLib.Chat("<Administrator> Minedown and smelt the ores you find, then report back right away", 150, 150, 150);
                }
                if (tf2questcounter == 900)
                {
                    SgaLib.Chat("<Administrator> However accessing this function may attract unwanted attention too early, I'm sure it's nothing you can't handle", 150, 150, 150);
                }
                if (tf2questcounter == 1030)
                {
                    SgaLib.Chat("<Administrator> When your done, check your contracter. Try not to be a Disapointment.", 150, 150, 150);
                }
                if (tf2questcounter == 1050)
                {
                    tf2quest = 6; tf2questcounter = 0;
                }
            }
        }
コード例 #15
0
        public override void AI()
        {
            Player     P      = Main.player[npc.target];
            Cratrosity origin = npc.modNPC as Cratrosity;

            pmlphasetimer--;
            npc.dontTakeDamage = false;
            if (pmlphasetimer > 0)
            {
                //phase 1
                if (pmlphase == 1)
                {
                    OrderOfTheCrates(P);
                    origin.compressvargoal = 4f;
                    origin.themode         = 1;
                    npc.rotation           = Idglib.LookAt(npc.Center, P.Center);
                    npc.dontTakeDamage     = true;
                    npc.velocity           = (npc.velocity * 0.97f);
                    if (pmlphasetimer < 1000)
                    {
                        Vector2 it = new Vector2(P.Center.X - npc.Center.X, P.Center.Y - npc.Center.Y);
                        it.Normalize();
                        if (pmlphasetimer % 120 == 0)
                        {
                            npc.velocity = (it * (30f - pmlphasetimer * 0.02f));
                        }
                        if (pmlphasetimer % 120 < 60 && pmlphasetimer % 20 == 0)
                        {
                            Idglib.Shattershots(npc.Center, npc.Center + it * 50, new Vector2(0, 0), ProjectileID.NanoBullet, 40, (float)6, 80, 3, true, 0, false, 600);
                            Idglib.PlaySound(13, npc.Center, 0);
                        }
                    }
                }
                //phase 2
                if (pmlphase == 2)
                {
                    npc.dontTakeDamage = true;
                    OrderOfTheCrates(P);
                    npc.velocity = (npc.velocity * 0.77f);
                    Vector2 it = new Vector2(P.Center.X - npc.Center.X, P.Center.Y - npc.Center.Y);
                    it.Normalize();
                    npc.velocity += it * 0.3f;
                    npc.Opacity  += (0.1f - npc.Opacity) / 30f;
                }

                //phase 3
                if (pmlphase == 3)
                {
                    npc.ai[0] = 0;

                    if (pmlphasetimer > 1000)
                    {
                        int spawnedint = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CratrosityNight"));
                        spawnedint    = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CratrosityLight"));
                        pmlphasetimer = 105;
                        Idglib.Chat("Give in to Temptation!", 144, 79, 16);
                    }

                    if (NPC.CountNPCS(mod.NPCType("Cratrosity")) > 0)
                    {
                        pmlphasetimer = 100;
                    }

                    npc.dontTakeDamage = true;
                    base.OrderOfTheCrates(P);
                    npc.velocity = (npc.velocity * 0.77f);
                    Vector2 it = new Vector2(P.Center.X - npc.Center.X, P.Center.Y - npc.Center.Y);
                    it.Normalize();
                    npc.velocity += it * 0.3f;
                    npc.Opacity  += (0.1f - npc.Opacity) / 30f;
                }

                //phase 4
                if (pmlphase > 3)
                {
                    npc.velocity /= 1.5f;
                    if (pmlphasetimer > 1000)
                    {
                        pmlphasetimer = 100;
                    }
                }
            }
            else
            {
                npc.rotation = npc.rotation * 0.85f;
                npc.Opacity += (1f - npc.Opacity) / 30f;
                base.AI();
            }


            if (phase < 1)
            {
                int val;
                val = (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.WoodenCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.IronCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.GoldenCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.DungeonFishingCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.JungleFishingCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + evilcratetype.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.HallowedFishingCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.FloatingIslandFishingCrate.ToString())));
                val += NPC.CountNPCS(mod.NPCType("CratrosityCrateOfWitheredWeapon")) +
                       NPC.CountNPCS(mod.NPCType("CratrosityCrateOfWitheredArmor")) +
                       NPC.CountNPCS(mod.NPCType("CratrosityCrateOfPoisoned")) +
                       NPC.CountNPCS(mod.NPCType("CratrosityCrateOfSlowing"));
                if (val > 0)
                {
                    npc.dontTakeDamage = true;
                }
            }
        }
コード例 #16
0
        public override void AI()
        {
            Player P = Main.player[npc.target];

            if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active || Main.dayTime)
            {
                npc.TargetClosest(false);
                P = Main.player[npc.target];
                if (!P.active || P.dead || Main.dayTime)
                {
                    float speed = ((-10f));
                    npc.velocity = new Vector2(npc.velocity.X, npc.velocity.Y + speed);
                    npc.active   = false;
                }
            }
            else
            {
                npc.netUpdate = true;
                npc.timeLeft  = 99999;
                if (npc.ai[0] == 0)
                {
                    npc.position = P.position + new Vector2(0, 500f);
                }
                npc.ai[0] = npc.ai[0] + 1;
                if (npc.ai[0] == 2)
                {
                    normhp    = npc.life;
                    bosses[0] = NPC.NewNPC((int)npc.Center.X + 900, (int)npc.Center.Y - 32, NPCID.Spazmatism);
                    Main.npc[bosses[0]].boss     = false;
                    Main.npc[bosses[0]].timeLeft = 99999;
                    bossattach[0]                  = -1;
                    bosses[1]                      = NPC.NewNPC((int)npc.Center.X + 900, (int)npc.Center.Y - 32, NPCID.SkeletronPrime);
                    Main.npc[bosses[1]].boss       = false;
                    Main.npc[bosses[1]].timeLeft   = 99999;
                    Main.npc[bosses[1]].defDefense = 5000;
                    Main.npc[bosses[1]].defense    = 5000;
                    bossattach[1]                  = bosses[0];
                    bosses[2]                      = NPC.NewNPC((int)npc.Center.X - 900, (int)npc.Center.Y - 32, NPCID.Retinazer);
                    Main.npc[bosses[2]].boss       = false;
                    Main.npc[bosses[2]].timeLeft   = 99999;
                    bossattach[2]                  = -1;
                    bosses[3]                      = NPC.NewNPC((int)npc.Center.X - 900, (int)npc.Center.Y - 32, NPCID.SkeletronPrime);
                    Main.npc[bosses[3]].boss       = false;
                    Main.npc[bosses[3]].timeLeft   = 99999;
                    Main.npc[bosses[3]].defDefense = 5000;
                    Main.npc[bosses[3]].defense    = 5000;
                    bossattach[3]                  = bosses[2];
                    bosses[4]                      = NPC.NewNPC((int)npc.Center.X + 900, (int)npc.Center.Y - 32, NPCID.TheDestroyer);
                    Main.npc[bosses[4]].boss       = false;
                    Main.npc[bosses[4]].timeLeft   = 99999;
                    //Main.npc[bosses[4]].active=false;
                    bossattach[4]                = bosses[1];
                    bosses[5]                    = NPC.NewNPC((int)npc.Center.X - 900, (int)npc.Center.Y - 32, NPCID.TheDestroyer);
                    Main.npc[bosses[5]].boss     = false;
                    Main.npc[bosses[5]].timeLeft = 99999;
                    bossattach[5]                = bosses[3];
                    //Main.npc[bosses[5]].active=false;



                    npc.life = npc.life + Main.npc[bosses[0]].life;
                    npc.life = npc.life + Main.npc[bosses[1]].life;
                    npc.life = npc.life + Main.npc[bosses[2]].life;
                    npc.life = npc.life + Main.npc[bosses[3]].life;
                    npc.life = npc.life + Main.npc[bosses[4]].life;
                    npc.life = npc.life + Main.npc[bosses[5]].life;

                    npc.lifeMax = npc.life;
                }
                if (npc.ai[0] > 2)
                {
                    if (npc.ai[0] == 3)
                    {
                        for (int i = 0; i <= 5; i++)
                        {
                            NPC thisboss = Main.npc[bosses[i]];
                            if (thisboss == null || thisboss.active == false)
                            {
                                npc.Center = P.Center - new Vector2(0, 128);
                                npc.active = false;
                                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Mechacluskerf"));

                                for (int z = 0; z <= Main.maxNPCs; z++)
                                {
                                    NPC zz = Main.npc[z];
                                    if (zz.type == NPCID.SkeletronHand ||
                                        zz.type == NPCID.SkeletronHead ||
                                        zz.type == NPCID.SkeletronPrime ||
                                        zz.type == NPCID.Retinazer ||
                                        zz.type == NPCID.Spazmatism ||
                                        zz.type == NPCID.TheDestroyer ||
                                        zz.type == NPCID.TheDestroyerBody ||
                                        zz.type == NPCID.TheDestroyerTail)
                                    {
                                        zz.active = false;
                                    }
                                }
                                Idglib.Chat("Boss failed to properly spawn, boss item has been given back", 255, 255, 255);
                                break;
                            }
                        }
                    }

                    if (phase < 60)
                    {
                        npc.life = normhp;
                    }
                    Vector2 averagevec = npc.Center;
                    int     divider    = 1;

                    for (int i = 0; i <= 5; i++)
                    {
                        NPC thisboss = Main.npc[bosses[i]];
                        if (bosses[i] > -1 || npc.ai[0] < 30)
                        {
                            thisboss.boss = false;
                            if (thisboss.life < 1 && npc.ai[0] > 30)
                            {
                                bossactive[i] = 0;
                                if (i == 0)
                                {
                                    Main.npc[bosses[1]].defDefense = 20;
                                    Main.npc[bosses[1]].defense    = 20;
                                    bossattach[1] = -1;
                                }
                                if (i == 2)
                                {
                                    Main.npc[bosses[3]].defDefense = 20;
                                    Main.npc[bosses[3]].defense    = 20;
                                    bossattach[3] = -1;
                                }


                                thisboss.active = false;
                                bossattach[i]   = -1;
                                bosses[i]       = 0;
                            }
                            else
                            {
                                if (phase < 1)
                                {
                                    npc.life = npc.life + thisboss.life;
                                }
                            }
                        }

                        if (thisboss.active == true)
                        {
                            if (thisboss.life > 0 && bossactive[i] > 0)
                            {
                                divider    = divider + 1;
                                averagevec = averagevec + thisboss.Center;
                                if (bossattach[i] > -1)
                                {
                                    NPC myfellaboss = Main.npc[bossattach[i]];
                                    if (myfellaboss.active == true)
                                    {
                                        Main.npc[bosses[i]].position = myfellaboss.Center;
                                    }
                                }
                            }
                        }
                    }
                    //averagevec=averagevec-npc.Center;
                    if (divider > 1)
                    {
                        shooting = shooting + 1;
                        float shoottype = 0;
                        if (divider < 4)
                        {
                            if (shooting % 1200 < 700)
                            {
                                if (shooting % 1200 > 100)
                                {
                                    shoottype = 1;
                                    if (shooting % 200 == 0 && shooting % 8 == 0)
                                    {
                                        for (float f = 0; f < MathHelper.TwoPi; f += MathHelper.Pi / 10f)
                                        {
                                            float angle = (shooting / 60f) + f;
                                            int   proj  = Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 24f, mod.ProjectileType("HellionBolt"), 30, 15f);
                                            Main.projectile[proj].timeLeft  = 200;
                                            Main.projectile[proj].netUpdate = true;
                                            //Idglib.Shattershots(npc.position, P.position + P.velocity * (1f + (shooting - 120 % 160) / 150f), new Vector2(P.width, P.height), 88, 25, 8, 0, 1, true, 0, false, 450);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (shooting % 1200 > 850)
                                {
                                    shoottype = 2;
                                    if (shooting % 10 == 0)
                                    {
                                        for (float f = -1; f < 2; f += 2f)
                                        {
                                            float angle = (shooting / 20f) * f;
                                            int   proj  = Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 18f, mod.ProjectileType("HellionBolt"), 30, 15f);
                                            Main.projectile[proj].timeLeft  = 200;
                                            Main.projectile[proj].netUpdate = true;
                                        }
                                    }
                                }
                            }

                            if (shoottype == 1)
                            {
                                if ((shooting + 90) % 180 == 0 && Main.expertMode)
                                {
                                    if (Main.npc[bosses[1]].active && Main.npc[bosses[1]].type == NPCID.SkeletronPrime)
                                    {
                                        Vector2           Centerhere = (P.position - Main.npc[bosses[1]].Center);
                                        List <Projectile> itz        = Idglib.Shattershots(Main.npc[bosses[1]].Center, P.position, new Vector2(P.width, P.height), ProjectileID.SaucerMissile, 25, 10, 80, 2, false, 0, false, 450);
                                        itz[0].localAI[1] = -30;
                                        itz[1].localAI[1] = -30;
                                    }
                                }
                                if (shooting % 180 == 0 && Main.expertMode)
                                {
                                    if (Main.npc[bosses[3]].active && Main.npc[bosses[3]].type == NPCID.SkeletronPrime)
                                    {
                                        Vector2           Centerhere = (P.position - Main.npc[bosses[3]].Center);
                                        List <Projectile> itz        = Idglib.Shattershots(Main.npc[bosses[3]].Center, P.position, new Vector2(P.width, P.height), ProjectileID.SaucerMissile, 25, 10, 80, 2, false, 0, false, 450);
                                        itz[0].localAI[1] = -30;
                                        itz[1].localAI[1] = -30;
                                    }
                                }
                            }

                            if (shoottype == 2)
                            {
                                if (true)
                                {
                                    if (Main.npc[bosses[1]].active && Main.npc[bosses[1]].type == NPCID.SkeletronPrime)
                                    {
                                        Main.npc[bosses[1]].position.X -= 12.15f;
                                    }
                                }
                                if (true)
                                {
                                    if (Main.npc[bosses[3]].active && Main.npc[bosses[3]].type == NPCID.SkeletronPrime)
                                    {
                                        Main.npc[bosses[3]].position.X += 12.15f;
                                    }
                                }
                            }
                        }
                        averagevec = averagevec / divider;
                        Vector2 lastpos = npc.position;
                        npc.position        = npc.position + ((averagevec - npc.position) / 15);
                        rotatationsensation = (int)(rotatationsensation + (5));
                    }
                    else
                    {
                        if (phase < 60)
                        {
                            phase = phase + 1;
                            rotatationsensation = (int)(rotatationsensation + (5 + (phase / 33)));
                        }
                        else
                        {
                            shooting            = shooting + 1;
                            rotatationsensation = (int)(rotatationsensation + 12);
                            phase = phase + 1;
                            int expert = 0;
                            if (Main.expertMode)
                            {
                                expert = 1;
                            }
                            if (shooting % ((int)(30 + (npc.life / 5000))) == 0)
                            {
                                Idglib.Shattershots(npc.Center, P.position, new Vector2(P.width, P.height), 100, 25, 12, 60, 2 + expert, true, 0, true, 300);
                            }

                            if (shooting % (int)(60) < 30 && shooting % 3 == 0)
                            {
                                Idglib.Shattershots(npc.Center, P.position, new Vector2(P.width, P.height), 83, 20, 3 + expert, 0, 1, true, (float)shooting / 22, false, 300);
                            }
                            if ((shooting - 30) % (int)(60) < 30 && shooting % 3 == 0)
                            {
                                Idglib.Shattershots(npc.Center, P.position, new Vector2(P.width, P.height), 83, 20, 3 + expert, 0, 1, true, -(float)shooting / 22, false, 300);
                            }
                            if (phase < 240)
                            {
                                npc.velocity = new Vector2(((P.position.X - 500) - npc.position.X) / 32, ((P.position.Y - 150) - npc.position.Y) / 16);
                            }
                            else
                            {
                                npc.velocity = new Vector2(((P.position.X + 500) - npc.position.X) / 32, ((P.position.Y - 150) - npc.position.Y) / 16);
                                if (phase > 420)
                                {
                                    phase = 60;
                                }
                            }
                        }
                    }
                }



                //npc.spriteDirection = (int)npc.ai[1]*14;
            }



            //int dust = Dust.NewDust(npc.Center, 0, 0, 178, 0, 5, 0, new Color=Main.hslToRgb((float)(npc.ai[0]/300)%1, 1f, 0.9f), 1f);
            int  dustType  = 43;                                                                 //Main.rand.Next(139, 143);
            int  dustIndex = Dust.NewDust(npc.Center + new Vector2(-16, -16), 32, 32, dustType); //,0,5,0,new Color=Main.hslToRgb((float)(npc.ai[0]/300)%1, 1f, 0.9f),1f);
            Dust dust      = Main.dust[dustIndex];

            dust.velocity.X     = dust.velocity.X + Main.rand.Next(-50, 51) * 0.01f;
            dust.velocity.Y     = dust.velocity.Y + Main.rand.Next(-50, 51) * 0.01f;
            dust.scale         *= 3f + Main.rand.Next(-30, 31) * 0.01f;
            dust.fadeIn         = 0f;
            dust.noGravity      = true;
            dust.color          = Main.hslToRgb((float)(npc.ai[0] / 300) % 1, 1f, 0.9f);
            npc.spriteDirection = rotatationsensation;
        }
コード例 #17
0
        public override void NPCLoot()
        {
            List <int> types = new List <int>();

            /*WorldGen.CopperTierOre = 7;
             * WorldGen.IronTierOre = 6;
             * WorldGen.SilverTierOre = 9;
             * WorldGen.GoldTierOre = 8;*/

            if (SGAWorld.craftwarning < 30)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrueCopperWraithNotch"));
            }
            if (Main.expertMode)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WraithTargetingGamepad"));
            }

            int shardtype = ModContent.ItemType <WraithFragment>();

            /*if (SGAWorld.WorldIsTin)
             * {
             *      shardtype = mod.ItemType("WraithFragment2");
             *      //npc.GivenName = "Tin Wraith";
             * }*/



            types.Insert(types.Count, shardtype);
            types.Insert(types.Count, SGAmod.WorldOres[0, SGAWorld.oretypesprehardmode[0] == TileID.Copper ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[0, SGAWorld.oretypesprehardmode[0] == TileID.Copper ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[1, SGAWorld.oretypesprehardmode[1] == TileID.Iron ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[1, SGAWorld.oretypesprehardmode[1] == TileID.Iron ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[2, SGAWorld.oretypesprehardmode[2] == TileID.Silver ? 1 : 0]); types.Insert(types.Count, SGAmod.WorldOres[2, SGAWorld.oretypesprehardmode[2] == TileID.Silver ? 1 : 0]);
            types.Insert(types.Count, SGAmod.WorldOres[3, SGAWorld.oretypesprehardmode[3] == TileID.Gold ? 1 : 0]);

            DropHelper.DropFixedItemQuanity(types.ToArray(), (Main.expertMode ? 50 : 30) * (Main.hardMode ? 2 : 1), npc.Center);



            if (shardtype > 0)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, shardtype, (Main.expertMode ? 60 : 30) * (Main.hardMode ? 2 : 1));
            }

            /*
             * WeightedItemSet[] sets = {
             *                              new WeightedItemSet(new (int,int)[]{ (ItemID.CopperPlating, 15),(ItemID.CopperBar, 25)  }),
             * new WeightedItemSet(new (int,int)[]{ (ItemID.SunStone, 1) }),
             * new WeightedItemSet(new (int,int)[]{ (ItemID.MoonStone, 1) }),
             * new WeightedItemSet(new (int,int)[]{ (ItemID.FragmentNebula, 10),(ItemID.FragmentSolar, 10),(ItemID.FragmentStardust, 10),(ItemID.FragmentVortex, 10) },3),
             *
             *      };
             *
             * DropHelper.DropFromItemSets(npc.Center, sets,2);
             */



            /*for (int f = 0; f < (Main.expertMode ? 50 : 30); f += 1)
             * {
             *      Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, types[Main.rand.Next(0, types.Count)]);
             * }*/

            Achivements.SGAAchivements.UnlockAchivement("Copper Wraith", Main.LocalPlayer);
            if (SGAWorld.downedWraiths < 1)
            {
                SGAWorld.downedWraiths = 1;
                Idglib.Chat("You may now craft bars without being attacked", 150, 150, 70);
            }
        }
コード例 #18
0
        public override void AI()
        {
            npc.ai[0] += 1;
            double angle  = ((double)(npc.ai[0] / 13f)) + 2.0 * Math.PI;
            NPC    Master = Main.npc[(int)npc.ai[1]];

            if (!Master.active || npc.ai[1] < 1)
            {
                npc.active = false;
            }
            npc.Center = Master.Center;

            if (Master.life < Master.lifeMax * 0.35 && npc.ai[2] == 0)
            {
                if (Main.netMode != 1)
                {
                    Idglib.Chat("Murk calls for backup with a killer fly swarm!", 103, 128, 79);
                    int x      = (int)(Master.position.X + (float)Main.rand.Next(Master.width - 32));
                    int y      = (int)(Master.position.Y + (float)Main.rand.Next(Master.height - 32));
                    int num663 = mod.NPCType("BossFlyMiniboss1");

                    int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255);
                    Main.npc[num664].ai[1]     = Master.whoAmI;
                    Main.npc[num664].life      = (int)((double)(Master.lifeMax * (Main.hardMode ? 1.5 : 0.5)));
                    Main.npc[num664].lifeMax   = Main.npc[num664].life;
                    Main.npc[num664].damage    = Main.hardMode ? (Main.expertMode ? 80 : 50) : 25;
                    Main.npc[num664].netUpdate = true;
                    if (!Main.hardMode)
                    {
                        Main.npc[num664].dontTakeDamage = true;
                    }
                    if (Main.netMode == 2 && num664 < 200)
                    {
                        NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0);
                    }

                    if (Main.hardMode)
                    {
                        x      = (int)(Master.position.X + (float)Main.rand.Next(Master.width - 32));
                        y      = (int)(Master.position.Y + (float)Main.rand.Next(Master.height - 32));
                        num663 = mod.NPCType("BossFly1");

                        if (Main.expertMode)
                        {
                            for (int i = 0; i < 10; i += 1)
                            {
                                num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255);
                                Main.npc[num664].ai[0]          = Main.rand.NextFloat(50, 450);
                                Main.npc[num664].ai[2]          = 10 + (i * 12);
                                Main.npc[num664].ai[1]          = Master.whoAmI;
                                Main.npc[num664].damage         = 50;
                                Main.npc[num664].netUpdate      = true;
                                Main.npc[num664].dontTakeDamage = true;
                                if (Main.netMode == 2 && num664 < 200)
                                {
                                    NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0);
                                }
                            }
                        }
                    }

                    npc.ai[2]     = 1;
                    npc.netUpdate = true;
                }
            }



            if (Main.netMode != 1 && npc.ai[0] % 300 == 0 && NPC.CountNPCS(mod.NPCType("BossFly2")) < (Main.expertMode ? 2 : 1) && Master.localAI[0] < 0)
            {
                int x      = (int)(Master.position.X + (float)Main.rand.Next(Master.width - 32));
                int y      = (int)(Master.position.Y + (float)Main.rand.Next(Master.height - 32));
                int num663 = mod.NPCType("BossFly2");

                int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255);
                Main.npc[num664].ai[1]     = Master.whoAmI;
                Main.npc[num664].netUpdate = true;
                if (Main.netMode == 2 && num664 < 200)
                {
                    NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0);
                }
            }
        }
コード例 #19
0
        public override bool PreAI()
        {
            if (averagey == null)
            {
                averagey = new List <int>();
            }

            if (Main.netMode != 1)
            {
                if (npc.ai[0] == 0)
                {
                    npc.realLife = npc.whoAmI;

                    int latestNPC = npc.whoAmI;

                    int randomWormLength = Main.rand.Next(1, 1);
                    for (int i = 0; i < randomWormLength; ++i)
                    {
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernNeck"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody2"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                        latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernBody3"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                        Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                    }
                    latestNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SharkvernTail"), npc.whoAmI, 0, latestNPC, ai3: npc.whoAmI);
                    Main.npc[(int)latestNPC].realLife = npc.whoAmI;
                    Main.npc[(int)latestNPC].ai[3]    = npc.whoAmI;

                    npc.ai[0]     = 1;
                    npc.netUpdate = true;
                }
            }
            touchwater = false;

            int minTilePosX = (int)(npc.position.X / 16.0) - 1;
            int maxTilePosX = (int)((npc.position.X + npc.width) / 16.0) + 2;
            int minTilePosY = (int)(npc.position.Y / 16.0) - 1;
            int maxTilePosY = (int)((npc.position.Y + npc.height) / 16.0) + 2;

            if (minTilePosX < 0)
            {
                minTilePosX = 0;
            }
            if (maxTilePosX > Main.maxTilesX)
            {
                maxTilePosX = Main.maxTilesX;
            }
            if (minTilePosY < 0)
            {
                minTilePosY = 0;
            }
            if (maxTilePosY > Main.maxTilesY)
            {
                maxTilePosY = Main.maxTilesY;
            }

            bool collision = false;

            for (int i = minTilePosX - 5; i < maxTilePosX + 5; ++i)
            {
                for (int j = minTilePosY - 5; j < maxTilePosY + 10; ++j)
                {
                    if (Main.tile[i, j] != null)
                    {
                        if ((int)Main.tile[i, j].liquid > 64)
                        {
                            touchwater = true;
                        }
                    }
                }
            }

            if (ramwater == false)
            {
                for (int i = minTilePosX - 5; i < maxTilePosX + 5; ++i)
                {
                    for (int j = minTilePosY - 5; j < maxTilePosY; ++j)
                    {
                        if (Main.tile[i, j] != null)
                        {
                            if ((int)Main.tile[i, j].liquid > 240)
                            {
                                if (ramwater == false)
                                {
                                    if (npc.velocity.Y > 6)
                                    {
                                        ramwater = true;
                                        for (float xx = 6f; xx < 30f; xx += 0.5f)
                                        {
                                            int proj2 = Projectile.NewProjectile(npc.Center, new Vector2(Main.rand.NextFloat(-8f, 8f), -Main.rand.NextFloat(0, xx)), mod.ProjectileType("RandomOceanCrap"), 30, 4);
                                            Main.projectile[proj2].friendly  = false;
                                            Main.projectile[proj2].hostile   = true;
                                            Main.projectile[proj2].netUpdate = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            for (int i = minTilePosX; i < maxTilePosX; ++i)
            {
                for (int j = minTilePosY; j < maxTilePosY; ++j)
                {
                    if (Main.tile[i, j] != null && (Main.tile[i, j].nactive() && (Main.tileSolid[(int)Main.tile[i, j].type] || Main.tileSolidTop[(int)Main.tile[i, j].type] && (int)Main.tile[i, j].frameY == 0) || (int)Main.tile[i, j].liquid > 64))
                    {
                        Vector2 vector2;
                        vector2.X = (float)(i * 16);
                        vector2.Y = (float)(j * 16);
                        if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16.0 && (npc.position.Y + npc.height > (double)vector2.Y && npc.position.Y < vector2.Y + 16.0))
                        {
                            collision = true;
                            if (Main.rand.Next(100) == 0 && Main.tile[i, j].nactive())
                            {
                                WorldGen.KillTile(i, j, true, true, false);
                            }
                        }
                    }
                }
            }

            if (!collision)
            {
                Rectangle rectangle1      = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
                int       maxDistance     = 1000;
                bool      playerCollision = true;
                for (int index = 0; index < 255; ++index)
                {
                    if (Main.player[index].active)
                    {
                        Rectangle rectangle2 = new Rectangle((int)Main.player[index].position.X - maxDistance, (int)Main.player[index].position.Y - maxDistance, maxDistance * 2, maxDistance * 2);
                        if (rectangle1.Intersects(rectangle2))
                        {
                            playerCollision = false;
                            break;
                        }
                    }
                }
                if (playerCollision)
                {
                    collision = true;
                }
            }


            float speed = 15f + (Math.Min(Math.Max(0, rage / 100f), 6));

            float acceleration = 1f + (Math.Min(Math.Max(0, rage / 300f), 3));

            npc.position = new Vector2(MathHelper.Clamp(npc.position.X, 150f, (float)(Main.maxTilesX * 16) - 150f), npc.position.Y);

            Vector2 npcCenter  = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
            float   targetXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2);
            float   targetYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2);

            timer += 1;


            if (timer % 1000 > 700)
            {
                collision   = true;
                targetYPos -= 800;
                if (timer % 1000 == 849)
                {
                    ramwater      = false;
                    npc.netUpdate = true;
                }
                if (timer % 1000 > 850)
                {
                    targetYPos += 4800;
                }
            }

            if (npc.ai[3] > 0)
            {
                timer      = 0;
                targetXPos = (float)(Main.maxTilesX * 0.6f);
                if (npc.Center.X > (Main.maxTilesX / 2) * 16)
                {
                    targetXPos = (float)(Main.maxTilesX * 16) - (Main.maxTilesX * 0.6f);
                }
                targetYPos = averagey[0];
                //targetYPos=(float)SGAWorld.RaycastDownWater((int)targetXPos/16,(int)(1),50)*16;
                Summoncenter = new Vector2(targetXPos, targetYPos - 500f);
                double angle = (npc.ai[3] / 30f) + 2.0 * Math.PI;
                targetXPos += (float)((Math.Cos(angle) * 800f) * -1f);
                targetYPos += (float)((Math.Sin(angle) * 400f) * -1f) - 500f;
            }

            if (Main.player[npc.target].dead)
            {
                targetYPos = 100000f;
            }

            float targetRoundedPosX = (float)((int)(targetXPos / 16.0) * 16);
            float targetRoundedPosY = (float)((int)(targetYPos / 16.0) * 16);

            npcCenter.X = (float)((int)(npcCenter.X / 16.0) * 16);
            npcCenter.Y = (float)((int)(npcCenter.Y / 16.0) * 16);
            float dirX = targetRoundedPosX - npcCenter.X;
            float dirY = targetRoundedPosY - npcCenter.Y;

            float length = (float)Math.Sqrt(dirX * dirX + dirY * dirY);

            if (!collision && npc.ai[3] < 1)
            {
                npc.TargetClosest(true);
                npc.velocity.Y = npc.velocity.Y + 0.11f;
                if (npc.velocity.Y > speed)
                {
                    npc.velocity.Y = speed;
                }
                if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < speed * 0.4)
                {
                    if (npc.velocity.X < 0.0)
                    {
                        npc.velocity.X = npc.velocity.X - acceleration * 1.1f;
                    }
                    else
                    {
                        npc.velocity.X = npc.velocity.X + acceleration * 1.1f;
                    }
                }
                else if (npc.velocity.Y == speed)
                {
                    if (npc.velocity.X < dirX)
                    {
                        npc.velocity.X = npc.velocity.X + acceleration;
                    }
                    else if (npc.velocity.X > dirX)
                    {
                        npc.velocity.X = npc.velocity.X - acceleration;
                    }
                }
                else if (npc.velocity.Y > 4.0)
                {
                    if (npc.velocity.X < 0.0)
                    {
                        npc.velocity.X = npc.velocity.X + acceleration * 0.9f;
                    }
                    else
                    {
                        npc.velocity.X = npc.velocity.X - acceleration * 0.9f;
                    }
                }
            }

            else
            {
                if (timer % 1000 <= 700)
                {
                    if (npc.soundDelay == 0)
                    {
                        float num1 = length / 40f;
                        if (num1 < 10.0)
                        {
                            num1 = 10f;
                        }
                        if (num1 > 20.0)
                        {
                            num1 = 20f;
                        }
                        npc.soundDelay = (int)num1;
                        Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1);
                    }
                }
                float absDirX  = Math.Abs(dirX);
                float absDirY  = Math.Abs(dirY);
                float newSpeed = speed / length;
                dirX = dirX * newSpeed;
                dirY = dirY * newSpeed;
                if (npc.velocity.X > 0.0 && dirX > 0.0 || npc.velocity.X < 0.0 && dirX < 0.0 || (npc.velocity.Y > 0.0 && dirY > 0.0 || npc.velocity.Y < 0.0 && dirY < 0.0))
                {
                    if (npc.velocity.X < dirX)
                    {
                        npc.velocity.X = npc.velocity.X + acceleration;
                    }
                    else if (npc.velocity.X > dirX)
                    {
                        npc.velocity.X = npc.velocity.X - acceleration;
                    }
                    if (npc.velocity.Y < dirY)
                    {
                        npc.velocity.Y = npc.velocity.Y + acceleration;
                    }
                    else if (npc.velocity.Y > dirY)
                    {
                        npc.velocity.Y = npc.velocity.Y - acceleration;
                    }
                    if (Math.Abs(dirY) < speed * 0.2 && (npc.velocity.X > 0.0 && dirX < 0.0 || npc.velocity.X < 0.0 && dirX > 0.0))
                    {
                        if (npc.velocity.Y > 0.0)
                        {
                            npc.velocity.Y = npc.velocity.Y + acceleration * 2f;
                        }
                        else
                        {
                            npc.velocity.Y = npc.velocity.Y - acceleration * 2f;
                        }
                    }
                    if (Math.Abs(dirX) < speed * 0.2 && (npc.velocity.Y > 0.0 && dirY < 0.0 || npc.velocity.Y < 0.0 && dirY > 0.0))
                    {
                        if (npc.velocity.X > 0.0)
                        {
                            npc.velocity.X = npc.velocity.X + acceleration * 2f;
                        }
                        else
                        {
                            npc.velocity.X = npc.velocity.X - acceleration * 2f;
                        }
                    }
                }
                else if (absDirX > absDirY)
                {
                    if (npc.velocity.X < dirX)
                    {
                        npc.velocity.X = npc.velocity.X + acceleration * 1.1f;
                    }
                    else if (npc.velocity.X > dirX)
                    {
                        npc.velocity.X = npc.velocity.X - acceleration * 1.1f;
                    }
                    if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < speed * 0.5)
                    {
                        if (npc.velocity.Y > 0.0)
                        {
                            npc.velocity.Y = npc.velocity.Y + acceleration;
                        }
                        else
                        {
                            npc.velocity.Y = npc.velocity.Y - acceleration;
                        }
                    }
                }
                else
                {
                    if (npc.velocity.Y < dirY)
                    {
                        npc.velocity.Y = npc.velocity.Y + acceleration * 1.1f;
                    }
                    else if (npc.velocity.Y > dirY)
                    {
                        npc.velocity.Y = npc.velocity.Y - acceleration * 1.1f;
                    }
                    if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < speed * 0.5)
                    {
                        if (npc.velocity.X > 0.0)
                        {
                            npc.velocity.X = npc.velocity.X + acceleration;
                        }
                        else
                        {
                            npc.velocity.X = npc.velocity.X - acceleration;
                        }
                    }
                }
            }

            npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f;
            Vector2 capvelo = npc.velocity;

            capvelo.Normalize();
            float speedmove = 15f - (length / 800f);

            if (npc.ai[3] > 0)
            {
                speedmove = speedmove / 2f;
            }
            if (npc.velocity.Length() < capvelo.Length() * speedmove)
            {
                npc.velocity = capvelo * speedmove;
            }



            if (collision)
            {
                if (npc.localAI[0] != 1)
                {
                    npc.netUpdate = true;
                }
                npc.localAI[0] = 1f;
            }
            else
            {
                if (npc.localAI[0] != 0.0)
                {
                    npc.netUpdate = true;
                }
                npc.localAI[0] = 0.0f;
            }
            if ((npc.velocity.X > 0.0 && npc.oldVelocity.X < 0.0 || npc.velocity.X < 0.0 && npc.oldVelocity.X > 0.0 || (npc.velocity.Y > 0.0 && npc.oldVelocity.Y < 0.0 || npc.velocity.Y < 0.0 && npc.oldVelocity.Y > 0.0)) && !npc.justHit)
            {
                npc.netUpdate = true;
            }

            int num254 = (int)(npc.position.X + (float)(npc.width / 2)) / 16;
            int num255 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16;

            /*if (Main.tile[num254, num255 - 1] == null)
             * {
             *  Main.tile[num254, num255 - 1] = new Tile();
             * }
             * if (Main.tile[num254, num255 - 1].active())
             * {
             * if (Main.tile[num254, num255 - 1].liquid > 128)
             * {
             * rage=0;
             * }}*/

            rage = rage + (length < 2000 && npc.ai[3] < 1 ? 1 : 0);
            if (touchwater == true)
            {
                rage = Math.Max(-150, rage - 5);
                if (Main.expertMode)
                {
                    rage = ((int)Math.Max(((1f - ((float)npc.life / (float)npc.lifeMax)) * 350f) - 150f, rage - 4));
                }
            }
            npc.damage = Math.Min(npc.defDamage, Math.Max(180, (int)rage / 2));
            sergedout  = sergedout - 1;
            bool anyalive = false;

            if (npc.ai[3] < -399)
            {
                npc.ai[3] -= 1;
                if (npc.ai[3] < -60 * 60)
                {
                    npc.ai[3] = 0;
                }
            }

            if (npc.life > npc.lifeMax * 0.50)
            {
                averagey.Add((int)npc.Center.Y);
            }

            if (npc.ai[3] < 1000 && npc.ai[3] > -1 && npc.life < (int)npc.lifeMax * 0.50)
            {
                npc.ai[3] += 1;

                if (averagey.Count > 2)
                {
                    int thereat = 0;
                    for (int i = 0; i < averagey.Count; i += 1)
                    {
                        thereat += averagey[i];
                    }
                    thereat = (int)(thereat / averagey.Count);
                    averagey.Clear();
                    averagey.Add(thereat);
                }

                if (npc.ai[3] > 150)
                {
                    if (npc.ai[3] % 160 == 0 && Main.netMode != 1)
                    {
                        int him = NPC.NewNPC((int)Summoncenter.X, (int)Summoncenter.Y, mod.NPCType("SharvernMinion"));
                        Main.npc[him].ai[3] = Main.rand.Next(0, 2000);
                    }

                    for (int i = 0; i < 5; ++i)
                    {
                        double  devider   = (i / ((double)5f));
                        double  angle     = (npc.ai[3] / 15) + 2.0 * Math.PI * devider;
                        Vector2 thecenter = new Vector2((float)((Math.Cos(angle) * 150)), (float)((Math.Sin(angle) * 80)));
                        thecenter = thecenter.RotatedByRandom(MathHelper.ToRadians(10));
                        int DustID2 = Dust.NewDust(Summoncenter + (thecenter * 4.5f), 0, 0, mod.DustType("TornadoDust"), thecenter.X * 0.8f, thecenter.X * 0.8f, 20, default(Color), 2.5f);
                        Main.dust[DustID2].noGravity = true;
                        Main.dust[DustID2].velocity  = new Vector2(thecenter.X * 0.2f, thecenter.Y * 0.2f) * -1f;
                    }

                    for (int i = 0; i < 10; ++i)
                    {
                        double  devider   = (i / ((double)10f));
                        double  angle     = (npc.ai[3] / 30) + 2.0 * Math.PI * devider;
                        Vector2 thecenter = new Vector2((float)((Math.Cos(angle) * 150)), (float)((Math.Sin(angle) * 80)));
                        int     DustID2   = Dust.NewDust(Summoncenter + (thecenter * 0.5f), 0, 0, mod.DustType("TornadoDust"), thecenter.X * 0.7f, thecenter.X * 0.7f, 20, default(Color), 1.5f);
                        Main.dust[DustID2].noGravity = true;
                        Main.dust[DustID2].velocity  = new Vector2(thecenter.X * 0.04f, thecenter.Y * 0.04f);
                        Main.dust[DustID2].color     = Color.Aqua;
                    }

                    for (int i = 0; i < 360; i += Main.rand.Next(10, 45))
                    {
                        double  devider   = (i / ((double)360f));
                        double  angle     = 2.0 * Math.PI * devider;
                        Vector2 thecenter = new Vector2((float)((Math.Cos(angle) * 150)), (float)((Math.Sin(angle) * 80)));
                        int     DustID2   = Dust.NewDust(Summoncenter + (thecenter * 0.5f), 0, 0, mod.DustType("TornadoDust"), thecenter.X * 0.7f, thecenter.X * 0.7f, 20, default(Color), 3f);
                        Main.dust[DustID2].noGravity = true;
                        Main.dust[DustID2].velocity  = new Vector2(0, 0);
                        Main.dust[DustID2].color     = Color.Aqua;
                    }
                }

                if (npc.ai[3] > 999)
                {
                    npc.ai[3] = -500;
                }
            }


            if (rage == 700 && Main.netMode != 1)
            {
                Idglib.Chat("The Sharkvern beckens you to return it to the sea!", 50, 50, 255);
            }
            for (int k = 0; k < Main.maxPlayers; k++)
            {
                Player player = Main.player[k];
                if (player != null)
                {
                    if (player.active && !player.dead)
                    {
                        anyalive = true;
                        if (rage > 700)
                        {
                            player.AddBuff(BuffID.PotionSickness, 30, true);
                        }
                    }
                }
            }
            if (anyalive == false)
            {
                npc.life   = 0;
                npc.active = false;
            }

            return(false);
        }
コード例 #20
0
        public override void PreUpdate()
        {
            //if (SGAWorld.CutsceneActive)
            if (SpaceBoss.film.IsActive || CaliburnGuardianHardmode.film.IsActive)
            {
                player.AddBuff(ModContent.BuffType <Buffs.InvincibleBuff>(), 2);
            }


            if (!Main.gameMenu)
            {
                bool spacey = Spacey;

                enterlimbo += 1;

                SGAmod.anysubworld = SGAPocketDim.WhereAmI != null;

                if (Main.netMode != NetmodeID.Server && !Main.dedServ && Main.LocalPlayer == player)
                {
                    Projectile.NewProjectile(Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) / 2, Vector2.Zero, mod.ProjectileType("DrawOverride"), 0, 0f);
                    if (spacey)
                    {
                        Projectile.NewProjectile(Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) / 2, Vector2.Zero, mod.ProjectileType("AsteriodDraw"), 0, 0f);
                    }
                }

                if (SGAPocketDim.WhereAmI != null)
                {
                    if (SLWorld.currentSubworld is SGAPocketDim sub)
                    {
                        SLWorld.noReturn = false;
                        int limit = sub.LimitPlayers;
                        if (limit % 16 == 0 && limit > 0)
                        {
                            player.AddBuff(BuffID.NoBuilding, 2);
                        }
                        player.GetModPlayer <SGAPlayer>().noModTeleport = true;

                        if (sub.GetType() == typeof(SpaceDim))
                        {
                            Point loc = new Point((int)(player.Center.X) >> 4, (int)(player.Center.Y) >> 4);
                            if (WorldGen.InWorld(loc.X, loc.Y))
                            {
                                Tile tilez = Framing.GetTileSafely(loc.X, loc.Y);
                                if (tilez != null)
                                {
                                    if (tilez.wall >= 0)
                                    {
                                        ModWall wallz = WallLoader.GetWall(tilez.wall);
                                        if (wallz != null && wallz is IBreathableWallType)
                                        {
                                            goto movingOn;
                                        }
                                    }
                                }
                            }
                            player.AddBuff(ModContent.BuffType <SharkvernDrown>(), 3);
                        }
                    }

movingOn:

                    if (spacey)
                    {
                        SLWorld.noReturn = true;
                        player.gravity   = 0.12f;
                        if (spacevar < 1)//Arriving in Space now
                        {
                            player.velocity = new Vector2(0, -16);
                            player.Center   = new Vector2(spaceX * (Main.maxTilesX * 16f), (Main.maxTilesY * 16f) - (16 * 50));
                        }
                        if (player.velocity.Y > 0 && player.Center.Y > (Main.maxTilesY * 16f) - (16 * 50) && spacevar == 1)
                        {
                            //SGAPocketDim.EnterSubworld(mod.GetType().Name + "_SpaceDim");
                            SGAPocketDim.Exit();
                        }
                        targetedAsteriod = null;

                        if (player.HeldItem.pick > 0)
                        {
                            List <Projectile> allAsteriods2 = Main.projectile.Where(testby => testby.active && testby?.modProjectile is IMineableAsteriod).ToList();
                            List <Projectile> allAsteriods  = new List <Projectile>();
                            if (allAsteriods2.Count > 0)
                            {
                                foreach (Projectile proj in allAsteriods2)
                                {
                                    double length3 = Math.Sqrt((Math.Abs(proj.Center.X - player.Center.X) * Math.Abs(proj.Center.X - player.Center.X)) + (Math.Abs(proj.Center.Y - player.Center.Y) * Math.Abs(proj.Center.Y - player.Center.Y)));
                                    if (length3 < (Math.Sqrt(Player.tileRangeX * Player.tileRangeY) + player.blockRange) * 48)
                                    {
                                        allAsteriods.Add(proj);
                                    }
                                }

                                Vector2 from = Main.MouseWorld;

                                if (Main.SmartCursorEnabled)
                                {
                                    from = player.MountedCenter + Vector2.Normalize(from) * 16f;
                                }

                                //Main.NewText(allAsteriods.Count);
                                allAsteriods = allAsteriods.OrderBy(testby => ((Math.Abs(from.X - testby.Center.X) * Math.Abs(from.X - testby.Center.X)) + (Math.Abs(from.Y - testby.Center.Y) * Math.Abs(from.Y - testby.Center.Y)))
                                                                    + 0).ToList();

restartHere:
                                if (allAsteriods.Count > 0)
                                {
                                    MineableAsteriod targetedasteriod = allAsteriods[0].modProjectile as MineableAsteriod;

                                    //double length2 = Math.Sqrt(Math.Abs(targetedasteriod.projectile.Center.X - player.Center.X) * Math.Abs(targetedasteriod.projectile.Center.Y - player.Center.Y));

                                    // if (length2 < (Math.Sqrt(Player.tileRangeX * Player.tileRangeY) + player.blockRange) * 16)
                                    // {
                                    targetedAsteriod = targetedasteriod;
                                    targetedasteriod.miningTargeted = targetedasteriod.miningTargeted + 2;
                                    //break;
                                    // }
                                }
                            }
                        }

                        spacevar = 1;
                    }

                    if (SGAPocketDim.WhereAmI == typeof(LimboDim))
                    {
                        SLWorld.noReturn = true;
                    }
                }
                else //No subworld entered atm
                {
                    if (spacevar > 0)//dropping out of Space
                    {
                        player.Center   = new Vector2(spaceX * (Main.maxTilesX * 16f), 48);
                        player.velocity = new Vector2(0, 16);
                    }

                    if (player.wings > 0 && player.velocity.Y < 0 && player.Center.Y < (16 * 50) && spacevar == 0 && player.controlJump && !IdgNPC.bossAlive)
                    {
                        SpaceDim.postMoonLord = NPC.downedMoonlord;
                        SGAPocketDim.EnterSubworld(mod.GetType().Name + "_SpaceDim");
                    }
                    spacevar = 0;
                }

                spaceX = player.Center.X / (Main.maxTilesX * 16f);

                if (SGAPocketDim.WhereAmI == typeof(LimboDim))
                {
                    player.AddBuff(Idglib.Instance.BuffType("LimboFading"), 1);
                    if (enterlimbo > 0)
                    {
                        enterlimbo = -6;
                    }
                    if (enterlimbo == -5)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/crack"), new Vector2(-1, -1));
                        player.Center = new Vector2(Main.rand.Next(200, Main.maxTilesX - 400) * 16, 64);
                    }
                    if (enterlimbo > -2)
                    {
                        enterlimbo = -2;
                        if (Framing.GetTileSafely((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f)).wall == mod.WallType("NullWall") && DimDingeonsWorld.ancientLockedFabric)
                        {
                            enterlimbo = -6;
                        }
                    }
                }
                if (SGAPocketDim.WhereAmI == typeof(Limborinth))
                {
                    if (Framing.GetTileSafely((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f)).wall == mod.WallType("NullWallBossArena"))
                    {
                        if (NullBossArenaSpot == default)
                        {
                            Idglib.Chat("There's no turning back now...", 120, 15, 15);
                        }
                        NullBossArenaSpot = player.Center;
                    }
                    else
                    {
                        if (NullBossArenaSpot != default)
                        {
                            player.velocity = Vector2.Normalize(NullBossArenaSpot - player.Center) * 12f;
                            player.Center   = NullBossArenaSpot;
                        }
                    }
                }
                else
                {
                    NullBossArenaSpot = default;
                }
            }
        }
コード例 #21
0
        public override void AI()
        {
            projectile.velocity /= 1.05f;

            if (projectile.ai[0] < 0)
            {
                if (projectile.ai[0] == -2)
                {
                    if (SGAWorld.darknessVision == true)
                    {
                        if (P != null && P.active && !P.dead)
                        {
                            P.AddBuff(ModContent.BuffType <Watched>(), 60 * 45);
                        }
                    }

                    SoundEffectInstance sound = Main.PlaySound(SoundID.Roar, (int)projectile.Center.X, (int)projectile.Center.Y, 2);
                    if (sound != null)
                    {
                        sound.Pitch -= 0.75f;
                    }
                }
                projectile.ai[0] -= 1;
                if (P != null && P.active && !P.dead)
                {
                    projectile.Center = P.Center;
                }
                if (projectile.ai[0] < -120)
                {
                    projectile.Kill();
                }

                if ((int)projectile.ai[1] == 1)
                {
                    if (SGAWorld.darknessVision != true)
                    {
                        SGAWorld.darknessVision = true;

                        if (Main.netMode == 2)
                        {
                            NetMessage.SendData(MessageID.WorldData);
                        }
                        Idglib.Chat("Your Compass has has gained a new function...", 180, 25, 25);
                    }
                }

                return;
            }

            projectile.ai[0] += 1;

            if (projectile.ai[0] > 600)
            {
                P      = Main.player[Player.FindClosest(projectile.Center, 1, 1)];
                lookat = P.Center;
                if (P != null && P.active && !P.dead)
                {
                    projectile.velocity += ((P.Center - projectile.Center) * ((1f + projectile.ai[0] / 50f)) / 8000f) * Math.Min((projectile.ai[0] - 600) / 1000f, 1f);
                    if (P.Distance(projectile.Center) < 24 + (projectile.ai[0] / 300))
                    {
                        projectile.ai[0] = -1;
                    }
                }
            }
        }
コード例 #22
0
        public override void PostUpdate()
        {
            if ((Main.netMode < 1 || Main.myPlayer == 0) && Main.expertMode)
            {
                NightmareHardcore = Main.LocalPlayer.GetModPlayer <SGAPlayer>().nightmareplayer ? 1 : 0;
            }

            WorldIsTin = (WorldGen.CopperTierOre == 7 ? false : true);

            Items.Glowrock.DoFallenSpaceRocks();

            if (Main.dayTime == true)
            {
                harbingercounter = 0;
            }
            if (NPC.CountNPCS(NPCID.Golem) > 0 && SGAConfig.Instance.GolemImprovement)
            {
                golemchecker = 1;
                if (NPC.CountNPCS(mod.NPCType("SGAGolemBoss")) < 1)
                {
                    NPC myowner = Main.npc[NPC.FindFirstNPC(NPCID.Golem)];
                    NPC.NewNPC((int)myowner.position.X, (int)myowner.position.Y, mod.NPCType("SGAGolemBoss"));
                    //Main.NewText("Test: modded golem npc spawned", 25, 25, 80);
                }
            }
            else
            {
                golemchecker = 0;
            }

            harbingercounter += 1;
            if (NPC.downedAncientCultist)
            {
                stolecrafting += 1;
            }

            questvars[11] = Math.Max(questvars[11] - 1, 0);
            if (questvars[10] > 100 && questvars[10] < 1000)
            {
                questvars[10] += 1;
                questvars[11]  = 120;
                Hellion hellinstance = new Hellion();
                if (questvars[10] == 250)
                {
                    hellinstance.HellionTaunt("...");
                }
                if (questvars[10] == 400)
                {
                    hellinstance.HellionTaunt("I see...");
                }
                if (questvars[10] == 600)
                {
                    hellinstance.HellionTaunt("A new challenger rises...");
                }
                if (questvars[10] == 800)
                {
                    hellinstance.HellionTaunt("Curious...");
                }
            }

            if (questvars[10] > 1100 && questvars[10] < 2300)
            {
                questvars[10] += 1;
                questvars[11]  = 120;
                Hellion hellinstance = new Hellion();
                if (questvars[10] == 1200)
                {
                    hellinstance.HellionTaunt("Another emmessary...");
                }
                if (questvars[10] == 1400)
                {
                    hellinstance.HellionTaunt("Fallen. hmp...?");
                }
                if (questvars[10] == 1600)
                {
                    hellinstance.HellionTaunt("The dragon?");
                }
                if (questvars[10] == 1800)
                {
                    hellinstance.HellionTaunt("'Planets.System.FindDraken'");
                }
                if (questvars[10] == 2000)
                {
                    hellinstance.HellionTaunt("Who is this who is slaying my emissaries?");
                }
                if (questvars[10] == 2200)
                {
                    hellinstance.HellionTaunt("No matter... We'll be meeting soon enough...");
                }
            }

            if (questvars[10] > 2400 && questvars[10] < 3750)
            {
                questvars[10] += 1;
                questvars[11]  = 120;
                Hellion hellinstance = new Hellion();
                if (questvars[10] == 2400)
                {
                    hellinstance.HellionTaunt("There is no mistake");
                }
                if (questvars[10] == 2600)
                {
                    hellinstance.HellionTaunt("the failures found the dragon");
                }
                if (questvars[10] == 2800)
                {
                    hellinstance.HellionTaunt("You there, human");
                }
                if (questvars[10] == 3000)
                {
                    hellinstance.HellionTaunt("Hand over the dragon, and I'll spare your world");
                }
                if (questvars[10] == 3200)
                {
                    hellinstance.HellionTaunt("After all, we're old acquaintances");
                }
                if (questvars[10] == 3400)
                {
                    hellinstance.HellionTaunt("And thanks to the incompetence of my minions, my mission will finally be complete");
                }
                if (questvars[10] == 3600)
                {
                    hellinstance.HellionTaunt("I'm sure your dragon will have something to say about this");
                }
                if (questvars[10] == 3700)
                {
                    Main.PlaySound(29, -1, -1, 105, 1f, -0.6f);
                    hellinstance.HellionTaunt("I'll be waiting...");
                }
            }

            if (stolecrafting == -400)
            {
                Idglib.Chat("Bet you were expecting him to drop an Ancient Manipulator huh?", 25, 25, 80);
            }
            if (stolecrafting == -200)
            {
                Idglib.Chat("Welp, we stole that from him, come fight us if you want it", 25, 25, 80);
            }
            if (stolecrafting == -50)
            {
                Idglib.Chat("We want our wraith core fragments back you son of a bitch...", 25, 25, 80);
            }
        }
コード例 #23
0
        public bool DoingIntro()
        {
            introstate = 0;
            if (intro < 1200)
            {
                if (intro >= 950)
                {
                    introstate = 1;
                }
                if (intro < 200)
                {
                    npc.velocity.Y -= 0.5f;
                }
                if (intro == 100)
                {
                    Idglib.Chat("Draken: ...", 0, 200, 0);
                }
                if (intro == 200)
                {
                    Idglib.Chat("Draken: I...", 0, 200, 0);
                }
                if (intro == 400)
                {
                    Idglib.Chat("Draken: Trusted you...", 0, 200, 0);
                }
                if (intro == 600)
                {
                    Idglib.Chat("Draken: How could...", 0, 200, 0);
                }
                if (intro == 700)
                {
                    Idglib.Chat("Draken: You do this?", 0, 200, 0);
                }
                if (intro == 800)
                {
                    Idglib.Chat("Draken: how Could...!", 0, 200, 0);
                }
                if (intro == 950)
                {
                    Idglib.Chat("True Draken: YOU?!!", 200, 0, 0);
                    RippleBoom.MakeShockwave(npc.Center, 8f, 2f, 20f, 100, 3f, true);
                    Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 2, 1f, -0.5f);
                    npc.velocity.Y = 0;
                }
                if (npc.ai[1] < 1)
                {
                    if (intro == 1100)
                    {
                        Idglib.Chat("True Draken: Justice shall fall down on you!", 200, 0, 0);
                    }
                    if (intro == 1199)
                    {
                        Idglib.Chat("True Draken: Repent!", 200, 0, 0);
                    }
                }

                if (npc.ai[1] == 1)
                {
                    npc.ai[0] = 2200;
                    if (intro == 1000)
                    {
                        Idglib.Chat("True Draken: What do you hope to gain?", 200, 0, 0);
                    }
                    if (intro == 1150)
                    {
                        Idglib.Chat("True Draken: Tell me what?!", 200, 0, 0);
                    }
                }
                if (npc.ai[1] == 2)
                {
                    npc.ai[0] = -999;
                    if (intro == 1000)
                    {
                        Idglib.Chat("True Draken: I won't let you...", 200, 0, 0);
                    }
                    if (intro == 1150)
                    {
                        Idglib.Chat("True Draken: I WON'T LET YOU!!", 200, 0, 0);
                    }
                }

                if (intro > 700 && intro < 950)
                {
                    npc.velocity.Y -= (intro - 700f) / 1000f;
                }
                npc.velocity /= 1.5f;
                return(true);
            }
            introstate = 2;
            return(false);
        }