diff --git a/CalamityLists.cs b/CalamityLists.cs index 84ba589b64..b0ecbda121 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1039,6 +1039,7 @@ namespace CalamityMod ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemID.SolarEruption, ItemType(), diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index 038a5f6335..2ff8e40de2 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); // This weapon has two donor weapons recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.ElectrosphereLauncher); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs new file mode 100644 index 0000000000..4780b5b4a0 --- /dev/null +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -0,0 +1,76 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class ScorchedEarth : ModItem + { + private int counter = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scorched Earth"); + Tooltip.SetDefault("Fires a burst of four fuel-air rockets which explode into cluster bombs\n" + + "Each burst consumes two rockets each\n" + + "Burns your targets to a fine crisp"); + } + + public override void SetDefaults() + { + item.damage = 123; + item.ranged = true; + item.useTime = 8; + item.useAnimation = 32; // 4 shots in just over half a second + item.reuseDelay = 60; // 1 second recharge + item.width = 104; + item.height = 44; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 8.7f; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.autoReuse = true; + item.shootSpeed = 12.6f; + item.shoot = ModContent.ProjectileType(); + item.useAmmo = AmmoID.Rocket; + item.Calamity().donorItem = true; + } + + // Consume two ammo per fire + public override bool ConsumeAmmo(Player player) => counter % 2 == 0; + + public override Vector2? HoldoutOffset() => new Vector2(-30, 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) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + + if (counter == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ScorchedEarthShot" + Main.rand.Next(1,4)), position); + } + + counter++; + if (counter == 4) + counter = 0; + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.FragmentSolar, 50); + recipe.AddRecipeGroup("AnyAdamantiteBar", 15); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Ranged/ScorchedEarth.png b/Items/Weapons/Ranged/ScorchedEarth.png new file mode 100644 index 0000000000..dfcf39c6db Binary files /dev/null and b/Items/Weapons/Ranged/ScorchedEarth.png differ diff --git a/Projectiles/Ranged/RocketFire.cs b/Projectiles/Ranged/RocketFire.cs new file mode 100644 index 0000000000..e65c6cd2de --- /dev/null +++ b/Projectiles/Ranged/RocketFire.cs @@ -0,0 +1,148 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class RocketFire : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Rogue/TotalityFire"; + private bool initialized = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + //make it face the way it's going + if (projectile.ai[1] > 0f) + { + projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; + } + else + { + projectile.rotation = projectile.velocity.ToRotation(); + } + projectile.ai[1]--; + + //frames + if (!initialized) + { + initialized = true; + projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + //movement + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X *= -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X *= -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y *= -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y += 0.2f; + } + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + { + projectile.velocity.X *= 0.8f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + + //dust + if (Main.rand.NextBool(4)) + { + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[fire]; + dust.position.X -= 2f; + dust.position.Y += 2f; + dust.scale += (float)Main.rand.Next(50) * 0.01f; + dust.noGravity = true; + dust.velocity.Y -= 2f; + } + if (Main.rand.NextBool(10)) + { + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[fire]; + dust.position.X -= 2f; + dust.position.Y += 2f; + dust.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + dust.noGravity = true; + dust.velocity *= 0.1f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[1] = 10f; + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 120); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs new file mode 100644 index 0000000000..cd1df20f3c --- /dev/null +++ b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorchedEarthClusterBomb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cluster Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -2; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation(); + projectile.velocity *= 0.95f; + if (projectile.velocity.Length() < 0.5f && projectile.timeLeft > 10) + projectile.timeLeft = 10; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item14, projectile.position); + for (int i = 0; i < 10; i++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); + } + int projAmt = Main.rand.Next(2, 4); + if (projectile.owner == Main.myPlayer) + { + for (int k = 0; k < projAmt; k++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Ranged/ScorchedEarthClusterBomb.png b/Projectiles/Ranged/ScorchedEarthClusterBomb.png new file mode 100644 index 0000000000..eb95d346cb Binary files /dev/null and b/Projectiles/Ranged/ScorchedEarthClusterBomb.png differ diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs new file mode 100644 index 0000000000..ca1f046310 --- /dev/null +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -0,0 +1,114 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorchedEarthRocket : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rocket"); + Main.projFrames[projectile.type] = 10; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + } + + public override void AI() + { + //Lighting + Lighting.AddLight(projectile.Center, 1f, 0.79f, 0.3f); + + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > (projectile.frame == 1 ? 10 : 7)) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 6; + } + + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 5f, 30f); + + //Rotation + projectile.rotation = projectile.velocity.ToRotation(); + + if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) + { + float xVel = projectile.velocity.X * 0.5f; + float yVel = projectile.velocity.Y * 0.5f; + int d = Dust.NewDust(new Vector2(projectile.position.X + 3f + xVel, projectile.position.Y + 3f + yVel) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 1f); + Main.dust[d].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[d].velocity *= 0.2f; + Main.dust[d].noGravity = true; + d = Dust.NewDust(new Vector2(projectile.position.X + 3f + xVel, projectile.position.Y + 3f + yVel) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); + Main.dust[d].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[d].velocity *= 0.05f; + + } + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 300); + projectile.maxPenetrate = projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(SoundID.Item14, projectile.position); + for (int i = 0; i < 40; i++) + { + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[d].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[d].scale = 0.5f; + Main.dust[d].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int i = 0; i < 60; i++) + { + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[d].noGravity = true; + Main.dust[d].velocity *= 5f; + d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[d].velocity *= 2f; + } + CalamityUtils.ExplosionGores(projectile.Center, 10); + + if (projectile.owner == Main.myPlayer) + { + for (int j = 0; j < 5; j++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(8f, 10f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/ScorchedEarthRocket.png b/Projectiles/Ranged/ScorchedEarthRocket.png new file mode 100644 index 0000000000..4d28aca288 Binary files /dev/null and b/Projectiles/Ranged/ScorchedEarthRocket.png differ diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index 4e3592c4c7..5c3da29c4f 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -112,19 +112,8 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < projAmt; k++) { - Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (velocity.X == 0f && velocity.Y == 0f) - { - velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - velocity.Normalize(); - velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner); - if (flames.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[flames].penetrate = 3; - Main.projectile[flames].Calamity().forceRanged = true; - } + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner); } } } diff --git a/Sounds/Item/ScorchedEarthShot1.ogg b/Sounds/Item/ScorchedEarthShot1.ogg new file mode 100644 index 0000000000..3670d0c982 Binary files /dev/null and b/Sounds/Item/ScorchedEarthShot1.ogg differ diff --git a/Sounds/Item/ScorchedEarthShot2.ogg b/Sounds/Item/ScorchedEarthShot2.ogg new file mode 100644 index 0000000000..706ceb3f9b Binary files /dev/null and b/Sounds/Item/ScorchedEarthShot2.ogg differ diff --git a/Sounds/Item/ScorchedEarthShot3.ogg b/Sounds/Item/ScorchedEarthShot3.ogg new file mode 100644 index 0000000000..f1c7bd4a1a Binary files /dev/null and b/Sounds/Item/ScorchedEarthShot3.ogg differ