From f18eddc570266e197cd3a0cf88cdcfed62bdfa72 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Mon, 19 Jun 2023 17:43:41 +0200 Subject: [PATCH 1/5] Wave Skipper fixes. 1. Fixed Stealth Striked being miss-aligned with the mouse. 2. Put a legacy name on the projectile. --- Items/Weapons/Rogue/WaveSkipper.cs | 14 +++++++------- .../en-US/Mods.CalamityMod.Projectiles.Rogue.hjson | 4 ++-- ...opperProjectile.cs => WaveSkipperProjectile.cs} | 4 +++- 3 files changed, 12 insertions(+), 10 deletions(-) rename Projectiles/Rogue/{DuneHopperProjectile.cs => WaveSkipperProjectile.cs} (94%) diff --git a/Items/Weapons/Rogue/WaveSkipper.cs b/Items/Weapons/Rogue/WaveSkipper.cs index bea3fd5ab7..d53d7ff8c4 100644 --- a/Items/Weapons/Rogue/WaveSkipper.cs +++ b/Items/Weapons/Rogue/WaveSkipper.cs @@ -9,10 +9,12 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue -{ +{ [LegacyName("DuneHopper")] public class WaveSkipper : RogueWeapon { + public static int SpreadAngle = 8; + public override void SetDefaults() { Item.width = 44; @@ -27,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 44; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } @@ -36,12 +38,10 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int numProj = 3; - float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj; i++) + for (int i = -SpreadAngle; i < SpreadAngle * 2; i += SpreadAngle) { - Vector2 perturbedSpeed = new Vector2(velocity.X - 3f, velocity.Y - 3f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Vector2 spreadVelocity = player.SafeDirectionTo(Main.MouseWorld).RotatedBy(MathHelper.ToRadians(i)) * Item.shootSpeed; + int stealth = Projectile.NewProjectile(source, position, spreadVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 86b010913a..b48f4563d9 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -80,7 +80,6 @@ DestructionStar.DisplayName: Star of Destruction DragonShit.DisplayName: Fire DukesDecapitatorBubble.DisplayName: Bubble DukesDecapitatorProj.DisplayName: Decapitator -DuneHopperProjectile.DisplayName: Scourge DuststormCloud.DisplayName: Dust Cloud DuststormCloudStealth.DisplayName: Dust Cloud DuststormInABottleProj.DisplayName: Duststorm @@ -322,4 +321,5 @@ WebBallBol.DisplayName: Web Ball WrathwingCinder.DisplayName: Wrathwing Eruption WrathwingFireball.DisplayName: Wrathwing Fireball WrathwingSpear.DisplayName: Wrathwing -WulfrumKnifeProj.DisplayName: Knife \ No newline at end of file +WulfrumKnifeProj.DisplayName: Knife +WaveSkipperProjectile.DisplayName: Scourge \ No newline at end of file diff --git a/Projectiles/Rogue/DuneHopperProjectile.cs b/Projectiles/Rogue/WaveSkipperProjectile.cs similarity index 94% rename from Projectiles/Rogue/DuneHopperProjectile.cs rename to Projectiles/Rogue/WaveSkipperProjectile.cs index de56b54683..3d1277da7d 100644 --- a/Projectiles/Rogue/DuneHopperProjectile.cs +++ b/Projectiles/Rogue/WaveSkipperProjectile.cs @@ -2,9 +2,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { - public class DuneHopperProjectile : ModProjectile, ILocalizedModType + [LegacyName("DuneHopperProjectile")] + public class WaveSkipperProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/WaveSkipper"; From 9051aa25f02b8c4627ef51dc62b77e105fb3b562 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Mon, 19 Jun 2023 18:12:31 -0600 Subject: [PATCH 2/5] Fixed Frozen Shield and Rampart of Deities stating they give 25% DR instead of 15%. Due to water issues these cannot be tested atm. --- Items/CalamityGlobalItemTooltip.cs | 3 +++ Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index a18f47c540..b464d44c03 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -573,6 +573,9 @@ namespace CalamityMod.Items if (item.type == ItemID.FrozenTurtleShell) EditTooltipByNum(0, (line) => line.Text = "Puts a shell around the owner when below 50% life that reduces damage by 15%"); + if (item.type == ItemID.FrozenShield) + EditTooltipByNum(1, (line) => line.Text = "Puts a shell around the owner when below 50% life that reduces damage by 15%"); + // Ale and Sake rebalance. if (item.type == ItemID.Ale || item.type == ItemID.Sake) EditTooltipByNum(0, (line) => line.Text = "Increases melee damage and speed by 10% and reduces defense by 10%"); diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 30b1d1de04..4fcd7f1ae2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1285,7 +1285,7 @@ RampartofDeities: { ''' Causes stars to fall and gives increased immune time when damaged Provides life regeneration and reduces the cooldown of healing potions - Absorbs 25% of damage done to players on your team + Absorbs 15% of damage done to players on your team This effect is only active above 25% life Grants immunity to knockback Puts a shell around the owner when below 50% life that reduces damage taken From fbefc18c5fd7c476db3a73ecd10a7c510437f54b Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sun, 11 Jun 2023 22:30:21 +0200 Subject: [PATCH 3/5] Minion AI completed. --- Buffs/Summon/IceClasperBuff.png | Bin 436 -> 562 bytes Items/Weapons/Summon/AncientIceChunk.cs | 38 +-- .../Mods.CalamityMod.Projectiles.Summon.hjson | 3 +- Projectiles/Summon/IceClasperMinion.cs | 273 ++++++++++++++---- Projectiles/Summon/IceClasperMinion.png | Bin 3123 -> 5429 bytes Projectiles/Summon/IceClasperProjectile.cs | 56 ++++ Projectiles/Summon/IceClasperProjectile.png | Bin 0 -> 652 bytes 7 files changed, 288 insertions(+), 82 deletions(-) create mode 100644 Projectiles/Summon/IceClasperProjectile.cs create mode 100644 Projectiles/Summon/IceClasperProjectile.png diff --git a/Buffs/Summon/IceClasperBuff.png b/Buffs/Summon/IceClasperBuff.png index 19db922ca6a777549aea40c0042a8c35bdd04d95..c7db0626690b20063d26662041ccb4f7dc90a8de 100644 GIT binary patch delta 538 zcmV+#0_FX*1F{5=BYy$kNklY5PdN=0THc?U?T+5gb=|Guo6W40~QC- z!ou1jf+;O6VqqamsHfgL4}o`G=_wla$V zfTQgN0Kod(=p|(6>fs~Q1|nx*uz_SI8yNA`Mtdj@!a%o9+KHS2?SVSZov;7=mUchV z2>`>f@bvku=6|{I-D$kKdQ_`}ISeq`TbhZdrCR{wGh=6r$I^~D4Co*;Vyk=sV7SgR zqb~0k0C=9tSduW80oDZiNhT__8vww@yq|$bHO>rZ7f(WMz&r+cw(^C-;4fvhv%+m@_)8S(2lM8<}k3Tay-vo-t$&j zwW=@Wk`XCSoz;AH2y+;aFPNFVYXCt}>_XlW-5(J3FedUS_~el@5R0d*KH%M3W<0(D z3D$Xum-nwwhIl(zEy-;34DdrT@n85AQ)c`f{{Up2tiw<16WRa(01jnXNoGw=04e|g c00;m8022TJ007cclK=n!07*qoM6N<$f{AJLEdT%j delta 411 zcmV;M0c8HN1hfN?BYyw{XF*Lt006O%3;baP00009a7bBm000ib000ib0l1NC?EnA( z8FWQhbW?9;ba!ELWdLwtX>N2bZe?^JG%heMF*(%MvSa`N0WnELK~z{r)zvXh!%z@} zVc(20H=v}Wh)^V2Y7T<90R`NGG6e^qrJT+;Gr!W1?=|8~B_}*ZIrJ++&&*yvsSQd@y z4EJ3^eSG+;_kSM%X^=s3aMg$N4UmQgR)bTIegov+Y8t5Lb5-}uN4@+zK6!xrgjPnD zuKF3$>EpxKoPGm9LmK*|R?z9o!RRl5<#3f5Kz(WG6uJzcUM}Iu16US9SCz|#9K59Y zg%4kI`VEi`*=Wfs=(3-$_gw{Wrp05hbCyJh "Items.Weapons.Summon"; + public override void SetDefaults() { Item.damage = 31; @@ -26,35 +37,12 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item30; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float num72 = Item.shootSpeed; - player.itemTime = Item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int clasper = Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, type, damage, knockback, player.whoAmI, 0f, 0f); + int clasper = Projectile.NewProjectile(source, Main.MouseWorld, new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)), type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(clasper)) Main.projectile[clasper].originalDamage = Item.damage; diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 5781200a58..fca2d3979c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -296,4 +296,5 @@ WulfrumDroid.DisplayName: Wulfrum Droid WulfrumEnergyBurst.DisplayName: Bolt WulfrumFusionBolt.DisplayName: Fusion Bolt YharonMinionFireball.DisplayName: Dragon Fireball -YoungDuke.DisplayName: Young Old Duke \ No newline at end of file +YoungDuke.DisplayName: Young Old Duke +IceClasperProjectile.DisplayName: Ice Clasper Projectile \ No newline at end of file diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index 78840b49c8..db0c4d0d97 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -1,102 +1,263 @@ using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { public class IceClasperMinion : ModProjectile, ILocalizedModType { - public new string LocalizationCategory => "Projectiles.Summon"; + public Player Owner => Main.player[Projectile.owner]; - private int dust = 3; + public CalamityPlayer ModdedOwner => Owner.Calamity(); + + public enum IceClasperAIState + { + FollowOwner, + Ram + } + + public IceClasperAIState CurrentState + { + get => (IceClasperAIState)Projectile.ai[0]; + set => Projectile.ai[0] = (int)value; + } + + public ref float TimerForShooting => ref Projectile.ai[1]; + + public bool hasSpawned = false; + + public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.localNPCHitCooldown = AncientIceChunk.IFrames; + Projectile.minionSlots = 1f; + Projectile.penetrate = -1; + Projectile.coldDamage = true; + + Projectile.width = 62; + Projectile.height = 62; + Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.minion = true; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; - Projectile.minion = true; - Projectile.coldDamage = true; - Projectile.DamageType = DamageClass.Summon; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 16; } public override void AI() + { + CheckMinionExistence(); + + if (!hasSpawned) + { + SpawnEffect(); + hasSpawned = true; + } + + // Detects a target at a given distance: + NPC potentialTarget = Projectile.Center.MinionHoming(AncientIceChunk.EnemyDistanceDetection, Owner); + switch (CurrentState) + { + case IceClasperAIState.FollowOwner: + State_FollowOwner(potentialTarget); + break; + case IceClasperAIState.Ram: + State_Ram(potentialTarget); + break; + } + + if (Main.rand.NextBool(10)) + { + int ghostDust = Dust.NewDust(Projectile.position, 31, 62, 56, -0.5f * Projectile.rotation.ToRotationVector2().X, -0.5f * Projectile.rotation.ToRotationVector2().Y); + Main.dust[ghostDust].noLight = true; + Main.dust[ghostDust].noLightEmittence = true; + } + + DoAnimation(); + DoRotation(potentialTarget); + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); + Projectile.MinionAntiClump(); + } + + #region Methods + + public void State_FollowOwner(NPC target) { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (dust > 0) + // If the minion starts to get far, force the minion to go to you. + if (Projectile.WithinRange(Owner.Center, AncientIceChunk.EnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, 300f)) { - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 67, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - dust--; + Projectile.velocity = (Owner.Center - Projectile.Center) / 30f; + Projectile.netUpdate = true; + } + + // The minion will change directions to you if it's going away from you, meaning it'll just hover around you. + else if (!Projectile.WithinRange(Owner.Center, 160f)) + { + Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 40f; + Projectile.netUpdate = true; } + + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.EnemyDistanceDetection)) + { + Projectile.Center = Owner.Center; + Projectile.velocity *= .3f; + Projectile.netUpdate = true; + } + + if (target is not null) + { + if (Projectile.WithinRange(target.Center, AncientIceChunk.DistanceToDash)) + { + CurrentState = IceClasperAIState.Ram; + Projectile.netUpdate = true; + } + else + ShootTarget(target); + } + } + + public void State_Ram(NPC target) + { + if (target is null || !Owner.WithinRange(Projectile.Center, AncientIceChunk.EnemyDistanceDetection)) + { + CurrentState = IceClasperAIState.FollowOwner; + Projectile.netUpdate = true; + } + else if (target is not null) + { + // The distance to the target plus a small number so it's not 0, it'd break calculations. + float distToTarget = Projectile.Distance(target.Center) + .01f; + + // The minion will head towards it's rotation. + // If the target's close, the minion'll speed up, and viceversa, so it doesn't circle around the target doing nothing. + Projectile.velocity = Projectile.rotation.ToRotationVector2() * (AncientIceChunk.MinVelocity + (12f / (distToTarget * .01f))); + Projectile.velocity = Vector2.Clamp(Projectile.velocity, Vector2.One * -25f, Vector2.One * 25f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(target.Center), .001f * distToTarget); + } + } + + public void ShootTarget(NPC target) + { + if (TimerForShooting >= AncientIceChunk.TimeToShoot && Projectile.owner == Main.myPlayer) + { + Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 20f); + + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), + Projectile.Center, + velocity, + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + + Projectile.velocity -= velocity * .1f; + + // Make a dust effect for the firing effect. + for (int i = 0; i < 25; i++) + { + int shootDust = Dust.NewDust(Projectile.Center, 31, 0, 172, Projectile.rotation.ToRotationVector2().X, Projectile.rotation.ToRotationVector2().Y, 0, default, 1.5f); + Main.dust[shootDust].noLight = true; + Main.dust[shootDust].noLightEmittence = true; + Main.dust[shootDust].noGravity = true; + } + + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); + + TimerForShooting = 0f; + Projectile.netUpdate = true; + } + + if (TimerForShooting < AncientIceChunk.TimeToShoot) + TimerForShooting++; + } + + public void DoRotation(NPC target) + { + if (target is null) + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.velocity.ToRotation(), .3f); + else if (target is not null && !Projectile.WithinRange(target.Center, AncientIceChunk.DistanceToDash)) + Projectile.rotation = Projectile.rotation.AngleTowards(CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 20f).ToRotation(), .3f); + } + + public void DoAnimation() + { Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter % 5 == 0) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + } + + public void CheckMinionExistence() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 5) - { - Projectile.frame = 0; - } - Lighting.AddLight((int)(Projectile.Center.X / 16f), (int)(Projectile.Center.Y / 16f), 0.05f, 0.15f, 0.2f); - bool flag64 = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.iClasper = false; - } - if (modPlayer.iClasper) - { + if (Owner.dead) + ModdedOwner.iClasper = false; + if (ModdedOwner.iClasper) Projectile.timeLeft = 2; - } } + } - Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 12f, 9f, 4f, new Vector2(0f, -60f), 12f, 18f, true, true, 2); - - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + public void SpawnEffect() + { + int dustAmt = 45; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + float angle = MathHelper.TwoPi / dustAmt * dustIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 7f); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 56, velocity); + spawnDust.customData = false; + spawnDust.noGravity = true; + spawnDust.velocity *= .75f; + spawnDust.scale = velocity.Length() * .2f; + } } public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = texture2D13.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + NPC target = Projectile.Center.MinionHoming(1200f, Owner); + + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + if (target is not null && Projectile.WithinRange(target.Center, 450f)) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Color afterimageDrawColor = Color.Cyan with { A = 150 } * Projectile.Opacity * (1f - i / (float)Projectile.oldPos.Length); + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(texture, afterimageDrawPosition, frame, afterimageDrawColor, Projectile.rotation - MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0); + } + } + + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation - MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0); + return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.immune[Projectile.owner] = 7; + #endregion } } diff --git a/Projectiles/Summon/IceClasperMinion.png b/Projectiles/Summon/IceClasperMinion.png index 5d35882b80cce868edfeb9701942162193847ed7..bfdea9a04e7b3b8159b09c4b61bd7eb151c600e8 100644 GIT binary patch literal 5429 zcmYjV2~d)2+qOI%TlKVU;2g$NWBfuFvA=AZwadFFneXXc%G=e_UizV7SFy6o<>XQ#$a z1qFpY7oE?0%A=iv!j|dnzsh%#yORWY*b?RG^oK&@z@bI?;TOa?w{r>#O}Jf~H?}D# z9H3l0f9^_rz)G3N^RQ8WD*kiYh5d(WdtC1oxZgdWS^V^G&*<=-TP{35wcq+TaNw_h zFns>Lgubkkpz+(^N;&)o2WIs?-??CQMn8IANX)+{3b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3x;>3hJ2!EwuJ{SVtj`_Vu9oJ4cig5ZJtq0{r6nmM0_X{ pi$B?i^Ls>p "Projectiles.Summon"; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.idStaticNPCHitCooldown = 10; + Projectile.timeLeft = 300; + + Projectile.width = 12; + Projectile.height = 12; + Projectile.DamageType = DamageClass.Summon; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.minion = true; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + int bootlegTexture = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); + Main.dust[bootlegTexture].noGravity = true; + + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn, 180); + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return true; + } + } +} diff --git a/Projectiles/Summon/IceClasperProjectile.png b/Projectiles/Summon/IceClasperProjectile.png new file mode 100644 index 0000000000000000000000000000000000000000..98bedb5a00d2a717e2a919b2ae2649d9ae66f7fd GIT binary patch literal 652 zcmV;70(1R|P)5500001b5ch_0Itp) z=>Px%MoC0LR7i=%mcMILQ545NPilymR(YnOjW$6f9b!RL;^dDZlQ>AhNhbwMcX9A9 zaCZ{-b`or%(y2pAr#cC>LxR{O5(6!vv;jk;JcswrOYZZ%BntQXopSFx_wae&oOkZA z7^3`*r}ES3-;bwL7QkL<4S?417vg0M-}g~?Rw3D9_gquM;zsCl+IpADQl??^BxcLcJAR50CrZFLaReRv3MJ^CjscT_5rAW zd=J3PgGT^lujBw|UcTm?TnbIBk61|K)0Y6~{P^wwOnZdCzI`4kQS8h(05(?voy769 zTZf&7N-8?-dl{~&+${i_m2IUu^bzls)*OKQ?>;CGn!6QcE!A+Ra00;A8`t|}-m8+z zwi2(uj)kcD)g_(sNMwIholCj@iMd`8MJV1z>F(nV05+G44wxW*Tbu)6abrgb2$H_I z`5fp~!+}>lc0o<7jo7ls-ETXY%ew@XT?hUoUs-$>nqao@T3K%{7Xh6f`xA`%q51W^ zzAz8;dV(m5G?}@lw^#W0lz2^GMmwLKwEzyQWe0lXLR|jj-iasOm<6z3-9jtzSRbiK zxor=t<$(#Lt0nAg)5>Le8Ob~1Zg@m6H6yA7LgL{Z*~{@;8YRPYNs zsFgzF^mn(3v^x(UHEK>UW>A8lw;}`Gt>Nz}gff$Le;)tUo9ORuK?S>A-;Ac5HSh7L mfkGNj*cL#i-5MCLjrcbb literal 0 HcmV?d00001 From 30f855ef8136808f57921ba02ebea274b3a6305c Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sat, 17 Jun 2023 14:25:21 +0200 Subject: [PATCH 4/5] Reworked Ice Claspers; the summon. 1. Completely reworked Ice Clasper summon AI. 2. Resprited Ice Clasper summon. 3. New tooltip for Ancient Ice Chunk. 4. Further adjustments for Ice Clasper enemy. 5. Renamed some files so it doesn't crash. --- Items/Weapons/Summon/AncientIceChunk.cs | 14 +++-- ...ods.CalamityMod.Items.Weapons.Summon.hjson | 7 ++- .../Mods.CalamityMod.Projectiles.Enemy.hjson | 3 +- .../Mods.CalamityMod.Projectiles.Summon.hjson | 3 +- NPCs/NormalNPCs/IceClasper.cs | 41 ++++++++++--- ...ectile.cs => IceClasperEnemyProjectile.cs} | 2 +- Projectiles/Summon/IceClasperMinion.cs | 54 ++++++++++-------- ...ctile.cs => IceClasperSummonProjectile.cs} | 10 ++-- ...ile.png => IceClasperSummonProjectile.png} | Bin 9 files changed, 86 insertions(+), 48 deletions(-) rename Projectiles/Enemy/{IceClasperProjectile.cs => IceClasperEnemyProjectile.cs} (96%) rename Projectiles/Summon/{IceClasperProjectile.cs => IceClasperSummonProjectile.cs} (81%) rename Projectiles/Summon/{IceClasperProjectile.png => IceClasperSummonProjectile.png} (100%) diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 5450f74f83..746906a0d5 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -11,12 +11,14 @@ namespace CalamityMod.Items.Weapons.Summon { #region Other stats - public static int IFrames = 30; + public static int IFrames = 20; public static float EnemyDistanceDetection = 1200f; - public static float MaxDistanceFromOwner = 200f; - public static float DistanceToDash = 250f; - public static float MinVelocity = 20f; - public static float TimeToShoot = 100f; // In frames. + public static float MaxDistanceFromOwner = 400f; // Max distance the minions can be while shooting or idling. + public static float DistanceToDash = 250f; // Min distance to start dashing. + public static float DistanceToStopDash = 800f; // Max distance the player can be so the minions continue dashing. + public static float MinVelocity = 12f; + public static float TimeToShoot = 80f; // In frames. + public static float ProjectileDMGMultiplier = 1.5f; // They're kinda' weak. #endregion @@ -24,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 31; + Item.damage = 25; Item.mana = 10; Item.width = 30; Item.height = 30; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 5ce50790c2..b5ac9707bc 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -12,7 +12,12 @@ AbandonedSlimeStaff: { AncientIceChunk: { DisplayName: Ancient Ice Chunk - Tooltip: Summons an ice clasper to fight for you + Tooltip: + ''' + Summons an ice clasper to fight for you + The clasper fires ice shards at distant enemies + While you are close to enemies, it will aggressively bash them with frozen fury + ''' } AquasScepter: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 57d92e02b8..a709e4b0b1 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -35,4 +35,5 @@ SulphuricAcidMist.DisplayName: Acid Mist TornadoHostile.DisplayName: Tornado ToxicMinnowCloud.DisplayName: Toxic Cloud TrilobiteSpike.DisplayName: Spike -IceClasperProjectile.DisplayName: Ice Clasper Projectile \ No newline at end of file +IceClasperProjectile.DisplayName: Ice Clasper Projectile +IceClasperEnemyProjectile.DisplayName: Ice Clasper Enemy Projectile \ No newline at end of file diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index fca2d3979c..fc7418236e 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -297,4 +297,5 @@ WulfrumEnergyBurst.DisplayName: Bolt WulfrumFusionBolt.DisplayName: Fusion Bolt YharonMinionFireball.DisplayName: Dragon Fireball YoungDuke.DisplayName: Young Old Duke -IceClasperProjectile.DisplayName: Ice Clasper Projectile \ No newline at end of file +IceClasperProjectile.DisplayName: Ice Clasper Projectile +IceClasperSummonProjectile.DisplayName: Ice Clasper Summon Projectile \ No newline at end of file diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index 3311ca099e..d2194ecbea 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -13,6 +13,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent; +using System.IO; namespace CalamityMod.NPCs.NormalNPCs { @@ -50,14 +51,15 @@ namespace CalamityMod.NPCs.NormalNPCs public float MaxVelocity = 10f; public float DistanceFromPlayer = 500f; + // Although it is weird that Death Mode less projectiles, the AI also changes, making it a shotgun spread of 3 projectiles, so it'd be 2*3. public float AmountOfProjectiles = (CalamityWorld.death) ? 2f : (CalamityWorld.revenge) ? 4f : (Main.expertMode) ? 3f : 3f; - public float TimeBetweenProjectiles = (CalamityWorld.death) ? 50f : (CalamityWorld.revenge) ? 25f : (Main.expertMode) ? 35f : 45f; + public float TimeBetweenProjectiles = (CalamityWorld.death) ? 50f : (CalamityWorld.revenge) ? 35f : (Main.expertMode) ? 40f : 45f; public float TimeBetweenBurst = (CalamityWorld.death) ? 240f : 180f; - public float ProjectileSpeed = 10f; + public float ProjectileSpeed = 8f; public float TimeBeforeDash = (CalamityWorld.revenge) ? 100f : 120f; public float TimeDashing = 100f; - public float DashSpeed = 8f; + public float DashSpeed = 6f; #endregion @@ -81,8 +83,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 50; NPC.height = 50; NPC.defense = 12; - NPC.lifeMax = 600; - NPC.knockBackResist = 0.35f; + NPC.lifeMax = 500; + NPC.knockBackResist = 0.25f; NPC.noTileCollide = true; NPC.aiStyle = -1; AIType = -1; @@ -109,6 +111,18 @@ namespace CalamityMod.NPCs.NormalNPCs }); } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(rotationDir); + writer.Write(checkedRotationDir); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + rotationDir = reader.ReadInt32(); + checkedRotationDir = reader.ReadBoolean(); + } + public override void AI() { if (NPC.target < 0 || NPC.target == Main.maxPlayers || player.dead || !player.active) @@ -141,6 +155,7 @@ namespace CalamityMod.NPCs.NormalNPCs { rotationDir = (Main.rand.NextBool(2)).ToDirectionInt(); checkedRotationDir = true; + NPC.netUpdate = true; } Vector2 shootingPos = player.Center + new Vector2(MathF.Cos(RotationIncrease) * rotationDir, MathF.Sin(RotationIncrease) * rotationDir) * DistanceFromPlayer; @@ -148,6 +163,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.velocity = Vector2.Lerp(NPC.velocity, (shootingPos - NPC.Center).SafeNormalize(Vector2.Zero) * 6f, .1f); NPC.velocity = Vector2.Clamp(NPC.velocity, new Vector2(-MaxVelocity, -MaxVelocity), new Vector2(MaxVelocity, MaxVelocity)); + + NPC.netUpdate = true; } public void State_Shooting(Player player) @@ -164,6 +181,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Vector2 vecToPlayer = NPC.SafeDirectionTo(player.Center); Vector2 projVelocity = vecToPlayer * ProjectileSpeed; + int type = ModContent.ProjectileType(); // If Death Mode on, the enemy will shoot out a spead of projectiles, instead of a burst. if (death) @@ -174,23 +192,25 @@ namespace CalamityMod.NPCs.NormalNPCs int projectile = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projVelocity.SafeNormalize(Vector2.Zero) * 10f, spreadVelocity, - ModContent.ProjectileType(), + type, 24, 0f, Main.myPlayer); Main.projectile[projectile].timeLeft = 300; } + NPC.netUpdate = true; } else { int projectile = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projVelocity.SafeNormalize(Vector2.Zero) * 10f, projVelocity, - ModContent.ProjectileType(), + type, 24, 0f, Main.myPlayer); Main.projectile[projectile].timeLeft = 300; + NPC.netUpdate = true; } // Recoil effect when shooting. @@ -215,8 +235,9 @@ namespace CalamityMod.NPCs.NormalNPCs else if (AITimer >= TimeBetweenBurst / 2f && AITimer < TimeBetweenBurst) { Vector2 randPos = Main.rand.NextVector2CircularEdge(100f, 100f); - Dust telegraphDust = Dust.NewDustPerfect(NPC.Center + randPos, 172, NPC.DirectionFrom(NPC.Center + NPC.velocity + randPos) * Main.rand.NextFloat(5f, 7f)); + Dust telegraphDust = Dust.NewDustPerfect(NPC.Center + randPos, 172, NPC.DirectionFrom(NPC.Center + NPC.velocity + randPos) * Main.rand.NextFloat(5f, 7f), 0, default, 1.5f); telegraphDust.noGravity = true; + NPC.netUpdate = true; } } @@ -293,6 +314,8 @@ namespace CalamityMod.NPCs.NormalNPCs } } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => (isDashing) ? true : false; + public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType()); @@ -318,7 +341,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < NPC.oldPos.Length; i++) { - Color afterimageDrawColor = Color.Cyan with { A = 125 } * NPC.Opacity * (1f - i / (float)NPC.oldPos.Length) * AfterimageFade; + Color afterimageDrawColor = new Color(0.79f, 0.94f, 0.98f) with { A = 125 } * NPC.Opacity * (1f - i / (float)NPC.oldPos.Length) * AfterimageFade; Vector2 afterimageDrawPosition = NPC.oldPos[i] + NPC.Size * 0.5f - screenPos; spriteBatch.Draw(texture, afterimageDrawPosition, NPC.frame, afterimageDrawColor, NPC.rotation - MathHelper.PiOver2, origin, NPC.scale, SpriteEffects.None, 0f); } diff --git a/Projectiles/Enemy/IceClasperProjectile.cs b/Projectiles/Enemy/IceClasperEnemyProjectile.cs similarity index 96% rename from Projectiles/Enemy/IceClasperProjectile.cs rename to Projectiles/Enemy/IceClasperEnemyProjectile.cs index d7fd7b7b26..6272399762 100644 --- a/Projectiles/Enemy/IceClasperProjectile.cs +++ b/Projectiles/Enemy/IceClasperEnemyProjectile.cs @@ -6,7 +6,7 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Projectiles.Enemy { - public class IceClasperProjectile : ModProjectile, ILocalizedModType + public class IceClasperEnemyProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Enemy"; diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index db0c4d0d97..afcf7f17d3 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Summon public ref float TimerForShooting => ref Projectile.ai[1]; + public ref float AfterimageInterpolant => ref Projectile.localAI[0]; + public bool hasSpawned = false; public new string LocalizationCategory => "Projectiles.Summon"; @@ -38,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon { Main.projFrames[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } @@ -71,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon hasSpawned = true; } - // Detects a target at a given distance: + // Detects a target at a given distance. NPC potentialTarget = Projectile.Center.MinionHoming(AncientIceChunk.EnemyDistanceDetection, Owner); switch (CurrentState) { @@ -83,6 +85,7 @@ namespace CalamityMod.Projectiles.Summon break; } + // Flavor dust visual to show that it is ghostly. if (Main.rand.NextBool(10)) { int ghostDust = Dust.NewDust(Projectile.position, 31, 62, 56, -0.5f * Projectile.rotation.ToRotationVector2().X, -0.5f * Projectile.rotation.ToRotationVector2().Y); @@ -93,7 +96,7 @@ namespace CalamityMod.Projectiles.Summon DoAnimation(); DoRotation(potentialTarget); Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); - Projectile.MinionAntiClump(); + Projectile.MinionAntiClump(0.5f); } #region Methods @@ -101,14 +104,14 @@ namespace CalamityMod.Projectiles.Summon public void State_FollowOwner(NPC target) { // If the minion starts to get far, force the minion to go to you. - if (Projectile.WithinRange(Owner.Center, AncientIceChunk.EnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, 300f)) + if (Projectile.WithinRange(Owner.Center, AncientIceChunk.EnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner + 100f)) { Projectile.velocity = (Owner.Center - Projectile.Center) / 30f; Projectile.netUpdate = true; } // The minion will change directions to you if it's going away from you, meaning it'll just hover around you. - else if (!Projectile.WithinRange(Owner.Center, 160f)) + else if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner)) { Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 40f; Projectile.netUpdate = true; @@ -122,9 +125,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; } + // If the target is not null but not in range to dash: shoot. + // If in range to dash: dash. if (target is not null) { - if (Projectile.WithinRange(target.Center, AncientIceChunk.DistanceToDash)) + if (Owner.WithinRange(target.Center, AncientIceChunk.DistanceToDash)) { CurrentState = IceClasperAIState.Ram; Projectile.netUpdate = true; @@ -136,7 +141,8 @@ namespace CalamityMod.Projectiles.Summon public void State_Ram(NPC target) { - if (target is null || !Owner.WithinRange(Projectile.Center, AncientIceChunk.EnemyDistanceDetection)) + // If there's no target while dashing or the player's gone far enough from the target: back to shooting. + if (target is null || !Owner.WithinRange(Projectile.Center, AncientIceChunk.DistanceToStopDash)) { CurrentState = IceClasperAIState.FollowOwner; Projectile.netUpdate = true; @@ -163,26 +169,19 @@ namespace CalamityMod.Projectiles.Summon int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, - ModContent.ProjectileType(), - Projectile.damage, + ModContent.ProjectileType(), + (int)(Projectile.damage * AncientIceChunk.ProjectileDMGMultiplier), Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Projectile.originalDamage; + Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * AncientIceChunk.ProjectileDMGMultiplier); + // Flavor recoil effect. Projectile.velocity -= velocity * .1f; - // Make a dust effect for the firing effect. - for (int i = 0; i < 25; i++) - { - int shootDust = Dust.NewDust(Projectile.Center, 31, 0, 172, Projectile.rotation.ToRotationVector2().X, Projectile.rotation.ToRotationVector2().Y, 0, default, 1.5f); - Main.dust[shootDust].noLight = true; - Main.dust[shootDust].noLightEmittence = true; - Main.dust[shootDust].noGravity = true; - } - - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); + // For the fucking love of any god you can think of, this sound sucks but I can't find another one that fits better. + SoundEngine.PlaySound(SoundID.Item28, Projectile.Center); TimerForShooting = 0f; Projectile.netUpdate = true; @@ -195,9 +194,9 @@ namespace CalamityMod.Projectiles.Summon public void DoRotation(NPC target) { if (target is null) - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.velocity.ToRotation(), .3f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.velocity.ToRotation(), .15f); else if (target is not null && !Projectile.WithinRange(target.Center, AncientIceChunk.DistanceToDash)) - Projectile.rotation = Projectile.rotation.AngleTowards(CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 20f).ToRotation(), .3f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(target.Center), .15f); } public void DoAnimation() @@ -234,6 +233,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool? CanDamage() => (CurrentState == IceClasperAIState.Ram) ? null : false; + public override bool PreDraw(ref Color lightColor) { NPC target = Projectile.Center.MinionHoming(1200f, Owner); @@ -243,11 +244,16 @@ namespace CalamityMod.Projectiles.Summon Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - if (target is not null && Projectile.WithinRange(target.Center, 450f)) + // Flavor fade-in-and-out for afterimages. + AfterimageInterpolant += ((target is not null && Owner.WithinRange(target.Center, 450f)) || CurrentState == IceClasperAIState.Ram) ? .05f : -.05f; + AfterimageInterpolant = MathHelper.Clamp(AfterimageInterpolant, 0f, 1f); + float AfterimageFade = MathHelper.Lerp(0f, 1f, AfterimageInterpolant); + + if (CalamityConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { - Color afterimageDrawColor = Color.Cyan with { A = 150 } * Projectile.Opacity * (1f - i / (float)Projectile.oldPos.Length); + Color afterimageDrawColor = new Color(0.05f, 0.33f, 0.63f) with { A = 25 } * Projectile.Opacity * (1f - i / (float)Projectile.oldPos.Length) * AfterimageFade; Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; Main.EntitySpriteDraw(texture, afterimageDrawPosition, frame, afterimageDrawColor, Projectile.rotation - MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0); } diff --git a/Projectiles/Summon/IceClasperProjectile.cs b/Projectiles/Summon/IceClasperSummonProjectile.cs similarity index 81% rename from Projectiles/Summon/IceClasperProjectile.cs rename to Projectiles/Summon/IceClasperSummonProjectile.cs index 5958c7072f..ea14bbdde1 100644 --- a/Projectiles/Summon/IceClasperProjectile.cs +++ b/Projectiles/Summon/IceClasperSummonProjectile.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class IceClasperProjectile : ModProjectile, ILocalizedModType + public class IceClasperSummonProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.idStaticNPCHitCooldown = 10; Projectile.timeLeft = 300; - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 28; + Projectile.height = 28; Projectile.DamageType = DamageClass.Summon; Projectile.friendly = true; Projectile.tileCollide = false; @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Summon { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - int bootlegTexture = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); - Main.dust[bootlegTexture].noGravity = true; + int trailDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); + Main.dust[trailDust].noGravity = true; Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); } diff --git a/Projectiles/Summon/IceClasperProjectile.png b/Projectiles/Summon/IceClasperSummonProjectile.png similarity index 100% rename from Projectiles/Summon/IceClasperProjectile.png rename to Projectiles/Summon/IceClasperSummonProjectile.png From 95e5cebbbf2c7423312abf6e04a29bf4f152c979 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sun, 18 Jun 2023 11:06:54 +0200 Subject: [PATCH 5/5] Fixed localization in Ice Clasper's projectiles. 1. Renamed `Ice Clasper Enemy Projectile` and `Ice Clasper Summon Projecitle` to `Ice Shard`. 2. Deleted both instances of `Ice Clasper Projectile` that were useless. --- Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson | 3 +-- Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index a709e4b0b1..cd628cecf4 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -35,5 +35,4 @@ SulphuricAcidMist.DisplayName: Acid Mist TornadoHostile.DisplayName: Tornado ToxicMinnowCloud.DisplayName: Toxic Cloud TrilobiteSpike.DisplayName: Spike -IceClasperProjectile.DisplayName: Ice Clasper Projectile -IceClasperEnemyProjectile.DisplayName: Ice Clasper Enemy Projectile \ No newline at end of file +IceClasperEnemyProjectile.DisplayName: Ice Shard \ No newline at end of file diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index fc7418236e..37168b1091 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -297,5 +297,4 @@ WulfrumEnergyBurst.DisplayName: Bolt WulfrumFusionBolt.DisplayName: Fusion Bolt YharonMinionFireball.DisplayName: Dragon Fireball YoungDuke.DisplayName: Young Old Duke -IceClasperProjectile.DisplayName: Ice Clasper Projectile -IceClasperSummonProjectile.DisplayName: Ice Clasper Summon Projectile \ No newline at end of file +IceClasperSummonProjectile.DisplayName: Ice Shard \ No newline at end of file