diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 86ead7d4ea..aa889bdab6 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -17,11 +17,10 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 66; Item.height = 64; - Item.damage = 228; + Item.damage = 238; Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); - Item.useTime = 26; - Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; @@ -36,7 +35,6 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; - public override float StealthDamageMultiplier => 1.3f; public override void UseStyle(Player player, Rectangle heldItemFrame) { ExtraArmAnimations.ThrowArmAnimationFast(player, Item); diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index 2adfadd300..25eeaac9d0 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 120; - Item.damage = 332; + Item.damage = 240; Item.knockBack = 8.5f; - Item.useAnimation = Item.useTime = 55; + Item.useAnimation = Item.useTime = 40; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; Item.shootSpeed = 18f; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 0.25f; + public override float StealthDamageMultiplier => 0.3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -38,14 +38,13 @@ namespace CalamityMod.Items.Weapons.Rogue //If stealth is full, shoot a spread of 3 shurikens if (p.StealthStrikeAvailable()) { - int spread = 30; - for (int i = 0; i < 3; i++) + int spread = 20; + for (int i = -1; i <= 1; i++) { - Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread)); + Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread * i)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI, 0f, 1f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; - spread -= 30; } return false; } diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index 99a9d10b37..1bb816ab4a 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -12,12 +12,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 34; - Item.damage = 41; + Item.damage = 38; + Item.useAnimation = Item.useTime = 9; + Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 9; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 9; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -27,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.3f; + public override float StealthDamageMultiplier => 1f; public override float StealthVelocityMultiplier => 1.25f; @@ -42,9 +41,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; Main.projectile[stealth].aiStyle = -1; Main.projectile[stealth].extraUpdates = 1; + Main.projectile[stealth].localNPCHitCooldown = -1; } return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index dce54256c3..d45abb39ec 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -3,6 +3,7 @@ AcidBarrelDrop.DisplayName: Barrel Acid Drop AcidShrapnel.DisplayName: Acidic Shrapnel AdamantiteThrowingAxeProjectile.DisplayName: Adamantite Throwing Axe AntumbraShardProjectile.DisplayName: Antumbra Shard +ApoctolithExplosion.DisplayName: Apoctolith Boom ApoctolithProj.DisplayName: Apoctolith ApoctolithShard.DisplayName: Apoctolith Shard AshenStalactiteDebris.DisplayName: Ashen Debris diff --git a/Projectiles/Rogue/ApoctolithExplosion.cs b/Projectiles/Rogue/ApoctolithExplosion.cs new file mode 100644 index 0000000000..2016e7b790 --- /dev/null +++ b/Projectiles/Rogue/ApoctolithExplosion.cs @@ -0,0 +1,47 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ApoctolithExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 300; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Projectile.ai[0] == 0f) + { + float screenShakePower = 7 * Utils.GetLerpValue(1300f, 0f, Projectile.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + + CustomPulse blastRing1 = new(Projectile.Center, Vector2.Zero, Color.Blue, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f, 0.35f, 15); + GeneralParticleHandler.SpawnParticle(blastRing1); + + CustomPulse blastRing2 = new(Projectile.Center, Vector2.Zero, Color.Blue, "CalamityMod/Particles/FlameExplosion", new(1f, 0.5f), 0, 0.05f, 0.35f, 20); + GeneralParticleHandler.SpawnParticle(blastRing2); + + Projectile.ai[0] = 1f; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); + } +} diff --git a/Projectiles/Rogue/ApoctolithProj.cs b/Projectiles/Rogue/ApoctolithProj.cs index 6952d4915d..590be93ddb 100644 --- a/Projectiles/Rogue/ApoctolithProj.cs +++ b/Projectiles/Rogue/ApoctolithProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue public static Color LowBlueColor => Color.Blue; public static Color HighBlueColor => Color.DodgerBlue; - public int ShardDamage => (int)(Projectile.damage * 0.12f); + public int ShardDamage => (int)(Projectile.damage * 0.15f); public int ExplosionDamage => (int)(Projectile.damage * 0.5f); public int ExplosionRadius => 150; @@ -98,92 +98,35 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - #region Long convoluted particle code - - if (Projectile.Calamity().stealthStrike) - { - float screenShakePower = 7 * Utils.GetLerpValue(1300f, 0f, Projectile.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - - Particle blastRing = new CustomPulse( - Projectile.Center, - Vector2.Zero, - Projectile.Calamity().stealthStrike ? Color.Black : LowBlueColor, - "CalamityMod/Particles/FlameExplosion", - Vector2.One, - Main.rand.NextFloat(-10, 10), - 0.05f, - Projectile.Calamity().stealthStrike ? 0.5f : 0.2f, - 15); - GeneralParticleHandler.SpawnParticle(blastRing); - - Particle blastRing1 = new CustomPulse( - Projectile.Center, - Vector2.Zero, - LowBlueColor, - "CalamityMod/Particles/FlameExplosion", - Vector2.One, - Main.rand.NextFloat(-10, 10), - 0.05f, - 0.35f, - 15); - GeneralParticleHandler.SpawnParticle(blastRing1); - - Particle blastRing2 = new CustomPulse( - Projectile.Center, - Vector2.Zero, - LowBlueColor, - "CalamityMod/Particles/FlameExplosion", - new(1f, 0.5f), - 0, - 0.05f, - 0.35f, - 20); - GeneralParticleHandler.SpawnParticle(blastRing2); - } - GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, LowBlueColor, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 1f, 0f, 25)); GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", Vector2.One, 0f, 0.5f, 0f, 15)); for (int i = 0; i < 5; i++) GeneralParticleHandler.SpawnParticle(new BloodParticle2(Projectile.Center, new Vector2(Main.rand.NextFloat(6, 12), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)), 12, Main.rand.NextFloat(0.2f, 0.8f), HighBlueColor)); - GlowSparkParticle gs = new GlowSparkParticle(Projectile.Center, Vector2.Zero, false, 20, Projectile.Calamity().stealthStrike ? 0.06f : 0.03f, HighBlueColor, Vector2.One, true); + GlowSparkParticle gs = new(Projectile.Center, Vector2.Zero, false, 20, Projectile.Calamity().stealthStrike ? 0.06f : 0.03f, HighBlueColor, Vector2.One, true); gs.Rotation = Main.rand.NextFloat(-10, 10); - GeneralParticleHandler.SpawnParticle(gs); - #endregion - // Sounds - SoundEngine.PlaySound(AbyssGravel.MineSound, Projectile.position); SoundEngine.PlaySound(GiantClam.SlamSound, Projectile.position); SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode.WithPitchOffset(0.5f), Projectile.position); if (Projectile.Calamity().stealthStrike) SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/MineralMortarExplode"), Projectile.position); - // This only triggers if stealth is full - if (Projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) { - // Explosion damage + // Explosion + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), ExplosionDamage, 0, Projectile.owner); - foreach (NPC npc in Main.npc) + // Split shards + for (int i = 0; i < 5; i++) { - if (npc.active && npc.Distance(Projectile.Center) < ExplosionRadius && !npc.justHit) - { - npc.AddBuff(ModContent.BuffType(), 240); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), ExplosionDamage, 0, Projectile.owner, npc.whoAmI); - } - } - - int split = 0; - while (split < 5) - { - //Calculate the velocity of the projectile + // Calculate the velocity of the projectile float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; - //Prevents the projectile speed from being too low + + // Prevents the projectile speed from being too low if (shardspeedX < 2f && shardspeedX > -2f) { shardspeedX += -Projectile.velocity.X; @@ -192,14 +135,12 @@ namespace CalamityMod.Projectiles.Rogue { shardspeedY += -Projectile.velocity.Y; } - shardspeedX *= 2f; shardspeedY *= 2f; - //Spawn the projectile - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), ShardDamage, Projectile.knockBack / 2f, Projectile.owner); + // Spawn the projectile + int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + shardspeedX, Projectile.Center.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), ShardDamage, Projectile.knockBack / 2f, Projectile.owner); Main.projectile[shard].frame = Main.rand.Next(3); - split += 1; } } } diff --git a/Projectiles/Rogue/ApoctolithShard.cs b/Projectiles/Rogue/ApoctolithShard.cs index 7255ff54fb..f3bc88cee6 100644 --- a/Projectiles/Rogue/ApoctolithShard.cs +++ b/Projectiles/Rogue/ApoctolithShard.cs @@ -27,13 +27,14 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - TimeBeforeHoming = Main.rand.Next(30, 60); - Projectile.friendly = true; - Projectile.ignoreWater = true; Projectile.width = 13; - Projectile.scale = Main.rand.NextFloat(0.7f, 1.2f); Projectile.height = 13; + Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.scale = Main.rand.NextFloat(0.7f, 1.2f); + Projectile.timeLeft = 240; + TimeBeforeHoming = Main.rand.Next(30, 60); } public override bool? CanDamage() { @@ -52,10 +53,18 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ai[2] = MathHelper.Lerp(Projectile.ai[2], 10, 0.05f); CalamityUtils.HomeInOnNPC(Projectile, false, 400, Projectile.ai[2], 0.2f); - Projectile.velocity.Y += 0.4f; + Projectile.velocity.Y += 0.25f; } } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -Projectile.velocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -Projectile.velocity.Y; + return false; + } public override bool PreDraw(ref Color lightColor) { Asset tex = ModContent.Request(Texture); diff --git a/Projectiles/Rogue/RefractionRotorProjectile.cs b/Projectiles/Rogue/RefractionRotorProjectile.cs index 529037d242..7766f7032b 100644 --- a/Projectiles/Rogue/RefractionRotorProjectile.cs +++ b/Projectiles/Rogue/RefractionRotorProjectile.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public const int EnergyShotCount = 6; + public const int StealthEnergyShotCount = 4; private static float RotationIncrement = 0.5f; public override string Texture => "CalamityMod/Items/Weapons/Rogue/RefractionRotor"; @@ -111,11 +112,12 @@ namespace CalamityMod.Projectiles.Rogue if (CalamityUtils.CountProjectiles(shootType) > 24) return; - int energyDamage = (int)(Projectile.damage * 0.495); + int energyDamage = (int)(Projectile.damage * 0.5f); + int shotAmt = Projectile.Calamity().stealthStrike ? StealthEnergyShotCount : EnergyShotCount; float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < EnergyShotCount; i++) + for (int i = 0; i < shotAmt; i++) { - Vector2 shootVelocity = (MathHelper.TwoPi * i / EnergyShotCount + baseDirectionRotation).ToRotationVector2() * 9f; + Vector2 shootVelocity = (MathHelper.TwoPi * i / shotAmt + baseDirectionRotation).ToRotationVector2() * 9f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + shootVelocity, shootVelocity, shootType, energyDamage, Projectile.knockBack, Projectile.owner); } } diff --git a/Projectiles/Rogue/TitaniumClone.cs b/Projectiles/Rogue/TitaniumClone.cs index e43e62128d..220362b204 100644 --- a/Projectiles/Rogue/TitaniumClone.cs +++ b/Projectiles/Rogue/TitaniumClone.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[0] += 1f; if (Projectile.ai[0] > 30f) { - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 320f, 12f, 20f); } } diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 08d4017caa..de17c8d7e8 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[0] = 1f; Projectile.ai[1] = 0f; Projectile.netUpdate = true; + Projectile.ResetLocalNPCHitImmunity(); // Stealth uses -1 local and resets it when returning to guarantee it can hit again on the way back } } else @@ -144,32 +145,16 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnStealthClones(); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnStealthClones(); + private void SpawnStealthClones() { - if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike && Projectile.numHits < 3) + if (Projectile.Calamity().stealthStrike && Projectile.numHits < 3) { - for (int index2 = 0; index2 < 4; index2++) + for (int i = 0; i < 4; i++) { - float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; - float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike && Projectile.numHits < 3) - { - for (int index2 = 0; index2 < 4; index2++) - { - float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; - float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 randSpeed = Main.rand.NextVector2CircularEdge(6.5f, 6.5f) * Main.rand.NextFloat(0.4f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), Projectile.knockBack, Projectile.owner, 0f, 0f); } } }