From c4583827f28370f65304cf702e49150294ad4321 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 13 Feb 2022 16:32:54 -0600 Subject: [PATCH] Reworked Mauler's AI and moved it to T3 Acid Rain --- Events/AcidRainEvent.cs | 3 +- ExtraTextures/Line.png | Bin 0 -> 132 bytes NPCs/AcidRain/CragmawMire.cs | 14 +- NPCs/AcidRain/Mauler.cs | 449 +++++++++++ NPCs/AcidRain/Mauler.png | Bin 0 -> 10783 bytes NPCs/AcidRain/MaulerGlowmask.png | Bin 0 -> 1299 bytes NPCs/AcidRain/NuclearTerror.cs | 2 +- NPCs/SulphurousSea/Mauler.cs | 395 ---------- NPCs/SulphurousSea/Mauler.png | Bin 15875 -> 0 bytes Projectiles/Enemy/MaulerAcidBubble.cs | 79 ++ Projectiles/Enemy/MaulerAcidDrop.cs | 48 ++ Utilities/DrawingUtils.cs | 1002 +++++++++++++------------ Utilities/NPCStats.cs | 4 + 13 files changed, 1101 insertions(+), 895 deletions(-) create mode 100644 ExtraTextures/Line.png create mode 100644 NPCs/AcidRain/Mauler.cs create mode 100644 NPCs/AcidRain/Mauler.png create mode 100644 NPCs/AcidRain/MaulerGlowmask.png delete mode 100644 NPCs/SulphurousSea/Mauler.cs delete mode 100644 NPCs/SulphurousSea/Mauler.png create mode 100644 Projectiles/Enemy/MaulerAcidBubble.cs create mode 100644 Projectiles/Enemy/MaulerAcidDrop.cs diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 3d33fe7eed..dc05c4d9f5 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -91,7 +91,8 @@ namespace CalamityMod.Events public static Dictionary PossibleMinibossesPolter = new Dictionary() { { ModContent.NPCType(), new AcidRainSpawnData(4, 0.08f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(8, 0.05f, AcidRainSpawnRequirement.Anywhere) } + { ModContent.NPCType(), new AcidRainSpawnData(4, 0.07f, AcidRainSpawnRequirement.Water) }, + { ModContent.NPCType(), new AcidRainSpawnData(8, 0.045f, AcidRainSpawnRequirement.Anywhere) } }; public static readonly List AllMinibosses = PossibleMinibossesAS.Select(miniboss => miniboss.Key).ToList().Concat(PossibleMinibossesPolter.Select(miniboss => miniboss.Key)).Distinct().ToList(); diff --git a/ExtraTextures/Line.png b/ExtraTextures/Line.png new file mode 100644 index 0000000000000000000000000000000000000000..2408d292331c3585e2a34b595c2af2aaeafb17e5 GIT binary patch literal 132 zcmeAS@N?(olHy`uVBq!ia0y~yVEh7PGjcEi$>noS9|m!XgWR1M)}51i3FNS(JNh~@ zFl_AS{*%ZG4nJ@a+d-Mhn(p6`-J`r;B5Vg@5v&|Nrd|Ye=vzP7vv7ddMOn Z!O)|@^xvwLHx;Oe!PC{xWt~$(69D1WA-Vtn literal 0 HcmV?d00001 diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 14dcea5b11..14faa021ed 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -1,19 +1,15 @@ using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Projectiles.Enemy; -using CalamityMod.Projectiles.Environment; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Rogue; using Terraria.Utilities; -using CalamityMod.Projectiles.Rogue; using Terraria.World.Generation; namespace CalamityMod.NPCs.AcidRain @@ -82,11 +78,11 @@ namespace CalamityMod.NPCs.AcidRain npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; - } + npc.Calamity().VulnerableToHeat = false; + npc.Calamity().VulnerableToSickness = false; + npc.Calamity().VulnerableToElectricity = true; + npc.Calamity().VulnerableToWater = false; + } public override void AI() { diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs new file mode 100644 index 0000000000..88fe6296a9 --- /dev/null +++ b/NPCs/AcidRain/Mauler.cs @@ -0,0 +1,449 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; +using Terraria.World.Generation; + +namespace CalamityMod.NPCs.AcidRain +{ + public class Mauler : ModNPC + { + public enum MaulerAttackState + { + BubbleBursts, + HorizontalAcidCharge, + BigChargeupDash + } + + public bool InWater => Collision.DrownCollision(npc.Center, 1, 1); + public Player Target => Main.player[npc.target]; + public MaulerAttackState CurrentAttack + { + get => (MaulerAttackState)(int)npc.ai[0]; + set => npc.ai[0] = (int)value; + } + public ref float AttackTimer => ref npc.ai[1]; + public int CurrentFrame + { + get => (int)npc.localAI[0]; + set => npc.localAI[0] = value; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mauler"); + Main.npcFrameCount[npc.type] = 8; + } + + public override void SetDefaults() + { + npc.noGravity = true; + npc.damage = 135; + npc.width = 180; + npc.height = 90; + npc.defense = 50; + npc.DR_NERD(0.05f); + npc.lifeMax = 88500; + npc.aiStyle = -1; + aiType = -1; + npc.value = Item.buyPrice(0, 25, 0, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath60; + npc.knockBackResist = 0f; + npc.rarity = 2; + banner = npc.type; + bannerItem = ModContent.ItemType(); + npc.RemoveWaterSlowness(); + npc.Calamity().canBreakPlayerDefense = true; + npc.Calamity().VulnerableToHeat = false; + npc.Calamity().VulnerableToSickness = false; + npc.Calamity().VulnerableToElectricity = true; + npc.Calamity().VulnerableToWater = false; + } + + public override void AI() + { + npc.TargetClosest(false); + + // Reset things every frame. They may be changed in the attack states below. + npc.noTileCollide = false; + npc.noGravity = InWater; + TelegraphCompletionInterpolant = 0f; + + switch (CurrentAttack) + { + case MaulerAttackState.BubbleBursts: + DoBehavior_BubbleBursts(); + break; + case MaulerAttackState.HorizontalAcidCharge: + DoBehavior_HorizontalAcidCharge(); + break; + case MaulerAttackState.BigChargeupDash: + DoBehavior_BigChargeupDash(); + break; + } + + // Emit radioactive light. + Vector2 left = npc.Center - Vector2.UnitX * 15f; + Vector2 right = npc.Center + Vector2.UnitX * 15f; + DelegateMethods.v3_1 = Color.Lime.ToVector3(); + Utils.PlotTileLine(left, right, 10f, DelegateMethods.CastLightOpen); + + // Drift away from the world border. + if (npc.Center.X < (Main.offLimitBorderTiles + 6f) * 16f || npc.Center.X >= (Main.maxTilesX - Main.offLimitBorderTiles - 6f) * 16f) + { + npc.velocity *= 0.9f; + npc.Center = npc.Center.MoveTowards(Target.Center, 12f); + } + + AttackTimer++; + } + + public void DoBehavior_BubbleBursts() + { + int roarDelay = 32; + int shootDelay = 24; + int bubblesPerBurst = 7; + int burstShootRate = 45; + int burstCount = 3; + float wrappedAttackTimer = (AttackTimer - roarDelay - shootDelay) % burstShootRate; + + // Slow down. If necessary, fall. + npc.velocity *= 0.94f; + if (!InWater) + { + npc.noTileCollide = true; + npc.position.Y += 6f; + } + + // Roar prior to releasing bubbles. + if (AttackTimer <= roarDelay) + CurrentFrame = (int)Math.Round(Utils.InverseLerp(0f, roarDelay, AttackTimer, true) * 5f); + + // Animate as usual a bit after roaring. + else if (AttackTimer >= roarDelay + shootDelay) + { + npc.frameCounter++; + if (npc.frameCounter >= 5) + { + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type]; + npc.frameCounter = 0; + } + + // Open the mouth prior to creating bubbles. + if (wrappedAttackTimer >= burstShootRate * 0.7f) + CurrentFrame = 4; + } + if (AttackTimer == roarDelay) + Main.PlaySound(SoundID.Zombie, Target.Center, 97); + + // Rotate towards the target. + int previousSpriteDirection = npc.spriteDirection; + float idealRotation = npc.AngleTo(Target.Center); + if (previousSpriteDirection == 1) + idealRotation += MathHelper.Pi; + npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); + if (previousSpriteDirection != npc.spriteDirection) + npc.rotation += MathHelper.Pi; + + npc.rotation = npc.rotation.AngleTowards(idealRotation, 0.125f).AngleLerp(idealRotation, 0.075f); + + // Fire the bubble bursts. + bool shouldShootBubbles = AttackTimer >= roarDelay + shootDelay && wrappedAttackTimer == burstShootRate - 1f; + if (shouldShootBubbles) + { + Vector2 mouthPosition = npc.Center + new Vector2(npc.spriteDirection * -56f, 22f).RotatedBy(npc.rotation); + Main.PlaySound(SoundID.Item96, mouthPosition); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int bubbleShootType = ModContent.ProjectileType(); + int bubbleDamage = npc.GetProjectileDamage(bubbleShootType); + Vector2 baseBubbleShootVelocity = npc.SafeDirectionTo(mouthPosition) * 13.5f; + for (int i = 0; i < bubblesPerBurst; i++) + { + Vector2 bubbleShootVelocity = baseBubbleShootVelocity + Main.rand.NextVector2Circular(4f, 4f); + Projectile.NewProjectile(mouthPosition, bubbleShootVelocity, bubbleShootType, bubbleDamage, 0f); + } + + // Get launched back after firing. This only happens if in water and there's no obstacles behind. + if (InWater && Collision.CanHit(npc.Center, 1, 1, npc.Center - baseBubbleShootVelocity.SafeNormalize(Vector2.Zero) * 100f, 1, 1)) + npc.velocity -= baseBubbleShootVelocity * 0.62f; + npc.netUpdate = true; + } + } + + if (AttackTimer >= roarDelay + shootDelay + burstShootRate * burstCount) + SelectNextAttack(); + } + + public void DoBehavior_HorizontalAcidCharge() + { + int stuckGiveupTime = 360; + int chargeDelay = 45; + int chargePreparationTime = 15; + int chargeTime = 72; + int acidShootRate = 4; + float chargeSpeed = 24.5f; + ref float stuckTimer = ref npc.ai[2]; + ref float chargeDirection = ref npc.ai[3]; + + // Select frames. + npc.frameCounter++; + if (npc.frameCounter >= 5) + { + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type]; + npc.frameCounter = 0; + } + + // Decide the rotation and direction. + npc.rotation = npc.velocity.X * 0.0125f; + if (Math.Abs(npc.velocity.X) > 0.1f) + npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); + if (AttackTimer < chargeDelay + chargePreparationTime) + npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); + + // Move through tiles and attempt to reach water if stuck on land. + Vector2 idealPosition = Target.Center + Vector2.UnitX * (Target.Center.X < npc.Center.X).ToDirectionInt() * 480f; + if (!InWater && AttackTimer < chargeDelay) + { + npc.noTileCollide = true; + npc.noGravity = true; + AttackTimer = 0f; + + if (WorldUtils.Find(idealPosition.ToTileCoordinates(), Searches.Chain(new Searches.Down(1500), new CustomConditions.IsWater()), out Point hitPoint)) + idealPosition = hitPoint.ToWorldCoordinates(); + Vector2 idealVelocity = npc.SafeDirectionTo(idealPosition) * 20f; + + // Move towards the ideal position. + if (!npc.WithinRange(idealPosition, 120f)) + npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.05f); + + // Give up and do another attack if unable to find water. + stuckTimer++; + if (stuckTimer >= stuckGiveupTime) + { + npc.Opacity = 1f; + SelectNextAttack(); + } + } + else + stuckTimer = 0f; + + // Handle opacity. When not in water, become almost completely transparent. + npc.Opacity = MathHelper.Clamp(npc.Opacity + InWater.ToDirectionInt() * 0.04f, 0.33f, 1f); + + // Charge and release homing acid upward. + if (AttackTimer >= chargeDelay && AttackTimer < chargeDelay + chargePreparationTime) + { + // Define the charge direction. + if (chargeDirection == 0f) + { + chargeDirection = (Target.Center.X > npc.Center.X).ToDirectionInt(); + npc.netUpdate = true; + } + npc.position.Y += npc.SafeDirectionTo(Target.Center).Y * 8f; + npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitX * chargeDirection * chargeSpeed, 0.075f); + } + + bool isCharging = AttackTimer >= chargeDelay + chargePreparationTime && AttackTimer < chargeDelay + chargePreparationTime + chargeTime; + bool shouldShootAcid = isCharging && AttackTimer % acidShootRate == acidShootRate - 1f; + if (shouldShootAcid) + { + Main.PlaySound(SoundID.Item95, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int acidShootType = ModContent.ProjectileType(); + int acidDamage = npc.GetProjectileDamage(acidShootType); + Vector2 acidSpawnPosition = npc.Center + Main.rand.NextVector2Circular(30f, 10f).RotatedBy(npc.rotation); + Vector2 acidShootVelocity = -Vector2.UnitY.RotatedByRandom(0.33f) * Main.rand.NextFloat(8f, 10.5f); + Projectile.NewProjectile(acidSpawnPosition, acidShootVelocity, acidShootType, acidDamage, 0f); + npc.netUpdate = true; + } + } + + if (npc.velocity.Length() < 0.4f) + npc.velocity = Vector2.Zero; + + Vector2 aheadPosition = npc.position + npc.velocity.SafeNormalize(Vector2.UnitX * -npc.spriteDirection) * 150f; + bool stuckWhileCharging = !Collision.CanHit(npc.position, npc.width, npc.height, aheadPosition, npc.width, npc.height) || + Collision.SolidCollision(npc.position, npc.width, npc.height); + stuckWhileCharging &= isCharging; + if (AttackTimer >= chargeDelay + chargePreparationTime + chargeTime || stuckWhileCharging) + { + npc.velocity *= 0.5f; + SelectNextAttack(); + } + } + + public void DoBehavior_BigChargeupDash() + { + int chargeDelay = 105; + int telegraphTime = 60; + int chargeTime = 50; + float chargeSpeed = MathHelper.Clamp(npc.Distance(Target.Center) / chargeTime * 1.35f, 29f, 45f); + bool hasCharged = AttackTimer >= chargeDelay; + + // Slow down at first. If necessary, fall. + if (!hasCharged) + { + npc.velocity *= 0.94f; + npc.noGravity = true; + } + + // Select frames. + npc.frameCounter++; + if (npc.frameCounter >= (hasCharged ? 4 : 7)) + { + CurrentFrame = (CurrentFrame + 1) % Main.npcFrameCount[npc.type]; + npc.frameCounter = 0; + } + + // Open the mouth if close to the target after charging. + if (CurrentFrame < 4 && npc.WithinRange(Target.Center, 200f) && AttackTimer > chargeDelay) + CurrentFrame = 4; + + // Create the telegraph. + TelegraphCompletionInterpolant = Utils.InverseLerp(chargeDelay - telegraphTime, chargeDelay, AttackTimer, true); + TelegraphCompletionInterpolant *= Utils.InverseLerp(chargeDelay + 16f, chargeDelay, AttackTimer, true); + + // Rotate towards the target at first. + int previousSpriteDirection = npc.spriteDirection; + float idealRotation = npc.AngleTo(Target.Center); + if (previousSpriteDirection == 1) + idealRotation += MathHelper.Pi; + + // Roar as a telegraph. The placement of the sound is offset such that the player and ideally determine the determine where the charge will come from. + if (AttackTimer == chargeDelay - telegraphTime) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), Target.Center + Target.SafeDirectionTo(npc.Center) * 300f); + + // Charge. + if (AttackTimer == chargeDelay) + { + Main.PlaySound(SoundID.DD2_FlameburstTowerShot, Target.Center); + npc.velocity = npc.SafeDirectionTo(Target.Center) * chargeSpeed; + npc.netUpdate = true; + } + if (!hasCharged) + { + npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); + if (previousSpriteDirection != npc.spriteDirection) + npc.rotation += MathHelper.Pi; + + npc.rotation = npc.rotation.AngleTowards(idealRotation, 0.18f).AngleLerp(idealRotation, 0.08f); + } + else + { + TelegraphCompletionInterpolant = 0f; + npc.noGravity = npc.noTileCollide = true; + npc.rotation = npc.velocity.ToRotation(); + if (previousSpriteDirection == 1) + npc.rotation += MathHelper.Pi; + } + + if (AttackTimer >= chargeDelay + chargeTime) + SelectNextAttack(); + } + + public void SelectNextAttack() + { + // Reset the attack timer and optional attack variables. + AttackTimer = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + MaulerAttackState oldAttack = CurrentAttack; + + bool targetDefinitelyNotNearWater = false; + bool isInCrampedPosition = Collision.SolidCollision(npc.Center - Vector2.One * 150f, 300, 300) && InWater; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + isInCrampedPosition = true; + + // Register the target as not near water if they have left the ocean. + if (Target.position.X > 8000f && Target.position.X < Main.maxTilesX * 16f - 8000f) + targetDefinitelyNotNearWater = true; + + // Register the target as not near water if there's no water below the target's position or it's very far away. + if (WorldUtils.Find(Target.Center.ToTileCoordinates(), Searches.Chain(new Searches.Down(750), new CustomConditions.IsWater()), out Point hitPoint)) + { + if (Target.Distance(hitPoint.ToWorldCoordinates()) > 6400f) + targetDefinitelyNotNearWater = true; + } + else + targetDefinitelyNotNearWater = true; + + WeightedRandom attackSelector = new WeightedRandom(Main.rand); + attackSelector.Add(MaulerAttackState.BubbleBursts); + attackSelector.Add(MaulerAttackState.HorizontalAcidCharge); + attackSelector.Add(MaulerAttackState.BigChargeupDash); + + // Select the new attack. + // It is random, but will never perform the same attack twice in succession. + do + CurrentAttack = attackSelector.Get(); + while (oldAttack == CurrentAttack); + + // Bypass the above check and use an attack that doesn't require water if there's none nearby. + if (targetDefinitelyNotNearWater || isInCrampedPosition) + CurrentAttack = MaulerAttackState.BigChargeupDash; + + npc.netUpdate = true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/NPCs/AcidRain/MaulerGlowmask"); + Vector2 drawPosition = npc.Center - Main.screenPosition + Vector2.UnitY * npc.gfxOffY; + Vector2 origin = npc.frame.Size() * 0.5f; + SpriteEffects direction = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + spriteBatch.Draw(texture, drawPosition, npc.frame, npc.GetAlpha(drawColor), npc.rotation, origin, npc.scale, direction, 0f); + spriteBatch.Draw(glowmask, drawPosition, npc.frame, npc.GetAlpha(Color.White), npc.rotation, origin, npc.scale, direction, 0f); + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frame.Y = CurrentFrame * frameHeight; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 420); + } + + public override void NPCLoot() + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + + // Drop shark fins. They are specially colored to match the color of maulers. + int item = Item.NewItem(npc.Center, npc.Size, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); + Main.item[item].color = new Color(151, 115, 57, 255); + NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + + if (npc.life <= 0) + { + for (int k = 0; k < 30; k++) + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), npc.scale); + for (int i = 2; i <= 5; i++) + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot($"Gores/Mauler{i}"), npc.scale); + } + } + } +} diff --git a/NPCs/AcidRain/Mauler.png b/NPCs/AcidRain/Mauler.png new file mode 100644 index 0000000000000000000000000000000000000000..97e48d86f088b58039f02cf61b6642f9dc0cbdc5 GIT binary patch literal 10783 zcmb7~c{r5s-}h$*gE7W77)!=(>=#i(g|TJdD_hKvvK3NNvdoN~ED>X0vWBdY78zqH zR6-H5mJ%vUDp{V(_jf z2-(Bg!CLjn9i1?Q-Q#_v;aGjvF9yEPpL!VnhGjb+Q)*OO?(N2)ay2! zqAE4F9Ys|ne(zsn<`D(2^yfxfD>w*Vv9q$@{~sTaMZHBgu!KF(#3>j8K`{=V(7u4G za}bEUo~a?hA=GWPfYT+IK;R1&|+U*imyN$=|*g72ZbB;MG^On}r7*SUxW$IEeF-u7!mO z<--r3<>D$MS60>^OTTZ)HhcWLgLZ)>=lK*9X14r#_wU~zu*FZGCfkCUG--b%r;x3W zAAdjgbY*jOGPU3p`zUcS5zUE+ymn1DBA%(gEkIRu=2;O(6@Ad&D#G^CCCVJSAu>dp z)rLxtS@`B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 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.AcidRain npc.lifeMax = 198230; npc.defense = 50; - npc.damage = 175; + npc.damage = 135; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 20, 0, 0); npc.DR_NERD(0.3f); diff --git a/NPCs/SulphurousSea/Mauler.cs b/NPCs/SulphurousSea/Mauler.cs deleted file mode 100644 index 7c60fd681c..0000000000 --- a/NPCs/SulphurousSea/Mauler.cs +++ /dev/null @@ -1,395 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SulphurousSea -{ - public class Mauler : ModNPC - { - private bool hasBeenHit = false; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mauler"); - Main.npcFrameCount[npc.type] = 8; - } - - public override void SetDefaults() - { - npc.Calamity().canBreakPlayerDefense = true; - npc.noGravity = true; - npc.damage = 135; - npc.width = 180; - npc.height = 90; - npc.defense = 50; - npc.DR_NERD(0.05f); - npc.lifeMax = 165000; - npc.aiStyle = -1; - aiType = -1; - npc.value = Item.buyPrice(0, 25, 0, 0); - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath60; - npc.knockBackResist = 0f; - npc.rarity = 2; - banner = npc.type; - bannerItem = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToSickness = false; - npc.Calamity().VulnerableToElectricity = true; - npc.Calamity().VulnerableToWater = false; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasBeenHit); - writer.Write(npc.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasBeenHit = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < 300f) - { - flag14 = true; - } - if (Main.player[npc.target].dead && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] += 1f; - } - else - { - if (npc.localAI[1] > 0f) - { - npc.localAI[1] -= 1f; - } - } - npc.localAI[2] += 1f; - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.5f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.25f; - if (npc.velocity.X > 22f) - { - npc.velocity.X = 22f; - } - if (npc.velocity.X < -22f) - { - npc.velocity.X = -22f; - } - if (npc.velocity.Y > 13f) - { - npc.velocity.Y = 13f; - } - if (npc.velocity.Y < -13f) - { - npc.velocity.Y = -13f; - } - } - else - { - npc.velocity.X += (float)npc.direction * 0.2f; - if (npc.velocity.X < -4f || npc.velocity.X > 4f) - { - npc.velocity.X *= 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y -= 0.01f; - if (npc.velocity.Y < -0.3f) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y += 0.01f; - if (npc.velocity.Y > 0.3f) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid > 128) - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) - { - npc.velocity.Y *= 0.95f; - } - } - else - { - npc.localAI[1] += 1f; - npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 30f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float speed = 12f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 50; - if (Main.expertMode) - { - damage = 45; - } - int beam = Projectile.NewProjectile(npc.Center.X + (npc.spriteDirection == 1 ? 60f : -60f), npc.Center.Y, num6, num7, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (npc.velocity.Y == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.velocity.Y = (float)Main.rand.Next(-200, -150) * 0.1f; //50 20 - npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; //20 20 - npc.netUpdate = true; - } - } - npc.velocity.Y = npc.velocity.Y + 0.4f; //0.4 - if (npc.velocity.Y > 16f) - { - npc.velocity.Y = 16f; - } - npc.ai[0] = 1f; - } - if (hasBeenHit) - { - if (Main.rand.NextBool(300)) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.localAI[1] >= 255f || npc.localAI[2] >= 600f) - { - npc.localAI[2] = 0f; - BlowUp(); - return; - } - else if (npc.localAI[1] > 0f) - { - for (int k = 0; k < (int)((double)npc.localAI[1] * 0.05); k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 0, default, 1f); - } - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if (npc.rotation < -0.2f) - { - npc.rotation = -0.2f; - } - if (npc.rotation > 0.2f) - { - npc.rotation = 0.2f; - return; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - { - return hasBeenHit; - } - return null; - } - - public void BlowUp() - { - Main.PlaySound(SoundID.NPCDeath60, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 valueBoom = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spreadBoom = 15f * 0.0174f; - double startAngleBoom = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spreadBoom / 2; - double deltaAngleBoom = spreadBoom / 8f; - double offsetAngleBoom; - int iBoom; - int damageBoom = npc.localAI[1] >= 255f ? 200 : 50; - for (iBoom = 0; iBoom < 25; iBoom++) - { - int projectileType = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; - int boom1 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - } - } - for (int num621 = 0; num621 < 25; num621++) - { - int num622 = Dust.NewDust(npc.position, npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - Main.dust[num622].noGravity = true; - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - if (npc.localAI[1] >= 255f) - { - npc.active = false; - } - npc.netUpdate = true; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += hasBeenHit ? 0.15f : 0.075f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 420); - } - - public override void NPCLoot() - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - int item = Item.NewItem(npc.Center, npc.Size, ItemID.SharkFin, Main.rand.Next(2, 5), false, 0, false, false); - Main.item[item].color = new Color(151, 115, 57, 255); - NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe) - { - return 0f; - } - if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType()) && - !NPC.AnyNPCs(ModContent.NPCType())) - { - if (!Main.hardMode) - { - return 0.001f; - } - if (!NPC.downedMoonlord) - { - return 0.01f; - } - return 0.1f; - } - return 0f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 30; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler5"), 1f); - } - } - } -} diff --git a/NPCs/SulphurousSea/Mauler.png b/NPCs/SulphurousSea/Mauler.png deleted file mode 100644 index ac1337512457568b5ac54b13fba62dd62458d79b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15875 zcmeIZdpMM9-#$K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ljm8%O!xj7K0I{+dn>V%XMr6){hg)6Y~qp}zu3Zh*9cZ@t_#Al-Kd{t_v zsNBu;W-J$smd*`O_LDlkWSG`?yklE{jBu$gW`_%T)Pux%q3e9p(U_ULc^l=UrVld zmM5nhssERY{~zPxWNCDU>>aF&x|b7p{3WLpXEDGEm6c9;Iba(OBrITLF#QT|MIc7;)7JiG(kG$P+>ErVEHaQ`*-VwRDH=zMS?Fb&n+VtM( zZIQ-0jN3Sq`m#@Kd-JqOiaR;01Z5{D5Q0G`(pi4uK+d}GW)|@sZMxPT!S8^ zNZmtiL1HJ}CpKR+(Piz-!e6y{E4Ihov0-WS!4cTMGw+0zwuLRij_=p}0x`dM(FoYO z6a7ZzA4Hh_>xB%E%gBEk0o zMu;>vY))c07l2pUg4QRq zQBS*AN4d8%o>Bl{1+UXd_!xlC3PbzBgxWdG6H`2GKw#jK= z(cNQ|HSpXKw9TKV0-}y e&joOs`h7Jw@+h?6*e!J-jN98{Y)Y-YuKqtM*!tc8 diff --git a/Projectiles/Enemy/MaulerAcidBubble.cs b/Projectiles/Enemy/MaulerAcidBubble.cs new file mode 100644 index 0000000000..b29d82dc28 --- /dev/null +++ b/Projectiles/Enemy/MaulerAcidBubble.cs @@ -0,0 +1,79 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class MaulerAcidBubble : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid Bubble"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 150; + projectile.penetrate = -1; + } + + public override void AI() + { + // Handle frames. + projectile.frameCounter++; + projectile.frame = projectile.frameCounter / 4 % Main.projFrames[projectile.type]; + + // Home in on players after a sufficient amount of time has passed. + if (Time > 60f) + { + float flySpeed = Main.expertMode ? 17.5f : 14.5f; + Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)]; + if (!projectile.WithinRange(target.Center, 50f)) + projectile.velocity = (projectile.velocity * 49f + projectile.SafeDirectionTo(target.Center) * flySpeed) / 50f; + projectile.tileCollide = true; + } + + // Emit light. + Lighting.AddLight(projectile.Center, 0.2f, 0.6f, 0.2f); + + // Rotate. + projectile.rotation += projectile.direction * 0.04f; + Time++; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.localAI[1] < 1f) + { + return; + } + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + } + } +} diff --git a/Projectiles/Enemy/MaulerAcidDrop.cs b/Projectiles/Enemy/MaulerAcidDrop.cs new file mode 100644 index 0000000000..0653f3e90c --- /dev/null +++ b/Projectiles/Enemy/MaulerAcidDrop.cs @@ -0,0 +1,48 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class MaulerAcidDrop : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.penetrate = -1; + projectile.hostile = true; + projectile.timeLeft = 240; + projectile.tileCollide = false; + projectile.ignoreWater = false; + } + public override void AI() + { + float homingSpeed = 16f; + Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)]; + if (projectile.WithinRange(target.Center, 1200f) && projectile.timeLeft < 210) + projectile.velocity = (projectile.velocity * 59f + projectile.SafeDirectionTo(target.Center) * homingSpeed) / 60f; + projectile.Opacity = Utils.InverseLerp(0f, 25f, projectile.timeLeft, true); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + } + + public override Color? GetAlpha(Color lightColor) + { + lightColor = Color.White; + lightColor.A = 64; + return lightColor * projectile.Opacity; + } + } +} diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 25e9bd1d51..8e53532801 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -12,9 +12,9 @@ using Terraria.ModLoader; namespace CalamityMod { - public static partial class CalamityUtils - { - public static readonly Color[] ExoPalette = new Color[] + public static partial class CalamityUtils + { + public static readonly Color[] ExoPalette = new Color[] { new Color(250, 255, 112), new Color(211, 235, 108), @@ -26,542 +26,566 @@ namespace CalamityMod new Color(199, 62, 62), }; - #region Projectile Afterimages - ///

- /// Draws a projectile as a series of afterimages. The first of these afterimages is centered on the center of the projectile's hitbox.
- /// This function is guaranteed to draw the projectile itself, even if it has no afterimages and/or the Afterimages config option is turned off. - ///
- /// The projectile to be drawn. - /// The type of afterimage drawing code to use. Vanilla Terraria has three options: 0, 1, and 2. - /// The light color to use for the afterimages. - /// If mode 1 is used, this controls the loop increment. Set it to more than 1 to skip afterimages. - /// The texture to draw. Set to null to draw the projectile's own loaded texture. - /// If false, the afterimages will be centered on the projectile's position instead of its own center. - public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true) - { - if (texture is null) - texture = Main.projectileTexture[proj.type]; + #region Projectile Afterimages + /// + /// Draws a projectile as a series of afterimages. The first of these afterimages is centered on the center of the projectile's hitbox.
+ /// This function is guaranteed to draw the projectile itself, even if it has no afterimages and/or the Afterimages config option is turned off. + ///
+ /// The projectile to be drawn. + /// The type of afterimage drawing code to use. Vanilla Terraria has three options: 0, 1, and 2. + /// The light color to use for the afterimages. + /// If mode 1 is used, this controls the loop increment. Set it to more than 1 to skip afterimages. + /// The texture to draw. Set to null to draw the projectile's own loaded texture. + /// If false, the afterimages will be centered on the projectile's position instead of its own center. + public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true) + { + if (texture is null) + texture = Main.projectileTexture[proj.type]; - int frameHeight = texture.Height / Main.projFrames[proj.type]; - int frameY = frameHeight * proj.frame; - float scale = proj.scale; - float rotation = proj.rotation; + int frameHeight = texture.Height / Main.projFrames[proj.type]; + int frameY = frameHeight * proj.frame; + float scale = proj.scale; + float rotation = proj.rotation; - Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - Vector2 origin = rectangle.Size() / 2f; + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + Vector2 origin = rectangle.Size() / 2f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (proj.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + SpriteEffects spriteEffects = SpriteEffects.None; + if (proj.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; - // If no afterimages are drawn due to an invalid mode being specified, ensure the projectile itself is drawn anyway. - bool failedToDrawAfterimages = false; + // If no afterimages are drawn due to an invalid mode being specified, ensure the projectile itself is drawn anyway. + bool failedToDrawAfterimages = false; - if (CalamityConfig.Instance.Afterimages) - { - Vector2 centerOffset = drawCentered ? proj.Size / 2f : Vector2.Zero; - switch (mode) - { - // Standard afterimages. No customizable features other than total afterimage count. - // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. - case 0: - for (int i = 0; i < proj.oldPos.Length; ++i) - { - Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f); - } - break; + if (CalamityConfig.Instance.Afterimages) + { + Vector2 centerOffset = drawCentered ? proj.Size / 2f : Vector2.Zero; + switch (mode) + { + // Standard afterimages. No customizable features other than total afterimage count. + // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 0: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f); + } + break; - // Paladin's Hammer style afterimages. Can be optionally spaced out further by using the typeOneDistanceMultiplier variable. - // Type 1 afterimages linearly scale down from 66% to 0% opacity. They otherwise do not differ from type 0. - case 1: - // Safety check: the loop must increment - int increment = Math.Max(1, typeOneIncrement); - Color drawColor = proj.GetAlpha(lightColor); - int afterimageCount = ProjectileID.Sets.TrailCacheLength[proj.type]; - int k = 0; - while (k < afterimageCount) - { - Vector2 drawPos = proj.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER. - if (k > 0) - { - float colorMult = (float)(afterimageCount - k); - drawColor *= colorMult / ((float)afterimageCount * 1.5f); - } - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f); - k += increment; - } - break; + // Paladin's Hammer style afterimages. Can be optionally spaced out further by using the typeOneDistanceMultiplier variable. + // Type 1 afterimages linearly scale down from 66% to 0% opacity. They otherwise do not differ from type 0. + case 1: + // Safety check: the loop must increment + int increment = Math.Max(1, typeOneIncrement); + Color drawColor = proj.GetAlpha(lightColor); + int afterimageCount = ProjectileID.Sets.TrailCacheLength[proj.type]; + int k = 0; + while (k < afterimageCount) + { + Vector2 drawPos = proj.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER. + if (k > 0) + { + float colorMult = (float)(afterimageCount - k); + drawColor *= colorMult / ((float)afterimageCount * 1.5f); + } + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f); + k += increment; + } + break; - // Standard afterimages with rotation. No customizable features other than total afterimage count. - // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. - case 2: - for (int i = 0; i < proj.oldPos.Length; ++i) - { - float afterimageRot = proj.oldRot[i]; - SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + // Standard afterimages with rotation. No customizable features other than total afterimage count. + // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 2: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + float afterimageRot = proj.oldRot[i]; + SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f); - } - break; + Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f); + } + break; - default: - failedToDrawAfterimages = true; - break; - } - } + default: + failedToDrawAfterimages = true; + break; + } + } - // Draw the projectile itself. Only do this if no afterimages are drawn because afterimage 0 is the projectile itself. - if (!CalamityConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) - { - Vector2 startPos = drawCentered ? proj.Center : proj.position; - Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, proj.gfxOffY), rectangle, proj.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); - } - } + // Draw the projectile itself. Only do this if no afterimages are drawn because afterimage 0 is the projectile itself. + if (!CalamityConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) + { + Vector2 startPos = drawCentered ? proj.Center : proj.position; + Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, proj.gfxOffY), rectangle, proj.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); + } + } - // Used for bullets. This lets you draw afterimages while keeping the hitbox at the front of the projectile. - // This supports type 0 and type 2 afterimages. Vanilla bullets never have type 2 afterimages. - public static void DrawAfterimagesFromEdge(Projectile proj, int mode, Color lightColor, Texture2D texture = null) - { - if (texture is null) - texture = Main.projectileTexture[proj.type]; + // Used for bullets. This lets you draw afterimages while keeping the hitbox at the front of the projectile. + // This supports type 0 and type 2 afterimages. Vanilla bullets never have type 2 afterimages. + public static void DrawAfterimagesFromEdge(Projectile proj, int mode, Color lightColor, Texture2D texture = null) + { + if (texture is null) + texture = Main.projectileTexture[proj.type]; - int frameHeight = texture.Height / Main.projFrames[proj.type]; - int frameY = frameHeight * proj.frame; - float scale = proj.scale; - float rotation = proj.rotation; + int frameHeight = texture.Height / Main.projFrames[proj.type]; + int frameY = frameHeight * proj.frame; + float scale = proj.scale; + float rotation = proj.rotation; - Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - SpriteEffects spriteEffects = SpriteEffects.None; - if (proj.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + SpriteEffects spriteEffects = SpriteEffects.None; + if (proj.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; - Vector2 drawOrigin = new Vector2(texture.Width * 0.5f, proj.height * 0.5f); + Vector2 drawOrigin = new Vector2(texture.Width * 0.5f, proj.height * 0.5f); - switch (mode) - { - default: // If you specify an afterimage mode other than 0 or 2, you get nothing. - return; + switch (mode) + { + default: // If you specify an afterimage mode other than 0 or 2, you get nothing. + return; - // Standard afterimages. No customizable features other than total afterimage count. - // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. - case 0: - for (int i = 0; i < proj.oldPos.Length; ++i) - { - Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, drawOrigin, scale, spriteEffects, 0f); - } - return; + // Standard afterimages. No customizable features other than total afterimage count. + // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 0: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, drawOrigin, scale, spriteEffects, 0f); + } + return; - // Standard afterimages with rotation. No customizable features other than total afterimage count. - // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. - case 2: - for (int i = 0; i < proj.oldPos.Length; ++i) - { - float afterimageRot = proj.oldRot[i]; - SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + // Standard afterimages with rotation. No customizable features other than total afterimage count. + // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 2: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + float afterimageRot = proj.oldRot[i]; + SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); - // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, drawOrigin, scale, sfxForThisAfterimage, 0f); - } - return; - } - } - #endregion + Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, drawOrigin, scale, sfxForThisAfterimage, 0f); + } + return; + } + } + #endregion - /// - /// Calculates perspective matrices for usage by vertex shaders. - /// - /// The view matrix. - /// The projection matrix. - public static void CalculatePerspectiveMatricies(out Matrix viewMatrix, out Matrix projectionMatrix) - { - Vector2 zoom = Main.GameViewMatrix.Zoom; - Matrix zoomScaleMatrix = Matrix.CreateScale(zoom.X, zoom.Y, 1f); + /// + /// Calculates perspective matrices for usage by vertex shaders. + /// + /// The view matrix. + /// The projection matrix. + public static void CalculatePerspectiveMatricies(out Matrix viewMatrix, out Matrix projectionMatrix) + { + Vector2 zoom = Main.GameViewMatrix.Zoom; + Matrix zoomScaleMatrix = Matrix.CreateScale(zoom.X, zoom.Y, 1f); - // Screen bounds. - int height = Main.instance.GraphicsDevice.Viewport.Height; + // Screen bounds. + int height = Main.instance.GraphicsDevice.Viewport.Height; - // Get a matrix that aims towards the Z axis (these calculations are relative to a 2D world). - viewMatrix = Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up); + // Get a matrix that aims towards the Z axis (these calculations are relative to a 2D world). + viewMatrix = Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up); - // Offset the matrix to the appropriate position. - viewMatrix *= Matrix.CreateTranslation(0f, -height, 0f); + // Offset the matrix to the appropriate position. + viewMatrix *= Matrix.CreateTranslation(0f, -height, 0f); - // Flip the matrix around 180 degrees. - viewMatrix *= Matrix.CreateRotationZ(MathHelper.Pi); + // Flip the matrix around 180 degrees. + viewMatrix *= Matrix.CreateRotationZ(MathHelper.Pi); - // Account for the inverted gravity effect. - if (Main.LocalPlayer.gravDir == -1f) - viewMatrix *= Matrix.CreateScale(1f, -1f, 1f) * Matrix.CreateTranslation(0f, height, 0f); + // Account for the inverted gravity effect. + if (Main.LocalPlayer.gravDir == -1f) + viewMatrix *= Matrix.CreateScale(1f, -1f, 1f) * Matrix.CreateTranslation(0f, height, 0f); - // And account for the current zoom. - viewMatrix *= zoomScaleMatrix; + // And account for the current zoom. + viewMatrix *= zoomScaleMatrix; - projectionMatrix = Matrix.CreateOrthographicOffCenter(0f, Main.screenWidth * zoom.X, 0f, Main.screenHeight * zoom.Y, 0f, 1f) * zoomScaleMatrix; - } + projectionMatrix = Matrix.CreateOrthographicOffCenter(0f, Main.screenWidth * zoom.X, 0f, Main.screenHeight * zoom.Y, 0f, 1f) * zoomScaleMatrix; + } - /// - /// Sets a 's arbitrarily. - /// - /// The sprite batch. - /// The blend state to use. - public static void SetBlendState(this SpriteBatch spriteBatch, BlendState blendState) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, blendState, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); - } + /// + /// Sets a 's arbitrarily. + /// + /// The sprite batch. + /// The blend state to use. + public static void SetBlendState(this SpriteBatch spriteBatch, BlendState blendState) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, blendState, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); + } - // Cached for efficiency purposes. - internal static readonly FieldInfo BeginEndPairField = typeof(SpriteBatch).GetField("inBeginEndPair", BindingFlags.NonPublic | BindingFlags.Instance); + // Cached for efficiency purposes. + internal static readonly FieldInfo BeginEndPairField = typeof(SpriteBatch).GetField("inBeginEndPair", BindingFlags.NonPublic | BindingFlags.Instance); - /// - /// Determines if a is in a lock due to a call. - /// - /// The sprite batch to check. - public static bool HasBeginBeenCalled(this SpriteBatch spriteBatch) - { - return (bool)BeginEndPairField.GetValue(spriteBatch); - } + /// + /// Determines if a is in a lock due to a call. + /// + /// The sprite batch to check. + public static bool HasBeginBeenCalled(this SpriteBatch spriteBatch) + { + return (bool)BeginEndPairField.GetValue(spriteBatch); + } - /// - /// Draws text with an eight-way one-pixel offset border. - /// - /// - /// - /// - /// - /// - /// - /// - public static void DrawBorderStringEightWay(SpriteBatch sb, DynamicSpriteFont font, string text, Vector2 baseDrawPosition, Color main, Color border, float scale = 1f) - { - for (int x = -1; x <= 1; x++) - { - for (int y = -1; y <= 1; y++) - { - Vector2 drawPosition = baseDrawPosition + new Vector2(x, y); - if (x == 0 && y == 0) - continue; + /// + /// Draws a line significantly more efficiently than using just one scaled line texture. Positions are automatically converted to screen coordinates. + /// + /// The sprite batch by which the line should be drawn. + /// The starting point of the line in world coordinates. + /// The ending point of the line in world coordinates. + /// The color of the line. + /// The width of the line. + public static void DrawLineBetter(this SpriteBatch spriteBatch, Vector2 start, Vector2 end, Color color, float width) + { + // Draw nothing if the start and end are equal, to prevent division by 0 problems. + if (start == end) + return; - DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, drawPosition, border, 0f, default, scale, SpriteEffects.None, 0f); - } - } - DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, baseDrawPosition, main, 0f, default, scale, SpriteEffects.None, 0f); - } + start -= Main.screenPosition; + end -= Main.screenPosition; - public static void DrawItemGlowmaskSingleFrame(this Item item, SpriteBatch spriteBatch, float rotation, Texture2D glowmaskTexture) - { - Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f - 2f); - spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } + Texture2D line = ModContent.GetTexture("InfernumMode/ExtraTextures/Line"); + float rotation = (end - start).ToRotation(); + Vector2 scale = new Vector2(Vector2.Distance(start, end) / line.Width, width); - public static Rectangle GetCurrentFrame(this Item item, ref int frame, ref int frameCounter, int frameDelay, int frameAmt, bool frameCounterUp = true) - { - if (frameCounter >= frameDelay) - { - frameCounter = -1; - frame = frame == frameAmt - 1 ? 0 : frame + 1; - } - if (frameCounterUp) - frameCounter++; - return new Rectangle(0, item.height * frame, item.width, item.height); - } + spriteBatch.Draw(line, start, null, color, rotation, line.Size() * Vector2.UnitY * 0.5f, scale, SpriteEffects.None, 0f); + } - public static bool DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) - { - Player player = Main.player[projectile.owner]; - Item item = player.HeldItem; - if (!projectile.bobber || item.holdStyle <= 0) - return false; + /// + /// Draws text with an eight-way one-pixel offset border. + /// + /// + /// + /// + /// + /// + /// + /// + public static void DrawBorderStringEightWay(SpriteBatch sb, DynamicSpriteFont font, string text, Vector2 baseDrawPosition, Color main, Color border, float scale = 1f) + { + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + Vector2 drawPosition = baseDrawPosition + new Vector2(x, y); + if (x == 0 && y == 0) + continue; - float originX = player.MountedCenter.X; - float originY = player.MountedCenter.Y; - originY += player.gfxOffY; - //This variable is used to account for Gravitation Potions - float gravity = player.gravDir; + DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, drawPosition, border, 0f, default, scale, SpriteEffects.None, 0f); + } + } + DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, baseDrawPosition, main, 0f, default, scale, SpriteEffects.None, 0f); + } - if (item.type == fishingRodType) - { - originX += (float)(xPositionAdditive * player.direction); - if (player.direction < 0) - { - originX -= 13f; - } - originY -= yPositionAdditive * gravity; - } + public static void DrawItemGlowmaskSingleFrame(this Item item, SpriteBatch spriteBatch, float rotation, Texture2D glowmaskTexture) + { + Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f - 2f); + spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } - if (gravity == -1f) - { - originY -= 12f; - } - Vector2 mountedCenter = new Vector2(originX, originY); - mountedCenter = player.RotatedRelativePoint(mountedCenter + new Vector2(8f), true) - new Vector2(8f); - Vector2 lineOrigin = projectile.Center - mountedCenter; - bool canDraw = true; - if (lineOrigin.X == 0f && lineOrigin.Y == 0f) - return false; + public static Rectangle GetCurrentFrame(this Item item, ref int frame, ref int frameCounter, int frameDelay, int frameAmt, bool frameCounterUp = true) + { + if (frameCounter >= frameDelay) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } - float projPosMagnitude = lineOrigin.Length(); - projPosMagnitude = 12f / projPosMagnitude; - lineOrigin.X *= projPosMagnitude; - lineOrigin.Y *= projPosMagnitude; - mountedCenter -= lineOrigin; - lineOrigin = projectile.Center - mountedCenter; + public static bool DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) + { + Player player = Main.player[projectile.owner]; + Item item = player.HeldItem; + if (!projectile.bobber || item.holdStyle <= 0) + return false; - while (canDraw) - { - float height = 12f; - float positionMagnitude = lineOrigin.Length(); - if (float.IsNaN(positionMagnitude) || float.IsNaN(positionMagnitude)) - break; + float originX = player.MountedCenter.X; + float originY = player.MountedCenter.Y; + originY += player.gfxOffY; + //This variable is used to account for Gravitation Potions + float gravity = player.gravDir; - if (positionMagnitude < 20f) - { - height = positionMagnitude - 8f; - canDraw = false; - } - positionMagnitude = 12f / positionMagnitude; - lineOrigin.X *= positionMagnitude; - lineOrigin.Y *= positionMagnitude; - mountedCenter += lineOrigin; - lineOrigin = projectile.Center - mountedCenter; - if (positionMagnitude > 12f) - { - float positionInverseMultiplier = 0.3f; - float absVelocitySum = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); - if (absVelocitySum > 16f) - { - absVelocitySum = 16f; - } - absVelocitySum = 1f - absVelocitySum / 16f; - positionInverseMultiplier *= absVelocitySum; - absVelocitySum = positionMagnitude / 80f; - if (absVelocitySum > 1f) - { - absVelocitySum = 1f; - } - positionInverseMultiplier *= absVelocitySum; - if (positionInverseMultiplier < 0f) - { - positionInverseMultiplier = 0f; - } - absVelocitySum = 1f - projectile.localAI[0] / 100f; - positionInverseMultiplier *= absVelocitySum; - if (lineOrigin.Y > 0f) - { - lineOrigin.Y *= 1f + positionInverseMultiplier; - lineOrigin.X *= 1f - positionInverseMultiplier; - } - else - { - absVelocitySum = Math.Abs(projectile.velocity.X) / 3f; - if (absVelocitySum > 1f) - { - absVelocitySum = 1f; - } - absVelocitySum -= 0.5f; - positionInverseMultiplier *= absVelocitySum; - if (positionInverseMultiplier > 0f) - { - positionInverseMultiplier *= 2f; - } - lineOrigin.Y *= 1f + positionInverseMultiplier; - lineOrigin.X *= 1f - positionInverseMultiplier; - } - } - //This color decides the color of the fishing line. - Color lineColor = Lighting.GetColor((int)mountedCenter.X / 16, (int)mountedCenter.Y / 16, poleColor); - float rotation = lineOrigin.ToRotation() - MathHelper.PiOver2; + if (item.type == fishingRodType) + { + originX += (float)(xPositionAdditive * player.direction); + if (player.direction < 0) + { + originX -= 13f; + } + originY -= yPositionAdditive * gravity; + } - Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2(mountedCenter.X - Main.screenPosition.X + Main.fishingLineTexture.Width * 0.5f, mountedCenter.Y - Main.screenPosition.Y + Main.fishingLineTexture.Height * 0.5f), new Rectangle?(new Rectangle(0, 0, Main.fishingLineTexture.Width, (int)height)), lineColor, rotation, new Vector2(Main.fishingLineTexture.Width * 0.5f, 0f), 1f, SpriteEffects.None, 0f); - } - return false; - } + if (gravity == -1f) + { + originY -= 12f; + } + Vector2 mountedCenter = new Vector2(originX, originY); + mountedCenter = player.RotatedRelativePoint(mountedCenter + new Vector2(8f), true) - new Vector2(8f); + Vector2 lineOrigin = projectile.Center - mountedCenter; + bool canDraw = true; + if (lineOrigin.X == 0f && lineOrigin.Y == 0f) + return false; - public static void DrawHook(this Projectile projectile, Texture2D hookTexture, float angleAdditive = 0f) - { - Player player = Main.player[projectile.owner]; - Vector2 center = projectile.Center; - float angleToMountedCenter = projectile.AngleTo(player.MountedCenter) - MathHelper.PiOver2; - bool canShowHook = true; - while (canShowHook) - { - float distanceMagnitude = (player.MountedCenter - center).Length(); //Exact same as using a Sqrt - if (distanceMagnitude < hookTexture.Height + 1f) - { - canShowHook = false; - } - else if (float.IsNaN(distanceMagnitude)) - { - canShowHook = false; - } - else - { - center += projectile.SafeDirectionTo(player.MountedCenter) * hookTexture.Height; - Color tileAtCenterColor = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(hookTexture, center - Main.screenPosition, - new Rectangle?(new Rectangle(0, 0, hookTexture.Width, hookTexture.Height)), - tileAtCenterColor, angleToMountedCenter + angleAdditive, - hookTexture.Size() / 2, 1f, SpriteEffects.None, 0f); - } - } - } + float projPosMagnitude = lineOrigin.Length(); + projPosMagnitude = 12f / projPosMagnitude; + lineOrigin.X *= projPosMagnitude; + lineOrigin.Y *= projPosMagnitude; + mountedCenter -= lineOrigin; + lineOrigin = projectile.Center - mountedCenter; - internal static void IterateDisco(ref Color c, ref float aiParam, in byte discoIter = 7) - { - switch (aiParam) - { - case 0f: - c.G += discoIter; - if (c.G >= 255) - { - c.G = 255; - aiParam = 1f; - } - break; - case 1f: - c.R -= discoIter; - if (c.R <= 0) - { - c.R = 0; - aiParam = 2f; - } - break; - case 2f: - c.B += discoIter; - if (c.B >= 255) - { - c.B = 255; - aiParam = 3f; - } - break; - case 3f: - c.G -= discoIter; - if (c.G <= 0) - { - c.G = 0; - aiParam = 4f; - } - break; - case 4f: - c.R += discoIter; - if (c.R >= 255) - { - c.R = 255; - aiParam = 5f; - } - break; - case 5f: - c.B -= discoIter; - if (c.B <= 0) - { - c.B = 0; - aiParam = 0f; - } - break; - default: - aiParam = 0f; - c = Color.Red; - break; - } - } + while (canDraw) + { + float height = 12f; + float positionMagnitude = lineOrigin.Length(); + if (float.IsNaN(positionMagnitude) || float.IsNaN(positionMagnitude)) + break; - public static string ColorMessage(string msg, Color color) - { - StringBuilder sb; - if (!msg.Contains("\n")) - { - sb = new StringBuilder(msg.Length + 12); - sb.Append("[c/").Append(color.Hex3()).Append(':').Append(msg).Append(']'); - } - else - { - sb = new StringBuilder(); - foreach (string newlineSlice in msg.Split('\n')) - sb.Append("[c/").Append(color.Hex3()).Append(':').Append(newlineSlice).Append(']').Append('\n'); - } - return sb.ToString(); - } + if (positionMagnitude < 20f) + { + height = positionMagnitude - 8f; + canDraw = false; + } + positionMagnitude = 12f / positionMagnitude; + lineOrigin.X *= positionMagnitude; + lineOrigin.Y *= positionMagnitude; + mountedCenter += lineOrigin; + lineOrigin = projectile.Center - mountedCenter; + if (positionMagnitude > 12f) + { + float positionInverseMultiplier = 0.3f; + float absVelocitySum = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); + if (absVelocitySum > 16f) + { + absVelocitySum = 16f; + } + absVelocitySum = 1f - absVelocitySum / 16f; + positionInverseMultiplier *= absVelocitySum; + absVelocitySum = positionMagnitude / 80f; + if (absVelocitySum > 1f) + { + absVelocitySum = 1f; + } + positionInverseMultiplier *= absVelocitySum; + if (positionInverseMultiplier < 0f) + { + positionInverseMultiplier = 0f; + } + absVelocitySum = 1f - projectile.localAI[0] / 100f; + positionInverseMultiplier *= absVelocitySum; + if (lineOrigin.Y > 0f) + { + lineOrigin.Y *= 1f + positionInverseMultiplier; + lineOrigin.X *= 1f - positionInverseMultiplier; + } + else + { + absVelocitySum = Math.Abs(projectile.velocity.X) / 3f; + if (absVelocitySum > 1f) + { + absVelocitySum = 1f; + } + absVelocitySum -= 0.5f; + positionInverseMultiplier *= absVelocitySum; + if (positionInverseMultiplier > 0f) + { + positionInverseMultiplier *= 2f; + } + lineOrigin.Y *= 1f + positionInverseMultiplier; + lineOrigin.X *= 1f - positionInverseMultiplier; + } + } + //This color decides the color of the fishing line. + Color lineColor = Lighting.GetColor((int)mountedCenter.X / 16, (int)mountedCenter.Y / 16, poleColor); + float rotation = lineOrigin.ToRotation() - MathHelper.PiOver2; - /// - /// Returns a color lerp that allows for smooth transitioning between two given colors - /// - /// The first color you want it to switch between - /// The second color you want it to switch between - /// How long you want it to take to swap between colors - public static Color ColorSwap(Color firstColor, Color secondColor, float seconds) - { - double timeMult = (double)(MathHelper.TwoPi / seconds); - float colorMePurple = (float)((Math.Sin(timeMult * Main.GlobalTime) + 1) * 0.5f); - return Color.Lerp(firstColor, secondColor, colorMePurple); - } - /// - /// Returns a color lerp that supports multiple colors. - /// - /// The 0-1 incremental value used when interpolating. - /// The various colors to interpolate across. - /// - public static Color MulticolorLerp(float increment, params Color[] colors) - { - increment %= 0.999f; - int currentColorIndex = (int)(increment * colors.Length); - Color currentColor = colors[currentColorIndex]; - Color nextColor = colors[(currentColorIndex + 1) % colors.Length]; - return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); - } + Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2(mountedCenter.X - Main.screenPosition.X + Main.fishingLineTexture.Width * 0.5f, mountedCenter.Y - Main.screenPosition.Y + Main.fishingLineTexture.Height * 0.5f), new Rectangle?(new Rectangle(0, 0, Main.fishingLineTexture.Width, (int)height)), lineColor, rotation, new Vector2(Main.fishingLineTexture.Width * 0.5f, 0f), 1f, SpriteEffects.None, 0f); + } + return false; + } - // Cached for efficiency purposes. - internal static readonly FieldInfo UImageFieldMisc = typeof(MiscShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); - internal static readonly FieldInfo UImageFieldArmor = typeof(ArmorShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); + public static void DrawHook(this Projectile projectile, Texture2D hookTexture, float angleAdditive = 0f) + { + Player player = Main.player[projectile.owner]; + Vector2 center = projectile.Center; + float angleToMountedCenter = projectile.AngleTo(player.MountedCenter) - MathHelper.PiOver2; + bool canShowHook = true; + while (canShowHook) + { + float distanceMagnitude = (player.MountedCenter - center).Length(); //Exact same as using a Sqrt + if (distanceMagnitude < hookTexture.Height + 1f) + { + canShowHook = false; + } + else if (float.IsNaN(distanceMagnitude)) + { + canShowHook = false; + } + else + { + center += projectile.SafeDirectionTo(player.MountedCenter) * hookTexture.Height; + Color tileAtCenterColor = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(hookTexture, center - Main.screenPosition, + new Rectangle?(new Rectangle(0, 0, hookTexture.Width, hookTexture.Height)), + tileAtCenterColor, angleToMountedCenter + angleAdditive, + hookTexture.Size() / 2, 1f, SpriteEffects.None, 0f); + } + } + } - /// - /// Manually sets the texture of a instance, since vanilla's implementation only supports strings that access vanilla textures. - /// - /// The shader to bind the texture to. - /// The texture to bind. - public static MiscShaderData SetShaderTexture(this MiscShaderData shader, Texture2D texture) - { - UImageFieldMisc.SetValue(shader, new Ref(texture)); - return shader; - } + internal static void IterateDisco(ref Color c, ref float aiParam, in byte discoIter = 7) + { + switch (aiParam) + { + case 0f: + c.G += discoIter; + if (c.G >= 255) + { + c.G = 255; + aiParam = 1f; + } + break; + case 1f: + c.R -= discoIter; + if (c.R <= 0) + { + c.R = 0; + aiParam = 2f; + } + break; + case 2f: + c.B += discoIter; + if (c.B >= 255) + { + c.B = 255; + aiParam = 3f; + } + break; + case 3f: + c.G -= discoIter; + if (c.G <= 0) + { + c.G = 0; + aiParam = 4f; + } + break; + case 4f: + c.R += discoIter; + if (c.R >= 255) + { + c.R = 255; + aiParam = 5f; + } + break; + case 5f: + c.B -= discoIter; + if (c.B <= 0) + { + c.B = 0; + aiParam = 0f; + } + break; + default: + aiParam = 0f; + c = Color.Red; + break; + } + } - /// - /// Manually sets the texture of a instance, since vanilla's implementation only supports strings that access vanilla textures. - /// - /// The shader to bind the texture to. - /// The texture to bind. - public static ArmorShaderData SetShaderTexture(this ArmorShaderData shader, Texture2D texture) - { - UImageFieldArmor.SetValue(shader, new Ref(texture)); - return shader; - } + public static string ColorMessage(string msg, Color color) + { + StringBuilder sb; + if (!msg.Contains("\n")) + { + sb = new StringBuilder(msg.Length + 12); + sb.Append("[c/").Append(color.Hex3()).Append(':').Append(msg).Append(']'); + } + else + { + sb = new StringBuilder(); + foreach (string newlineSlice in msg.Split('\n')) + sb.Append("[c/").Append(color.Hex3()).Append(':').Append(newlineSlice).Append(']').Append('\n'); + } + return sb.ToString(); + } - public static void EnterShaderRegion(this SpriteBatch spriteBatch) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - } + /// + /// Returns a color lerp that allows for smooth transitioning between two given colors + /// + /// The first color you want it to switch between + /// The second color you want it to switch between + /// How long you want it to take to swap between colors + public static Color ColorSwap(Color firstColor, Color secondColor, float seconds) + { + double timeMult = (double)(MathHelper.TwoPi / seconds); + float colorMePurple = (float)((Math.Sin(timeMult * Main.GlobalTime) + 1) * 0.5f); + return Color.Lerp(firstColor, secondColor, colorMePurple); + } + /// + /// Returns a color lerp that supports multiple colors. + /// + /// The 0-1 incremental value used when interpolating. + /// The various colors to interpolate across. + /// + public static Color MulticolorLerp(float increment, params Color[] colors) + { + increment %= 0.999f; + int currentColorIndex = (int)(increment * colors.Length); + Color currentColor = colors[currentColorIndex]; + Color nextColor = colors[(currentColorIndex + 1) % colors.Length]; + return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); + } - public static void ExitShaderRegion(this SpriteBatch spriteBatch) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - } + // Cached for efficiency purposes. + internal static readonly FieldInfo UImageFieldMisc = typeof(MiscShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); + internal static readonly FieldInfo UImageFieldArmor = typeof(ArmorShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); - public static void DrawAuroras(Player player, float auroraCount, float opacity, Color color) - { + /// + /// Manually sets the texture of a instance, since vanilla's implementation only supports strings that access vanilla textures. + /// + /// The shader to bind the texture to. + /// The texture to bind. + public static MiscShaderData SetShaderTexture(this MiscShaderData shader, Texture2D texture) + { + UImageFieldMisc.SetValue(shader, new Ref(texture)); + return shader; + } + + /// + /// Manually sets the texture of a instance, since vanilla's implementation only supports strings that access vanilla textures. + /// + /// The shader to bind the texture to. + /// The texture to bind. + public static ArmorShaderData SetShaderTexture(this ArmorShaderData shader, Texture2D texture) + { + UImageFieldArmor.SetValue(shader, new Ref(texture)); + return shader; + } + + public static void EnterShaderRegion(this SpriteBatch spriteBatch) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + + public static void ExitShaderRegion(this SpriteBatch spriteBatch) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + + public static void DrawAuroras(Player player, float auroraCount, float opacity, Color color) + { float time = Main.GlobalTime % 3f / 3f; Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); for (int i = 0; i < auroraCount; i++) @@ -582,6 +606,6 @@ namespace CalamityMod 1); Main.playerDrawData.Add(drawData); } - } - } + } + } } diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index 942dea6426..7a6cabd163 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -38,6 +38,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.NPCs.AcidRain; namespace CalamityMod { @@ -739,6 +740,9 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 456 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 130, 212, 236, 248, 354 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 220, 220, 220 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 220, 220, 220 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 240, 264, 276, 390 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 400, 440, 464, 660 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 240, 264, 276, 390 } },