Ejemplo n.º 1
0
 public static int CheckForGore(Mod mod, string goreName, IDictionary <string, int> gores = null)
 {
     if (mod == null)
     {
         return(-1);                        //only for mod gores!
     }
     if (mod.GetGoreSlot("Gores/" + goreName) > 0)
     {
         return(mod.GetGoreSlot("Gores/" + goreName));
     }
     if (gores == null && mod is GoreInfo)
     {
         gores = ((GoreInfo)mod).GetGoreArray();
     }
     if (gores == null)
     {
         gores = (IDictionary <string, int>) typeof(ModGore).GetField("gores", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
     }
     foreach (string key in gores.Keys)
     {
         if (key.Contains(mod.Name) && key.Contains(goreName))
         {
             return(ModGore.GetGoreSlot(key));
         }
     }
     return(-1);
 }
Ejemplo n.º 2
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"));
 }
Ejemplo n.º 3
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));
         }
     }
 }
Ejemplo n.º 4
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();
            }
        }
Ejemplo n.º 5
0
        public static int AddWingByTextureName(string tex)
        {
            Texture2D TEX = Main.goreTexture[ModGore.GetGoreSlot("tex")];

            for (int i = 0; i < Main.wingsTexture.Length; i++)
            {
                if (Main.wingsTexture[i] == TEX)
                {
                    return(i);
                }
            }
            Array.Resize(ref Main.wingsTexture, Main.wingsTexture.Length + 1);
            Main.wingsTexture[Main.wingsTexture.Length - 1] = TEX;
            return(Main.wingsTexture.Length - 1);
        }
Ejemplo n.º 6
0
        private void Attack()
        {
            RotateCrawl();
            projectile.Center -= projectile.velocity;
            attackCounter++;
            if (attackCounter % 7 == 0 && attackCounter % 56 < 15)
            {
                Vector2 dir = gunRotation.ToRotationVector2();

                gunFrame = 0;
                projectile.frameCounter = 0;

                Vector2 pos = projectile.Center + (GunOffset().RotatedBy(projectile.rotation));
                Gore.NewGore(pos, new Vector2(Math.Sign(dir.X) * -1, -0.5f) * 2, ModGore.GetGoreSlot(AssetDirectory.MiscItem + "CoachGunCasing"), 1f);
                gunRotation -= Math.Sign(dir.X) * 0.3f;
                Projectile.NewProjectile(pos, dir.RotatedByRandom(0.1f) * 15, ProjectileID.Bullet, projectile.damage, projectile.knockBack, player.whoAmI);
            }
        }
Ejemplo n.º 7
0
        public override bool PreAI()
        {
            if (collided || stuck || projectile.timeLeft % 6 == 0)
            {
                if (trailWidth > 0.3f)
                {
                    trailWidth *= 0.995f;
                    if (trailWidth < 3.5f)
                    {
                        trailWidth *= 0.95f;
                    }
                }
                else
                {
                    trailWidth = 0;
                }
            }

            if (!collided)
            {
                if (stuck)
                {
                    NPC target = Main.npc[enemyID];
                    cooldown--;

                    if (!target.active)
                    {
                        if (projectile.timeLeft > 5)
                        {
                            projectile.timeLeft = 5;
                        }
                        projectile.velocity = Vector2.Zero;
                    }
                    else
                    {
                        var collidingProj = Main.projectile.Where(n => n.active && n != projectile && !collidedWith.Contains(n) && n.modProjectile is RebarProj modProj && Collision.CheckLinevLine(GetA(), GetB(), modProj.GetA2(), modProj.GetB2()).Length > 0 && !modProj.collidedWith.Contains(projectile) && modProj.distanceIn < distanceIn).OrderBy(n => n.velocity.Length()).FirstOrDefault();

                        if (collidingProj != default)
                        {
                            float angleBetween = Math.Abs(((((collidingProj.rotation - projectile.rotation) % 6.28f) + 9.42f) % 6.28f) - 3.14f);

                            float effectiveness = (3.14f - angleBetween) / 3.14f;

                            if (effectiveness >= 0.5f)
                            {
                                var mp = collidingProj.modProjectile as RebarProj;
                                mp.collidedWith.Add(collidingProj);

                                Vector2 vel = initialVel;
                                vel.Normalize();
                                vel *= effectiveness;
                                vel *= 4;
                                collidedWith.Clear();
                                if (cooldown < 0)
                                {
                                    projectile.friendly = true;
                                }

                                Vector2[] dustPositions = Collision.CheckLinevLine(GetA(), GetB(), mp.GetA2(), mp.GetB2());

                                if (dustPositions.Length > 0 && initialVel.Length() < 1)
                                {
                                    for (float i = 0; i < 15; i++)
                                    {
                                        Dust.NewDustPerfect(dustPositions[0], ModContent.DustType <RebarLine>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(3, 6), 0, new Color(248, 126, 0), Main.rand.NextFloat(0.35f, 0.5f));
                                    }
                                }

                                initialVel += vel;

                                projectile.damage = initialDamage + (int)Math.Pow(distanceIn, 0.5f);
                            }
                        }

                        offset     += initialVel;
                        distanceIn += initialVel.Length();

                        if (initialVel.Length() > 0.02f)
                        {
                            initialVel *= 0.5f;
                        }

                        var targetCollection = Main.npc.Where(n => n.active && !n.townNPC && (Collision.CheckAABBvLineCollision(n.position, n.Size, GetA3(), GetB3()) || Collision.CheckAABBvAABBCollision(projectile.position, projectile.Size, n.position, n.Size))).OrderBy(n => 1).FirstOrDefault();
                        if (targetCollection == default)
                        {
                            projectile.extraUpdates = 0;

                            if (projectile.timeLeft > 80)
                            {
                                projectile.timeLeft = 80;
                            }

                            projectile.friendly = false;
                            projectile.velocity = Vector2.Zero;

                            if (!collided)
                            {
                                projectile.alpha = 255;
                                Gore.NewGorePerfect(projectile.Center, initialVel, ModGore.GetGoreSlot(Texture));
                                collided = true;
                            }
                        }

                        projectile.position = target.position + offset;
                    }
                }

                else
                {
                    projectile.rotation = projectile.velocity.ToRotation();
                    ManageCaches();
                }
            }
            else
            {
                if (enemyID != -1)
                {
                    NPC target = Main.npc[enemyID];
                    projectile.position = target.position + offset;
                }
                projectile.alpha += 4;
            }

            ManageTrail();
            return(true);
        }
Ejemplo n.º 8
0
        public override void AI()
        {
            JetwelderPlayer modPlayer = player.GetModPlayer <JetwelderPlayer>();

            projectile.velocity = Vector2.Zero;
            projectile.Center   = player.Center;
            if (Main.mouseRight)
            {
                if (scaleCounter < 1)
                {
                    scaleCounter += 0.05f;
                }

                projectile.timeLeft = 2;

                direction = player.DirectionTo(Main.MouseWorld);
                direction.Normalize();

                player.ChangeDir(Math.Sign(direction.X));

                player.itemTime     = player.itemAnimation = 2;
                player.itemRotation = direction.ToRotation();
                if (player.direction != 1)
                {
                    player.itemRotation -= 3.14f;
                }

                player.itemRotation = MathHelper.WrapAngle(player.itemRotation);

                rotation = MathHelper.WrapAngle(direction.ToRotation());

                if (Main.mouseLeft)
                {
                    projectile.active = false;
                }

                if (rotation >= PiOverFour * -3 && rotation < PiOverFour * -1 && modPlayer.scrap >= 5)
                {
                    if (crawlerScale < 1)
                    {
                        crawlerScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderCrawler>();
                }
                else if (crawlerScale > 0)
                {
                    crawlerScale -= 0.1f;
                }

                if (rotation >= PiOverFour * -1 && rotation < PiOverFour * 1 && modPlayer.scrap >= 10)
                {
                    if (jumperScale < 1)
                    {
                        jumperScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderJumper>();
                }
                else if (jumperScale > 0)
                {
                    jumperScale -= 0.1f;
                }

                if (rotation >= PiOverFour * 1 && rotation < PiOverFour * 3 && modPlayer.scrap >= 15)
                {
                    if (gatlerScale < 1)
                    {
                        gatlerScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderGatler>();
                }
                else if (gatlerScale > 0)
                {
                    gatlerScale -= 0.1f;
                }

                if ((rotation >= PiOverFour * 3 || rotation < PiOverFour * -3) && modPlayer.scrap >= 20)
                {
                    if (finalScale < 1)
                    {
                        finalScale += 0.1f;
                    }
                    projType = ModContent.ProjectileType <JetwelderFinal>();
                }
                else if (finalScale > 0)
                {
                    finalScale -= 0.1f;
                }
            }
            else
            {
                projectile.active = false;

                if (projType == ModContent.ProjectileType <JetwelderCrawler>() && modPlayer.scrap >= 5)
                {
                    modPlayer.scrap -= 5;
                }
                if (projType == ModContent.ProjectileType <JetwelderJumper>() && modPlayer.scrap >= 10)
                {
                    modPlayer.scrap -= 10;
                }
                if (projType == ModContent.ProjectileType <JetwelderGatler>() && modPlayer.scrap >= 15)
                {
                    modPlayer.scrap -= 15;
                }
                if (projType == ModContent.ProjectileType <JetwelderFinal>() && modPlayer.scrap >= 20)
                {
                    modPlayer.scrap -= 20;
                }

                // modPlayer.scrap = 20;
                //Main.NewText(modPlayer.scrap.ToString(), Color.Orange);
                Vector2 position = player.Center;
                if (projType == ModContent.ProjectileType <JetwelderCrawler>() || projType == ModContent.ProjectileType <JetwelderJumper>())
                {
                    position = FindFirstTile(player.Center, projType);
                }
                if (projType == ModContent.ProjectileType <JetwelderGatler>())
                {
                    position.Y -= 10;
                }

                if (projType != -1)
                {
                    int j;
                    for (j = 0; j < 18; j++)
                    {
                        Vector2 direction = Main.rand.NextFloat(6.28f).ToRotationVector2();
                        Dust.NewDustPerfect((position + (direction * 6)) + new Vector2(0, 35), ModContent.DustType <Dusts.BuzzSpark>(), direction.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f) - 1.57f) * Main.rand.Next(2, 10), 0, new Color(255, 255, 60) * 0.8f, 1.6f);
                    }
                    for (j = 0; j < 3; j++)
                    {
                        for (int k = 1; k < 4; k++)
                        {
                            Gore.NewGore(position + Main.rand.NextVector2Circular(15, 15), Main.rand.NextVector2Circular(5, 5), ModGore.GetGoreSlot(Texture + "_Gore" + k.ToString()), 1f);
                        }
                    }
                    Projectile.NewProjectile(position, Vector2.Zero, projType, projectile.damage, projectile.knockBack, player.whoAmI);
                }
            }
        }
Ejemplo n.º 9
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)
        {
            if (player.altFunctionUse == 2)
            {
                cooldown = 130;
                Vector2 dir = Vector2.Normalize(new Vector2(speedX, speedY)) * 9;
                speedX = dir.X;
                speedY = dir.Y;
                type   = ModContent.ProjectileType <CoachGunBomb>();
            }
            else
            {
                float rot    = new Vector2(speedX, speedY).ToRotation();
                float spread = 0.4f;

                Vector2 offset = new Vector2(1, -0.05f * player.direction).RotatedBy(rot);

                for (int k = 0; k < 15; k++)
                {
                    var direction = offset.RotatedByRandom(spread);

                    Dust.NewDustPerfect(position + (offset * 70), ModContent.DustType <Dusts.Glow>(), direction * Main.rand.NextFloat(8), 125, new Color(150, 80, 40), Main.rand.NextFloat(0.2f, 0.5f));
                }

                Helper.PlayPitched("Guns/PlinkLever", 0.4f, Main.rand.NextFloat(-0.1f, 0.1f));
                Helper.PlayPitched("Guns/RifleLight", 0.7f, Main.rand.NextFloat(-0.1f, 0.1f));
                Dust.NewDustPerfect(player.Center + offset * 70, ModContent.DustType <Dusts.Smoke>(), Vector2.UnitY * -2 + offset.RotatedByRandom(spread) * 5, 0, new Color(60, 55, 50) * 0.5f, Main.rand.NextFloat(0.5f, 1));

                Projectile proj = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY) * 2, type, damage, knockBack, player.whoAmI);
                proj.GetGlobalProjectile <CoachGunGlobalProj>().shotFromGun = true;

                Projectile.NewProjectile(position + (offset * 70), Vector2.Zero, ModContent.ProjectileType <CoachGunMuzzleFlash>(), 0, 0, player.whoAmI, rot);

                Gore.NewGore(player.Center + (offset * 20), new Vector2(player.direction * -1, -0.5f) * 2, ModGore.GetGoreSlot(AssetDirectory.MiscItem + "CoachGunCasing"), 1f);

                return(false);
            }
            return(true);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
 public override void Kill(int timeLeft)
 {
     for (int i = 1; i < 8; i++)
     {
         Gore.NewGore(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2, projectile.height / 2), Main.rand.NextVector2Circular(5, 5), ModGore.GetGoreSlot(Texture + "_Gore" + i.ToString()), 1f);
     }
 }
Ejemplo n.º 12
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));
     }
 }
Ejemplo n.º 13
0
        //TODO: Move methods to top + method breaks
        //TODO: Turn needles into getnset
        public override bool PreAI()
        {
            if (stuck)
            {
                NPC target  = Main.npc[enemyID];
                int needles = target.GetGlobalNPC <NeedlerNPC>().needles;

                if (Main.rand.Next(Math.Max(((10 - needles) * 30) + 300, 50)) == 0)
                {
                    Gore.NewGoreDirect(projectile.Center, Vector2.Zero, ModGore.GetGoreSlot("StarlightRiver/Assets/NPCs/Vitric/MagmiteGore"), Main.rand.NextFloat(0.4f, 0.8f));
                }

                if (target.GetGlobalNPC <NeedlerNPC>().needleTimer == 1)
                {
                    //Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<NeedlerExplosion>(), projectile.damage * 3, projectile.knockBack, projectile.owner);
                    projectile.active = false;
                }

                if (needles > needleLerp)
                {
                    if (needleLerp < 10)
                    {
                        needleLerp += 0.2f;
                        if (needles > needleLerp + 3)
                        {
                            needleLerp += 0.4f;
                        }
                    }
                }
                else
                {
                    needleLerp = needles;
                }

                Color lightColor = Color.Lerp(Color.Orange, Color.Red, needleLerp / 20f);
                Lighting.AddLight(projectile.Center, lightColor.R * needleLerp / 2000f, lightColor.G * needleLerp / 2000f, lightColor.B * needleLerp / 2000f);

                if (!target.active)
                {
                    if (projectile.timeLeft > 5)
                    {
                        projectile.timeLeft = 5;
                    }
                    projectile.velocity = Vector2.Zero;
                }

                else
                {
                    projectile.position = target.position + offset;
                }

                if (projectile.timeLeft == 2)
                {
                    target.GetGlobalNPC <NeedlerNPC>().needles--;
                }

                return(false);
            }

            else
            {
                projectile.rotation = projectile.velocity.ToRotation();
            }
            return(true);
        }
Ejemplo n.º 14
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);
            }
        }
Ejemplo n.º 15
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.DD2_ExplosiveTrapExplode, projectile.Center);
            Main.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center);
            Helper.PlayPitched("Magic/FireHit", 0.5f, 0, projectile.Center);

            for (int k = 0; k < 80; k++)
            {
                Dust.NewDustPerfect(projectile.Center, DustType <Dusts.LavaSpark>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(6), 0, new Color(255, 155, 0), Main.rand.NextFloat(0.1f, 0.8f));
            }

            for (int k = 0; k < 60; k++)
            {
                var velocity = Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(30);
                var scale    = Main.rand.NextFloat(1.2f, 2.7f);

                var d = Dust.NewDustPerfect(projectile.Center, DustType <Dusts.GlassAttracted>(), velocity, Scale: scale);
                d.customData = projectile.Center;

                var d2 = Dust.NewDustPerfect(projectile.Center, DustType <Dusts.GlassAttractedGlow>(), velocity, Scale: scale);
                d2.customData = projectile.Center;
                d2.frame      = d.frame;
            }

            for (int k = 0; k < 4; k++)
            {
                Gore.NewGore(projectile.Center, Vector2.One.RotatedByRandom(6.28f) * 5, ModGore.GetGoreSlot(AssetDirectory.VitricBoss + "Gore/Mine" + k));
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    Projectile.NewProjectile(projectile.Center, Vector2.UnitY.RotatedByRandom(1) * -Main.rand.NextFloat(3, 5), ProjectileType <Items.Vitric.NeedlerEmber>(), 0, 0, 0);
                }
            }

            foreach (Player player in Main.player.Where(n => n.active && Vector2.Distance(n.Center, projectile.Center) < 1500))
            {
                player.GetModPlayer <StarlightPlayer>().Shake += 15;
            }

            foreach (Player player in Main.player.Where(n => Vector2.Distance(n.Center, projectile.Center) < 400))
            {
                player.Hurt(Terraria.DataStructures.PlayerDeathReason.ByProjectile(player.whoAmI, projectile.whoAmI), Main.expertMode ? projectile.damage * 2 : projectile.damage, 0);
            }
        }
Ejemplo n.º 16
0
        public override void Kill(int timeLeft)
        {
            for (int i = 1; i < 6; i++)
            {
                Gore.NewGore(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2, projectile.height / 2), Main.rand.NextVector2Circular(5, 5), ModGore.GetGoreSlot(Texture + "_Gore" + i.ToString()), 1f);
            }

            for (int i = 0; i < 6; i++)
            {
                Dust dust = Dust.NewDustDirect(projectile.Center - new Vector2(16, 16), 0, 0, ModContent.DustType <JetwelderDust>());
                dust.velocity = Main.rand.NextVector2Circular(4, 4);
                dust.scale    = Main.rand.NextFloat(1f, 1.5f);
                dust.alpha    = Main.rand.Next(80) + 40;
                dust.rotation = Main.rand.NextFloat(6.28f);

                Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(25, 25), ModContent.DustType <CoachGunDustFour>()).scale = 0.9f;
            }

            for (int i = 0; i < 3; i++)
            {
                Projectile.NewProjectileDirect(projectile.Center, Main.rand.NextFloat(6.28f).ToRotationVector2() * Main.rand.NextFloat(1, 2), ModContent.ProjectileType <CoachGunEmber>(), 0, 0, player.whoAmI).scale = Main.rand.NextFloat(0.85f, 1.15f);
            }

            for (int i = 0; i < 10; i++)
            {
                Vector2 vel  = Main.rand.NextFloat(6.28f).ToRotationVector2();
                Dust    dust = Dust.NewDustDirect(projectile.Center - new Vector2(16, 16) + (vel * Main.rand.Next(70)), 0, 0, ModContent.DustType <JetwelderDustTwo>());
                dust.velocity = vel * Main.rand.Next(7);
                dust.scale    = Main.rand.NextFloat(0.3f, 0.7f);
                dust.alpha    = 70 + Main.rand.Next(60);
                dust.rotation = Main.rand.NextFloat(6.28f);
            }
        }
Ejemplo 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;
        }
Ejemplo n.º 18
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);
            var tileUp    = Framing.GetTileSafely(x, y - 1);
            var tileFar   = Framing.GetTileSafely(x + npc.direction * 2, y - 1);
            var tileUnder = Framing.GetTileSafely(x, y + 1);

            ActionTimer++;

            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));
            }

            if (ActionState == 0)
            {
                if (npc.velocity.X == 0 && tile.slope() == 0 && !tile.halfBrick() && tile.collisionType == 1 && tileUp.collisionType == 0) //climb up small cliffs
                {
                    ActionState   = 1;
                    npc.velocity *= 0;
                    ActionTimer   = 0;
                    return;
                }

                npc.velocity.X += 0.05f * (Main.player[Main.myPlayer].Center.X > npc.Center.X ? 1 : -1);
                npc.velocity.X  = Math.Min(npc.velocity.X, 1.5f);
                npc.velocity.X  = Math.Max(npc.velocity.X, -1.5f);

                npc.direction       = npc.velocity.X > 0 ? 1 : -1;
                npc.spriteDirection = npc.velocity.X > 0 ? 1 : -1;

                if (tileFar.collisionType == 1 && npc.velocity.Y == 0) //jump up big cliffs
                {
                    npc.velocity.Y -= 8;
                }

                if (tileUnder.collisionType == 0 && npc.velocity.Y == 0) //hop off edges
                {
                    npc.velocity.Y -= 4;
                }

                if (npc.velocity.Y != 0)
                {
                    npc.frame.X = 0;
                    npc.frame.Y = 0;
                }
                else
                {
                    npc.frame.X = 42;
                    npc.frame.Y = (int)((ActionTimer / 5) % 5) * 40;
                }
            }

            if (ActionState == 1)
            {
                if (ActionTimer == 60)
                {
                    ActionState     = 0;
                    ActionTimer     = 0;
                    npc.position.Y -= 16;
                    npc.position.X += 26 * npc.direction;
                }

                npc.frame.X = 84;
                npc.frame.Y = (int)((ActionTimer / 60f) * 9) * 40;
            }

            npc.frame.Width  = 42;
            npc.frame.Height = 40;
        }
Ejemplo n.º 19
0
        private void SpawnAnimation() //The animation which plays when the boss is spawning
        {
            rotationLocked = true;
            lockedRotation = 1.57f;

            if (checkSpecificTime(2))
            {
                RandomizeTarget(); //pick a random target so the eyes will follow them
                startPos = npc.Center;

                if (IsInsideArena())
                {
                    StarlightPlayer mp = Main.LocalPlayer.GetModPlayer <StarlightPlayer>();
                    mp.ScreenMoveTarget = npc.Center + new Vector2(0, -600);
                    mp.ScreenMoveTime   = 650;
                }

                music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/VitricBossAmbient");

                SetFrameX(0);
                SetFrameY(0);
                lastTwistState = 0;

                Helper.PlayPitched("VitricBoss/CeirosEarthquake", 0.4f, 0, npc.Center);
                Helper.PlayPitched("VitricBoss/CeirosRumble", 0.4f, 0, npc.Center);
            }

            if (checkSpecificTime(90))
            {
                //Helper.PlayPitched("VitricBoss/StoneBreak", 0.25f, 0.3f, npc.Center);
                Helper.PlayPitched("VitricBoss/ceiroslidclose", 0.35f, 0.4f, npc.Center);
            }


            if (checkSpecificTime(120))
            {
                if (IsInsideArena())
                {
                    StarlightPlayer mp = Main.LocalPlayer.GetModPlayer <StarlightPlayer>();
                    mp.Shake += 10;

                    ZoomHandler.SetZoomAnimation(1.1f, 60);
                }

                for (int k = 0; k < 10; k++)
                {
                    Gore.NewGorePerfect(arena.Center() + new Vector2(Main.rand.Next(-600, 600), -450), Vector2.UnitY * Main.rand.NextFloat(-1, 2), ModGore.GetGoreSlot(AssetDirectory.VitricBoss + "Gore/Cluster" + Main.rand.Next(1, 19)));
                }

                for (int k = 0; k < 20; k++)
                {
                    Dust.NewDustPerfect(arena.Center() + new Vector2(Main.rand.Next(-600, 600), -450), DustID.Stone, Vector2.UnitY * Main.rand.NextFloat(6, 12), 0, default, Main.rand.NextFloat(1, 3));
        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);
Ejemplo n.º 21
0
        private void FireBullets()
        {
            if ((gunFrame == 0 || gunFrame == 4) && projectile.frameCounter % 2 == 0)
            {
                Vector2 bulletOffset = new Vector2(10, 9 * projectile.spriteDirection);

                Vector2 dir = currentRotation.ToRotationVector2();
                dir.Normalize();
                bulletOffset = bulletOffset.RotatedBy(currentRotation);

                Gore.NewGore(projectile.Center, new Vector2(Math.Sign(dir.X) * -1, -0.5f) * 2, ModGore.GetGoreSlot(AssetDirectory.SteampunkItem + "JetwelderCasing"), 1f);
                Projectile.NewProjectile(projectile.Center + bulletOffset, dir.RotatedByRandom(0.13f) * 15, ProjectileID.Bullet, projectile.damage, projectile.knockBack, player.whoAmI);
            }
        }