diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index af8d384247..467d81963e 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -377,9 +377,9 @@ namespace CalamityMod.Items { List earthColors = new List() { - new Color(255, 99, 146), - new Color(255, 228, 94), - new Color(127, 200, 248) + Color.OrangeRed, + Color.MediumTurquoise, + Color.LimeGreen }; if (nameLine != null) { diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 8972d1f57f..6522139aa3 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -1,159 +1,66 @@ using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Earth : ModItem, ILocalizedModType + public class Earth : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { Item.width = 92; Item.height = 104; - Item.damage = 210; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 16; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 16; + Item.damage = 1780; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = 38; + Item.useTime = 38; Item.useTurn = true; - Item.knockBack = 9.5f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 15f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - var source = player.GetSource_ItemUse(Item); - float projSpeed = 25f; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } - - for (int i = 0; i < 3; i++) - { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f; - - int projDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), projDamage, hit.Knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } - - if (target.Calamity().miscDefenseLoss < target.defense) - target.Calamity().miscDefenseLoss += 1; - - if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) - return; - - int heal = Main.rand.Next(1, 70); - player.lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/EarthGlow").Value); } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) + public override void ModifyTooltips(List list) { - var source = player.GetSource_ItemUse(Item); - float projSpeed = 25f; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX - Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY - Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) + List earthColors = new List() { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } + Color.OrangeRed, + Color.MediumTurquoise, + Color.LimeGreen + }; - for (int i = 0; i < 3; i++) - { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist; - float speedY5 = mouseYDist + (float)Main.rand.Next(-180, 181) * 0.02f; - int earthDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, ModContent.ProjectileType(), earthDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); - } + int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count); + Color currentColor = earthColors[colorIndex]; + Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count]; + Color earthTooltipColor = Color.Lerp(currentColor, nextColor, Main.GlobalTimeWrappedHourly % 2f > 1f ? 1f : Main.GlobalTimeWrappedHourly % 1f); - if (player.moonLeech || player.lifeSteal <= 0f) - return; - - int heal = Main.rand.Next(1, 70); - player.lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3"); + if (line != null) + line.OverrideColor = Color.Lerp(earthTooltipColor, Color.White, 0.5f); } - + public override bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/EarthGlow.png b/Items/Weapons/Melee/EarthGlow.png new file mode 100644 index 0000000000..5209a5943b Binary files /dev/null and b/Items/Weapons/Melee/EarthGlow.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 6d3b68101a..18185e1eec 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -409,12 +409,10 @@ Earth: { DisplayName: Earth Tooltip: ''' - Lowers enemy defense by 1 with every strike - Your attacks will heal you a lot - Rains RGB meteors that explode into more meteors after a short time on enemy hits - Ice meteors freeze enemies - Flame meteors explode - Green meteors spawn healing orbs + A beautiful prismatic blade with unrivaled close combat proficiency + Heals you greatly on hit + Every other swing will summon three Gaia meteors to fall upon nearby enemies + 'All its spawn shall know the beauty and wrath of their creator' ''' } @@ -639,7 +637,7 @@ GrandDad: { Tooltip: "[GFB]" TooltipNormal: ''' - A high quality blade that rips through enemies using its immense weight + An unfathomably heavy blade that rips through enemies using its sheer mass Heals you on hit Striking weaker enemies will launch them with incredible force Launched enemies take immense damage when colliding with walls and floors diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 4524c9c5ee..9075326ff6 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -318,3 +318,5 @@ YinYoLight.DisplayName: Light Shard RespiteblockHoldout.DisplayName: Respiteblock RespiteblockBlood.DisplayName: Respiteblock Blood GrandGuardianBoom.DisplayName: Grand Guardian Boom +EarthBoom.DisplayName: Earth Boom +EarthMeteor.DisplayName: Earth Meteor diff --git a/Projectiles/Melee/Earth2.cs b/Projectiles/Melee/Earth2.cs deleted file mode 100644 index 7129550d8f..0000000000 --- a/Projectiles/Melee/Earth2.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class Earth2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - private int noTileHitCounter = 120; - - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.ignoreWater = true; - Projectile.coldDamage = true; - } - - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - Projectile.tileCollide = true; - } - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - Projectile.alpha -= 15; - int alphaControl = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - { - alphaControl = 0; - } - if (Projectile.alpha < alphaControl) - { - Projectile.alpha = alphaControl; - } - Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int greenishDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[greenishDust].velocity = dustDirection * 0.66f; - Main.dust[greenishDust].position = Projectile.Center + dustDirection * 12f; - } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) - { - int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[gored].velocity *= 0.66f; - Main.gore[gored].velocity += Projectile.velocity * 0.3f; - } - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) - { - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(Projectile.Center, 0f, 0f, 1.5f); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 15; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Melee/Earth2.png b/Projectiles/Melee/Earth2.png deleted file mode 100644 index ffd272bc9a..0000000000 Binary files a/Projectiles/Melee/Earth2.png and /dev/null differ diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs deleted file mode 100644 index c58c9f6ec2..0000000000 --- a/Projectiles/Melee/Earth3.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class Earth3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - private int noTileHitCounter = 120; - - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.ignoreWater = true; - } - - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - Projectile.tileCollide = true; - } - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - Projectile.alpha -= 15; - int alphaControl = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - { - alphaControl = 0; - } - if (Projectile.alpha < alphaControl) - { - Projectile.alpha = alphaControl; - } - Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int brownDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[brownDust].velocity = dustDirection * 0.66f; - Main.dust[brownDust].position = Projectile.Center + dustDirection * 12f; - } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) - { - int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[gored].velocity *= 0.66f; - Main.gore[gored].velocity += Projectile.velocity * 0.3f; - } - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) - { - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(Projectile.Center, 1.5f, 0f, 0f); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 30; - Projectile.height = 30; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 20; i++) - { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dusty].scale = 0.5f; - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 3f); - Main.dust[dusty2].noGravity = true; - Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 2f); - Main.dust[dusty2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Melee/Earth3.png b/Projectiles/Melee/Earth3.png deleted file mode 100644 index 816c0bfa15..0000000000 Binary files a/Projectiles/Melee/Earth3.png and /dev/null differ diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs deleted file mode 100644 index 45697eb278..0000000000 --- a/Projectiles/Melee/Earth4.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using CalamityMod.Balancing; -using CalamityMod.Projectiles.Healing; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class Earth4 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - private int noTileHitCounter = 120; - - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.ignoreWater = true; - } - - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - Projectile.tileCollide = true; - } - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - Projectile.alpha -= 15; - int alphaControl = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - { - alphaControl = 0; - } - if (Projectile.alpha < alphaControl) - { - Projectile.alpha = alphaControl; - } - Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(16)) - { - Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int brightGreenDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[brightGreenDust].velocity = dustDirection * 0.66f; - Main.dust[brightGreenDust].position = Projectile.Center + dustDirection * 12f; - } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) - { - int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[gored].velocity *= 0.66f; - Main.gore[gored].velocity += Projectile.velocity * 0.3f; - } - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) - { - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(Projectile.Center, 0f, 1.5f, 0f); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 15; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.GreenFairy, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - SoundEngine.PlaySound(SoundID.Item4, Projectile.position); - - int heal = (int)Math.Round(hit.Damage * 0.075); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } - } -} diff --git a/Projectiles/Melee/Earth4.png b/Projectiles/Melee/Earth4.png deleted file mode 100644 index aefb4f61d2..0000000000 Binary files a/Projectiles/Melee/Earth4.png and /dev/null differ diff --git a/Projectiles/Melee/EarthBoom.cs b/Projectiles/Melee/EarthBoom.cs new file mode 100644 index 0000000000..58fc294fb1 --- /dev/null +++ b/Projectiles/Melee/EarthBoom.cs @@ -0,0 +1,35 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EarthBoom : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 500; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 15; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + } +} diff --git a/Projectiles/Melee/EarthGhost.png b/Projectiles/Melee/EarthGhost.png new file mode 100644 index 0000000000..287cfafd83 Binary files /dev/null and b/Projectiles/Melee/EarthGhost.png differ diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs new file mode 100644 index 0000000000..15802cc67f --- /dev/null +++ b/Projectiles/Melee/EarthHoldout.cs @@ -0,0 +1,314 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EarthHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; + public override float HitboxOutset => 105; + + public override Vector2 HitboxSize => new Vector2(145, 145); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(0, 104); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public bool spawnBoom = true; + public Color mainColor = Color.OrangeRed; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void OnSpawn(IEntitySource source) + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + base.OnSpawn(source); + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + spawnBoom = true; + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + + doSwing = true; + swingCount++; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time == (int)(timeMax * 0.4f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? 0.6f : 0.9f) }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.9f)) + { + CanHit = true; + + for (int i = 0; i < 2; i++) + { + mainColor = Main.rand.Next(3) switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, false, 12, Main.rand.NextFloat(0.03f, 0.01f), mainColor, new Vector2 (0.3f, 1f))); + } + for (int i = 0; i < 6; i++) + { + mainColor = Main.rand.Next(3) switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, mainColor, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, 0, true)); + } + } + else + CanHit = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 3; i++) + { + mainColor = Main.rand.Next(3) switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + bool color = Main.rand.NextBool(); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GeneralParticleHandler.SpawnParticle(sparker); + + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + + mainColor = Main.rand.Next(3) switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (damageDone <= 2 && Projectile.numHits > 0) + Projectile.numHits -= 1; + + bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) + { + // Launch + Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -17; + target.velocity = launchVel * (target.knockBackResist == 0 ? 0 : 1f); + } + + if (Projectile.ai[1] == -1 && spawnBoom) + { + Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0, 0, 2); + spawnBoom = false; + } + + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = 0.2f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center); + + int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 15, 1, 20)); + if (Projectile.numHits < 20) + { + Owner.statLife += heal; + Owner.HealEffect(heal); + if (Owner.statLife > Owner.statLifeMax2) + Owner.statLife = Owner.statLifeMax2; + } + + int points = 6; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + if (k % 2 == 0) + velocity *= 5; + Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 11, 0.08f, mainColor, new Vector2(1f, 0.4f), true); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 35, 0.06f, mainColor, new Vector2(0.4f, 1.1f), false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 15, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.5f, 15, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + + for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) + { + mainColor = Main.rand.Next(3) switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + Particle mini = new CustomPulse(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 1f), mainColor, "CalamityMod/Particles/HealingPlus", Vector2.One, Main.rand.NextFloat(-10, 10), Main.rand.NextFloat(0.8f, 1.4f), 0.2f, 35, true); + GeneralParticleHandler.SpawnParticle(mini); + + Dust dust2 = Dust.NewDustPerfect(target.Center, 278, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.7f)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 1f; + int hitsToMinMult = 1; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/EarthGlow"); + + float r = (FlipAsSword ? MathHelper.ToRadians(90) : 0f); + + for (int i = 0; i < 5; i++) + { + Color auraColor = mainColor * 0.5f * fadeIn; + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/EarthGhost").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/EarthMeteor.cs b/Projectiles/Melee/EarthMeteor.cs new file mode 100644 index 0000000000..d87ddf8f06 --- /dev/null +++ b/Projectiles/Melee/EarthMeteor.cs @@ -0,0 +1,189 @@ +using CalamityMod.Buffs.DamageOverTime; +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using ReLogic.Utilities; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Melee +{ + public class EarthMeteor : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public ref float time => ref Projectile.ai[0]; + public SlotId AudSlot; + public Color mainColor = Color.White; + public Color randomColor = Color.White; + public Color variedColor = Color.White; + public int colorTimer = 0; + public int fallTime = 180; + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 84; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + Projectile.scale = 1.2f; + randomColor = Main.rand.Next(3) switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + if (time == 0) + { + mainColor = randomColor; + } + + if (time % 20 == 0) + { + variedColor = colorTimer switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + colorTimer++; + if (colorTimer >= 3) + colorTimer = 0; + } + mainColor = Color.Lerp(mainColor, variedColor, 0.07f); + + if (time == 0 && Projectile.ai[2] == 2) + { + SoundStyle fire2 = new("CalamityMod/Sounds/Item/WeldingShoot"); + AudSlot = SoundEngine.PlaySound(fire2 with { Volume = 0.01f, Pitch = 0.01f, IsLooped = true }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && ChargeSound.IsPlaying && Projectile.ai[2] == 2) + { + ChargeSound.Position = Projectile.Center; + ChargeSound.Pitch = Utils.Remap(time, 0, fallTime, 0.4f, -0.6f) * 100; + ChargeSound.Volume = Utils.Remap(time, 0, fallTime, 0f, 0.7f) * 100; + } + if (time == (int)(fallTime * 0.2f) && Projectile.ai[2] > 0) + { + Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + } + if (time == fallTime) + { + Projectile.extraUpdates = 15; + + NPC target = Projectile.Center.ClosestNPCAt(2000); + if (target != null) + Projectile.velocity = (target.Center - Projectile.Center + target.velocity * 8).SafeNormalize(Vector2.UnitX) * 8; + else + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8; + } + if (time >= fallTime) + { + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; + if (targetDist < 1400f) + { + GlowSparkParticle orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, false, 12, 0.02f, mainColor, new Vector2(0.3f, 1f), false, false); + GeneralParticleHandler.SpawnParticle(orb); + + GlowSparkParticle orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, false, 12, 0.02f, mainColor, new Vector2(0.3f, 1f), false, false); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + else + { + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * Utils.Remap(time, 0, fallTime, 0, 0.65f), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 3), Utils.Remap(time, fallTime * 0.7f, fallTime, 1, 2)), 0, 0.7f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * Utils.Remap(time, 0, fallTime, 0f, 0.65f), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 3), Utils.Remap(time, fallTime * 0.7f, fallTime, 1, 2)), 0, 0.55f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom3); + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; + } + public override bool PreDraw(ref Color lightColor) + { + if (time <= fallTime) + return false; + + Color auraColor = mainColor; + for (int i = 0; i < 7; i++) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/EarthMeteor").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 20f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale * 1.1f, SpriteEffects.None, 0f); + } + + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.White, randomColor, 0.3f), 1); + return false; + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && Projectile.ai[2] == 2) + ChargeSound?.Stop(); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits <= 0) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); + for (int i = 0; i < 20; i++) + { + randomColor = Main.rand.Next(3) switch + { + 0 => Color.OrangeRed, + 1 => Color.MediumTurquoise, + _ => Color.LawnGreen, + }; + Dust dust2 = Dust.NewDustPerfect(target.Center, 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20)); + dust2.scale = Main.rand.NextFloat(0.85f, 1.15f); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.White, randomColor, 0.5f); + } + + Particle bolt2 = new CustomPulse(target.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.5f, 19); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomPulse(target.Center, Vector2.Zero, Color.MediumTurquoise, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.35f, 17); + GeneralParticleHandler.SpawnParticle(bolt3); + Particle bolt4 = new CustomPulse(target.Center, Vector2.Zero, Color.LawnGreen, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.2f, 15); + GeneralParticleHandler.SpawnParticle(bolt4); + + SoundStyle fire2 = new("CalamityMod/Sounds/Item/EarthMeteor"); + SoundEngine.PlaySound(fire2 with { Volume = 0.9f }, target.Center); + + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f, 3f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 2f, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + + } + } + public override bool? CanDamage() => time < fallTime ? false : null; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 80, targetHitbox); + } +} diff --git a/Projectiles/Melee/EarthMeteor.png b/Projectiles/Melee/EarthMeteor.png new file mode 100644 index 0000000000..80998fa158 Binary files /dev/null and b/Projectiles/Melee/EarthMeteor.png differ diff --git a/Projectiles/Melee/EarthProj.cs b/Projectiles/Melee/EarthProj.cs deleted file mode 100644 index 4a7107eda7..0000000000 --- a/Projectiles/Melee/EarthProj.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EarthProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - private int noTileHitCounter = 120; - - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.ignoreWater = true; - } - - public override void AI() - { - int randomToSubtract = Main.rand.Next(1, 4); - noTileHitCounter -= randomToSubtract; - if (noTileHitCounter == 0) - { - Projectile.tileCollide = true; - } - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - Projectile.alpha -= 15; - int alphaControl = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - { - alphaControl = 0; - } - if (Projectile.alpha < alphaControl) - { - Projectile.alpha = alphaControl; - } - Projectile.localAI[0] += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; - int dustChoice = Main.rand.Next(3); - if (dustChoice == 0) - { - dustChoice = 74; - } - else if (dustChoice == 1) - { - dustChoice = 229; - } - else - { - dustChoice = 244; - } - if (Main.rand.NextBool(16)) - { - Vector2 dustDirection = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int dustOnHit = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[dustOnHit].velocity = dustDirection * 0.66f; - Main.dust[dustOnHit].position = Projectile.Center + dustDirection * 12f; - } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) - { - int gored = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[gored].velocity *= 0.66f; - Main.gore[gored].velocity += Projectile.velocity * 0.3f; - } - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) - { - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - } - Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 0.5f); - } - - public override void OnKill(int timeLeft) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - int projChoice = Main.rand.Next(3); - if (projChoice == 0) - { - projChoice = ModContent.ProjectileType(); - } - else if (projChoice == 1) - { - projChoice = ModContent.ProjectileType(); - } - else - { - projChoice = ModContent.ProjectileType(); - } - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 15; k++) - { - int dustChoice = Main.rand.Next(3); - if (dustChoice == 0) - { - dustChoice = 74; - } - else if (dustChoice == 1) - { - dustChoice = 229; - } - else - { - dustChoice = 244; - } - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustChoice, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - } - } -} diff --git a/Projectiles/Melee/EarthProj.png b/Projectiles/Melee/EarthProj.png deleted file mode 100644 index ab03cbf3af..0000000000 Binary files a/Projectiles/Melee/EarthProj.png and /dev/null differ diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 067ae7e3c5..69bf397245 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -154,9 +154,9 @@ namespace CalamityMod.Projectiles.Melee if (CanHit) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 5; i++) { - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 24, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.Gold : Color.Goldenrod)); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.Gold : Color.Goldenrod)); } } } @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Melee } bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; - if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) || Main.zenithWorld || target.type == ModContent.NPCType()) + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) { if (target.type == ModContent.NPCType()) { @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.Melee target.knockBackResist = 1; // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) - target.FallingNPC().ApplyFallDamage(target, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 4 : 1), launchVel, 5f, true); + target.FallingNPC().ApplyFallDamage(target, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel, 5f, true); } Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35, false, 13, 0.5f, Color.DodgerBlue); GeneralParticleHandler.SpawnParticle(spark); diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 98f381a1db..7358ea6f11 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnSpawn(IEntitySource source) { + Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; base.OnSpawn(source); @@ -178,6 +179,14 @@ namespace CalamityMod.Projectiles.Melee if (damageDone <= 2 && Projectile.numHits > 0) Projectile.numHits -= 1; + bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust; + if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && !CalamityPlayer.areThereAnyDamnBosses && target.CanBeChasedBy(Projectile, false)) + { + // Launch + Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -8; + target.velocity = launchVel * (target.knockBackResist == 0 ? 0 : 1f); + } + if (spawnBoom) { Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner); @@ -189,8 +198,8 @@ namespace CalamityMod.Projectiles.Melee SoundStyle fire2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); SoundEngine.PlaySound(fire2 with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, Projectile.Center); - int heal = (int)(MathHelper.Clamp(4 - Projectile.numHits * 2, 1, 4)); - if (Projectile.numHits < 4) + int heal = (int)(MathHelper.Clamp(3 - Projectile.numHits, 1, 3)); + if (Projectile.numHits < 3) { Owner.statLife += heal; Owner.HealEffect(heal); diff --git a/Sounds/Item/EarthMeteor.ogg b/Sounds/Item/EarthMeteor.ogg new file mode 100644 index 0000000000..79027e4a4e Binary files /dev/null and b/Sounds/Item/EarthMeteor.ogg differ