diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 5814d9db9d..11510f690f 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -11,19 +11,20 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ProfanedPartisan : RogueWeapon { + public static int ShardBaseDamage => 88; public override void SetDefaults() { Item.width = 68; Item.height = 68; - Item.damage = 222; + Item.damage = 333; Item.crit = 15; Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 18; - Item.useAnimation = 18; + Item.useTime = 21; + Item.useAnimation = 21; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index 519c1c8cb2..32a36636f4 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -9,11 +9,12 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SpearofPaleolith : RogueWeapon { + public static int ShardBaseDamage => 25; public override void SetDefaults() { Item.width = 54; Item.height = 54; - Item.damage = 65; + Item.damage = 70; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 27; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 35f; + Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 79545b4952..24cfc9a19e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -358,8 +358,10 @@ EclipsesFall: { DisplayName: Eclipse's Fall Tooltip: ''' - Summons spears from the sky on hit - Stealth strikes impale enemies and summon a constant barrage of spears over time + Throws a javelin that shatters into fragments of primordial light upon enemy hits + If more than 20 fragments exist, the oldest fragments will seek out enemies to attack + Stealth strikes coalsce fragments into an eclipse spear, gaining power based on the number of fragments + The eclipse spear will pierce though any enemy hit by Eclipse's Fall 'When the sun goes dark, you will know judgement' ''' } @@ -865,8 +867,10 @@ ProfanedPartisan: { DisplayName: Profaned Partisan Tooltip: ''' - Fires an unholy spear that explodes on enemy hits - Stealth strikes spawn smaller spears to fly along side it + Throws a profaned spear that splits into miniature spears upon hitting an enemy + Stealth strikes remain impaled in an enemy for 10 seconds + While an enemy is impaled, all spears that strike them instead erupt into homing fireballs + Inflicts [cbuff:CalamityMod/HolyFlames] ''' } @@ -1086,9 +1090,10 @@ SpearofPaleolith: { DisplayName: Spear of Paleolith Tooltip: ''' - Throws an ancient spear that shatters enemy armor - Spears rain fossil shards as they travel - Stealth strikes travel slower but further, raining more fossil shards + Throws an ancient spear that shatters into fossil shards upon hitting an enemy + Stealth strikes remain impaled in the enemy for 10 seconds + While an enemy is impaled, all spears that strike them erupt into even more fossil shards + Inflicts [cbuff:CalamityMod/ArmorCrunch] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 4a9d6a9c32..74ea651bdb 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -339,3 +339,4 @@ EclipseGuandao.DisplayName: Eclipse Guandao EclipsesFallSpear.DisplayName: Eclipses Fall Spear EclipseSpark.DisplayName: Eclipse Spark EclipseSpear.DisplayName: Eclipse Spear +ProfanedPartisanFlare.DisplayName: Profaned Partisan Flare diff --git a/Projectiles/Rogue/EclipseFragment.png b/Projectiles/Rogue/EclipseFragment.png index 93296c6a1e..fc489108d0 100644 Binary files a/Projectiles/Rogue/EclipseFragment.png and b/Projectiles/Rogue/EclipseFragment.png differ diff --git a/Projectiles/Rogue/EclipseSpear.cs b/Projectiles/Rogue/EclipseSpear.cs index 05dc251e75..50161ddbd0 100644 --- a/Projectiles/Rogue/EclipseSpear.cs +++ b/Projectiles/Rogue/EclipseSpear.cs @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.ai[0] = -1; + //Projectile.ai[0] = -1; Projectile.netUpdate = true; } diff --git a/Projectiles/Rogue/EclipsesFallSpear.cs b/Projectiles/Rogue/EclipsesFallSpear.cs index f6857c153e..80da75fd77 100644 --- a/Projectiles/Rogue/EclipsesFallSpear.cs +++ b/Projectiles/Rogue/EclipsesFallSpear.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = Projectile.height = 40; + Projectile.width = Projectile.height = 50; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index dc34689d70..4dce7a9c4e 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,17 +16,30 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.timeLeft = 90; - AIType = ProjectileID.WoodenArrowFriendly; + Projectile.penetrate = 4; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; + Projectile.timeLeft = 600; + AIType = ProjectileID.SpikyBall; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localNPCHitCooldown = 15; + Projectile.usesLocalNPCImmunity = true; } - public override void AI() + public override bool PreAI() { - Projectile.rotation += Projectile.velocity.Y; - Projectile.velocity.Y *= 1.05f; + if (Projectile.originalDamage == 0) + { + Projectile.originalDamage = SpearofPaleolith.ShardBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; + } + + Projectile.velocity.X *= 0.975f; + return true; + } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); diff --git a/Projectiles/Rogue/ProfanedPartisanFlare.cs b/Projectiles/Rogue/ProfanedPartisanFlare.cs new file mode 100644 index 0000000000..231f372217 --- /dev/null +++ b/Projectiles/Rogue/ProfanedPartisanFlare.cs @@ -0,0 +1,124 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ProfanedPartisanFlare : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public int timer = 0; + public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = 3; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + } + + public override bool? CanHitNPC(NPC target) + { + return true; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + NPC target = null; + public override void AI() + { + + if (Projectile.originalDamage == 0) + { + Projectile.originalDamage = ProfanedPartisan.ShardBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; + } + if (target != null && Projectile.localNPCImmunity[target.whoAmI] <= 0 && target.active && !target.dontTakeDamage) + { + Projectile.Calamity().HomingTarget = target.whoAmI; + var dis = Projectile.Distance(target.Center); + Projectile.velocity = Projectile.velocity.ToRotation().AngleLerp(Projectile.DirectionTo(target.Center).ToRotation(), (Projectile.Distance(target.Center) < 160 ? 0.1f + (1 - dis/160)*0.4f : 0.1f)).ToRotationVector2() * Projectile.velocity.Length(); + } + else + { + target = GetTargetInRange(2000); + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void OnKill(int timeLeft) + { + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + var frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; + } + + NPC GetTargetInRange(float range) + { + var player = Main.player[Projectile.owner]; + { + NPC gotTarget = null; + float currentDistance = range; + foreach (var npc in Main.ActiveNPCs) + { + if (Projectile.localNPCImmunity[npc.whoAmI] > 0) + continue; + var myDistance = npc.Distance(Projectile.Center); + + if (npc.CanBeChasedBy() && myDistance < currentDistance) + { + currentDistance = myDistance; + gotTarget = npc; + } + } + return gotTarget; + } + } + } +} diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index b7c056a4ad..68b13ed38f 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -1,5 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,10 +16,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/ProfanedPartisan"; + + public static int Lifetime => 600; + public int ExplodeTime => 60 * Projectile.MaxUpdates; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailingMode[Type] = -1; } public override void SetDefaults() @@ -24,47 +30,91 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.penetrate = 9; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; - Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + } + public float StuckEnemyID + { + get { return Projectile.ai[0]; } + set { Projectile.ai[0] = value; } + } + public float StuckEnemyDistance + { + get { return Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public float StuckEnemyRotation + { + get { return Projectile.ai[2]; } + set { Projectile.ai[2] = value; } } public override void AI() { - if (Projectile.ai[0] < 0.4f) + Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.2f); + if (StuckEnemyID > 0) { - Projectile.ai[0] += 0.1f; + Projectile.tileCollide = false; + if (!Main.npc[(int)StuckEnemyID - 1].active) + { + StuckEnemyID = 0; + Projectile.velocity = -Vector2.UnitY.RotatedByRandom(0.25f) * Main.rand.NextFloat(0, 1f); + Projectile.tileCollide = true; + return; + } + Projectile.Center = Main.npc[(int)StuckEnemyID - 1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; + return; } - else + else if (Projectile.damage == 0) //after running out of penetrate hits, if not impaled or dead { - Projectile.tileCollide = true; + Projectile.velocity *= 0.975f; + float intensity = 1 - Projectile.timeLeft / (float)ExplodeTime; + Projectile.position += Main.rand.NextVector2CircularEdge(intensity, intensity); + + if (Projectile.timeLeft == 1) + { + + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + for (var i = 0; i < 3; i++) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2().RotatedBy((i - 1) * 0.25f + Main.rand.NextFloat(-0.1f, 0.1f)) * 24f, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0f, 0f); + } + } + } + return; } - //Backwards projectile fix - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Rotating 45 degrees if shooting right - if (Projectile.spriteDirection == 1) - { - Projectile.rotation += MathHelper.ToRadians(45f); - DrawOffsetX = -26; - DrawOriginOffsetX = 13; - DrawOriginOffsetY = 2; - } - //Rotating 45 degrees if shooting right - if (Projectile.spriteDirection == -1) - { - Projectile.rotation -= MathHelper.ToRadians(45f); - DrawOffsetX = 2; - DrawOriginOffsetX = -13; - DrawOriginOffsetY = 2; - } + Projectile.velocity *= 0.998f; + if (Projectile.timeLeft < (Lifetime - 45)*Projectile.MaxUpdates) + Projectile.velocity.Y += 0.02f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; if (Main.rand.NextBool(3)) { int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); @@ -72,20 +122,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[d].velocity *= 0.3f; Main.dust[d].velocity += Projectile.velocity * 0.85f; } - Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.2f); - - if (Projectile.Calamity().stealthStrike) //Stealth strike - { - Vector2 spearPosition = new Vector2(Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f)); - Vector2 spearSpeed = Projectile.velocity; - if (Projectile.timeLeft % 18 == 0) - { - int projID = ModContent.ProjectileType(); - int spearDamage = (int)(Projectile.damage * 0.4f); - float spearKB = 1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spearPosition, spearSpeed, projID, spearDamage, spearKB, Projectile.owner); - } - } } public override void OnKill(int timeLeft) @@ -95,20 +131,48 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 50, default, 2.6f); } SoundEngine.PlaySound(SoundID.Item45, Projectile.position); - - int projID = ModContent.ProjectileType(); - int explosionDamage = (int)(Projectile.damage * 0.8f); - float explosionKB = 8f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, Projectile.owner); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + float glowIntensity = Projectile.damage == 0 && StuckEnemyID == 0 ? 4f * (1-(Projectile.timeLeft/(float)ExplodeTime)) : 0f; + Projectile.DrawProjectileWithBackglow(Color.Yellow, lightColor, glowIntensity); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.tileCollide = false; + if (Projectile.Calamity().stealthStrike) + { + StuckEnemyID = target.whoAmI + 1; + StuckEnemyDistance = Projectile.Distance(target.Center); + StuckEnemyRotation = Projectile.DirectionFrom(target.Center).ToRotation(); + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; + } + else + { + Projectile.timeLeft = ExplodeTime; + } + bool strongSplit = Main.projectile.Any(x => x.active && x.owner == Projectile.owner && x.type == Projectile.type && x.ai[0] == (target.whoAmI + 1)); + int splitType = strongSplit ? ModContent.ProjectileType() : ModContent.ProjectileType(); + if (!strongSplit) + for (var i = 0; i < 3; i++) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2().RotatedBy((i-1)*0.25f + Main.rand.NextFloat(-0.1f,0.1f)) * 10, splitType, (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); + p.hostile = false; + p.friendly = true; + p.DamageType = Projectile.DamageType; + if (strongSplit) + p.Calamity().conditionalHomingRange = 600; + p.localNPCImmunity[target.whoAmI] = 60; + } + target.AddBuff(ModContent.BuffType(), 180); + if (!strongSplit) + { + Projectile.Kill(); + } + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Rogue/ProfanedPartisanSpear.cs b/Projectiles/Rogue/ProfanedPartisanSpear.cs index 0f9ab63c40..0c9a9b8ab3 100644 --- a/Projectiles/Rogue/ProfanedPartisanSpear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,9 +11,6 @@ namespace CalamityMod.Projectiles.Rogue public class ProfanedPartisanSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public int timer = 0; - - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 10; @@ -20,72 +18,60 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = -1; - Projectile.extraUpdates = 3; + Projectile.penetrate = 5; + Projectile.extraUpdates = 0; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 600; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.ai[1] != 1f) - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - Projectile.ai[1] = 1f; - Projectile.ai[0] = 1f; - Projectile.extraUpdates = 2; - if (Projectile.timeLeft > 280) - Projectile.timeLeft = 280; - } - return false; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(); - } - - private void OnHitEffects() - { - if (Projectile.ai[1] != 1f) - { - Projectile.velocity.X *= -1f; - Projectile.velocity.Y *= -1f; - Projectile.ai[1] = 1f; - Projectile.ai[0] = 1f; - Projectile.extraUpdates = 2; - if (Projectile.timeLeft > 280) - Projectile.timeLeft = 280; - } } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - - if (Projectile.ai[0] == 1f) - timer++; - if (timer >= 5) - Projectile.penetrate = 1; - if (timer >= 10) + float timeGateValue = 30f; + if (Projectile.ai[0] <= 0f) //Copied from HolySpear.cs { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 7f, 20f); + Projectile.ai[1] += 1f; + + float slowGateValue = 25f; + float fastGateValue = 10f; + float minVelocity = 2f; + float maxVelocity = minVelocity * 5f; + float extremeVelocity = maxVelocity * 2f; + float deceleration = 0.9f; + float acceleration = 2f; + + if (Projectile.localAI[1] >= timeGateValue) + { + if (Projectile.velocity.Length() < extremeVelocity) + Projectile.velocity *= acceleration; + } + else + { + if (Projectile.ai[1] <= slowGateValue) + { + if (Projectile.velocity.Length() > minVelocity) + Projectile.velocity *= deceleration; + } + else if (Projectile.ai[1] < slowGateValue + fastGateValue) + { + if (Projectile.velocity.Length() < maxVelocity) + Projectile.velocity *= acceleration; + } + else + Projectile.ai[1] = 0f; + } } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index 1ddf1453bf..f818062d6a 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.Linq; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -11,14 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SpearofPaleolith"; - private bool stealthInit = false; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - + public static int Lifetime => 600; public override void SetDefaults() { Projectile.width = 12; @@ -26,33 +20,51 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.StickProjectile; - Projectile.timeLeft = 600; - AIType = ProjectileID.BoneJavelin; + Projectile.extraUpdates = 5; + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; Projectile.DamageType = RogueDamageClass.Instance; } - + public float StuckEnemyID + { + get { return Projectile.ai[0]; } + set { Projectile.ai[0] = value; } + } + public float StuckEnemyDistance + { + get { return Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public float StuckEnemyRotation + { + get { return Projectile.ai[2]; } + set { Projectile.ai[2] = value; } + } public override void AI() { - if (Projectile.Calamity().stealthStrike && !stealthInit) + if (StuckEnemyID > 0) { - Projectile.velocity *= 0.5f; - Projectile.timeLeft = 1800; - stealthInit = true; + Projectile.tileCollide = false; + if (!Main.npc[(int)StuckEnemyID - 1].active) + { + StuckEnemyID = 0; + Projectile.velocity = -Vector2.UnitY.RotatedByRandom(0.25f) * Main.rand.NextFloat(0, 1f); + Projectile.tileCollide = true; + return; + } + Projectile.Center = Main.npc[(int)StuckEnemyID - 1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; + return; } - if (Main.rand.NextBool(4)) + Projectile.velocity *= 0.998f; + if (Projectile.timeLeft < (Lifetime - 25) * Projectile.MaxUpdates) + Projectile.velocity.Y += 0.02f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Main.rand.NextBool(20)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (Projectile.timeLeft % 3 == 0) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } + } public override bool PreDraw(ref Color lightColor) @@ -63,13 +75,32 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - for (int i = 0; i <= 10; i++) + for (int i = 0; i <= 5; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X*2.5f, Projectile.oldVelocity.Y*2.5f); } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.Calamity().stealthStrike) + { + Projectile.stopsDealingDamageAfterPenetrateHits = true; + StuckEnemyID = target.whoAmI + 1; + StuckEnemyDistance = Projectile.Distance(target.Center); + StuckEnemyRotation = Projectile.DirectionFrom(target.Center).ToRotation(); + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; + } + + bool strongSplit = Main.projectile.Any(x => x.active && x.owner == Projectile.owner && x.type == Projectile.type && x.ai[0] == (target.whoAmI + 1)); + int shardCount = strongSplit ? 5 : 3; + for (var i = 0; i < shardCount; i++) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0,-1).RotatedByRandom(1) * (strongSplit ? 10 : 7.5f), ModContent.ProjectileType(), 0 /*Shard dmg is set in its AI*/, Projectile.knockBack, Projectile.owner, 0f, 0f); + p.localNPCImmunity[target.whoAmI] = 30; + } + target.AddBuff(ModContent.BuffType(), 120); + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); }