Esempio n. 1
0
 public override bool CheckDead()
 {
     NPC.downedSlimeKing = true;
     for (int i = 0; i < 12; i++)
     {
         Dust dust;
         dust = Main.dust[Terraria.Dust.NewDust(npc.position, npc.width, npc.height, 43, 0f, 0f, 0, new Color(255, 255, 255), 5f)];
     }
     for (int i = 0; i < 3; i++)
     {
         Vector2 a = new Vector2(npc.Center.X + Main.rand.Next(20) - Main.rand.Next(20), npc.Center.Y + Main.rand.Next(20) - Main.rand.Next(20));
         Vector2 b = new Vector2(Main.rand.Next(3), Main.rand.Next(3));
         if (i == 0)
         {
             Gore.NewGoreDirect(a, b, mod.GetGoreSlot("Gores/NeonGore"), 1f);
         }
         if (i == 1)
         {
             Gore.NewGoreDirect(a, b, mod.GetGoreSlot("Gores/NeonGore"), 1f);
         }
         if (i == 2)
         {
             Gore.NewGoreDirect(a, b, mod.GetGoreSlot("Gores/NeonGore"), 1f);
         }
         NPC.NewNPC((int)a.X, (int)a.Y, ModContent.NPCType <NeonSlime>());
     }
     return(true);
 }
Esempio n. 2
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            if (Main.rand.NextBool(2))
            {
                Gore g = Gore.NewGoreDirect(projectile.Center, Vector2.Zero, GoreID.Pages);
                g.timeLeft -= 60;
            }
            else
            {
                Gore g = Gore.NewGoreDirect(projectile.Center, Vector2.Zero, GoreID.PageScrap);
                g.timeLeft -= 60;

                g           = Gore.NewGoreDirect(projectile.Center, Vector2.Zero, GoreID.PageScrap);
                g.timeLeft -= 60;
            }

            /*FargoPlayer mPlayer = Main.player[projectile.owner].GetModPlayer<FargoPlayer>();
             *
             * if (projectile.owner == Main.myPlayer)
             * {
             *  mPlayer.DarkMageBookCounter++;
             *  if (mPlayer.DarkMageBookCounter >= DarkMageSkeletonFriend.HitsToTrigger)
             *  {
             *      // Summon skeleton friend
             *      Vector2 position = target.Center + new Vector2(160 * (target.direction == 0 ? 1 : -1), Main.screenHeight / 2f);
             *      int d = (int)(projectile.damage * 1.33);
             *      mPlayer.DarkMageBookCounter = 0;
             *
             *      Projectile pro = Projectile.NewProjectileDirect(position, new Vector2(0, -24), ModContent.ProjectileType<DarkMageSkeletonFriend>(), d, 0f, projectile.owner);
             *      pro.localAI[0] = target.whoAmI;
             *  }
             * }*/
        }
Esempio n. 3
0
 public override void AI()
 {
     for (int i = 0; i < 2; i++)
     {
         Gore.NewGoreDirect(projectile.Center + Main.rand.NextVector2Circular(25, 25), Main.rand.NextFloat(3.14f, 6.28f).ToRotationVector2() * 7, ModGore.GetGoreSlot("StarlightRiver/Assets/NPCs/Vitric/MagmiteGore"), Main.rand.NextFloat(0.4f, 0.8f));
     }
 }
        public override void Kill(int timeLeft)
        {
            for (int k = 0; k < 60; k++)
            {
                Gore.NewGoreDirect(projectile.Center, (Vector2.UnitY * Main.rand.NextFloat(-16, -1)).RotatedByRandom(0.8f), ModGore.GetGoreSlot("StarlightRiver/Assets/NPCs/Vitric/MagmiteGore"), Main.rand.NextFloat(1.0f, 1.4f));
            }

            for (int k = 0; k < 50; k++)
            {
                Dust.NewDust(projectile.position, 16, 16, 14);
            }

            for (int x = -8; x < 8; x++)
            {
                for (int y = -8; y < 8; y++)
                {
                    Tile tile = Main.tile[(int)projectile.Center.X / 16 + x, (int)projectile.Center.Y / 16 + y];
                    if (tile.active() && Main.tileSolid[tile.type] && Helpers.Helper.IsEdgeTile((int)projectile.Center.X / 16 + x, (int)projectile.Center.Y / 16 + y))
                    {
                        Vector2 pos = new Vector2((int)projectile.Center.X / 16 + x, (int)projectile.Center.Y / 16 + y) * 16 + Vector2.One * 8;
                        if (!Main.projectile.Any(n => n.active && n.type == ModContent.ProjectileType <MagmaSwordBurn>() && n.Center == pos))
                        {
                            Projectile.NewProjectile(pos, Vector2.Zero, ModContent.ProjectileType <MagmaSwordBurn>(), 25, 0, projectile.owner);
                        }
                        else
                        {
                            Main.projectile.FirstOrDefault(n => n.active && n.type == ModContent.ProjectileType <MagmaSwordBurn>() && n.Center == pos).timeLeft = 180;
                        }
                    }
                }
                Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.AmberBolt, 0, 0, 0, default, 0.5f);
Esempio n. 5
0
        public override void AI()
        {
            projectile.velocity *= 0.97f;
            if (!Ignited)
            {
                Dustcloud(green);
            }

            else
            {
                if (++projectile.ai[1] < chargetime)
                {
                    if (projectile.ai[1] <= chargetime)
                    {
                        projectile.scale -= 0.01f;
                    }

                    Lighting.AddLight(projectile.Center, Color.Yellow.ToVector3() * 0.75f);
                    projectile.timeLeft = 20;
                    if (Main.rand.NextBool(3))
                    {
                        Dust dust = Dust.NewDustDirect(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2, projectile.height / 2), 0, 0, DustID.GoldCoin);
                        dust.noGravity = true;
                        dust.velocity  = Vector2.Normalize(projectile.Center - dust.position);
                        dust.scale     = 1.2f;
                        dust.fadeIn    = 0.5f;
                    }
                    if (Main.rand.NextBool(5))
                    {
                        Dustcloud(Color.Lerp(green, white, Math.Min(projectile.ai[1] / (chargetime / 2), 1)));
                    }
                }
                else
                {
                    if (projectile.ai[1] == chargetime)
                    {
                        projectile.scale = 1.2f;
                        Main.PlaySound(new LegacySoundStyle(SoundID.Item, 14).WithVolume(0.4f).WithPitchVariance(0.1f), projectile.Center);
                        Main.player[projectile.owner].GetModPlayer <StarlightPlayer>().Shake = 8;
                    }
                    Lighting.AddLight(projectile.Center, Color.OrangeRed.ToVector3());
                    if (Main.rand.NextBool())
                    {
                        Dustcloud(orange, 4);
                        Dustcloud(gray, 8);
                        Dust dust = Dust.NewDustDirect(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2, projectile.height / 2), 0, 0, 6);
                        //dust.noGravity = true;
                        dust.velocity *= 4f;
                        dust.scale     = 0.65f;
                    }
                    if (Main.rand.NextBool(3))
                    {
                        Gore gore = Gore.NewGoreDirect(projectile.Center, Main.rand.NextVector2Circular(2, 2), GoreID.ChimneySmoke1);
                        gore.rotation = Main.rand.NextFloatDirection();
                        gore.timeLeft = 10;
                    }
                }
            }
        }
Esempio n. 6
0
 public override void Kill(int timeLeft)
 {
     DustCircle();
     Main.PlaySound(SoundID.Tink, projectile.position);
     Gore.NewGoreDirect(projectile.position, Vector2.Zero, ModGore.GetGoreSlot("CastledsContent/Gores/HarpyCapsule_1"));
     Gore.NewGoreDirect(projectile.position, Vector2.Zero, ModGore.GetGoreSlot("CastledsContent/Gores/HarpyCapsule_1"));
     Gore.NewGoreDirect(projectile.position, Vector2.Zero, ModGore.GetGoreSlot("CastledsContent/Gores/HarpyCapsule_2"));
     Gore.NewGoreDirect(projectile.position, Vector2.Zero, ModGore.GetGoreSlot("CastledsContent/Gores/HarpyCapsule_2"));
 }
Esempio n. 7
0
        public override void NPCLoot()
        {
            for (int k = 0; k < 30; k++)
            {
                Gore.NewGoreDirect(npc.Center, (Vector2.UnitY * Main.rand.NextFloat(-8, -1)).RotatedByRandom(0.5f), ModGore.GetGoreSlot("StarlightRiver/Assets/NPCs/Vitric/MagmiteGore"), Main.rand.NextFloat(0.5f, 0.8f));
            }

            Main.PlaySound(SoundID.DD2_GoblinHurt, npc.Center);
        }
Esempio n. 8
0
        //Adepted from aiStyle 136
        public override void AI()
        {
            ExtraAI();
            float range  = 400f;
            float range2 = 16f;

            DelegateMethods.v3_1 = new Vector3(1.2f, 1f, 0.3f);
            float num6 = projectile.ai[0] / 40f;

            if (num6 > 1f)
            {
                num6 = 1f;
            }
            float num7 = (projectile.ai[0] - 38f) / 40f;

            if (num7 < 0f)
            {
                num7 = 0f;
            }
            Utils.PlotTileLine(projectile.Center + projectile.rotation.ToRotationVector2() * range * num7, projectile.Center + projectile.rotation.ToRotationVector2() * range * num6, range2, DelegateMethods.CastLight);
            Utils.PlotTileLine(projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(0.19634954631328583) * range * num7, projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(0.19634954631328583) * range * num6, range2, DelegateMethods.CastLight);
            Utils.PlotTileLine(projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(-0.19634954631328583) * range * num7, projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(-0.19634954631328583) * range * num6, range2, DelegateMethods.CastLight);
            if (num7 == 0f && num6 > 0.1f)
            {
                for (int j = 0; j < 3; j++)
                {
                    Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 6);
                    dust.fadeIn    = 1.5f;
                    dust.velocity  = projectile.rotation.ToRotationVector2().RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 12f)) * (0.5f + Main.rand.NextFloat() * 2.5f) * 15f;
                    dust.noLight   = true;
                    dust.noGravity = true;
                    dust.alpha     = 200;
                }
            }
            if (Main.rand.Next(5) == 0 && projectile.ai[0] >= 15f)
            {
                Gore gore = Gore.NewGoreDirect(projectile.Center + projectile.rotation.ToRotationVector2() * 300f - Utils.RandomVector2(Main.rand, -20f, 20f), Vector2.Zero, 61 + Main.rand.Next(3), 0.5f);
                gore.velocity *= 0.3f;
                gore.velocity += projectile.rotation.ToRotationVector2() * 4f;
            }
            for (int i = 0; i < 1; i++)
            {
                Dust dust2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 31);
                dust2.fadeIn    = 1.5f;
                dust2.scale     = 0.4f;
                dust2.velocity  = projectile.rotation.ToRotationVector2().RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 12f)) * (0.5f + Main.rand.NextFloat() * 2.5f) * 15f;
                dust2.velocity *= 0.3f;
                dust2.noLight   = true;
                dust2.noGravity = true;
                float num4 = Main.rand.NextFloat();
                dust2.position  = Vector2.Lerp(projectile.Center + projectile.rotation.ToRotationVector2() * range * num7, projectile.Center + projectile.rotation.ToRotationVector2() * range * num6, num4);
                dust2.position += projectile.rotation.ToRotationVector2().RotatedBy(1.5707963705062866) * (20f + 100f * (num4 - 0.5f));
            }
            projectile.frameCounter++;
            projectile.ai[0]++;
        }
Esempio n. 9
0
 public override void HitEffect(int hitDirection, double damage)
 {
     if (npc.life <= 0 && Main.netMode != NetmodeID.Server)
     {
         for (int k = 0; k <= 5; k++)
         {
             Gore.NewGoreDirect(npc.position, Vector2.Zero, ModGore.GetGoreSlot(AssetDirectory.VitricNpc + "Gore/SnakeGore" + k));
         }
     }
 }
Esempio n. 10
0
 public static void DropGores(this NPC npc, int count = 1)
 {
     if (npc.life <= 0)
     {
         for (int k = 0; k < count; k++)
         {
             Gore i = Gore.NewGoreDirect(npc.position, npc.velocity.ToRotation().ToRotationVector2() * Main.rand.NextFloat(2),
                                         Helper.mod.GetGoreSlot(String.Format("Gores/{0}{1}_{2}", string.Join("", npc.FullName.Split(' ')), "Gore", k)));
         }
     }
 }
Esempio n. 11
0
        public override void Kill(int timeLeft)
        {
            var gore = Gore.NewGoreDirect(projectile.position, projectile.velocity * 0.4f, mod.GetGoreSlot("Gores/MiniCannonball"), 1f);

            gore.rotation = projectile.rotation;
            gore.timeLeft = 60;
            //Main.PlaySound(SoundID.Item53.SoundId, (int)projectile.Center.X, (int)projectile.Center.Y, SoundID.Item53.Style, 0.9f, -2f);
            if (Main.netMode != NetmodeID.Server)
            {
                Main.PlaySound(SoundID.Item10.SoundId, (int)projectile.Center.X, (int)projectile.Center.Y, SoundID.Item10.Style, 1.0f, -0.8f);
            }

            /**for (int i = 0; i < 5; i++)
             * {
             *      int dustIndex = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), 1, 1, ModContent.DustType<MiniCannonballDust>());
             *      var unit = projectile.velocity;
             *      unit.Normalize();
             *      Main.dust[dustIndex].velocity *= 0.8f;
             *      Main.dust[dustIndex].velocity += -unit * 3;
             *      Main.dust[dustIndex].scale = 1.6f;
             *      Main.dust[dustIndex].rotation = (-unit).ToRotation() + MathHelper.PiOver2;
             * }**/
            //Point tileCoords = projectile.position.ToTileCoordinates();
            Vector2 tileCoords = new Vector2(projectile.position.X / 16, projectile.position.Y / 16);
            Tile    tileSafely = Framing.GetTileSafely((int)tileCoords.X, (int)tileCoords.Y);
            Vector2 norm       = projectile.velocity;

            norm.Normalize();
            norm *= 16;
            Vector2 otherTileCoords = new Vector2((projectile.position.X + norm.X) / 16, (projectile.position.Y + norm.Y) / 16);
            Tile    otherTile       = Framing.GetTileSafely((int)otherTileCoords.X, (int)otherTileCoords.Y);

            if (tileSafely.nactive())
            {
                tileSafely = otherTile;
                if (tileSafely.nactive())
                {
                    otherTileCoords = otherTileCoords + (otherTileCoords - tileCoords);
                    tileSafely      = Framing.GetTileSafely((int)(otherTileCoords.X), (int)otherTileCoords.Y);
                }
            }
            //WorldGen.KillTile_MakeTileDust((int)tileCoords.X, (int)tileCoords.Y, tileSafely);

            for (int i = 0; i < 5; i++)
            {
                int dustIndex = WorldGen.KillTile_MakeTileDust((int)tileCoords.X, (int)tileCoords.Y, tileSafely);
                var unit      = projectile.velocity;
                unit.Normalize();
                Main.dust[dustIndex].velocity *= 0.8f;
                Main.dust[dustIndex].velocity += -unit * 3;
                Main.dust[dustIndex].scale     = 1.6f;
                Main.dust[dustIndex].rotation  = (-unit).ToRotation() + MathHelper.PiOver2;
            }
        }
Esempio n. 12
0
        public override void HitEffect(int hitDirection, double damage)
        {
            if (npc.life <= 0 && Main.netMode != NetmodeID.Server)
            {
                for (int k = 0; k < 30; k++)
                {
                    Gore.NewGoreDirect(npc.Center, (Vector2.UnitY * Main.rand.NextFloat(-8, -1)).RotatedByRandom(0.5f), ModGore.GetGoreSlot("StarlightRiver/Assets/NPCs/Vitric/MagmiteGore"), Main.rand.NextFloat(0.5f, 0.8f));
                }

                Main.PlaySound(SoundID.DD2_GoblinHurt, npc.Center);
            }
        }
Esempio n. 13
0
 public override void Kill(int timeLeft)
 {
     for (int i = 0; i < 5; i++)
     {
         Dust.NewDust(projectile.position, projectile.width, projectile.height, 46);
     }
     for (int i = 1; i <= Main.rand.Next(2, 5); i++)
     {
         Gore gore = Gore.NewGoreDirect(projectile.position, projectile.velocity / 2, mod.GetGoreSlot("Gores/Skelet/skeler" + i));
         gore.timeLeft = 40;
     }
     Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 2, 0.75f, 0.25f);
 }
Esempio n. 14
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 3, 1f, 0f);

            for (int i = 0; i <= 3; i++)
            {
                Gore gore = Gore.NewGoreDirect(projectile.position + new Vector2(Main.rand.Next(projectile.width), Main.rand.Next(projectile.height)),
                                               Main.rand.NextVector2Circular(-1, 1),
                                               mod.GetGoreSlot("Gores/Skelet/bonger" + Main.rand.Next(1, 5)),
                                               projectile.scale);
                gore.timeLeft = 20;
            }
        }
Esempio n. 15
0
        public override void Kill(int timeLeft)
        {
            if (Main.netMode != NetmodeID.Server)
            {
                Main.PlaySound(SoundID.NPCDeath22, projectile.Center);
            }

            Gore.NewGoreDirect(projectile.position, projectile.velocity / 2, mod.GetGoreSlot("Gores/Gazer/GazerEye"), 1f).timeLeft = 10;
            foreach (var segment in chain.Segments)
            {
                Gore.NewGoreDirect(segment.Vertex2.Position, projectile.velocity / 2, mod.GetGoreSlot("Gores/Gazer/GazerChain"), 1f).timeLeft = 10;
            }
        }
Esempio n. 16
0
        public override void AI()
        {
            if (projectile.ai[0] == 0)
            {
                projectile.friendly = true;
                projectile.timeLeft = 3;
                Main.PlaySound(SoundID.Item14, projectile.position);
                if (projectile.ai[1] == 1)
                {
                    projectile.ai[1]++;
                    Main.PlaySound(SoundID.Item42, projectile.Center);// chain react explosion sfx
                }

                #region Explosion Dust FX
                Dust d;
                for (int i = 0; i < 8; i++)
                {
                    d           = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 2f);
                    d.velocity *= 3f;
                    if (Main.rand.Next(2) == 0)
                    {
                        d.scale  = 0.5f;
                        d.fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
                    }
                }
                for (int i = 0; i < 14; i++)
                {
                    d           = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 2f);
                    d.velocity *= 5f;
                    d           = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2f);
                    d.velocity *= 2f;
                }
                Gore g;
                for (int i = 0; i < 2; i++)
                {
                    for (int y = -1; y < 2; y += 2)
                    {
                        for (int x = -1; x < 2; x += 2)
                        {
                            g           = Gore.NewGoreDirect(projectile.Center - new Vector2(16, 16), default(Vector2), Main.rand.Next(61, 64), 1f);
                            g.velocity *= 0.33f * i;
                            g.velocity += new Vector2(x, y);
                        }
                    }
                }
                #endregion
            }
            projectile.ai[0]++;
        }
Esempio n. 17
0
        public override void AI()
        {
            var x    = (int)(npc.Center.X / 16) + npc.direction; //check 1 tile infront of la cretura
            var y    = (int)(npc.Center.Y / 16);
            var tile = Framing.GetTileSafely(x, y);

            if (Main.rand.Next(10) == 0)
            {
                Gore.NewGoreDirect(npc.Center, (Vector2.UnitY * -3).RotatedByRandom(0.2f), ModGore.GetGoreSlot("StarlightRiver/Assets/NPCs/Vitric/MagmiteGore"), Main.rand.NextFloat(0.5f, 0.8f));
            }

            npc.velocity.X += 0.1f * (Main.player[Main.myPlayer].Center.X > npc.Center.X ? 1 : -1);

            npc.spriteDirection = npc.velocity.X > 0 ? 1 : -1;
        }
Esempio n. 18
0
        public override void HitEffect(int hitDirection, double damage)
        {
            if (npc.life <= 0 && Main.netMode != NetmodeID.Server)
            {
                for (int k = 0; k <= 4; k++)
                {
                    Gore.NewGoreDirect(npc.position, Vector2.Zero, ModGore.GetGoreSlot(AssetDirectory.VitricNpc + "Gore/CrystalPopperGore" + k));
                }
            }

            if (npc.ai[0] == 0 && damage > maxIgnoreDamage)
            {
                ExitSleep();
            }
        }
Esempio n. 19
0
        public override void HitEffect(int hitDirection, double damage)
        {
            if (npc.life <= 0 && Main.netMode != 2)
            {
                Gore gore = Gore.NewGoreDirect(npc.Center, RandomVel, mod.GetGoreSlot("Gores/Mobs/OwtchGore"), npc.scale);
                gore.position -= new Vector2(Main.goreTexture[gore.type].Width, Main.goreTexture[gore.type].Height) / 2;
                gore.timeLeft  = 60;

                for (int i = 0; i < 10; i++)
                {
                    Dust dust = Dust.NewDustDirect(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 69, RandomVel.X, RandomVel.Y, 0, default(Color), 1f);
                    dust.noGravity = false;
                }
            }
        }
Esempio n. 20
0
        public override void Kill(int timeLeft)
        {
            for (int i = 0; i < 8; i++)
            {
                Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 167, Scale: Main.rand.NextFloat(0.7f, 1)).noGravity = true;
            }

            Main.PlaySound(new LegacySoundStyle(SoundID.NPCKilled, 1).WithPitchVariance(0.2f).WithVolume(0.15f), projectile.Center);

            for (int j = 1; j <= 3; j++)
            {
                Gore gore = Gore.NewGoreDirect(projectile.Center, projectile.velocity, mod.GetGoreSlot("Gores/LocustCrook/SmallLocustGore" + j.ToString()));
                gore.timeLeft = 20;
            }
        }
Esempio n. 21
0
        public override void AI()
        {
            projectile.ai[0]++;
            if (projectile.ai[0] > passivetime && projectile.ai[1] == 0)
            {
                projectile.ai[1]++;
                Main.PlaySound(new LegacySoundStyle(SoundID.Item, 14).WithVolume(0.5f).WithPitchVariance(0.2f), projectile.Center);
                projectile.velocity.Y = -12;
                for (int i = 0; i < 3; i++)
                {
                    Gore gore = Gore.NewGoreDirect(projectile.Center + Main.rand.NextVector2Square(-18, 18), Main.rand.NextVector2Circular(3, 3), GoreID.ChimneySmoke1);
                    gore.timeLeft = 20;
                }
            }

            if (projectile.ai[1] == 0)
            {
                startingpoint = projectile.Center;
                Vector2 dustvel = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 5) * 3;
                Gore    gore    = Gore.NewGoreDirect(projectile.Center + Main.rand.NextVector2Square(-18, 18), Main.rand.NextVector2Circular(3, 3), GoreID.ChimneySmoke1, 0.6f);
                gore.timeLeft = 20;
                for (int i = 0; i < 4; i++)
                {
                    Dust dust = Dust.NewDustPerfect(projectile.Center + (Vector2.UnitY * 20), mod.DustType("SandDust"), dustvel);
                    dust.position.X += Main.rand.NextFloat(-6, 6);
                    dust.noGravity   = false;
                    dust.scale       = 0.75f;
                }
            }
            else
            {
                projectile.hide      = false;
                projectile.alpha     = (activetime - projectile.timeLeft) * (255 / activetime);
                projectile.rotation += 0.1f + projectile.direction;
                if (Main.rand.Next(4) == 0)
                {
                    Gore.NewGorePerfect(projectile.Center, projectile.velocity.RotatedByRandom(MathHelper.Pi / 14) / 2, mod.GetGoreSlot("Gores/SandBall"), Main.rand.NextFloat(0.6f, 0.8f));
                }

                for (int i = 0; i < 3; i++)
                {
                    Dust dust = Dust.NewDustPerfect(projectile.Center + (Vector2.UnitY * 16), mod.DustType("SandDust"), projectile.velocity.RotatedByRandom(MathHelper.Pi / 8) * 0.2f);
                    dust.position += dust.velocity * Main.rand.NextFloat(20, 25);
                    dust.noGravity = true;
                    dust.scale     = Main.rand.NextFloat(0.5f, 1.2f);
                }
            }
        }
Esempio n. 22
0
        public override void ModifyLight(int tX, int tY, ref float r, ref float g, ref float b)
        {
            //https://github.com/tModLoader/tModLoader/blob/master/ExampleMod/Tiles/ExampleTorch.cs
            //star in a bottle emits fallen stars gores

            Tile  tile         = Main.tile[tX, tY];
            int   logic        = GetTileLogic(tX, tY);
            float mirroredSign = (tile.frameX >= 18 * _FRAMEWIDTH) ? -1 : 1f;

            switch (logic)
            {
            case ItemID.StarinaBottle:
                float torchPulse = Main.demonTorch * 0.2f;
                r = 0.9f - torchPulse;
                g = 0.9f - torchPulse;
                b = 0.7f + torchPulse;
                if (Main.rand.Next(20) == 0)
                {
                    Gore star = Gore.NewGoreDirect(new Vector2(tX * 16 - 2, tY * 16 - 8), default(Vector2), Main.rand.Next(16, 18));
                    star.scale     *= 0.5f + (float)(Main.rand.NextDouble() * 0.25f);
                    star.velocity.Y = (star.velocity.Y + 2f) * 2;
                    star.velocity  /= 2f;
                }
                break;

            case ItemID.HeartLantern:
                r = 1f - Main.demonTorch * 0.1f;
                g = 0.3f - Main.demonTorch * 0.2f;
                b = 0.5f + Main.demonTorch * 0.2f;
                break;

            case ItemID.Furnace:
                r = 0.83f;
                g = 0.6f;
                b = 0.5f;
                if (Main.rand.Next(4) == 0)
                {
                    Dust ember = Dust.NewDustDirect(new Vector2(tX * 16 + 2 + 6 * mirroredSign, tY * 16 + 18), 8, 2, 6);
                    ember.noGravity   = true;
                    ember.velocity.X *= 0.5f;
                    ember.velocity.Y -= 0.5f;
                    ember.fadeIn      = 0.2f;
                }
                break;
            }
        }
Esempio n. 23
0
        public override bool CheckDead()
        {
            Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Explosion>(), 0, 2);
            for (int i = 0; i < 2; i++)
            {
                Vector2 a2 = new Vector2(npc.Center.X + Main.rand.Next(60) - Main.rand.Next(60), npc.Center.Y + Main.rand.Next(20) - Main.rand.Next(20));
                Vector2 b2 = new Vector2(Main.rand.Next(7), Main.rand.Next(7));
                Gore.NewGoreDirect(a2, b2, mod.GetGoreSlot("Gores/BoCgore1"), 1f);
            }

            Vector2 a = new Vector2(npc.Center.X + Main.rand.Next(60) - Main.rand.Next(60), npc.Center.Y + Main.rand.Next(20) - Main.rand.Next(20));
            Vector2 b = new Vector2(Main.rand.Next(7), Main.rand.Next(7));

            Gore.NewGoreDirect(a, b, mod.GetGoreSlot("Gores/BoCgore2"), 1f);
            NPC.downedBoss2 = true;
            return(true);
        }
Esempio n. 24
0
        public override void AI()
        {
            if (projectile.ai[1] < 0f || projectile.ai[1] > 200f)
            {
                projectile.Kill();
                return;
            }
            Projectile nPC = Main.projectile[(int)projectile.ai[1]];
            float      num = -8f;

            //	Vector2 center = nPC.Center + new Vector2((110f + num) * (float)nPC.spriteDirection, 30f).RotatedBy((double)nPC.rotation, default(Vector2));
            //	projectile.Center = center;
            projectile.rotation  = 3 * (MathHelper.Pi / 2);
            DelegateMethods.v3_1 = new Vector3(1.2f, 1f, 0.3f);
            float num2 = projectile.ai[0] / 40f;

            if (num2 > 1f)
            {
                num2 = 1f;
            }
            float num3 = (projectile.ai[0] - 38f) / 40f;

            if (num3 < 0f)
            {
                num3 = 0f;
            }
            Utils.PlotTileLine(projectile.Center + projectile.rotation.ToRotationVector2() * 400f * num3, projectile.Center + projectile.rotation.ToRotationVector2() * 400f * num2, 16f, new Utils.PerLinePoint(DelegateMethods.CastLight));
            Utils.PlotTileLine(projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(0.19634954631328583, default(Vector2)) * 400f * num3, projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(0.19634954631328583, default(Vector2)) * 400f * num2, 16f, new Utils.PerLinePoint(DelegateMethods.CastLight));
            Utils.PlotTileLine(projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(-0.19634954631328583, default(Vector2)) * 400f * num3, projectile.Center + projectile.rotation.ToRotationVector2().RotatedBy(-0.19634954631328583, default(Vector2)) * 400f * num2, 16f, new Utils.PerLinePoint(DelegateMethods.CastLight));

            if (Main.rand.Next(5) == 0 && projectile.ai[0] >= 15f)
            {
                Vector2 vector = projectile.Center + projectile.rotation.ToRotationVector2() * 300f;
                vector -= Utils.RandomVector2(Main.rand, -20f, 20f);
                Gore gore = Gore.NewGoreDirect(vector, Vector2.Zero, 61 + Main.rand.Next(3), 0.5f);
                gore.velocity *= 0.3f;
                gore.velocity += projectile.rotation.ToRotationVector2() * 4f;
            }
            projectile.frameCounter++;
            projectile.ai[0] += 1f;
            if (projectile.ai[0] >= 78f)
            {
                projectile.Kill();
            }
        }
 public override void HitEffect(int hitDirection, double damage)
 {
     if (npc.life <= 0 && Main.netMode != 2)
     {
         Gore gore = Gore.NewGoreDirect(npc.Center, RandomVel, mod.GetGoreSlot("Gores/Mobs/GeemerGore0"), npc.scale);
         gore.position -= new Vector2(Main.goreTexture[gore.type].Width, Main.goreTexture[gore.type].Height) / 2;
         gore.timeLeft  = 60;
         gore           = Gore.NewGoreDirect(npc.Center, RandomVel, mod.GetGoreSlot("Gores/Mobs/GeemerGore1"), npc.scale);
         gore.position -= new Vector2(Main.goreTexture[gore.type].Width, Main.goreTexture[gore.type].Height) / 2;
         gore.timeLeft  = 60;
         for (int i = 0; i < 4; i++)
         {
             gore           = Gore.NewGoreDirect(npc.Center, RandomVel, mod.GetGoreSlot("Gores/Mobs/GeemerGore2"), npc.scale);
             gore.position -= new Vector2(Main.goreTexture[gore.type].Width, Main.goreTexture[gore.type].Height) / 2;
             gore.timeLeft  = 60;
         }
     }
 }
Esempio n. 26
0
        public override void Kill(int timeLeft)
        {
            for (int i = 0; i < 3; i++)
            {
                Vector2 spawnoffset = (i == 0) ? projectile.oldVelocity : projectile.oldVelocity.RotatedByRandom(MathHelper.Pi);
                Projectile.NewProjectile(projectile.Center + spawnoffset * 2, Vector2.Zero, ModContent.ProjectileType <WarheadBoom>(),
                                         projectile.damage, projectile.knockBack, projectile.owner, spawnoffset.ToRotation());
            }

            for (int i = 0; i < 4; i++)
            {
                Gore gore = Gore.NewGoreDirect(projectile.Center, Main.rand.NextVector2Circular(2, 2), 11 + Main.rand.Next(3), 0.7f);
                gore.timeLeft = 10;
            }

            for (int i = 0; i < 10; i++)
            {
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(-16, -4), 0, default, 1.3f);
Esempio n. 27
0
        public override void Kill(int timeLeft)
        {
            if (projectile.ai[1] > 0)
            {
                // reset size to normal width and height.
                projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
                projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
                projectile.width      = 10;
                projectile.height     = 10;
                projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
                projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
            }

            Main.PlaySound(SoundID.Item53.WithPitchVariance(0.2f).WithVolume(0.9f), projectile.position);

            var gore = Gore.NewGoreDirect(projectile.position, projectile.velocity * 0.4f, mod.GetGoreSlot("Gores/WrenchProjectile"), 1f);

            gore.rotation = projectile.rotation;
        }
Esempio n. 28
0
 public override bool CanUseItem(Player player)
 {
     if (player.altFunctionUse == 2)
     {
         if (strung < strungMax)
         {
             if (player.ConsumeItem(ItemID.VineRope))
             {
                 strung += strung > 0 ? 2 : 1;
             }
             else if (player.ConsumeItem(ItemID.Vine) && strung < strungMax - 10)
             {
                 strung += 25;
             }
         }
         item.noUseGraphic = true;
         //item.useTime = 4;//20;
         //item.useAnimation = 4;//20;
         item.useStyle = 1;
         item.shoot    = ProjectileID.None;
         item.UseSound = null;
         if (strung > strungMax)
         {
             strung = strungMax;
         }
         return(true);
     }
     //animation.Frame = strung>0 ? 1 : 0;
     if (strung <= 0)
     {
         return(false);
     }
     SetDefaults();
     strung--;
     if (strung <= 0)
     {
         Main.PlaySound(SoundID.Item, (int)player.Center.X, (int)player.Center.Y, 102, 0.75f, 1);
         Vector2 pos = player.Center + (Main.MouseWorld - player.Center).SafeNormalize(Vector2.Zero) * (10 - player.direction * 2);
         Gore.NewGoreDirect(pos, player.velocity, mod.GetGoreSlot("Gores/NPCs/FG2_Gore")).position = pos;
     }
     return(base.CanUseItem(player));
 }
Esempio n. 29
0
        public override void AI()
        {
            if (projectile.ai[0] == 0)
            {
                projectile.ai[0]++;
                Main.PlaySound(SoundID.Item14.WithVolume(0.5f), projectile.position);

                Dust d;
                for (int i = 0; i < 8; i++)
                {
                    d           = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 2f);
                    d.velocity *= 1f;
                    if (Main.rand.Next(2) == 0)
                    {
                        d.scale  = 0.5f;
                        d.fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
                    }
                }
                for (int i = 0; i < 14; i++)
                {
                    d           = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 2f);
                    d.velocity *= 3f;
                    d           = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2f);
                    d.velocity *= 2f;
                }
                Gore g;
                for (int i = 0; i < 2; i++)
                {
                    for (int y = -1; y < 2; y += 2)
                    {
                        for (int x = -1; x < 2; x += 2)
                        {
                            g           = Gore.NewGoreDirect(projectile.Center - new Vector2(16, 16), default(Vector2), Main.rand.Next(61, 64), 1f);
                            g.velocity *= 0.33f * i;
                            g.velocity += new Vector2(x, y);
                        }
                    }
                }
            }
        }
Esempio n. 30
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.Item14, projectile.position);
            for (int i = 0; i < 7; i++)
            {
                Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f);
            }
            for (int i = 0; i < 3; i++)
            {
                int num568 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2.5f);
                Main.dust[num568].noGravity = true;
                Dust dust1 = Main.dust[num568];
                Dust dust2 = dust1;
                dust2.velocity *= 3f;
                num568          = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f);
                dust1           = Main.dust[num568];
                dust2           = dust1;
                dust2.velocity *= 2f;
            }
            Gore gore  = Gore.NewGoreDirect(new Vector2(projectile.position.X - 10f, projectile.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
            Gore gore2 = gore;

            gore2.velocity  *= 0.3f;
            gore.velocity.X += Main.rand.Next(-10, 11) * 0.05f;
            gore.velocity.Y += Main.rand.Next(-10, 11) * 0.05f;
            if (projectile.owner == Main.myPlayer)
            {
                projectile.localAI[1]   = -1f;
                projectile.maxPenetrate = 0;
                projectile.position.X  += projectile.width / 2;
                projectile.position.Y  += projectile.height / 2;
                projectile.width        = 80;
                projectile.height       = 80;
                projectile.position.X  -= projectile.width / 2;
                projectile.position.Y  -= projectile.height / 2;
                projectile.Damage();
            }
        }