From b97454490bf3587b303f711c3b642c7faaa98421 Mon Sep 17 00:00:00 2001 From: sunny-raindrops Date: Sun, 14 Sep 2025 05:27:28 -0700 Subject: [PATCH 01/13] Scorched Earth --- Items/Weapons/Ranged/ScorchedEarth.cs | 57 +++--- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 3 +- Projectiles/Ranged/RocketFire.cs | 24 ++- .../Ranged/ScorchedEarthClusterBomb.cs | 13 +- Projectiles/Ranged/ScorchedEarthHoldout.cs | 110 +++++++++++ Projectiles/Ranged/ScorchedEarthRocket.cs | 180 ++++++++++-------- 6 files changed, 268 insertions(+), 119 deletions(-) create mode 100644 Projectiles/Ranged/ScorchedEarthHoldout.cs diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index f41004aca0..7082337888 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -1,68 +1,71 @@ -using CalamityMod.Items.Materials; +using System.ComponentModel.DataAnnotations; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Steamworks; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { public class ScorchedEarth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/ScorchedEarthShot", 3); + public static readonly SoundStyle RocketShoot = new("CalamityMod/Sounds/Item/ScorpioShot") { Volume = 0.45f }; - private int counter = 0; + public static int OriginalUseTime = 60; + public static int TimeBetweenBursts = 10; + public static int ProjectilesPerBurst = 4; public override void SetDefaults() { + Item.damage = 500; + Item.DamageType = DamageClass.Ranged; + Item.useAnimation = Item.useTime = OriginalUseTime; + Item.shoot = ProjectileType(); + Item.shootSpeed = 15f; + Item.knockBack = 6.5f; + Item.width = 104; Item.height = 44; - Item.damage = 485; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 8; - Item.useAnimation = 32; // 4 shots in just over half a second - Item.reuseDelay = 60; // 1 second recharge - Item.useLimitPerAnimation = 4; - Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 8.7f; + Item.channel = true; + Item.noUseGraphic = true; + Item.useAmmo = AmmoID.Rocket; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - Item.autoReuse = true; - Item.shootSpeed = 12.6f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = AmmoID.Rocket; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; Item.Calamity().donorItem = true; } - // Consume two ammo per fire - public override bool CanConsumeAmmo(Item ammo, Player player) => counter % 2 == 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override Vector2? HoldoutOffset() => new Vector2(-30, 0); + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, -30); - if (counter == 0) - { - SoundEngine.PlaySound(ShootSound, position); - } + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); - counter++; - if (counter == 4) - counter = 0; return false; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddRecipeGroup("AnyAdamantiteBar", 15). AddIngredient(10). AddIngredient(ItemID.FragmentSolar, 50). diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 2d767078ac..4db7199620 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -1044,8 +1044,9 @@ ScorchedEarth: { DisplayName: Scorched Earth Tooltip: ''' - Fires a burst of four fuel-air rockets which explode into cluster bombs + Fires a burst of four heat seeking missles that rapidly accelerate after a short delay Each burst consumes two rockets each + All rockets explode into cluster bombs 'Burns your targets to a fine crisp' ''' } diff --git a/Projectiles/Ranged/RocketFire.cs b/Projectiles/Ranged/RocketFire.cs index 899990b1ac..e6b3ee1246 100644 --- a/Projectiles/Ranged/RocketFire.cs +++ b/Projectiles/Ranged/RocketFire.cs @@ -1,4 +1,6 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,11 +13,11 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/Rogue/TotalityFire"; private bool initialized = false; + public static Asset Glow; public override void SetStaticDefaults() { Main.projFrames[Type] = 3; ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -60,7 +62,6 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.frame = 0; } - //movement if (Projectile.velocity.X != Projectile.velocity.X) { @@ -99,9 +100,9 @@ namespace CalamityMod.Projectiles.Ranged } //dust - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(3)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? DustID.Torch : Main.rand.NextBool() ? 53 : 54, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -109,9 +110,9 @@ namespace CalamityMod.Projectiles.Ranged dust.noGravity = true; dust.velocity.Y -= 2f; } - if (Main.rand.NextBool(10)) + if (Main.rand.NextBool(6)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? DustID.Torch : Main.rand.NextBool() ? 53 : 54, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -120,6 +121,17 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity *= 0.1f; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Daybreak, 300); + target.AddBuff(BuffID.Oiled, 300); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(BuffID.Daybreak, 300); + target.AddBuff(BuffID.Oiled, 300); + } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs index 2127a50d88..93a7ccd2ee 100644 --- a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs +++ b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -32,9 +33,15 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 10; i++) + for (int i = 0; i < 15; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 1f); + int size = 16; + Vector2 position = Projectile.Center; + Vector2 velocity = Main.rand.NextVector2Circular(size, size); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.2f, 0.3f), Color.DarkOrange * 0.5f, Main.rand.Next(6, 9), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustID.Torch, velocity, 0, default, Main.rand.NextFloat(1f, 2f)); + dust.noGravity = true; } int projAmt = Main.rand.Next(2, 4); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Ranged/ScorchedEarthHoldout.cs b/Projectiles/Ranged/ScorchedEarthHoldout.cs new file mode 100644 index 0000000000..b94b1ab9e6 --- /dev/null +++ b/Projectiles/Ranged/ScorchedEarthHoldout.cs @@ -0,0 +1,110 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.ScorchedEarth; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorchedEarthHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 5f * Projectile.spriteDirection * Owner.gravDir; + public override float RecoilResolveSpeed => 0.1f; + public override float MaxOffsetLengthFromArm => 15f; + public override float OffsetXUpwards => -12f; + public override float OffsetXDownwards => 2f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 10f; + + public ref float ShootingTimer => ref Projectile.ai[0]; + public ref float TimerBetweenBursts => ref Projectile.ai[1]; + + public override void HoldoutAI() + { + + if (ShootingTimer >= HeldItem.useAnimation) + { + // Shooting the burst of rockets. + // The time is adapted to the speed modifier from the reforge. + int adaptedTimeBetweenBursts = TimeBetweenBursts * HeldItem.useAnimation / OriginalUseTime; + + if (ShootingTimer % adaptedTimeBetweenBursts == 0f) + ShootRocket(HeldItem, false); + + // Resets the timers when everything has been shot. + if (ShootingTimer >= HeldItem.useAnimation + adaptedTimeBetweenBursts * (ProjectilesPerBurst - 1)) + { + ShootingTimer = 0f; + TimerBetweenBursts = 0f; + } + if (Main.dedServ) + return; + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, Main.rand.NextBool() ? Color.DarkSlateGray : Color.DarkGray, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + //for (int i = 0; i < 2; i++) + { + //Vector2 backsmokeVel = new Vector2(6, -2) * Main.rand.NextFloat(0.1f, 1.1f); + //Particle backsmoke = new HeavySmokeParticle(Projectile.Center + (-Projectile.velocity * 60f), backsmokeVel, Main.rand.NextBool() ? Color.DarkSlateGray : Color.Black, Main.rand.Next(20, 30 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + //GeneralParticleHandler.SpawnParticle(backsmoke); + } + } + + ShootingTimer++; + } + + public void ShootRocket(Item item, bool isRMB) + { + // We use the velocity of this projectile as its direction vector. + Vector2 projectileVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(item, out _, out float projSpeed, out int damage, out float knockback, out int rocketType, Main.rand.Next(100) > 50); // 50% ammo conservation + + // Spawns the projectile. + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 12; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(10f)), ModContent.ProjectileType(), damage, knockback, Projectile.owner, rocketType); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + SoundEngine.PlaySound(RocketShoot with { Pitch = 0.045f }, Projectile.Center); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthFromArm -= 7f; + + Particle shootPulse = new DirectionalPulseRing(GunTipPosition,Vector2.Zero,Color.Gray * 0.7f,new Vector2(0.5f, 1f),Projectile.rotation, 0.1f, 0.4f, 25); + GeneralParticleHandler.SpawnParticle(shootPulse); + for (int i = 0; i <= 8; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index d806b0180c..2e3219c493 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,123 +12,135 @@ namespace CalamityMod.Projectiles.Ranged public class ScorchedEarthRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public int time = 0; + public int index = -1; + public static readonly SoundStyle RocketExplosion = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBExplosion"); + public override void SetStaticDefaults() { Main.projFrames[Type] = 10; ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 3; - ProjectileID.Sets.TrailingMode[Type] = 0; } + public override void SetDefaults() { - Projectile.width = 22; - Projectile.height = 22; + Projectile.width = Projectile.height = 34; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - 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; - } + //Rotation + Projectile.rotation = Projectile.velocity.ToRotation(); + //If the frame ever goes over 10, return it to 6 if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 6; } - - CalamityUtils.HomeInOnNPC(Projectile, true, 400f, 5f, 30f); - - //Rotation - Projectile.rotation = Projectile.velocity.ToRotation(); - - 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, DustID.CopperCoin, 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, DustID.CopperCoin, 0f, 0f, 100, default, 0.5f); - Main.dust[d].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[d].velocity *= 0.05f; + //For the first 20 frames, the rocket constantly loses velocity and stays on frame 0 + if (time <= 20) + { + Projectile.velocity *= 0.9f; + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + //Ensures the prime sound only plays once + if (time == 24) + { + SoundStyle PrimeSound = new("CalamityMod/Sounds/Item/ScorchedEarthShot", 3) { Volume = 0.25f, MaxInstances = 8 }; + SoundEngine.PlaySound(PrimeSound with { Pitch = -0.1f }, Projectile.Center); + } + //Be VERY CAREFUL changing this. The rocket quickly gains speed for a very limited amount of time to make sure it doesn't go too fast + if (time > 24 && time < 34) + { + Projectile.velocity *= index != -1 ? 1.15f : 1.5f; + } + //All of these effects only trigger once the rocket is speeding up + if (time >= 24) + { + //Lighting + Lighting.AddLight(Projectile.Center, 1f, 0.79f, 0.3f); + Projectile.frameCounter++; + if (Projectile.frameCounter >= 5) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Type]) + { + Projectile.frame = 6; + } + } + } + //After the rocket has reached full speed, give it homing for half a second + if (time >= 37 && time < 67) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 350f, 20f, 6f); + } + time++; } public override void OnKill(int timeLeft) { if (Projectile.owner == Main.myPlayer) { - Projectile.ExpandHitboxBy(300); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - - if (!Main.dedServ) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 10; - 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; - } - } - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2f, Projectile.owner); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + SoundEngine.PlaySound(RocketExplosion with { MaxInstances = 2}, Projectile.Center); + // Create Blast + float blastSize = 300; + float minMultiplier = 0.25f; + int hitsToMinMult = 4; + int debuff1 = BuffID.Daybreak; + int debuff2 = BuffID.Oiled; + int debuffTime = 360; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[2] = debuff2; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Ranged; for (int j = 0; j < 5; j++) { Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(8f, 10f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } } + for (int i = 0; i < 15; i++) + { + Vector2 randVel = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.DarkSlateGray * 0.8f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.7f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 2; i++) + { + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.OrangeRed : Color.DarkGoldenrod * 0.8f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1.4f); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.18f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 1.8f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle blastRing4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.8f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing4); + Particle blastRing5 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.13f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing5); + } } - public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + if (time < 1) + return false; + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition; + Vector2 origin = frame.Size() * 0.5f; + + drawPosition = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; } } From adee275f71e904c20336b069dd2d5d4a83c3bbae Mon Sep 17 00:00:00 2001 From: sunny-raindrops Date: Sun, 14 Sep 2025 16:34:42 -0700 Subject: [PATCH 02/13] Visual Touches --- .../Ranged/ScorchedEarthClusterBomb.cs | 19 ++++++++++++++++++- Projectiles/Ranged/ScorchedEarthHoldout.cs | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs index 93a7ccd2ee..c81b851c14 100644 --- a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs +++ b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs @@ -1,5 +1,6 @@ using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public class ScorchedEarthClusterBomb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public Vector2 vibrate = Vector2.Zero; public override void SetDefaults() { Projectile.width = 14; @@ -28,11 +30,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 0.95f; if (Projectile.velocity.Length() < 0.5f && Projectile.timeLeft > 10) Projectile.timeLeft = 10; + if (Projectile.timeLeft <= 75) + { + float power = 2.5f; + vibrate = Main.rand.NextVector2Circular(power, power); + } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.8f , MaxInstances = 3}, Projectile.position); for (int i = 0; i < 15; i++) { int size = 16; @@ -53,5 +60,15 @@ namespace CalamityMod.Projectiles.Ranged } } } + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition; + Vector2 origin = frame.Size() * 0.5f; + drawPosition = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition + vibrate, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } } } diff --git a/Projectiles/Ranged/ScorchedEarthHoldout.cs b/Projectiles/Ranged/ScorchedEarthHoldout.cs index b94b1ab9e6..489e44d8cc 100644 --- a/Projectiles/Ranged/ScorchedEarthHoldout.cs +++ b/Projectiles/Ranged/ScorchedEarthHoldout.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged //for (int i = 0; i < 2; i++) { //Vector2 backsmokeVel = new Vector2(6, -2) * Main.rand.NextFloat(0.1f, 1.1f); - //Particle backsmoke = new HeavySmokeParticle(Projectile.Center + (-Projectile.velocity * 60f), backsmokeVel, Main.rand.NextBool() ? Color.DarkSlateGray : Color.Black, Main.rand.Next(20, 30 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + //Particle backsmoke = new HeavySmokeParticle(GunTipPosition + (-Projectile.velocity * 110f), -Projectile.velocity.SafeNormalize(Vector2.UnitY) * backsmokeVel, Main.rand.NextBool() ? Color.DarkSlateGray : Color.Black, Main.rand.Next(20, 30 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); //GeneralParticleHandler.SpawnParticle(backsmoke); } } From 2e0367b7a87ca0dd9f3b328008f8227d4e0f70fc Mon Sep 17 00:00:00 2001 From: sunny-raindrops Date: Sun, 14 Sep 2025 20:01:32 -0700 Subject: [PATCH 03/13] Rocket behavior updates --- Projectiles/Ranged/ScorchedEarthRocket.cs | 130 ++++++++++++++++++---- 1 file changed, 106 insertions(+), 24 deletions(-) diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index 2e3219c493..a14577f93e 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -13,8 +13,12 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public int time = 0; + public bool BonusEffectMode; + public bool HasHit = false; + public bool SetLifetime = false; public int index = -1; public static readonly SoundStyle RocketExplosion = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBExplosion"); + public ref float RocketID => ref Projectile.ai[0]; public override void SetStaticDefaults() { @@ -22,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged ProjectileID.Sets.CultistIsResistantTo[Type] = true; } - public override void SetDefaults() { Projectile.width = Projectile.height = 34; @@ -81,15 +84,94 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.HomeInOnNPC(Projectile, true, 350f, 20f, 6f); } + //Handling Tile Breaking/Liquid Rockets + BonusEffectMode = Projectile.ai[2] == 2; + if (BonusEffectMode) + { + if (!SetLifetime) + { + Projectile.timeLeft = 60; + Projectile.extraUpdates = 0; + Projectile.damage = 0; + Projectile.alpha = 255; + SetLifetime = true; + } + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII) + { + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = (int)(Projectile.RocketBehavior(info) * 3f); + if (time % 5 == 0) + { + Projectile.ExplodeTiles((int)(blastRadius * Utils.Remap(time, 60f, 1f, 1f, 0f, true)), info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + } + } + else + { + Point center = Projectile.Center.ToTileCoordinates(); + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = Projectile.RocketBehavior(info); + if (RocketID == ItemID.DryRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadDry); + } + } + if (RocketID == ItemID.WetRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadWater); + } + } + if (RocketID == ItemID.LavaRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadLava); + } + } + if (RocketID == ItemID.HoneyRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadHoney); + } + } + } + } time++; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + HasHit = true; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + HasHit = true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + HasHit = true; + return true; + } public override void OnKill(int timeLeft) { - if (Projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer && HasHit == true && !BonusEffectMode && Projectile.ai[2] == 0) { + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); SoundEngine.PlaySound(RocketExplosion with { MaxInstances = 2}, Projectile.Center); + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, RocketID, 0f, 2f); // Create Blast float blastSize = 300; float minMultiplier = 0.25f; @@ -97,37 +179,37 @@ namespace CalamityMod.Projectiles.Ranged int debuff1 = BuffID.Daybreak; int debuff2 = BuffID.Oiled; int debuffTime = 360; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.75f : 1)), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); blast.localAI[0] = debuff1; blast.localAI[2] = debuff2; blast.localAI[1] = debuffTime; blast.timeLeft = 15; blast.DamageType = DamageClass.Ranged; - for (int j = 0; j < 5; j++) + for (int j = 0; j < (isClusterRocket ? 9 : 5); j++) { Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(8f, 10f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } - } - for (int i = 0; i < 15; i++) - { - Vector2 randVel = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); - Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.DarkSlateGray * 0.8f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.7f); - GeneralParticleHandler.SpawnParticle(smoke); - } - for (int i = 0; i < 2; i++) - { - //Explosion effect - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.OrangeRed : Color.DarkGoldenrod * 0.8f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1.4f); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.18f, 20, true, 1f); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 1.8f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing3); - Particle blastRing4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.8f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing4); - Particle blastRing5 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.13f, 20, true, 1f); - GeneralParticleHandler.SpawnParticle(blastRing5); + for (int i = 0; i < 15; i++) + { + Vector2 randVel = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Black, Main.rand.Next(20, 25 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.7f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 2; i++) + { + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.OrangeRed : Color.DarkGoldenrod * 0.8f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1.4f); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.18f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 1.8f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle blastRing4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.8f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing4); + Particle blastRing5 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.13f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing5); + } } } public override bool PreDraw(ref Color lightColor) From c755f736750afe0cbfe1fa025549dc6f17283a4a Mon Sep 17 00:00:00 2001 From: sunny-raindrops Date: Sun, 14 Sep 2025 20:20:06 -0700 Subject: [PATCH 04/13] Final touches --- .../en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson | 6 +++--- Projectiles/Ranged/ScorchedEarthRocket.cs | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 4db7199620..ea16dc2398 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -1044,9 +1044,9 @@ ScorchedEarth: { DisplayName: Scorched Earth Tooltip: ''' - Fires a burst of four heat seeking missles that rapidly accelerate after a short delay - Each burst consumes two rockets each - All rockets explode into cluster bombs + Fires a burst of four heat seeking missiles that rapidly accelerate after a short delay + All rockets explode into napalm cluster bombs on impact +50% chance to save ammo 'Burns your targets to a fine crisp' ''' } diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index a14577f93e..202badee22 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Projectiles.Ranged public bool BonusEffectMode; public bool HasHit = false; public bool SetLifetime = false; - public int index = -1; public static readonly SoundStyle RocketExplosion = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBExplosion"); public ref float RocketID => ref Projectile.ai[0]; @@ -61,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged //Be VERY CAREFUL changing this. The rocket quickly gains speed for a very limited amount of time to make sure it doesn't go too fast if (time > 24 && time < 34) { - Projectile.velocity *= index != -1 ? 1.15f : 1.5f; + Projectile.velocity *= 1.5f; } //All of these effects only trigger once the rocket is speeding up if (time >= 24) @@ -170,6 +169,7 @@ namespace CalamityMod.Projectiles.Ranged bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); SoundEngine.PlaySound(RocketExplosion with { MaxInstances = 2}, Projectile.Center); + //If using a rocket with extra effects, spawn an invisible copy that handes the tile breaking/liquid spawning logic if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, RocketID, 0f, 2f); // Create Blast @@ -179,6 +179,7 @@ namespace CalamityMod.Projectiles.Ranged int debuff1 = BuffID.Daybreak; int debuff2 = BuffID.Oiled; int debuffTime = 360; + //The explosion has a different damage scaling depending on which rocket type you have. Left is Cluster Rocket, right is Non-Cluster. Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.75f : 1)), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); blast.localAI[0] = debuff1; blast.localAI[2] = debuff2; From 6be75d3dca06bccd2ce6511186d698a50cce053a Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Tue, 16 Sep 2025 00:09:17 -0400 Subject: [PATCH 05/13] Fix Scorched Earth localization indentation --- Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index ea16dc2398..f729f662d8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -1046,7 +1046,7 @@ ScorchedEarth: { ''' Fires a burst of four heat seeking missiles that rapidly accelerate after a short delay All rockets explode into napalm cluster bombs on impact -50% chance to save ammo + 50% chance to save ammo 'Burns your targets to a fine crisp' ''' } From cc3a92a9d829c622b06b713e867e978603b6e8a5 Mon Sep 17 00:00:00 2001 From: sunny-raindrops Date: Tue, 16 Sep 2025 16:24:49 -0700 Subject: [PATCH 06/13] Deleted unused bits and a projectile I forgot --- Items/Weapons/Ranged/ScorchedEarth.cs | 4 +- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 1 - Projectiles/Ranged/ScorchedEarthBlast.cs | 85 ------------------- Projectiles/Ranged/ScorchedEarthHoldout.cs | 3 +- Projectiles/Ranged/ScorchedEarthRocket.cs | 3 +- 5 files changed, 3 insertions(+), 93 deletions(-) delete mode 100644 Projectiles/Ranged/ScorchedEarthBlast.cs diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index 7082337888..878d0c7068 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -1,10 +1,8 @@ -using System.ComponentModel.DataAnnotations; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using Steamworks; using Terraria; using Terraria.Audio; using Terraria.DataStructures; diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index e7a674c92d..c399a3778c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -175,7 +175,6 @@ RicoshotCoin.DisplayName: Ricoshot Coin RocketFire.DisplayName: Fire RubberMortarRoundProj.DisplayName: Rubber Mortar SandblasterBullet.DisplayName: Sandstorm -ScorchedEarthBlast.DisplayName: Earth Scorcher ScorchedEarthClusterBomb.DisplayName: Cluster Bomb ScorchedEarthRocket.DisplayName: Rocket ScorpioRocket.DisplayName: Nano Missile diff --git a/Projectiles/Ranged/ScorchedEarthBlast.cs b/Projectiles/Ranged/ScorchedEarthBlast.cs deleted file mode 100644 index 7673ef7306..0000000000 --- a/Projectiles/Ranged/ScorchedEarthBlast.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ScorchedEarthBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - private static int Lifetime = 20; - private static float ExplosionRadius = 150f; - private static float StartDustQuantity = 36f; - - public override void SetDefaults() - { - // Width and height don't actually do anything because the explosion uses custom collision - Projectile.width = Projectile.height = 300; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = Lifetime; - - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - // localAI[0] = frame counter - // localAI[1] = dust quantity - public override void AI() - { - // Play sound on frame 1 and initialize dust quantity - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[1] = StartDustQuantity; - } - - // Pure dust projectile - DrawProjectile(); - - // Increment frame counter - Projectile.localAI[0] += 1f; - } - - private void DrawProjectile() - { - // Taper down the dust amount for the last bit of the projectile's life - if (Projectile.localAI[0] >= Lifetime - 15) - Projectile.localAI[1] -= 1f; - - int dustCount = (int)Projectile.localAI[1]; - for (int i = 0; i < dustCount; ++i) - { - int dustType = Main.rand.NextBool() ? 6 : 244; - float scale = Main.rand.NextFloat(2.0f, 2.5f); - float randX = Main.rand.NextFloat(-30f, 30f); - float randY = Main.rand.NextFloat(-30f, 30f); - float randVelocity = Main.rand.NextFloat(5f, 19f); - float speed = (float)Math.Sqrt((double)(randX * randX + randY * randY)); - speed = randVelocity / speed; - randX *= speed; - randY *= speed; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].velocity.X = randX; - Main.dust[idx].velocity.Y = randY; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Daybreak, 300); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); - } -} diff --git a/Projectiles/Ranged/ScorchedEarthHoldout.cs b/Projectiles/Ranged/ScorchedEarthHoldout.cs index 489e44d8cc..67d1515ac0 100644 --- a/Projectiles/Ranged/ScorchedEarthHoldout.cs +++ b/Projectiles/Ranged/ScorchedEarthHoldout.cs @@ -3,10 +3,8 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Mono.Cecil; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; using static CalamityMod.Items.Weapons.Ranged.ScorchedEarth; using static Terraria.ModLoader.ModContent; @@ -50,6 +48,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, Main.rand.NextBool() ? Color.DarkSlateGray : Color.DarkGray, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); GeneralParticleHandler.SpawnParticle(smoke); + //Visual request from the donor that I tried and didn't end up liking. This is commented and not deleted in case the donor really wants this effect //for (int i = 0; i < 2; i++) { //Vector2 backsmokeVel = new Vector2(6, -2) * Main.rand.NextFloat(0.1f, 1.1f); diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index 202badee22..5aa1a6b15f 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -1,5 +1,4 @@ -using System; -using CalamityMod.Particles; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; From ceaf62634b441d2632cb8b0aaf9569d8f19d9bb8 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 18 Sep 2025 11:41:11 -0500 Subject: [PATCH 07/13] virid vanguard rework --- Buffs/DamageOverTime/SagePoison.cs | 6 +- Buffs/Summon/ViridVanguardBuff.cs | 4 +- CalPlayer/CalamityPlayer.cs | 13 +- Items/Weapons/Summon/ViridVanguard.cs | 104 ++++-- ...ods.CalamityMod.Items.Weapons.Summon.hjson | 10 +- Projectiles/Summon/ViridVanguardBlade.cs | 337 +++++++++++++++--- Projectiles/Summon/ViridVanguardBlade.png | Bin 1039 -> 2029 bytes 7 files changed, 401 insertions(+), 73 deletions(-) diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index 61879513b7..ae70da14e7 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -1,6 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.DataStructures; -using CalamityMod.NPCs; +using CalamityMod.DataStructures; using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; @@ -15,6 +13,8 @@ namespace CalamityMod.Buffs.DamageOverTime SicknessDebuffScaling = 1, NPCLifeRegenMethod = SagePoisonPower }; + + public static float ViridVanguardPoisonMultiplier => 3; public static void SagePoisonPower(NPC npc, int buffType, ref int buffIndex, ref int damage) { // The base DoT is multiplied by the amount of Viral Sprouts you have when applied diff --git a/Buffs/Summon/ViridVanguardBuff.cs b/Buffs/Summon/ViridVanguardBuff.cs index 51ea3391d7..68ca32a558 100644 --- a/Buffs/Summon/ViridVanguardBuff.cs +++ b/Buffs/Summon/ViridVanguardBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon @@ -7,6 +7,6 @@ namespace CalamityMod.Buffs.Summon { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.ViridVanguard; + protected override ref bool MinionBool => ref BuffModdedOwner.viridVanguard; } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1e43caf7eb..fb007455a1 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1544,7 +1544,11 @@ namespace CalamityMod.CalPlayer public bool deathstareEyeball = false; public bool witherBlossom = false; public bool flowersOfMortality = false; - public bool ViridVanguard = false; + public bool viridVanguard = false; + public bool ViridVanguardActiveAttackerThisFrame = false; + public float ViridVanguardRotation = 0; + public float ViridVanguardActiveCooldown = 0; + public float ViridVanguardRotationToAdd = 0; public bool sageSpirit = false; public bool fleshBall = false; public bool eyeOfNight = false; @@ -2006,6 +2010,11 @@ namespace CalamityMod.CalPlayer #region ResetEffects public override void ResetEffects() { + ViridVanguardActiveAttackerThisFrame = Main.projectile.Any(x => x.active && x.type == ModContent.ProjectileType() && x.owner == Player.whoAmI && x.ModProjectile().CurrentState == ViridVanguardBlade.ViridVanguardAIState.PhotonRipperZenithSlashes); + ViridVanguardRotation = MathHelper.WrapAngle(ViridVanguardRotation + ViridVanguardRotationToAdd); + ViridVanguardRotationToAdd = ViridVanguard.IdleCirclingSpeed; + if (ViridVanguardActiveCooldown > 0) + ViridVanguardActiveCooldown--; if (fleshKnuckles) Player.statLifeMax2 += 25; @@ -2696,7 +2705,7 @@ namespace CalamityMod.CalPlayer deathstareEyeball = false; witherBlossom = false; flowersOfMortality = false; - ViridVanguard = false; + viridVanguard = false; sageSpirit = false; fleshBall = false; eyeOfNight = false; diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 6c1376707e..254c555923 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -12,21 +13,60 @@ namespace CalamityMod.Items.Weapons.Summon public class ViridVanguard : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public const int HorizontalSlashChargeTime = 14; - public const float HorizontalSlashSpeed = 44f; + #region AI-Related Balancing Properties - public const int VerticalSlashChargeTime = 32; + public static float IdleCirclingSpeed => 0.0375f; + public static float AxeCirclingSpeedMultiplier => 3f; + public static float ActiveAttackCirclingSpeedMultiplier => 10f; - public const float VerticalSlashSpeed = 45f; + //The next three are the amount of times the sword does each attack before moving to the next one + public static int HorizontalSlashAmount => 7; + public static int VerticalPierceAmount => 5; + public static int StabAmount => 6; + /// + /// How long the player must wait after an active ends to start the next one + /// + public static int ActiveAttackCooldown => 300; + public static int ActiveAttackStartup => 90; + public static int ActiveAttackEndlag => 30; + /// + /// How many slashes each vanguard will do during the active + /// + public static int ActiveAttackSlashCount => 4; + #endregion + #region Damage Balancing Properties - public const float VerticalTeleportOffset = 850f; - public const int PierceChargeAttackCycleTime = 44; + //Sage Poison's damage is kept in the Sage Poison file + public static float ActiveAttackSlashDmgMult => 5f; - public const float MaxTargetingDistance = 1550f; + //Note: the following two only apply when not using the active attack + public static float AxeDmgMult => 1.5f; + public static float SwordDmgMult => 1f; + #endregion - public const int ChargesPerAttackCycle = 7; + + + private static Texture2D BladeOutline = null; + public static Texture2D GetBladeOutlineTex() + { + if (BladeOutline == null) + { + var texture = ModContent.Request("CalamityMod/Projectiles/Summon/ViridVanguardBlade").Value; + BladeOutline = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[BladeOutline.Width * BladeOutline.Height]; + var ColorArray = new Color[BladeOutline.Width * BladeOutline.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + BladeOutline.SetData(ColorArray); + } + return BladeOutline; + } public override void SetStaticDefaults() { @@ -52,22 +92,44 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - player.AddBuff(Item.buffType, 2); - var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - minion.originalDamage = Item.damage; - minion.ModProjectile().BladeIndex = player.ownedProjectileCounts[type]; - - int bladeIndex = 0; - foreach (Projectile pro in Main.ActiveProjectiles) + float totalSlots = 0f; + foreach (Projectile p in Main.ActiveProjectiles) { - if (pro.type == type && pro.owner == player.whoAmI) + if (p.minion && p.owner == player.whoAmI) { - pro.ModProjectile().BladeIndex = bladeIndex++; - pro.ModProjectile().AITimer = 0f; - pro.netUpdate = true; + totalSlots += p.minionSlots; + } + } + if (totalSlots >= player.maxMinions) + { + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI && pro.ModProjectile().ActiveTimer == 0) + { + pro.ModProjectile().BeginSuperEpicPhotonRipperZenithKnockoffAttack(); + } + } + } + else + { + player.AddBuff(Item.buffType, 2); + + var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = damage; + minion.ModProjectile().BladeIndex = player.ownedProjectileCounts[type]; + + int bladeIndex = 0; + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI) + { + pro.ModProjectile().BladeIndex = bladeIndex++; + pro.ModProjectile().ActiveTimer = ViridVanguard.ActiveAttackCooldown; + pro.ModProjectile().AITimer = 0f; + pro.netUpdate = true; + } } } return false; @@ -75,6 +137,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). + AddIngredient(). + AddIngredient(). AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index c7d4dbc128..a16a0ca355 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -856,7 +856,15 @@ ViralSprout: { ViridVanguard: { DisplayName: Virid Vanguard - Tooltip: Summons a circular formation of blades that slice nearby enemies to pieces + Tooltip: + ''' + Alternates between summoning axes and swords laced with a powerful poison + Axes orbit the player, dealing high damage at a close range + Swords chase down enemies with extreme position, tearing them to shreds + All weapons inflict Sage Poision, which becomes more powerful the more weapons are summoned + When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor + This effect has a five-second cooldown + ''' } VoidConcentrationStaff: { diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index ce229a590f..28ebe7d1f5 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -1,7 +1,10 @@ using System; +using System.Collections.Generic; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -23,6 +26,10 @@ namespace CalamityMod.Projectiles.Summon HorizontalSlashes, VerticalPierceTeleport, RegularPierceSlashes, + ChargingCircle, + PhotonRipperZenithSlashes, + PhotonRipperZenithEndlag, + AxeCircle, } public int BladeIndex; @@ -31,15 +38,15 @@ namespace CalamityMod.Projectiles.Summon public Vector2 ChargeStartingPosition; + public float BladeAngleForPhripperZenith = 0; + + public int CurrentViridCount => (int)MathHelper.Max(1, Owner.ownedProjectileCounts[Type]); + public float BladeHoverOffsetAngle { get { - float projectileCounts = Owner.ownedProjectileCounts[Type]; - if (projectileCounts <= 1f) - projectileCounts = 1f; - - return MathHelper.TwoPi * BladeIndex / projectileCounts + AITimer / 27f; + return MathHelper.TwoPi * BladeIndex / CurrentViridCount + Owner.Calamity().ViridVanguardRotation; } } @@ -49,15 +56,53 @@ namespace CalamityMod.Projectiles.Summon set => Projectile.ai[0] = (int)value; } + public static List ActiveAttackStateList = new() { ViridVanguardAIState.ChargingCircle, ViridVanguardAIState.PhotonRipperZenithSlashes, ViridVanguardAIState.PhotonRipperZenithEndlag }; + + public Player Owner => Main.player[Projectile.owner]; public ref float AITimer => ref Projectile.ai[1]; + public float ActiveTimer + { + get => Owner.Calamity().ViridVanguardActiveCooldown; + set => Owner.Calamity().ViridVanguardActiveCooldown = value; + } + + public bool IsAxe => BladeIndex % 2 == 0; + + public bool DrawAsAxe => IsInDotRange && CurrentState == ViridVanguardAIState.PhotonRipperZenithSlashes ? !ActiveAttacking : IsAxe; + + bool IsInDotRange = false; + + bool ActiveAttacking = false; + + Vector2 StoredAttackMousePos = Vector2.Zero; + + bool anySlashingBladesThisFrame = false; + public ref float BladeGleamInterpolant => ref Projectile.localAI[0]; + #region AI consts + public const int HorizontalSlashChargeTime = 14; + + public const float HorizontalSlashSpeed = 44f; + + public const int VerticalSlashChargeTime = 32; + + public const float VerticalSlashSpeed = 45f; + + public const float VerticalTeleportOffset = 850f; + + public const int PierceChargeAttackCycleTime = 44; + + public const float MaxTargetingDistance = 1550f; + + + #endregion + public override void SetStaticDefaults() { - Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; @@ -66,8 +111,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 84; - Projectile.height = 84; + Projectile.width = 120; + Projectile.height = 120; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -108,7 +153,7 @@ namespace CalamityMod.Projectiles.Summon if (BladeGleamInterpolant <= 0.02f) BladeGleamInterpolant = 0f; - NPC potentialTarget = Projectile.Center.MinionHoming(ViridVanguard.MaxTargetingDistance, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(MaxTargetingDistance, Owner); switch (CurrentState) { case ViridVanguardAIState.CircleOwner: @@ -123,24 +168,43 @@ namespace CalamityMod.Projectiles.Summon case ViridVanguardAIState.RegularPierceSlashes: DoBehavior_RegularPierceSlashes(potentialTarget); break; + case ViridVanguardAIState.ChargingCircle: + DoBehavior_PhotonRipperZenithStartup(potentialTarget); + break; + case ViridVanguardAIState.PhotonRipperZenithSlashes: + DoBehavior_PhotonRipperZenithActive(potentialTarget); + break; + case ViridVanguardAIState.PhotonRipperZenithEndlag: + DoBehavior_PhotonRipperZenithEndlag(potentialTarget); + break; + case ViridVanguardAIState.AxeCircle: + DoBehavior_AxeCircle(potentialTarget); + break; } AITimer++; + if (CurrentState == ViridVanguardAIState.PhotonRipperZenithEndlag) + Projectile.MaxUpdates = 1; } public void DoBehavior_CircleOwner(NPC potentialTarget) { + //Reset active cooldown if it's in the negative somehow + if (ActiveTimer < 0) + ActiveTimer = ViridVanguard.ActiveAttackCooldown; + // Begin attacking if an enemy is nearby. + var viridAmount = 300f / CurrentViridCount; if (potentialTarget is not null) { - CurrentState = ViridVanguardAIState.HorizontalSlashes; + CurrentState = IsAxe ? ViridVanguardAIState.AxeCircle : ViridVanguardAIState.HorizontalSlashes; AITimer = 0f; Projectile.netUpdate = true; return; } - - Vector2 hoverDestination = Owner.Center + BladeHoverOffsetAngle.ToRotationVector2() * 200f; - Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 16f); + float hoverDistMult = MathHelper.Lerp(IsAxe ? 170 : 200, IsAxe ? 200 : 170, (MathF.Sin(AITimer * 0.06f) + 1) * 0.5f); + Vector2 hoverDestination = Owner.Center + BladeHoverOffsetAngle.ToRotationVector2() * hoverDistMult; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 20f); Projectile.velocity *= 0.8f; // Teleport to the owner if sufficiently far away. @@ -154,10 +218,35 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; } + public void DoBehavior_AxeCircle(NPC potentialTarget) + { + // Begin attacking if an enemy is nearby. + var viridAmount = 300f / CurrentViridCount; + if (potentialTarget is null) + { + ReturnToIdleState(); + return; + } + var offset = MathHelper.TwoPi * MathF.Floor(BladeIndex * 0.5f) / MathF.Ceiling(CurrentViridCount * 0.5f) + Owner.Calamity().ViridVanguardRotation; + Vector2 hoverDestination = Owner.Center + offset.ToRotationVector2() * 200f; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 32f); + Projectile.velocity *= 0.8f; + + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 2500f)) + { + Projectile.Center = hoverDestination; + Projectile.netUpdate = true; + } + Owner.Calamity().ViridVanguardRotationToAdd = ViridVanguard.IdleCirclingSpeed * MathHelper.SmoothStep(1f, ViridVanguard.AxeCirclingSpeedMultiplier, AITimer / 150f); + // Aim away from the target. + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + } + public void DoBehavior_HorizontalSlashes(NPC target) { int hoverTime = 22; - int chargeTime = ViridVanguard.HorizontalSlashChargeTime; + int chargeTime = HorizontalSlashChargeTime; // Exit the attack state if the blade no longer has a valid target. if (target is null) @@ -197,15 +286,15 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Pitch = 1.6f, Volume = 0.27f }, Projectile.Center); Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - Projectile.velocity = Vector2.UnitX * (target.Center.X > Projectile.Center.X).ToDirectionInt() * ViridVanguard.HorizontalSlashSpeed; + Projectile.velocity = Vector2.UnitX * (target.Center.X > Projectile.Center.X).ToDirectionInt() * HorizontalSlashSpeed; Projectile.netUpdate = true; } // Switch to the next attack state once enough charges have happened. - if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.ChargesPerAttackCycle) + if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.HorizontalSlashAmount) { AITimer = 0f; - CurrentState = ViridVanguardAIState.VerticalPierceTeleport; + CurrentState = false ? ViridVanguardAIState.VerticalPierceTeleport : ViridVanguardAIState.RegularPierceSlashes; Projectile.netUpdate = true; } } @@ -213,7 +302,7 @@ namespace CalamityMod.Projectiles.Summon public void DoBehavior_VerticalPierceTeleport(NPC target) { int hoverTime = 26; - int chargeTime = ViridVanguard.VerticalSlashChargeTime; + int chargeTime = VerticalSlashChargeTime; // Exit the attack state if the blade no longer has a valid target. if (target is null) @@ -250,30 +339,30 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Pitch = 1.6f, Volume = 0.27f }, Projectile.Center); Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - Projectile.velocity = Vector2.UnitY * ViridVanguard.VerticalSlashSpeed; + Projectile.velocity = Vector2.UnitY * VerticalSlashSpeed; Projectile.netUpdate = true; } // Teleport above the target once sufficiently far below them. - if (wrappedAttackTimer >= hoverTime + 5f && Projectile.Center.Y > target.Center.Y + ViridVanguard.VerticalTeleportOffset) + if (wrappedAttackTimer >= hoverTime + 5f && Projectile.Center.Y > target.Center.Y + VerticalTeleportOffset) { Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - Projectile.Center = target.Center - Vector2.UnitY * ViridVanguard.VerticalTeleportOffset * 0.7f; + Projectile.Center = target.Center - Vector2.UnitY * VerticalTeleportOffset * 0.7f; Projectile.netUpdate = true; } // Switch to the next attack state once enough charges have happened. - if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.ChargesPerAttackCycle) + if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.VerticalPierceAmount) { AITimer = 0f; - CurrentState = ViridVanguardAIState.RegularPierceSlashes; + CurrentState = ViridVanguardAIState.HorizontalSlashes; Projectile.netUpdate = true; } } public void DoBehavior_RegularPierceSlashes(NPC target) { - int attackCycleTime = ViridVanguard.PierceChargeAttackCycleTime; + int attackCycleTime = PierceChargeAttackCycleTime; float upwardRiseTimeRatio = 0.4f; float pierceTimeRatio = 0.14f; @@ -286,14 +375,13 @@ namespace CalamityMod.Projectiles.Summon } // Initialize the starting position on the first frame. - int localAITimer = (int)AITimer + Projectile.identity; - if (localAITimer % attackCycleTime == 1f) + if (AITimer % attackCycleTime == 1f) { ChargeStartingPosition = Projectile.Center + Main.rand.NextVector2Circular(80f, 80f); Projectile.netUpdate = true; } - float attackCompletion = localAITimer / (float)attackCycleTime % 1f; + float attackCompletion = AITimer / (float)attackCycleTime % 1f; // Reset the trail point array if aiming at the target. if (attackCompletion < upwardRiseTimeRatio) @@ -323,21 +411,138 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Vector2.Zero; // Play a slice sound once ready to charge. - if (localAITimer % attackCycleTime == (int)(attackCycleTime * upwardRiseTimeRatio)) + if (AITimer % attackCycleTime == (int)(attackCycleTime * upwardRiseTimeRatio)) SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Pitch = 1.6f, Volume = 0.27f }, Projectile.Center); // Switch to the next attack state once enough charges have happened. - if (localAITimer >= attackCycleTime * ViridVanguard.ChargesPerAttackCycle) + if (AITimer >= attackCycleTime * ViridVanguard.StabAmount) { AITimer = 0f; - CurrentState = ViridVanguardAIState.HorizontalSlashes; + CurrentState = ViridVanguardAIState.VerticalPierceTeleport; Projectile.netUpdate = true; } } + public void DoBehavior_PhotonRipperZenithStartup(NPC target) + { + Projectile.MaxUpdates = 2; + float completion = AITimer / (ViridVanguard.ActiveAttackStartup * (float)Projectile.MaxUpdates); + Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); + //Projectile.Center = hoverDestination; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, MathHelper.Lerp(16f, 64f, completion)); + Projectile.velocity *= 0.8f; + Owner.Calamity().ViridVanguardRotationToAdd = MathHelper.Lerp(1, ViridVanguard.ActiveAttackCirclingSpeedMultiplier, completion) * ViridVanguard.IdleCirclingSpeed; + BladeAngleForPhripperZenith += Owner.Calamity().ViridVanguardRotationToAdd / Projectile.MaxUpdates; + ActiveTimer = -1; + IsInDotRange = false; + + if (completion >= 1f) + { + CurrentState = ViridVanguardAIState.PhotonRipperZenithSlashes; + Projectile.netUpdate = true; + } + + // Aim away from the target. + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + } + public void DoBehavior_PhotonRipperZenithActive(NPC target) + { + Projectile.MaxUpdates = 2; + Vector2 angleToMouse = Owner.DirectionTo(IsInDotRange ? StoredAttackMousePos : Owner.Calamity().mouseWorld); + + float dotResult = Vector2.Dot(angleToMouse, BladeAngleForPhripperZenith.ToRotationVector2()); + + if (dotResult < -0.5f) + { + IsInDotRange = false; + ActiveAttacking = false; + } + else if (!IsInDotRange) + { + IsInDotRange = true; + StoredAttackMousePos = Owner.Calamity().mouseWorld; + ActiveTimer--; + + if (ActiveTimer % 2 == 0) + { + ActiveAttacking = true; + Projectile.ResetLocalNPCHitImmunity(); + } + } + dotResult += 1f; + dotResult /= 2f; + if (!ActiveAttacking) + { + Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * 116f; + Projectile.Center = hoverDestination; + Projectile.velocity *= 0.8f; + + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + if ((ActiveTimer < -2 * ViridVanguard.ActiveAttackSlashCount * CurrentViridCount || ActiveTimer > 0) && Projectile.FinalExtraUpdate()) + { + CurrentState = ViridVanguardAIState.PhotonRipperZenithEndlag; + ActiveTimer = ViridVanguard.ActiveAttackCooldown; + AITimer = 0; + } + } + else + { + float distance = Owner.Distance(StoredAttackMousePos); + float endSize = MathHelper.Clamp(distance * 0.25f, 164f, 300f); + Vector2 hoverCenter = Vector2.Lerp(Owner.Center, Owner.Center + Owner.Center.DirectionTo(StoredAttackMousePos) * (distance > 164 ? distance - endSize : 0), dotResult); + Vector2 finalHoverDestination = hoverCenter + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(116f, endSize, dotResult); + Projectile.Center = finalHoverDestination; + Projectile.velocity *= 0.8f; + Projectile.rotation = Projectile.AngleFrom(hoverCenter) + MathHelper.PiOver2; + } + + Owner.Calamity().ViridVanguardRotationToAdd = ViridVanguard.ActiveAttackCirclingSpeedMultiplier * ViridVanguard.IdleCirclingSpeed; + BladeAngleForPhripperZenith += Owner.Calamity().ViridVanguardRotationToAdd / Projectile.MaxUpdates; + + } + public void DoBehavior_PhotonRipperZenithEndlag(NPC target) + { + + Projectile.MaxUpdates = 1; + float completion = 1 - AITimer / (ViridVanguard.ActiveAttackEndlag * (float)Projectile.MaxUpdates); + if (Owner.Calamity().ViridVanguardActiveAttackerThisFrame) + { + AITimer = 0; + ActiveTimer = ViridVanguard.ActiveAttackCooldown; + completion = 1; + } + Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); + Projectile.Center = hoverDestination; + //Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, MathHelper.Lerp(16f,64f,completion)); + Projectile.velocity *= 0.8f; + Owner.Calamity().ViridVanguardRotationToAdd = MathHelper.Lerp(1, ViridVanguard.ActiveAttackCirclingSpeedMultiplier, completion) * ViridVanguard.IdleCirclingSpeed; + BladeAngleForPhripperZenith += Owner.Calamity().ViridVanguardRotationToAdd / Projectile.MaxUpdates; + + if (completion <= 0f) + { + ReturnToIdleState(); + Owner.Calamity().ViridVanguardRotation += MathHelper.WrapAngle(BladeAngleForPhripperZenith - BladeHoverOffsetAngle); //This will cause the proper rotation to be kept on completion + Projectile.netUpdate = true; + } + + // Aim away from the target. + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + } + + public void BeginSuperEpicPhotonRipperZenithKnockoffAttack() + { + + if (CurrentState != ViridVanguardAIState.CircleOwner) + AITimer = 0f; + BladeAngleForPhripperZenith = BladeHoverOffsetAngle; + CurrentState = ViridVanguardAIState.ChargingCircle; + AITimer = 0f; + Projectile.netUpdate = true; + } public void ReturnToIdleState() { AITimer = 0f; + Projectile.extraUpdates = 0; CurrentState = ViridVanguardAIState.CircleOwner; Projectile.netUpdate = true; } @@ -348,25 +553,51 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.type == ModContent.ProjectileType()) { if (Owner.dead) - Owner.Calamity().ViridVanguard = false; + Owner.Calamity().viridVanguard = false; - if (Owner.Calamity().ViridVanguard) + if (Owner.Calamity().viridVanguard) Projectile.timeLeft = 2; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.Calamity().sagePoisonDamage = (int)(SagePoison.debuffData.EnemyLostRegen * SagePoison.ViridVanguardPoisonMultiplier * CurrentViridCount); + target.AddBuff(ModContent.BuffType(), 60); + if (ActiveAttacking) + { + Vector2 vel = new Vector2(0.1f, 0.1f).RotatedByRandom(100); + VoidSparkParticle spark2 = new VoidSparkParticle(target.Center, vel, false, 9, Main.rand.NextFloat(0.25f, 0.35f), Main.rand.NextBool() ? Color.LimeGreen : Color.Goldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound with { Volume = CommonCalamitySounds.SwiftSliceSound.Volume * 0.3f, MaxInstances = 0 }, Projectile.Center); + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + //Deals massively increased damage during the active attack + if (ActiveAttacking) + modifiers.SourceDamage *= ViridVanguard.ActiveAttackSlashDmgMult; + //when not using the active, deal the right amount of damage for the swords vs axes + else if (!ActiveAttackStateList.Contains(CurrentState)) + if (IsAxe) + modifiers.SourceDamage *= ViridVanguard.AxeDmgMult; + else + modifiers.SourceDamage *= ViridVanguard.SwordDmgMult; + } + public Color TrailColorFunction(float completionRatio) { - float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * (CurrentState == ViridVanguardAIState.CircleOwner ? 0.3f : 0.48f); return Color.Lerp(new(115, 196, 127), Color.Yellow, MathHelper.Clamp(completionRatio * 1.4f, 0f, 1f)) * opacity; } - public float TrailWidthFunction(float completionRatio) => Projectile.height * (1f - completionRatio) * 0.8f; + public float TrailWidthFunction(float completionRatio) => Projectile.height * (1f - completionRatio) * (DrawAsAxe ? 0.6f : 0.8f); public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle frame = texture.Frame(2, 1, DrawAsAxe ? 0 : 1, 0); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; @@ -381,19 +612,35 @@ namespace CalamityMod.Projectiles.Summon TrailDrawer.DrawTrail(); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - // Draw the blade. - Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation + 0.2f, origin, Projectile.scale, direction, 0); + // Draw the blade.// Draw the blade. + float outlineOpacity = 1; + float outlineWidth = 1; + Color outlineColor = Color.LimeGreen; + if (!(ActiveAttackStateList.Contains(CurrentState) && ActiveTimer > 0)) + { + outlineWidth = Math.Clamp(MathF.Pow(1 - ActiveTimer / ViridVanguard.ActiveAttackCooldown, 3), 0, 1); + outlineOpacity = 0.75f; + } + var outlineTex = ViridVanguard.GetBladeOutlineTex(); + var rotation = Projectile.rotation + (DrawAsAxe ? -0.2f : 0.2f); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(2, 0) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, 2) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(-2, 0) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, -2) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0); // Draw the gleam at the tip of the blade. - Texture2D shineTex = ModContent.Request("CalamityMod/Particles/HalfStar").Value; - Vector2 shineScale = new Vector2(1.67f, 3f) * Projectile.scale; - shineScale *= MathHelper.Lerp(0.9f, 1.1f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.4f + Projectile.identity) * 0.5f + 0.5f); - - Vector2 lensFlareWorldPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Projectile.width * Projectile.scale * 0.88f; - Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Yellow, 0.23f) with { A = 0 } * BladeGleamInterpolant; - Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, 0f, shineTex.Size() * 0.5f, shineScale * 0.6f, 0, 0); - Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, MathHelper.PiOver2, shineTex.Size() * 0.5f, shineScale, 0, 0); + if (ActiveTimer <= 0) + { + Texture2D shineTex = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + Vector2 shineScale = new Vector2(1.67f, 3f) * Projectile.scale; + shineScale *= MathHelper.Lerp(0.9f, 1.1f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.4f + Projectile.identity) * 0.5f + 0.5f); + Vector2 lensFlareWorldPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Projectile.width * Projectile.scale * 0.88f; + Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Yellow, 0.23f) with { A = 0 } * BladeGleamInterpolant; + Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, 0f, shineTex.Size() * 0.5f, shineScale * 0.6f, 0, 0); + Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, MathHelper.PiOver2, shineTex.Size() * 0.5f, shineScale, 0, 0); + } // Reset textures for shaders, since they're only defined once at load-time in vanilla. GameShaders.Misc["EmpressBlade"].UseImage0("Images/Extra_209"); GameShaders.Misc["EmpressBlade"].UseImage1("Images/Extra_210"); diff --git a/Projectiles/Summon/ViridVanguardBlade.png b/Projectiles/Summon/ViridVanguardBlade.png index e2cbaf204065d350318d6fed2d1b8a0483ac6865..6621e5b1c6d9a485ca78784ba46dd68451622e76 100644 GIT binary patch delta 1980 zcmZ8ieLT}^8~@E-ytIih%pQbLUYfVHP@ZIJiX)4><@~%2nMJ6H*@jA#atJ3XK})%QgV4&I_STdlaw zc_WVKwS&CVE`njZJDv(nSX$XYaYyP0arsF*c0T~<_QQBq8_DXorpb_ z2n5HbFtVJ3$OkPwoL!trW+}h_0QK+_!znZhWecDM9gqMHh6G>`3V__~Z~Wzk_AvNY zUIW4|FbzNt%8`(#oI!l$k3bkQHn4mg2E2q`^1u9lTLGwaQ4>Hwy#!Y`0<8Wo*)J=R z^?ylKLimemK*AbdJ43dUAoTZ?3xV*ZDrR8w0;n(X0D$tN`0YB#j8T4H`W^c^QI8xu zNZ?qkeSQ#lrB10u04+luIxlrhE&bGN{Vk(6f&bw(crY|{bXsPSeRy)Gmp8>WJ(R_| zqB;3?a`LTUdU`=9Pqe7BF{t4#2(?%{RPWy95JY|0+dndTSHL2gxR= z@(q}Mrk3vTTAKPzANaVJE&H$UC9SI^KaM4}8A)Hg|0Tt>U`S8)n<+us0=s*wF5it5 zp`%jH^PQ?<_mtk~INIBif*UH_x*i{=61$_UCzs;lgxvNm$gTPc?*1D&WqxR%BTlj= zzDAS|)ALfT$L%{b?WPxu@Hap7M5luhcd8ZB@-(6v37x zJd8E3$`Ad)kQ(J;7j9f((RO9F`B?B?tlpr8E(tSLCJ4!Q#@n++Kn1NqZD?g?gYb8>6|O~4S9`44SI(pdh@QK%>STD!_XBQCJyEDipbY{5IAb; zoTiLuXn!{CL*DRlEy-monIw%yZ@)KVuW_^;F(uUXK}llH#a-p6MQycRtk&>14@^7| z5jG{7m@eJ)Yb4xIIdQ5IZcA}!YPUkr8n4gPG<2}p`Hfs&VURL3 z)W@ejhd5XTNOUv)d3GRvueIPnO})IUc^FfM(suL^yM@Qmx6+Z!{L10=wvT)@@4aL8 z;tPgWOA6yh9NJcJtthuoI~XPn_>+( zxUog=x6ZuRB+c*Jz9z(ag9@Ymy0pu_A7g5rO+756*XZW+l*K!-W9X!dMf2#w)6b|4 zD+TO7%06X_;oj)+AgjUMJ5MRC1?GsBA#*DWX5Nb6n*3q1oO+#G6s8Ul zAoLz>G*ub05RL;*4U2GfpE?h$;D-Os4*WTrbB5b|uXdJdlj<=lhdq{6%eia@(AL#)C|QU2U-v zzUoPTqTDLOz>3l5SVhH!08A60S4p^ijpANF78-;T?DHg2HeJ=B;T)`{P)1Y0+=K8qj zvy#q&`}pGMN!;rt(6HccT9fIq!t)C&YXi{$b=|9vLq1D+Wtr3PZY0tKpFS`@tq%Sc zRRfsEO)sMTc^z_AJbR~A|8Dx;fR7-)dRTODi%B;hheEvh*nL>_LW0%y960W1T=sy| zis`lCCG(Lb_K|1DvK!7XP~F4J(;V=sBiqRds8kmr`h{zl&X{4jh65k0svJw?J_KKl zwJJUep0)~-Z<}9jl#U?bp-0Axx1nV(pCuU9h~%^KnS;*k8j9f53_auK8HaQg7Cdr?sdWX|O!mk;HgXwGR7_#J5b#ZYP5kaVE8>2O(oFp2)Wu zh!x1@<_e6=8f21?=h(W{hJkT!LW(+A1)P&678q4wFN_&d!x>l2Vu_+|rPiuc(P^&; zwIca0vAe^(pJZAkd)+i1icCx7%@jFVw2d|r_(epwDa=~r&-><|+Q@alsOdXnk4uV2 z4}4QTiH&q61r%eui031SCS8b?BWVrIg(=J^-`2SU!NsE)-z-({slbQ1#m@{o5tey-5SEArE^CfiIFLH~RLYvhJB zHDb_15TrhNKW4F_Z`=3p>N28XZBnqB5zy4`2k%STFUNr`3xgvQfeB`|uIw$Ia!-)a zpPsN__pACACx6SPSsZw3kc0VGd00T@(L_t(&L(SKX(wZ<3g<*(-K@ji%Zp-UoCu%8TvT?dI{=q)Z z`8EOD=Ke)BOFdp6pAJ?AYMQqF4GN)cL*QLqM7ZA|!uVHh!4>iI zY>0^ZlC{AV5hx+Xe_#-q$Q~fb?lvk!F|v&`hC|!vOQa3Ug8^8)=Wu?A7DH?zzNQ}H zPY)qR!YQyfQiHZaAAe|5tE&@GHXB<6<*2cl8&UPn=mp2v_7?_WpZfkcSY zb^LJJ5B1K-zeEZmqHwgw2vI;kM6-$(U4D#$?W7}r4I&dgN25WArH%3Z;wVL&;AfLY z4Ph7ngydWbSc1efbP%mT0`kxqFT?;W21`2(*DIGir9t^1F$*{>72|a&f1W{{@k00e zIEq2k-uHr_jgeDXNQ^-%lmZIzb;f+qII4M?Zfn78L3|KEMH|ICF^${{rAYi|L9xWH zS2i(7tP~MY5Y+e6#3vz*!UC2f4TBaT+IbFvfQ*98?1f@fERBS4)6{i*5r~`IaxYlB z*UCUdW4nqd9uG!M5sy)Lf1ulKp1F0=I<3WU67fPbaj|O{d}b?gW@$~e_CM-NLg-LofsT z=?;Mv1Ksa`01hZzC@7Bo4gdfE07*qoM6N<$ Eg58s??*IS* From 2dc829844ba5b0e0582c513b317451019db57914 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 18 Sep 2025 11:42:04 -0500 Subject: [PATCH 08/13] oops missed some cleanup --- Projectiles/Summon/ViridVanguardBlade.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index 28ebe7d1f5..89f9ffac80 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Summon ChargingCircle, PhotonRipperZenithSlashes, PhotonRipperZenithEndlag, - AxeCircle, + AxeCircle } public int BladeIndex; @@ -79,8 +79,6 @@ namespace CalamityMod.Projectiles.Summon Vector2 StoredAttackMousePos = Vector2.Zero; - bool anySlashingBladesThisFrame = false; - public ref float BladeGleamInterpolant => ref Projectile.localAI[0]; #region AI consts From ce0e38c008c7f23fab9aae7bcf6963ce8fae27be Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 18 Sep 2025 13:53:33 -0500 Subject: [PATCH 09/13] balancing --- Buffs/DamageOverTime/SagePoison.cs | 2 +- CalPlayer/CalamityPlayer.cs | 10 ++++++++-- Items/Weapons/Summon/ViridVanguard.cs | 5 ++--- .../en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson | 6 +++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index ae70da14e7..27cbd603f0 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.DamageOverTime NPCLifeRegenMethod = SagePoisonPower }; - public static float ViridVanguardPoisonMultiplier => 3; + public static float ViridVanguardPoisonMultiplier => 2; public static void SagePoisonPower(NPC npc, int buffType, ref int buffIndex, ref int damage) { // The base DoT is multiplied by the amount of Viral Sprouts you have when applied diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index fb007455a1..362ad4acfc 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2013,8 +2013,14 @@ namespace CalamityMod.CalPlayer ViridVanguardActiveAttackerThisFrame = Main.projectile.Any(x => x.active && x.type == ModContent.ProjectileType() && x.owner == Player.whoAmI && x.ModProjectile().CurrentState == ViridVanguardBlade.ViridVanguardAIState.PhotonRipperZenithSlashes); ViridVanguardRotation = MathHelper.WrapAngle(ViridVanguardRotation + ViridVanguardRotationToAdd); ViridVanguardRotationToAdd = ViridVanguard.IdleCirclingSpeed; - if (ViridVanguardActiveCooldown > 0) - ViridVanguardActiveCooldown--; + + if (Player.HeldItem.type == ModContent.ItemType()) + { + if (ViridVanguardActiveCooldown > 0) + ViridVanguardActiveCooldown--; + } + else if (ViridVanguardActiveCooldown >= 0 && ViridVanguardActiveCooldown < ViridVanguard.ActiveAttackCooldown) + ViridVanguardActiveCooldown++; if (fleshKnuckles) Player.statLifeMax2 += 25; diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 254c555923..2c7217deb6 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon public static float ActiveAttackSlashDmgMult => 5f; //Note: the following two only apply when not using the active attack - public static float AxeDmgMult => 1.5f; + public static float AxeDmgMult => 1.25f; public static float SwordDmgMult => 1f; #endregion @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 26; Item.height = 36; - Item.damage = 73; + Item.damage = 60; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.useAnimation = Item.useTime = 14; @@ -117,7 +117,6 @@ namespace CalamityMod.Items.Weapons.Summon player.AddBuff(Item.buffType, 2); var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - minion.originalDamage = damage; minion.ModProjectile().BladeIndex = player.ownedProjectileCounts[type]; int bladeIndex = 0; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index a16a0ca355..5d1c69cecb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -858,12 +858,12 @@ ViridVanguard: { DisplayName: Virid Vanguard Tooltip: ''' - Alternates between summoning axes and swords laced with a powerful poison + Alternates between summoning axes and swords, both laced with a powerful poison Axes orbit the player, dealing high damage at a close range - Swords chase down enemies with extreme position, tearing them to shreds + Swords chase down enemies with extreme precision, tearing them to shreds All weapons inflict Sage Poision, which becomes more powerful the more weapons are summoned When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor - This effect has a five-second cooldown + This ability has a five-second cooldown that requires holding this item ''' } From 8141e7622968689b4ebdd97671bec2342ce883ef Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 18 Sep 2025 14:39:50 -0500 Subject: [PATCH 10/13] typo --- Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 5d1c69cecb..174b0909cb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -861,7 +861,7 @@ ViridVanguard: { Alternates between summoning axes and swords, both laced with a powerful poison Axes orbit the player, dealing high damage at a close range Swords chase down enemies with extreme precision, tearing them to shreds - All weapons inflict Sage Poision, which becomes more powerful the more weapons are summoned + All weapons inflict Sage Poison, which becomes more powerful the more weapons are summoned When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor This ability has a five-second cooldown that requires holding this item ''' From 22123bacff810854c36056b5b3c1f940f0fb99d7 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Thu, 18 Sep 2025 23:04:05 -0400 Subject: [PATCH 11/13] fix doubled comment in virid vanguard --- Projectiles/Summon/ViridVanguardBlade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index 89f9ffac80..77e9cfcae4 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -610,7 +610,7 @@ namespace CalamityMod.Projectiles.Summon TrailDrawer.DrawTrail(); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - // Draw the blade.// Draw the blade. + // Draw the blade. float outlineOpacity = 1; float outlineWidth = 1; Color outlineColor = Color.LimeGreen; From d501bae6082dbce6a9ed08afb12ccb920559c46c Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 18 Sep 2025 22:12:41 -0500 Subject: [PATCH 12/13] requested changes --- Projectiles/Summon/ViridVanguardBlade.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index 77e9cfcae4..eec31f918a 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -292,7 +292,7 @@ namespace CalamityMod.Projectiles.Summon if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.HorizontalSlashAmount) { AITimer = 0f; - CurrentState = false ? ViridVanguardAIState.VerticalPierceTeleport : ViridVanguardAIState.RegularPierceSlashes; + CurrentState = ViridVanguardAIState.RegularPierceSlashes; Projectile.netUpdate = true; } } @@ -426,7 +426,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.MaxUpdates = 2; float completion = AITimer / (ViridVanguard.ActiveAttackStartup * (float)Projectile.MaxUpdates); Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); - //Projectile.Center = hoverDestination; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, MathHelper.Lerp(16f, 64f, completion)); Projectile.velocity *= 0.8f; Owner.Calamity().ViridVanguardRotationToAdd = MathHelper.Lerp(1, ViridVanguard.ActiveAttackCirclingSpeedMultiplier, completion) * ViridVanguard.IdleCirclingSpeed; @@ -511,7 +511,6 @@ namespace CalamityMod.Projectiles.Summon } Vector2 hoverDestination = Owner.Center + BladeAngleForPhripperZenith.ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); Projectile.Center = hoverDestination; - //Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, MathHelper.Lerp(16f,64f,completion)); Projectile.velocity *= 0.8f; Owner.Calamity().ViridVanguardRotationToAdd = MathHelper.Lerp(1, ViridVanguard.ActiveAttackCirclingSpeedMultiplier, completion) * ViridVanguard.IdleCirclingSpeed; BladeAngleForPhripperZenith += Owner.Calamity().ViridVanguardRotationToAdd / Projectile.MaxUpdates; From 67ecbccf79a0ad240dae1e1a00ac976ccd736686 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 11 Sep 2025 19:13:15 -0500 Subject: [PATCH 13/13] bugfixes --- NPCs/DevourerofGods/DevourerofGodsBody.cs | 13 +++++++------ NPCs/DevourerofGods/DevourerofGodsHead.cs | 7 ++----- NPCs/DevourerofGods/DevourerofGodsTail.cs | 18 +++++++----------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index e612aa2d03..6b71d81ddb 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.DevourerofGods global.unbreakableDR = true; NPC.chaseable = false; } - NPC.LifeMaxNERB(750000, 900000, 1500000); + NPC.LifeMaxNERB(760000, 910000, 1500000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -149,19 +149,20 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - if (NPC.life > Main.npc[(int)NPC.ai[1]].life) - NPC.life = Main.npc[(int)NPC.ai[1]].life; + NPC.life = Main.npc[(int)NPC.ai[2]].life; + NPC.lifeMax = Main.npc[(int)NPC.ai[2]].lifeMax;NPC.life = NPC.lifeMax; // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; + float lifeRatio = Main.npc[(int)NPC.ai[2]].life / (float)Main.npc[(int)NPC.ai[2]].lifeMax; bool phase2 = lifeRatio < 0.65f; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (phase2) + if (phase2 && !phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60) { + phase2Started = true; // Once before DoG spawns, set new size @@ -264,7 +265,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Decide segment offset stuff. NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; - NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * (phase2Started ? 80 : NPC.width ); NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); // Velocity variables diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index f1e0a49651..2ca5af73be 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -42,11 +42,9 @@ using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; using Terraria.GameContent.ItemDropRules; -using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using static System.Net.Mime.MediaTypeNames; namespace CalamityMod.NPCs.DevourerofGods { @@ -289,6 +287,8 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToSickness = false; + + NPC.life = NPC.lifeMax; } public override void BossHeadSlot(ref int index) @@ -536,9 +536,6 @@ namespace CalamityMod.NPCs.DevourerofGods // Continuously reset certain things. AttemptingToEnterPortal = false; - // Worm variable - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; // Despawn if (player.dead) diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 5ab1ead78d..7e785a3b8e 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.width = 66; NPC.height = 66; NPC.defense = 50; - NPC.LifeMaxNERB(750000, 900000, 1500000); + NPC.LifeMaxNERB(760000, 910000, 1500000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -152,30 +152,26 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - if (NPC.life > Main.npc[(int)NPC.ai[1]].life) - NPC.life = Main.npc[(int)NPC.ai[1]].life; + NPC.life = Main.npc[(int)NPC.ai[2]].life; + NPC.lifeMax = Main.npc[(int)NPC.ai[2]].lifeMax; + // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; + float lifeRatio = Main.npc[(int)NPC.ai[2]].life / (float)Main.npc[(int)NPC.ai[2]].lifeMax; bool phase2 = lifeRatio < 0.65f; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (phase2) + if (phase2 && !phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60) { phase2Started = true; - - // Once before DoG spawns, set new size - if (Main.npc[(int)NPC.ai[2]].localAI[2] == 60f) - { NPC.position = NPC.Center; NPC.width = (int)(80 * NPC.scale); - NPC.height = (int)(140 * NPC.scale); + NPC.height = (int)(80 * NPC.scale); NPC.frame = new Rectangle(0, 0, 86, 148); NPC.position -= NPC.Size * 0.5f; NPC.ForceNetUpdate(false); - } } if (invinceTime > 0)