Esempio n. 1
0
        private void OrbitTarget(int npc = -1)
        {
            Player  player = Main.player[projectile.owner];
            Vector2 origin = player.Center;

            if (npc > -1)
            {
                origin = Main.npc[npc].Center;
            }

            float pos = 1;
            float max = 1;

            for (int i = 0; i < Main.projectile.Length; i++)
            {
                if (i != projectile.whoAmI)
                {
                    if (Main.projectile[i].active && Main.projectile[i].type == mod.ProjectileType("LivingFireballMinion") && Main.projectile[i].owner == projectile.owner)
                    {
                        max++;
                        if (i < projectile.whoAmI)
                        {
                            pos++;
                        }
                    }
                }
            }
            Vector2 offset   = new Vector2(0, -25 - max * 5);
            float   rotation = pos / max;

            offset            = DavesUtils.Rotate(offset, MathHelper.ToRadians(rotation * 360) + Main.GameUpdateCount / 25f);
            projectile.Center = origin + offset;
        }
Esempio n. 2
0
        public void Oval(Projectile proj, float topSpeed, float maxRange, float inc)
        {
            Player player = Main.player[proj.owner];
            int    MW     = Math.Abs(proj.ai[0]) > player.Center.X ? -1 : 1;

            if (proj.velocity.Length() > topSpeed)
            {
                proj.velocity = Vector2.Normalize(proj.velocity) * topSpeed;
            }
            float extensionLength = Vector2.Distance(new Vector2(Math.Abs(proj.ai[0]), Math.Abs(proj.ai[1])), player.Center) / 2;

            if (extensionLength > maxRange * 0.55f)
            {
                extensionLength = maxRange * 0.55f;
            }
            inc *= MW;
            float rotationSpeed = 0.4f;

            proj.localAI[0] += GetVelMult(extensionLength, rotationSpeed, MW == -1);
            Vector2 SpinnyPlace = new Vector2((float)Math.Sin(proj.localAI[0] + inc) * extensionLength + (extensionLength), (float)Math.Cos(proj.localAI[0] + inc) * (extensionLength / 3));
            float   rotatyBoi   = (new Vector2(Math.Abs(proj.ai[0]), Math.Abs(proj.ai[1])) - player.Center).ToRotation();

            SpinnyPlace    = DavesUtils.Rotate(SpinnyPlace, rotatyBoi);
            SpinnyPlace   += player.Center;
            proj.rotation += 0.2f;
            proj.Center    = SpinnyPlace;
        }
Esempio n. 3
0
        public override void AI()
        {
            npc.TargetClosest(true);
            npc.spriteDirection = npc.velocity.X > 0 ? 1 : -1;
            Player player = Main.player[npc.target];

            npc.ai[0] = GetAiType(player);
            float   num = 25f;
            Vector2 vel = new Vector2(0, 200);
            float   inc = MathHelper.ToRadians(360f / num);

            for (int i = 0; i < num; i++)
            {
                int dustid = Dust.NewDust(npc.Center + DavesUtils.Rotate(vel, i * inc), 1, 1, DustID.GreenBlood);
                Main.dust[dustid].noGravity = true;
            }
            if (Vector2.Distance(npc.Center, player.Center) < 200)
            {
                player.AddBuff(BuffID.Poisoned, 60);
            }
            float maxSpeed     = 4.5f;
            float acceleration = 0.13f;

            if (npc.ai[0] < 2)//Long Range Stuff
            {
                if (npc.collideX && npc.velocity.Y == 0)
                {
                    npc.velocity.Y -= maxSpeed + npc.ai[1]; npc.ai[1] += 1;
                }
                else if (!npc.collideX)
                {
                    npc.ai[1] = 0;
                }
                int mult = (npc.ai[0] == 0 ? 1 : -1);
                if (npc.velocity.X * mult < 0)
                {
                    mult *= 2;
                }
                npc.velocity.X += mult * acceleration;
                if (npc.velocity.X * mult > maxSpeed)
                {
                    npc.velocity.X = maxSpeed * mult;
                }
            }
            else
            {
                if (npc.ai[0] == 2 && npc.velocity.Y == 0)
                {
                    npc.velocity.Y += maxSpeed;
                }                                                                         //Above Stuff
                else if (npc.ai[0] == 3 && npc.velocity.Y == 0)
                {
                    npc.velocity.Y -= maxSpeed + npc.ai[1]; npc.ai[1] += 1;
                }                                                                                                           //Below Stuff


                //Close Range Stuff
            }
        }
Esempio n. 4
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 vel = new Vector2(speedX, speedY);

            vel = DavesUtils.Rotate(vel, MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f)));
            Projectile.NewProjectile(position, vel, item.shoot, damage, knockBack, player.whoAmI);
            return(false);
        }
Esempio n. 5
0
        public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
        {
            Vector2 velInit = Vector2.Normalize(target.Center - player.Center) * 16f;

            for (int i = -1; i < 3; i++)
            {
                Vector2 vel = DavesUtils.Rotate(velInit, MathHelper.ToRadians(2) * i);
                Projectile.NewProjectile(target.Center, vel, mod.ProjectileType("CrystilShard"), damage, knockBack, player.whoAmI);
            }
        }
Esempio n. 6
0
        public override void Kill(int timeleft)
        {
            int   numBlasts = Main.rand.Next(3, 8);
            float step      = 360 / numBlasts;

            for (int i = 0; i < numBlasts; i++)
            {
                Vector2 vel = DavesUtils.Rotate(new Vector2(0, -8), MathHelper.ToRadians(step * i));
                Projectile.NewProjectile(projectile.Center, vel, mod.ProjectileType("FireOrbSplit"), (int)(projectile.damage * 0.8f), projectile.knockBack * 0.8f, projectile.owner);
            }
        }
Esempio n. 7
0
 public override void Kill(int timeleft)
 {
     if (projectile.ai[0] == 0)
     {
         for (int i = 0; i < 2; i++)
         {
             Vector2 vel = DavesUtils.Rotate(projectile.velocity * 1.4f, 0.5f * (i == 0 ? 1f : -1f));
             Projectile.NewProjectile(projectile.Center, vel, projectile.type, (int)(projectile.damage * 0.8f), projectile.knockBack, projectile.owner, 1);
         }
         Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.4f, projectile.type, (int)(projectile.damage * 0.8f), projectile.knockBack, projectile.owner, 1);
     }
 }
Esempio n. 8
0
 private void CrystilLasersFromNPC(Player player, int num = 3)
 {
     if (Main.netMode != NetmodeID.MultiplayerClient)
     {
         Vector2 vel = Vector2.Normalize(player.Center - npc.Center) * 16;
         for (int i = 0; i < num; i++)
         {
             int projid = Projectile.NewProjectile(npc.Center, DavesUtils.Rotate(vel, MathHelper.ToRadians(10 * (i - num / 2))), mod.ProjectileType("CrystilWarning"), CrystilDamage, 0f, Main.myPlayer, npc.whoAmI);
             NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, projid);
         }
     }
 }
Esempio n. 9
0
 private void CrystilCircle(int num = 10, float startRotaion = 0f, int type = -1)
 {
     if (Main.netMode != NetmodeID.MultiplayerClient)
     {
         float   speed = DRGNModWorld.MentalMode ? 12f : Main.expertMode ? 10f : 8f;
         float   inc   = MathHelper.ToRadians(360 / num);
         Vector2 vel   = DavesUtils.Rotate(new Vector2(0, -speed), startRotaion);
         for (int i = 0; i < num; i++)
         {
             int projid = Projectile.NewProjectile(npc.Center, DavesUtils.Rotate(vel, inc * i), type == -1 ? mod.ProjectileType("GiantCrystil") : type, CrystilDamage, 0f, Main.myPlayer);
             NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, projid);
         }
     }
 }
Esempio n. 10
0
        public override void AI()
        {
            if (projectile.localAI[0] == 0 && projectile.owner == Main.myPlayer)
            {
                int target = DavesUtils.FindNearestTargettableNPC(projectile, 200);
                if (target != -1)
                {
                    projectile.velocity = Vector2.Normalize(Main.npc[target].Center - projectile.Center) * 10f;
                }
                Vector2 desiredPos = projectile.Center + DavesUtils.Rotate(Vector2.Normalize(projectile.velocity) * 100f, Main.rand.NextFloat(-1f, 1f));
                projectile.ai[0]      = desiredPos.X;
                projectile.ai[1]      = desiredPos.Y;
                projectile.netUpdate  = true;
                projectile.localAI[0] = 1;
            }
            MoveTo();
            int dustid = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("ShadeDust"));

            Main.dust[dustid].noGravity = true;
        }
Esempio n. 11
0
        public override void NPCLoot(NPC npc)
        {
            int closestPlayer = Player.FindClosest(npc.position, npc.width, npc.height);

            if (Main.player[closestPlayer].GetModPlayer <DRGNPlayer>().ashenArmorSet || Main.player[closestPlayer].GetModPlayer <DRGNPlayer>().cyEquip)
            {
                bool Crystil = Main.player[closestPlayer].GetModPlayer <DRGNPlayer>().cyEquip;
                if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly)
                {
                    int     numCrystals = Crystil ? Main.rand.Next(8, 16) : Main.rand.Next(5, 10);
                    int     inc         = 360 / numCrystals;
                    Vector2 startingVel = new Vector2(Crystil? -14 : -10, 0);
                    for (int i = 0; i < numCrystals; i++)
                    {
                        int projid = Projectile.NewProjectile(npc.Center, DavesUtils.Rotate(startingVel, inc * i), Crystil ? mod.ProjectileType("Crystil") : mod.ProjectileType("FlareCrystalShard"), Crystil ? 40 : 20, 1f, closestPlayer);
                        NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, projid);
                    }
                }
            }
            if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly && npc.position.Y > Main.rockLayer * 16.0 && npc.value > 0f && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 30))
            {
                if (Main.player[closestPlayer].ZoneJungle)
                {
                    Item.NewItem(npc.getRect(), mod.ItemType("FrogClaw"));
                }
            }
            if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly && npc.position.Y > Main.rockLayer * 16.0 && npc.value > 0f && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 5))
            {
                if (Main.player[closestPlayer].ZoneJungle && DRGNModWorld.downedToxicFrog)
                {
                    Item.NewItem(npc.getRect(), mod.ItemType("ToxicFlesh"), DRGNModWorld.MentalMode ? 3 : 1);
                }
            }
            int rand = Main.rand.Next(1, 5);

            if (npc.type == NPCID.CultistBoss && DRGNModWorld.MentalMode)
            {
                Item.NewItem(npc.getRect(), ItemID.CultistBossBag, Main.ActivePlayersCount);
            }
            if ((npc.type == NPCID.Drippler || npc.type == NPCID.BloodZombie) && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 50))
            {
                Item.NewItem(npc.getRect(), mod.ItemType("BloodCore"));
            }
            if ((npc.type == NPCID.CaveBat || npc.type == NPCID.UndeadMiner || npc.type == NPCID.MotherSlime || npc.type == NPCID.UndeadViking || npc.type == NPCID.IceBat || npc.type == NPCID.GraniteFlyer || npc.type == NPCID.GraniteGolem) && Main.rand.NextBool(DRGNModWorld.MentalMode ? 4 : Main.expertMode ? 2 : 1, 50))
            {
                Item.NewItem(npc.getRect(), mod.ItemType("SoulContainer"));
            }
            if (!Main.expertMode)
            {
                if (npc.type == NPCID.WallofFlesh && Main.rand.NextBool(1, 5))
                {
                    Item.NewItem(npc.getRect(), ModContent.ItemType <Items.Equipables.ReaperEmblem>());
                }
                if (npc.type == NPCID.Golem)
                {
                    if (rand == 1)
                    {
                        Item.NewItem(npc.getRect(), ModContent.ItemType <RockSpear>());
                    }
                    else if (rand == 2)
                    {
                        Item.NewItem(npc.getRect(), ModContent.ItemType <RockWhip>());
                    }
                    if (rand == 3)
                    {
                        Item.NewItem(npc.getRect(), ModContent.ItemType <RockSprayer>());
                    }
                    if (rand == 4)
                    {
                        Item.NewItem(npc.getRect(), ModContent.ItemType <CelestialSundial>());
                    }
                    else if (rand == 5)
                    {
                        Item.NewItem(npc.getRect(), ModContent.ItemType <RockYoyo>());
                    }
                }
            }
            if (DRGNModWorld.SwarmUp)
            {
                if (npc.type == mod.NPCType("Ant") || npc.type == mod.NPCType("FireAnt") || npc.type == mod.NPCType("ElectricAnt"))
                {
                    Main.invasionSize -= 1;
                }
                else if (npc.type == mod.NPCType("FlyingAnt"))
                {
                    Main.invasionSize -= 2;
                }
                else if (npc.type == mod.NPCType("AntCrawlerHead"))
                {
                    Main.invasionSize -= 4;
                }
                else if (npc.type == mod.NPCType("DragonFly"))
                {
                    Main.invasionSize = 0;
                }
            }
            if (!npc.boss && npc.lifeMax > 1 && npc.damage > 0 && !npc.friendly && NPC.downedMoonlord && npc.value > 0f && Main.rand.NextBool(DRGNModWorld.MentalMode? 4 : Main.expertMode ? 2 : 1, 15))
            {
                if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneUnderworldHeight)
                {
                    Item.NewItem(npc.getRect(), mod.ItemType("MagmaticEssence"));
                }
                if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneJungle)
                {
                    Item.NewItem(npc.getRect(), mod.ItemType("EarthenEssence"));
                }
                if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneSnow)
                {
                    Item.NewItem(npc.getRect(), mod.ItemType("GlacialEssence"));
                }
                if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].ZoneSkyHeight)
                {
                    Item.NewItem(npc.getRect(), mod.ItemType("LunarEssence"));
                }
            }
            if (npc.type == NPCID.Golem && DRGNModWorld.LihzahrdOre == false)
            {
                Main.NewText("The Jungle has condensed", 85, 85, 5);

                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 600, Main.maxTilesY - 300);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);


                    DRGNModWorld.LihzahrdOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("LihzahrdOre"));
                }
            }

            if (npc.type == NPCID.MoonLordCore && DRGNModWorld.LuminiteOre == false)
            {
                Main.NewText("The Lunar Being has fallen and your world has been blessed", 180, 180, 180);
                Item.NewItem(npc.getRect(), mod.ItemType("LunarBlessing"), Main.ActivePlayersCount);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 600, Main.maxTilesY - 300);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);


                    DRGNModWorld.LuminiteOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), TileID.LunarOre);
                }
            }
            if (npc.type == mod.NPCType("ToxicFrog") && DRGNModWorld.EarthenOre == false)
            {
                Main.NewText("The earth has released its energy", 0, 255, 100);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 200, Main.maxTilesY - 600);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);


                    DRGNModWorld.EarthenOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("EarthenOre"));
                }
            }
            if (npc.type == mod.NPCType("TheVirus") && DRGNModWorld.TechnoOre == false)
            {
                Main.NewText("Technology is infecting your world", 0, 40, 0);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 400, Main.maxTilesY - 200);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);


                    DRGNModWorld.TechnoOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("TechnoOre"));
                }
            }
            if (npc.type == mod.NPCType("Cloud") && DRGNModWorld.CosmoOre == false)
            {
                Main.NewText("The sun and moon have condensed", 180, 180, 255);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 600, Main.maxTilesY - 600);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);


                    DRGNModWorld.CosmoOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("CosmoOre"));
                }
            }
            if (npc.type == mod.NPCType("VoidSnakeHead") && DRGNModWorld.VoidOre == false)
            {
                Main.NewText("The void has collapsed", 0, 255, 100);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 700, Main.maxTilesY);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);


                    DRGNModWorld.VoidOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("VoidOre"));
                }
            }
            if (npc.type == mod.NPCType("GalacticGuardian") && DRGNModWorld.GalactiteOre == false)
            {
                Main.NewText("A galaxy has formed in your world", 200, 200, 200);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 700, Main.maxTilesY);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);



                    DRGNModWorld.GalactiteOre = true;

                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(10, 15), WorldGen.genRand.Next(10, 15), (ushort)mod.TileType("GalacticaOre"));
                }
            }
            if (npc.type == mod.NPCType("IceFish") && DRGNModWorld.GlacialOre == false)
            {
                Main.NewText("The ancient being has fallen granting your world its power", 0, 100, 255);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next((int)WorldGen.worldSurface + 400, Main.maxTilesY - 300);
                    int X = Main.rand.Next(100, Main.maxTilesX - 100);



                    DRGNModWorld.GlacialOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("GlacialOre"));
                }
            }
            if (npc.type == mod.NPCType("FireDragon") && DRGNModWorld.SolariumOre == false)
            {
                Main.NewText("Hell has risen releasing power into the depths of your world", 255, 50, 50);
                for (int k = 0; k < 750; k++)                     //750 is the ore spawn rate. the bigger is the number = more ore spawns
                {
                    int Y = Main.rand.Next(Main.maxTilesY - 400, Main.maxTilesY);
                    int X = Main.rand.Next(10, Main.maxTilesX - 10);



                    DRGNModWorld.SolariumOre = true;
                    WorldGen.OreRunner(X, Y, (double)WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10), (ushort)mod.TileType("SolariumOre"));
                }
            }
        }