diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index 92cab6a912..e1757ba91c 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -21,12 +21,15 @@ namespace CalamityMod.Buffs.StatBuffs if (modPlayer.abyssalDivingSuitPrevious) { if (player.IsUnderwater()) + { + if (player.maxFallSpeed < 9f) + player.maxFallSpeed = 9f; player.gills = true; + } modPlayer.abyssalDivingSuitPower = true; modPlayer.depthCharm = true; modPlayer.jellyfishNecklace = true; modPlayer.anechoicPlating = true; - modPlayer.ironBoots = true; player.arcticDivingGear = true; player.accFlipper = true; player.accDivingHelm = true; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1dbe674969..d3b0f14233 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -736,6 +736,10 @@ namespace CalamityMod.CalPlayer /// Used to prevent dodges from triggering The Bee's full health damage reduction cooldown. public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; + public bool aFossil = false; + public bool aPowder = false; + public bool fallingBlockProtection = false; + public bool trapProtection = false; public bool alluringBait = false; public bool enchantedPearl = false; public bool fishingStation = false; @@ -911,6 +915,7 @@ namespace CalamityMod.CalPlayer public bool baroclaw = false; public bool HasIncreasedDashFirstFrame = false; public bool IsFirstDashFrame = true; + public int fallingBootVelCheckTimer = 0; public bool voidOfCalamity = false; public bool voidOfExtinction = false; public bool eArtifact = false; @@ -2143,6 +2148,10 @@ namespace CalamityMod.CalPlayer arcFlashRingVisual = false; bGlassBand = false; bGlassBandVisual = false; + aFossil = false; + aPowder = false; + fallingBlockProtection = false; + trapProtection = false; alluringBait = false; enchantedPearl = false; fishingStation = false; @@ -3279,7 +3288,7 @@ namespace CalamityMod.CalPlayer } //Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero - if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != Player.oldVelocity.Y) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) + if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { gSabatonHotkeyHoldTime++; if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime % 3f == 0) @@ -4084,7 +4093,7 @@ namespace CalamityMod.CalPlayer } // Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued // Also cancel fall if the player has upwards Y velocity (Goodbye Inner Tube cheese) - if (Player.velocity.Y < 0f || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) + if ((Player.gravDir == 1 && Player.velocity.Y < 0f) || (Player.gravDir == -1 && Player.velocity.Y > 1f) || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) { gSabatonFall = 0; gSabatonFalling = false; @@ -4103,7 +4112,7 @@ namespace CalamityMod.CalPlayer Player.controlJump = false; // Check if player hit some form of solid resistance (the ground) - if (Player.oldVelocity.Y == Player.velocity.Y) + if (0 == Player.velocity.Y) { var source = Player.GetSource_Accessory(FindAccessory(ItemType())); //Spawn explosion. ai[0] is used for transferring the recorded falling time @@ -4458,6 +4467,8 @@ namespace CalamityMod.CalPlayer ModDashMovement(); } #endregion + + Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it } #endregion diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index dcc2c5d56e..a8f69fe751 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -995,7 +995,7 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= 0.65f; // 80 in normal, 100 in expert, 150 in master - else if (proj.type == ProjectileID.SpikyBallTrap || proj.type == ProjectileID.FlamethrowerTrap || proj.type == ProjectileID.PoisonDartTrap) + else if (proj.type == ProjectileID.SpikyBallTrap || proj.type == ProjectileID.FlamethrowerTrap || proj.type == ProjectileID.FlamesTrap || proj.type == ProjectileID.PoisonDartTrap) modifiers.SourceDamage *= 0.625f; // 120 in normal, 144 in expert, 216 in master @@ -1003,6 +1003,24 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= 0.6f; } + bool isFallingBlock = (proj.type == ProjectileID.SandBallFalling) || (proj.type == ProjectileID.SiltBall) || (proj.type == ProjectileID.AshBallFalling) || + (proj.type == ProjectileID.CrimsandBallFalling) || (proj.type == ProjectileID.EbonsandBallFalling) || (proj.type == ProjectileID.PearlSandBallFalling) || + (proj.type == ProjectileID.ShellPileFalling) || (proj.type == ProjectileID.SlushBall) || (proj.type == ModContent.ProjectileType()); + if (Player.Calamity().fallingBlockProtection && isFallingBlock) + modifiers.Cancel(); + + bool isIgnoredTrap = (proj.type == ProjectileID.PoisonDartTrap) || (proj.type == ProjectileID.VenomDartTrap) || (proj.type == ProjectileID.PoisonDart); + if (Player.Calamity().trapProtection && isIgnoredTrap) + modifiers.Cancel(); + + bool isReducedTrap = (proj.type == ProjectileID.Boulder) || (proj.type == ProjectileID.BouncyBoulder) || (proj.type == ProjectileID.LifeCrystalBoulder) || + (proj.type == ProjectileID.MiniBoulder) || (proj.type == ProjectileID.MoonBoulder) || (proj.type == ProjectileID.SpearTrap) || + (proj.type == ProjectileID.SpikyBallTrap) || (proj.type == ProjectileID.GeyserTrap) || (proj.type == ProjectileID.FlamethrowerTrap) || + (proj.type == ProjectileID.RollingCactus) || (proj.type == ProjectileID.RollingCactusSpike) || (proj.type == ProjectileID.Explosives) || + (proj.type == ProjectileID.TNTBarrel) || (proj.type == ProjectileID.Landmine) || (proj.type == ModContent.ProjectileType()) || (proj.type == ProjectileID.FlamesTrap); // Fun fact: flamethrower traps fire proj 188, NOT ProjectileID.FlamethrowerTrap :) + if (Player.Calamity().trapProtection && isReducedTrap) + modifiers.SourceDamage *= 0.35f; + // Reduce damage dealt by rainbow trails depending on how faded they are. if (proj.type == ProjectileID.HallowBossLastingRainbow) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 64f5c79438..a5428f552b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1270,9 +1270,6 @@ namespace CalamityMod.CalPlayer // Increase fall speed if (!Player.mount.Active) { - if (Player.IsUnderwater() && ironBoots) - Player.maxFallSpeed = 9f; - if (!Player.wet) { if (cirrusDress) @@ -1283,6 +1280,15 @@ namespace CalamityMod.CalPlayer Player.maxFallSpeed = 20f; } + if (Player.controlDown && ironBoots) + { + Player.maxFallSpeed = 23f; // This is slightly faster than slimy saddle (so it can be viable) + if (Player.gravDir == 1 ? Player.velocity.Y <= 0 : Player.velocity.Y >= 0) + Player.velocity.Y *= 0.7f; + else if (Player.gravDir == 1 ? Player.velocity.Y < Player.maxFallSpeed : Player.velocity.Y > Player.maxFallSpeed) + Player.velocity.Y = MathHelper.Lerp(Player.velocity.Y, Player.maxFallSpeed, 0.1f); + } + if (LungingDown) { Player.maxFallSpeed = 80f; @@ -1726,6 +1732,49 @@ namespace CalamityMod.CalPlayer } } + if (ironBoots) + { + if (Player.controlDown) + { + if (Player.gravDir == 1 ? Player.velocity.Y > 0 : Player.velocity.Y < 0) + fallingBootVelCheckTimer++; + + if (Player.velocity.Y == 0 && fallingBootVelCheckTimer > 10) + { + float power = Utils.Remap(fallingBootVelCheckTimer, 10, 40, 0.1f, 1); + float scaledPower = (float)Math.Pow(power, 3); + int damage = (int)Player.GetBestClassDamage().ApplyTo(1500 * scaledPower); // Damage scales down thrice + Vector2 playerFeet = Player.Center + Vector2.UnitY * 26 * Player.gravDir; + + float blastSize = 120 * power; + float minMultiplier = 0.1f; + int hitsToMinMult = 6; + int debuff = ModContent.BuffType(); + int debuffTime = (int)(300 * power); + Projectile blast = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), playerFeet, Vector2.Zero, ModContent.ProjectileType(), (int)(damage), -25 * power, Player.whoAmI, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 5; + + int particleNumber = (int)Math.Max(15 * power, 2); + for (int i = -particleNumber; i <= particleNumber; i++) + { + Particle sparks = new AltSparkParticle(playerFeet, (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, false, Main.rand.Next(17, 30 + 1), Main.rand.NextFloat(0.2f, 0.8f), Main.rand.NextBool() ? Color.Lerp(Color.Gold, Color.Silver, 0.3f) : Color.Silver); + GeneralParticleHandler.SpawnParticle(sparks); + } + + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(sound with { Volume = 0.6f * power, Pitch = Main.rand.NextFloat(0.6f, 0.8f) }, playerFeet); + + Player.Calamity().GeneralScreenShakePower = 4 * scaledPower; + fallingBootVelCheckTimer = 0; + } + } + + if (Player.gravDir == 1 ? Player.velocity.Y <= 0 : Player.velocity.Y >= 0) + fallingBootVelCheckTimer = 0; + } + if (unstableGraniteCore) { zapActivity += 1; diff --git a/Dusts/SquareDust.cs b/Dusts/SquareDust.cs new file mode 100644 index 0000000000..054b05ad37 --- /dev/null +++ b/Dusts/SquareDust.cs @@ -0,0 +1,63 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquareDust : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + dust.rotation = Main.rand.NextFloat(-5, 5); + } + + public override bool Update(Dust dust) + { + float fadeSpeed = (dust.fadeIn + 1); + float rotDir = Math.Sign(dust.rotation); + dust.rotation += 0.04f * dust.scale * rotDir; + dust.velocity *= 0.96f * fadeSpeed; + if (dust.noGravity) + dust.scale -= 0.045f * fadeSpeed; + else + { + dust.scale -= 0.03f * fadeSpeed; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed; + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; + + Vector2 squash = Vector2.One; + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/SquashDust.cs b/Dusts/SquashDust.cs new file mode 100644 index 0000000000..92f997c578 --- /dev/null +++ b/Dusts/SquashDust.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquashDust : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + float fadeSpeed = (dust.fadeIn + 1); + dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; + dust.velocity *= 0.96f * fadeSpeed; + if (dust.noGravity) + dust.scale -= 0.045f * fadeSpeed; + else + { + dust.scale -= 0.03f * fadeSpeed; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed; + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/SquashDustHollow.cs b/Dusts/SquashDustHollow.cs new file mode 100644 index 0000000000..9060175773 --- /dev/null +++ b/Dusts/SquashDustHollow.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquashDustHollow : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + float fadeSpeed = (dust.fadeIn + 1); + dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; + dust.velocity *= 0.96f * fadeSpeed; + if (dust.noGravity) + dust.scale -= 0.045f * fadeSpeed; + else + { + dust.scale -= 0.03f * fadeSpeed; + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed; + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Dusts/SquashDustTileTouch.cs b/Dusts/SquashDustTileTouch.cs new file mode 100644 index 0000000000..4158167ca4 --- /dev/null +++ b/Dusts/SquashDustTileTouch.cs @@ -0,0 +1,69 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class SquashDustTileTouch : ModDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) + { + dust.scale *= Main.rand.NextFloat(0.8f, 1f); + } + + public override bool Update(Dust dust) + { + bool touchedTiles = false; + int size = (int)(2); + if (Collision.SolidCollision(dust.position, size, size)) + { + touchedTiles = true; + dust.velocity = Vector2.Zero; + } + float fadeSpeed = (dust.fadeIn + 1); // For this dust, fadeIn is used to increase the power of gravity if it's active, otherwise it makes it's lifetime change + dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; + dust.velocity *= 0.96f; + if (dust.noGravity) + dust.scale -= 0.045f * (touchedTiles ? 0.4f : 1) * fadeSpeed; + else + { + dust.scale -= 0.03f * (touchedTiles ? 0.4f : 1); + dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f) * fadeSpeed; + } + + float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f); + if (!dust.noLightEmittence) + Lighting.AddLight(dust.position, dust.color.ToVector3() * light); + + if (dust.scale <= 0) + dust.active = false; + + if (!touchedTiles) + dust.position += dust.velocity; + + return false; + } + public override bool PreDraw(Dust dust) + { + Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); + Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; + + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + + // Glow Orb + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Effects/ArsenalEffects.cs b/Effects/ArsenalEffects.cs new file mode 100644 index 0000000000..fbd09d8a21 --- /dev/null +++ b/Effects/ArsenalEffects.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using CalamityMod.TileEntities; +using CalamityMod.Tiles.DraedonSummoner; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Effects +{ + public class ArsenalEffects + { + public static int ArsenalDust = 278; // Colorable firework dust, simple and effective. Most visuals use a mix of the energy respective dust and this + + // Plasma + public static int ArsenalPlamaDust = ModContent.DustType(); + public static Color ArsenalPlamaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.35f); + // Laser + public static int ArsenalLaserDust = ModContent.DustType(); + public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Firebrick, 0.35f); + // Pulse + public static int ArsenalPulseDust = ModContent.DustType(); + public static Color ArsenalPulseColor = Color.Lerp(Color.DarkOrchid, Color.Magenta, 0.35f); + // Electric + public static int ArsenalElectricDust = ModContent.DustType(); + public static Color ArsenalElectricColor = Color.Lerp(Color.Aqua, Color.Aquamarine, 0.35f); + // Gauss + public static int ArsenalGaussDust = ModContent.DustType(); + public static Color ArsenalGaussColor = Color.Lerp(Color.Yellow, Color.Goldenrod, 0.35f); + } +} diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 8a366bd53a..e7af14fa61 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -177,7 +177,6 @@ namespace CalamityMod.ILEditing IL_WorldGen.Chlorophyte += AdjustChlorophyteSpawnLimits; IL_UIWorldCreation.SetDefaultOptions += ChangeDefaultWorldSize; IL_UIWorldCreation.AddWorldSizeOptions += SwapSmallDescriptionKey; - IL_UIWorldCreation.AddWorldDifficultyOptions += SwapMasterModeDescriptionKey; Terraria.IO.On_WorldFile.ClearTempTiles += ClearModdedTempTiles; On_WorldGen.MakeDungeon += LimitDungeonEntranceXPosition; IL_WorldGen.DungeonHalls += LimitDungeonHallsXPosition; diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index b6ca1da325..419d4c19f9 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -161,7 +161,7 @@ namespace CalamityMod.ILEditing } #endregion - #region Change World Generation Descriptions + #region Change Small World Description /// /// Changes the description of Small worlds to serve as a warning. /// @@ -184,26 +184,6 @@ namespace CalamityMod.ILEditing } - - /// - /// Changes the description of Master Mode to mention boss changes. - /// - private static void SwapMasterModeDescriptionKey(ILContext il) - { - // Swap vanilla's Master Mode description string (UI.WorldDescriptionMaster) with Calamity's edited version (Mods.CalamityMod.UI.WorldMaster). - var cursor = new ILCursor(il); - - // Move to after the string. - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdstr("UI.WorldDescriptionMaster"))) - { - LogFailure("Change Master Mode Description", "Could not match string \"UI.WorldDescriptionMaster\"."); - return; - } - - // Pop this value off, then replace it with Calamity's new string. - cursor.EmitPop(); - cursor.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.WorldMaster"); - } #endregion #region Clear temporary modded tiles diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 51803181a3..8fa999b765 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -65,7 +65,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(15). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index 09447e3273..6293e34145 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.pickSpeed -= 0.1f; + player.Calamity().aFossil = true; + player.Calamity().fallingBlockProtection = true; } public override void AddRecipes() diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 05610d1dc1..0a6598e7c6 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -20,20 +20,25 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.pickSpeed -= 0.15f; - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight) - { - player.statDefense += 10; - player.endurance += 0.05f; - } + player.pickSpeed -= 0.3f; + player.Calamity().aPowder = true; + player.Calamity().fallingBlockProtection = true; + player.Calamity().trapProtection = true; + + // Doesn't stack with downgrades + if (player.chiselSpeed) + player.pickSpeed += 0.15f; + if (player.Calamity().aFossil) + player.pickSpeed += 0.1f; } public override void AddRecipes() { CreateRecipe(). AddIngredient(). + AddIngredient(ItemID.AncientChisel). AddIngredient(3). - AddIngredient(15). + AddIngredient(10). AddIngredient(ItemID.Bone, 15). AddTile(TileID.Anvils). Register(); diff --git a/Items/Accessories/IronBoots.cs b/Items/Accessories/IronBoots.cs index a87ec69437..5e50b0a3b2 100644 --- a/Items/Accessories/IronBoots.cs +++ b/Items/Accessories/IronBoots.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.ironBoots = true; + player.noFallDmg = true; } } } diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index 8f20c5926b..ca173561dc 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -92,6 +92,8 @@ namespace CalamityMod.Items.Accessories Projectile.tileCollide = false; Projectile.ArmorPenetration = 20; Projectile.netImportant = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 0969ede8cc..fbe8783d5f 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -73,7 +73,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "HaguriHat", "Heart Plus Up!", "Hugekraken", - "Lilac Olligoci", "LordMetarex", "Memes", "Mercutio 'Merkalto' Takle", @@ -146,6 +145,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "L0st", "Leon", "Leviathan", + "Lilac Olligoci", "Lompl Allimath", "Lucille Karma", "MarieArk", diff --git a/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs index ab7226c2e3..a2ae0bcf56 100644 --- a/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs +++ b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs @@ -41,11 +41,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - //Item.useAmmo = AmmoID.Arrow; - - modItem.UsesCharge = true; - modItem.MaxCharge = 85f; - modItem.ChargePerUse = 0.001f; // Charge depletion is done in the holdout, but it needs a small fee to prevent usage at 0% } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs index 323cf7ae91..5b3983dd1b 100644 --- a/Items/Weapons/Ranged/BladedgeRailbow.cs +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -70,6 +71,8 @@ namespace CalamityMod.Items.Weapons.Ranged ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), // Not ranged ModContent.ProjectileType(), diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index f7b115b4da..3a54076ed3 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -39,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[stealth].Calamity().stealthStrike = true; Main.projectile[stealth].aiStyle = -1; Main.projectile[stealth].tileCollide = false; + Main.projectile[stealth].usesIDStaticNPCImmunity = false; Main.projectile[stealth].usesLocalNPCImmunity = true; + Main.projectile[stealth].localNPCHitCooldown = 10; } return false; } diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 89cf7dcd29..374b63d451 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; } return false; } diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 2799f984b0..686a7719a8 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; } return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index df6bdae49d..040455ec51 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -116,7 +116,11 @@ AmbrosialAmpoule: { AncientFossil: { DisplayName: Ancient Fossil - Tooltip: Increases mining speed by 10% + Tooltip: + ''' + Increases mining speed by 10% + Provides immunity to damage from falling blocks + ''' } AnechoicPlating: { @@ -202,8 +206,10 @@ ArchaicPowder: { DisplayName: Archaic Powder Tooltip: ''' - Increases mining speed by 15% - 5% increased damage reduction and +10 defense while underground or in the underworld + Increases mining speed by 30% + Provides immunity to damage from falling blocks and dart traps + 65% resistance to all damage from traps + Does not stack with downgrades ''' } @@ -1000,7 +1006,13 @@ InterstellarStompers: { IronBoots: { DisplayName: Iron Boots - Tooltip: Allows you to sink faster through liquids + Tooltip: + ''' + Hold DOWN to increase your maximum fall speed, even in water + Upon hitting the ground, a shockwave is created at your feet + The shockwave scales in both damage and size the longer you fall for + Negates fall damage + ''' } JellyChargedBattery: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index e4025b826b..08b4725ff0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -467,9 +467,8 @@ FetidEmesis: { ''' Fires an accelerating stream of bullets until the barrel overheats When the barrel overheats, a spread of fetid chunks is vomited out - Holding while firing will hold in the chunks - If held in for long enough, more chunks will be fired After firing, the gun must cool back down before it can be used again + Pressing while firing will instantly launch the chunks 75% chance to save ammo ''' } diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index dc46a26af4..9934224d3d 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,6 +1,4 @@ -// Vanilla UI edits SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" -WorldMaster: Game over man, game over! (Brutally hard boss changes, for the truly brave) // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines diff --git a/Particles/GlowSquareParticleThick.png b/Particles/GlowSquareParticleThick.png new file mode 100644 index 0000000000..09dd34cbde Binary files /dev/null and b/Particles/GlowSquareParticleThick.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 00aefb65a5..d7d3eee9ef 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -4218,6 +4218,26 @@ namespace CalamityMod.Projectiles } #endregion + #region On Hit NPC + public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) + { + // Implementation of shared static iframes. + // If this projectile does not use static iframes, or is not registered to share them, then do nothing. + if (!projectile.usesIDStaticNPCImmunity || !SharedStaticIFrames.Includes(projectile.type)) + return; + + // Get the set of shared static iframe projectile types. + // If it's empty, then do nothing. + IList sharedWithProjectiles = SharedStaticIFrames.GetSharedStaticIFrames(projectile.type); + if (sharedWithProjectiles.Count <= 0) + return; + + // Apply the appropriate shared static iframes to all projectile types with which it is shared. + foreach (int projType in sharedWithProjectiles) + Projectile.perIDStaticNPCImmunity[projType][target.whoAmI] = Main.GameUpdateCount + (uint)projectile.idStaticNPCHitCooldown; + } + #endregion + #region Can Damage + Can Hit public override bool? CanDamage(Projectile projectile) { diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 3f29fce51a..f443bd8369 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Projectiles { // Various shorthands for projectiles which receive very simple changes, such as setting one flag. IProjectileTweak[] defenseDamage = Do(DefenseDamage); - IProjectileTweak[] trueMelee = Do(TrueMelee); - IProjectileTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed); + IProjectileTweak[] trueMelee = Do(TrueMelee, DefaultIDStaticIFrames); // All the tweaked true melee projectiles need to be changed from global to static as well + IProjectileTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed, DefaultIDStaticIFrames); IProjectileTweak[] pointBlank = Do(PointBlank); IProjectileTweak[] standardBulletTweaks = Do(PointBlank, ExtraUpdatesDelta(+2)); IProjectileTweak[] standardChainsawTweaks = Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5)); IProjectileTweak[] standardDrillTweaks = Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+25), LocalIFrames(5)); - IProjectileTweak[] counterweightTweaks = Do(MaxUpdatesExact(2), IDStaticIFrames(10)); + IProjectileTweak[] counterweightTweaks = Do(MaxUpdatesExact(2), DefaultIDStaticIFrames); // Shorthand for changing all the stats of a yoyo at once. This handles extra update related math for you. // For topSpeed, put in how fast you want the yoyo to be EXACTLY: it will be divided out in extra updates for you. @@ -116,14 +116,14 @@ namespace CalamityMod.Projectiles { ProjectileID.AdamantiteChainsaw, standardChainsawTweaks }, { ProjectileID.AdamantiteDrill, standardDrillTweaks }, { ProjectileID.AdamantiteGlaive, Do(TrueMelee, LocalIFrames(7)) }, - { ProjectileID.Anchor, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Arkhalis, Do(TrueMeleeNoSpeed, ScaleExact(1.25f)) }, - { ProjectileID.Bee, Do(PiercingExact(2)) }, - { ProjectileID.BeeArrow, Do(PointBlank, ExtraUpdatesExact(1)) }, + { ProjectileID.Anchor, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.Arkhalis, Do(TrueMeleeNoSpeed, ScaleExact(1.25f), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.Bee, Do(PiercingExact(2), DefaultIDStaticIFrames) }, + { ProjectileID.BeeArrow, Do(PointBlank, ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.BlackCounterweight, counterweightTweaks }, { ProjectileID.BlueCounterweight, counterweightTweaks }, { ProjectileID.BlueMoon, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Bullet, standardBulletTweaks }, + { ProjectileID.Bullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.BulletHighVelocity, Do(PointBlank, LocalIFrames(-1)) }, { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5), ScaleExact(1.5f)) }, { ProjectileID.ChlorophyteChainsaw, standardChainsawTweaks }, @@ -132,45 +132,45 @@ namespace CalamityMod.Projectiles { ProjectileID.CobaltChainsaw, standardChainsawTweaks }, { ProjectileID.CobaltDrill, standardDrillTweaks }, { ProjectileID.CobaltNaginata, Do(TrueMelee, LocalIFrames(9)) }, - { ProjectileID.CrystalBullet, standardBulletTweaks }, + { ProjectileID.CrystalBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.CrystalVileShardHead, Do(LocalIFrames(23)) }, { ProjectileID.CrystalVileShardShaft, Do(LocalIFrames(23)) }, - { ProjectileID.CursedBullet, standardBulletTweaks }, + { ProjectileID.CursedBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.ClusterRocketI, Do(LocalIFrames(15)) }, { ProjectileID.ClusterFragmentsI, Do(IDStaticIFrames(15)) }, { ProjectileID.ClusterRocketII, Do(LocalIFrames(15)) }, { ProjectileID.ClusterFragmentsII, Do(IDStaticIFrames(15)) }, - { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, + { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, { ProjectileID.ClusterSnowmanRocketII, Do(LocalIFrames(15)) }, - { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3)) }, // Flying Dragon + { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3), DefaultIDStaticIFrames) }, // Flying Dragon { ProjectileID.EmeraldBolt, Do(NoPiercing) }, { ProjectileID.EmpressBlade, Do(LocalIFrames(30)) }, // Terraprisma - { ProjectileID.EnchantedBoomerang, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.ExplosiveBullet, standardBulletTweaks }, + { ProjectileID.EnchantedBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.ExplosiveBullet, Do(PointBlank, ExtraUpdatesDelta(+2), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert - { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150)) }, - { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2)) }, + { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150), DefaultIDStaticIFrames) }, + { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames - { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FlowerPetal, Do(MaxUpdatesExact(4), LocalIFrames(10)) }, // Orichalcum armor { ProjectileID.FlowerPow, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.GiantBee, Do(PiercingExact(2)) }, + { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.GiantBee, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GladiusStab, Do(TrueMelee, LocalIFrames(-1)) }, - { ProjectileID.GoldenBullet, standardBulletTweaks }, - { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2)) }, + { ProjectileID.GoldenBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, { ProjectileID.Hamdrax, standardDrillTweaks }, // Drax (never internally renamed since 1.1) - { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.IceSickle, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.IchorBullet, standardBulletTweaks }, - { ProjectileID.InfluxWaver, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2)) }, + { ProjectileID.IchorBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.InfluxWaver, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, { ProjectileID.LaserDrill, Do(ArmorPenetrationDelta(+25), LocalIFrames(5)) }, - { ProjectileID.LightDisc, Do(MaxUpdatesExact(3)) }, + { ProjectileID.LightDisc, Do(MaxUpdatesExact(3), DefaultIDStaticIFrames) }, { ProjectileID.LostSoulHostile, Do(TileCollide) }, // Ragged Caster { ProjectileID.MeteorShot, standardBulletTweaks }, { ProjectileID.Meowmere, Do(PiercingExact(3), LocalIFrames(-1)) }, @@ -181,14 +181,14 @@ namespace CalamityMod.Projectiles { ProjectileID.MythrilChainsaw, standardChainsawTweaks }, { ProjectileID.MythrilDrill, standardDrillTweaks }, { ProjectileID.MythrilHalberd, Do(TrueMelee, LocalIFrames(8)) }, - { ProjectileID.NanoBullet, standardBulletTweaks }, + { ProjectileID.NanoBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.NebulaDrill, standardDrillTweaks }, { ProjectileID.NebulaLaser, Do(ExtraUpdatesDelta(-1)) }, { ProjectileID.OrichalcumChainsaw, standardChainsawTweaks }, { ProjectileID.OrichalcumDrill, standardDrillTweaks }, { ProjectileID.PalladiumChainsaw, standardChainsawTweaks }, { ProjectileID.PalladiumDrill, standardDrillTweaks }, - { ProjectileID.PartyBullet, standardBulletTweaks }, + { ProjectileID.PartyBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.PoisonFang, Do(LocalIFrames(10)) }, { ProjectileID.PurpleCounterweight, counterweightTweaks }, { ProjectileID.QueenSlimeGelAttack, Do(NoPiercing) }, @@ -200,20 +200,20 @@ namespace CalamityMod.Projectiles { ProjectileID.RocketFireworkYellow, Do(TimeLeftDelta(+45)) }, { ProjectileID.SawtoothShark, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(6)) }, { ProjectileID.ShadowBeamHostile, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.SolarFlareDrill, standardDrillTweaks }, { ProjectileID.StardustDrill, standardDrillTweaks }, - { ProjectileID.Starfury, Do(TimeLeftExact(75)) }, + { ProjectileID.Starfury, Do(TimeLeftExact(75), DefaultIDStaticIFrames) }, { ProjectileID.StarWrath, Do(NoPiercing) }, { ProjectileID.Sunfury, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(2)) }, // Beam Sword projectile - { ProjectileID.Terragrim, Do(TrueMeleeNoSpeed, ScaleExact(1.25f)) }, - { ProjectileID.ThunderStaffShot, Do(PiercingExact(3)) }, //Thunder Zapper projectile + { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, // Beam Sword projectile + { ProjectileID.Terragrim, Do(TrueMeleeNoSpeed, ScaleExact(1.25f), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.ThunderStaffShot, Do(PiercingExact(3), DefaultIDStaticIFrames) }, //Thunder Zapper projectile { ProjectileID.TitaniumChainsaw, standardChainsawTweaks }, { ProjectileID.TitaniumDrill, standardDrillTweaks }, - { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1)) }, + { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.TrueNightsEdge, Do(PiercingExact(4)) }, - { ProjectileID.VenomBullet, standardBulletTweaks }, + { ProjectileID.VenomBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, { ProjectileID.VortexDrill, standardDrillTweaks }, { ProjectileID.Wasp, Do(PiercingExact(2)) }, @@ -236,7 +236,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ObsidianSwordfish, trueMelee }, { ProjectileID.OrichalcumHalberd, trueMelee }, { ProjectileID.PalladiumPike, trueMelee }, - { ProjectileID.PiercingStarlight, trueMelee }, + { ProjectileID.PiercingStarlight, Do(TrueMelee, IDStaticIFrames(4)) }, // Has an exception in Vanilla iframe code, uses 4 iframes { ProjectileID.PlatinumShortswordStab, trueMelee }, { ProjectileID.RulerStab, trueMelee }, { ProjectileID.ShadowJoustingLance, trueMelee }, @@ -254,41 +254,41 @@ namespace CalamityMod.Projectiles #endregion #region CATEGORY 4: Point Blank support - { ProjectileID.Blizzard, pointBlank }, // Blizzard Staff projectiles, re-used in Frostbite Blaster. - { ProjectileID.BlueFlare, pointBlank }, - { ProjectileID.BoneArrow, pointBlank }, - { ProjectileID.CandyCorn, pointBlank }, - { ProjectileID.ChlorophyteArrow, pointBlank }, - { ProjectileID.ChlorophyteBullet, pointBlank }, - { ProjectileID.CrimsandBallGun, pointBlank }, - { ProjectileID.CrystalDart, pointBlank }, - { ProjectileID.CursedArrow, pointBlank }, - { ProjectileID.CursedDart, pointBlank }, + { ProjectileID.Blizzard, Do(PointBlank, DefaultIDStaticIFrames) }, // Blizzard Staff projectiles, re-used in Frostbite Blaster. + { ProjectileID.BlueFlare, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.BoneArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CandyCorn, Do(PointBlank, IDStaticIFrames(7)) }, // Has an exception in Vanilla iframe code, uses 7 iframes + { ProjectileID.ChlorophyteArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.ChlorophyteBullet, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CrimsandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CrystalDart, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CursedArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.CursedDart, Do(PointBlank, DefaultIDStaticIFrames) }, { ProjectileID.DD2PhoenixBowShot, pointBlank }, // Phantom Phoenix - { ProjectileID.EbonsandBallGun, pointBlank }, - { ProjectileID.FireArrow, pointBlank }, - { ProjectileID.Flare, pointBlank }, - { ProjectileID.FrostburnArrow, pointBlank }, + { ProjectileID.EbonsandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.FireArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.Flare, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.FrostburnArrow, Do(PointBlank, DefaultIDStaticIFrames) }, { ProjectileID.Harpoon, pointBlank }, - { ProjectileID.Hellwing, pointBlank }, - { ProjectileID.HellfireArrow, pointBlank }, - { ProjectileID.HolyArrow, pointBlank }, - { ProjectileID.IchorArrow, pointBlank }, - { ProjectileID.JestersArrow, pointBlank }, + { ProjectileID.Hellwing, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.HellfireArrow, Do(PointBlank, ExtraUpdatesDelta(+2)) }, + { ProjectileID.HolyArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.IchorArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.JestersArrow, Do(PointBlank, DefaultIDStaticIFrames) }, { ProjectileID.MoonlordArrow, pointBlank }, // Luminite Arrow - { ProjectileID.PainterPaintball, pointBlank }, - { ProjectileID.PearlSandBallGun, pointBlank }, - { ProjectileID.PhantasmArrow, pointBlank }, - { ProjectileID.PoisonDartBlowgun, pointBlank }, - { ProjectileID.PulseBolt, pointBlank }, - { ProjectileID.SandBallGun, pointBlank }, - { ProjectileID.Seed, pointBlank }, - { ProjectileID.ShadowFlameArrow, pointBlank }, - { ProjectileID.SnowBallFriendly, pointBlank }, - { ProjectileID.Stake, pointBlank }, - { ProjectileID.UnholyArrow, pointBlank }, - { ProjectileID.VenomArrow, pointBlank }, - { ProjectileID.WoodenArrowFriendly, pointBlank }, + { ProjectileID.PainterPaintball, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PearlSandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PhantasmArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PoisonDartBlowgun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.PulseBolt, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.SandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.Seed, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.ShadowFlameArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.SnowBallFriendly, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.Stake, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.UnholyArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.VenomArrow, Do(PointBlank, DefaultIDStaticIFrames) }, + { ProjectileID.WoodenArrowFriendly, Do(PointBlank, DefaultIDStaticIFrames) }, #endregion #region CATEGORY 5: Defense Damage support @@ -327,6 +327,319 @@ namespace CalamityMod.Projectiles { ProjectileID.ThornBall, Do(Main.zenithWorld ? IgnoreWater : DontIgnoreWater, DefenseDamage) }, // Plantera bouncing thorn balls { ProjectileID.UnholyTridentHostile, defenseDamage }, #endregion + + #region CATEGORY 6: Static Iframe changes + {ProjectileID.AbigailCounter, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Ale, Do(DefaultIDStaticIFrames)}, + {ProjectileID.AmberBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.AmethystBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.AshBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BallofFire, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BallofFrost, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bananarang, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bat, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BeeHive, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Beenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BlackCat, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodArrow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodButcherer, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodNautilusTears, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodWater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BloodyMachete, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BombFish, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bone, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoneArrowFromMerchant, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoneDagger, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoneJavelin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BookOfSkullsSkull, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BookStaffShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Boulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoulderStaffOfEarth, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyBoulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyDynamite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BouncyGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.BoxingGlove, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bubble, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Bunny, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CannonballFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CavelingGardener, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2Rocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2RocketExplosive, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2RocketExplosiveLarge, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2RocketLarge, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Celeb2Weapon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChainGuillotine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChainKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChargedBlasterCannon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChargedBlasterLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChargedBlasterOrb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ChlorophytePartisan, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClothiersCurse, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterMineI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterMineII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterSnowmanFragmentsI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ClusterSnowmanFragmentsII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CoinPortal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CombatWrench, Do(IDStaticIFrames(7))}, // Has an exception in Vanilla iframe code, uses 7 iframes + {ProjectileID.CopperCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CorruptSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrimsandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrimsonHeart, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrimsonSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalLeaf, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalLeafShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalPulse, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalPulse2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalShard, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CrystalStorm, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CursedDartFlame, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CursedFlameFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.CursedFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Daybreak, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DD2PhoenixBow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DemonScythe, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DiamondBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DirtStickyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DripplerFlailExtraBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryadsWardCircle, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DryRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.DrySnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Dynamite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EatersBite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EbonsandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EighthNote, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Electrosphere, Do(IDStaticIFrames(8))}, // Has an exception in Vanilla iframe code, uses 8 iframes + {ProjectileID.ElectrosphereMissile, Do(DefaultIDStaticIFrames)}, + {ProjectileID.EnchantedBeam, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Explosives, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FallingStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Flairon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FlamesTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FlowerPowPetal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FrostArrow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.FrostDaggerfish, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GasTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GelBalloon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Geode, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GeyserTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GoldCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GolemFist, Do(DefaultIDStaticIFrames)}, + {ProjectileID.GreenLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Grenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HallowSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HallowStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HeatRay, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HolyWater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneyRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoneySnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HornetStinger, Do(DefaultIDStaticIFrames)}, + {ProjectileID.HoundiusShootiusFireball, Do(DefaultIDStaticIFrames)}, + {ProjectileID.IceBlock, Do(DefaultIDStaticIFrames)}, + {ProjectileID.IceBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.IchorDart, Do(DefaultIDStaticIFrames)}, + {ProjectileID.JackOLantern, Do(DefaultIDStaticIFrames)}, + {ProjectileID.JavelinFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Landmine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LaserMachinegun, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LaserMachinegunLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LastPrism, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LastPrismLaser, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.LavaBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LavaMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LavaRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LavaSnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Leaf, Do(DefaultIDStaticIFrames)}, + {ProjectileID.LifeCrystalBoulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MagicMissile, Do(IDStaticIFrames(8))}, // Has an exception in Vanilla iframe code, uses 8 iframes + {ProjectileID.MagnetSphereBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MechanicWrench, Do(IDStaticIFrames(7))}, // Has an exception in Vanilla iframe code, uses 7 iframes + {ProjectileID.MedusaHead, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MedusaHeadRay, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Meteor1, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.Meteor2, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.Meteor3, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.MinecartMechLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniBoulder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniMinotaur, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeMineI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeMineII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeRocketI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeRocketII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeSnowmanRocketI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniNukeSnowmanRocketII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniRetinaLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MiniSharkron, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovCocktail, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovFire, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovFire2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MolotovFire3, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MonkStaffT3_AltShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MudBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Mushroom, Do(DefaultIDStaticIFrames)}, + {ProjectileID.MushroomSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NailFriendly, Do(IDStaticIFrames(1))}, // Has an exception in Vanilla iframe code, uses 1 iframe + {ProjectileID.NebulaArcanumExplosionShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NebulaArcanumExplosionShotShard, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NebulaBlaze1, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.NebulaBlaze2, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.NettleBurstEnd, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NettleBurstLeft, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NettleBurstRight, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NightBeam, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NorthPoleSnowflake, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NorthPoleSpear, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NorthPoleWeapon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NurseSyringeHeal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.NurseSyringeHurt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.OrnamentFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.OrnamentStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PaladinsHammerFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PaperAirplaneA, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PaperAirplaneB, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PartyGirlGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PearlSandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PewMaticHornShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Phantasm, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PineNeedleFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PlatinumCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PoisonDart, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PoisonDartTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PoisonedKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PossessedHatchet, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PrincessWeapon, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineIII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ProximityMineIV, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PureSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PurificationPowder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PurpleLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.PygmySpear, Do(DefaultIDStaticIFrames)}, + {ProjectileID.QuarterNote, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RainbowFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxBlue, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxGreen, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxRed, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketFireworksBoxYellow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketIII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketIV, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanI, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanIII, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RocketSnowmanIV, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RollingCactus, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RollingCactusSpike, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RottenEgg, Do(DefaultIDStaticIFrames)}, + {ProjectileID.RubyBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SandBallFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SandSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SantaBombs, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SantankMountRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SapphireBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ScarabBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ScutlixLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ScutlixLaserFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SeedlerNut, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SeedlerThorn, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShadowBeamFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShadowFlameKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShellPileFalling, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShimmerArrow, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ShimmerFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Shuriken, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SiltBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SilverBullet, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SilverCoin, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SkyFracture, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SlushBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SnowSpray, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SolarCounter, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SolarFlareRay, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SoulDrain, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpearTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpelunkerFlare, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Spider, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpiderEgg, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpikyBall, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpikyBallTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SpiritFlame, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes + {ProjectileID.SporeGas, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeGas2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeGas3, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.SporeTrap2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StarAnise, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StarCannonStar, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StardustCellMinion, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StardustCellMinionShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StardustGuardianExplosion, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StickyBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StickyDynamite, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StickyGrenade, Do(DefaultIDStaticIFrames)}, + {ProjectileID.StormTigerGem, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Stynger, Do(IDStaticIFrames(7))}, // Has an exception in Vanilla iframe code, uses 7 iframes + {ProjectileID.StyngerShrapnel, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TentacleSpike, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThornChakram, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThrowingKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThunderSpear, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ThunderSpearShot, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TiedEighthNote, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TitaniumStormShard, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TopazBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicBubble, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicCloud, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicCloud2, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicCloud3, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ToxicFlask, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Truffle, Do(DefaultIDStaticIFrames)}, + {ProjectileID.TruffleSpore, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Typhoon, Do(IDStaticIFrames(6))}, // Has an exception in Vanilla iframe code, uses 6 iframes + {ProjectileID.UFOLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.UFOMinion, Do(DefaultIDStaticIFrames)}, + {ProjectileID.UnholyTridentFriendly, Do(DefaultIDStaticIFrames)}, + {ProjectileID.UnholyWater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VampireKnife, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VenomDartTrap, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ViciousPowder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VilePowder, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VilethornBase, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VilethornTip, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexBeater, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexBeaterRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexVortexLightning, Do(DefaultIDStaticIFrames)}, + {ProjectileID.VortexVortexPortal, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Waffle, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WandOfFrostingFrost, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WandOfSparkingSpark, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WaterBolt, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WaterStream, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Web, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetBomb, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetMine, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WetSnowmanRocket, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Wisp, Do(DefaultIDStaticIFrames)}, + {ProjectileID.WoodenBoomerang, Do(DefaultIDStaticIFrames)}, + {ProjectileID.Xenopopper, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ZapinatorLaser, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ZoologistStrikeGreen, Do(DefaultIDStaticIFrames)}, + {ProjectileID.ZoologistStrikeRed, Do(DefaultIDStaticIFrames)}, + + #endregion + }; } @@ -472,6 +785,7 @@ namespace CalamityMod.Projectiles } } internal static IProjectileTweak IDStaticIFrames(int f) => new IDStaticIFrameRule(f); + internal static IProjectileTweak DefaultIDStaticIFrames => new IDStaticIFrameRule(10); #endregion #region Ignore Water diff --git a/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs b/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs index 93e6c4f824..0321d38bd4 100644 --- a/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs +++ b/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs @@ -19,12 +19,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override float OffsetXUpwards => -0f; public override float BaseOffsetY => -0f; public override float OffsetYDownwards => 0f; + public override float WeaponTurnSpeed => 0.45f; - public static int FramesPerLoad = 13; - public static int MaxLoadableShots = 15; public static float BulletSpeed = 12f; public SlotId ChargeSlot; - public Color mainColor = Color.Lerp(Color.Chartreuse, Color.White, 0.35f); public int time = 0; public ref float CurrentChargingFrames => ref Projectile.ai[0]; @@ -80,15 +78,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i <= 25; i++) { - Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 267, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 1.3f)); + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlamaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 1.3f)); dust.noGravity = true; - dust.color = mainColor; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; } CurrentChargingFrames = 0; - if (modItem.Charge > 0) - modItem.Charge -= 0.06f; - else - Projectile.Kill(); } // Spread Fire mode else @@ -105,15 +99,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } for (int i = 0; i <= 4; i++) { - Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 267, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.4f, 1.1f)); - dust.noGravity = true; - dust.color = mainColor; + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, Effects.ArsenalEffects.ArsenalPlamaDust, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.8f, 1.3f)); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; + dust.fadeIn = 2; } CurrentChargingFrames = 0; - if (modItem.Charge > 0) - modItem.Charge -= 0.025f; - else - Projectile.Kill(); } } else if (downtime == 0) @@ -124,7 +115,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float particleScale = Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true); float strength = particleScale; - Vector3 DustLight = mainColor.ToVector3(); + Vector3 DustLight = Effects.ArsenalEffects.ArsenalPlamaColor.ToVector3(); Lighting.AddLight(GunTipPosition, DustLight * strength); } @@ -134,11 +125,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal ChargeSound?.Stop(); for (int i = 0; i < 20; i++) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, Effects.ArsenalEffects.ArsenalDust); chargefull.velocity = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 4f + Owner.velocity * 0.5f; chargefull.scale = Main.rand.NextFloat(0.6f, 0.8f); chargefull.noGravity = false; - chargefull.color = mainColor; + chargefull.color = Effects.ArsenalEffects.ArsenalPlamaColor; } SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorChargeLoop"); ChargeSlot = SoundEngine.PlaySound(sound with { Volume = 0.7f, IsLooped = true }, Projectile.Center); @@ -146,11 +137,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (CurrentChargingFrames > chargeMax && Main.rand.NextBool()) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, Effects.ArsenalEffects.ArsenalDust); chargefull.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(5, 9); chargefull.scale = Main.rand.NextFloat(0.2f, 0.4f); chargefull.noGravity = true; - chargefull.color = mainColor; + chargefull.color = Effects.ArsenalEffects.ArsenalPlamaColor; } } @@ -193,10 +184,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (CurrentChargingFrames > 0 && downtime == 0) { float randSize = Main.rand.NextFloat(0.8f, 1.2f); - Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, mainColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); Main.EntitySpriteDraw(rechargeTexture, tipPosition - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.15f * Utils.GetLerpValue(0, chargeMax, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0); - Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, mainColor with { A = 0 } * fade, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.5f, 0.9f) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1), flipSprite); + Main.EntitySpriteDraw(pointTexture, tipPosition - Main.screenPosition + (Projectile.velocity * 15 * fade), null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * fade, Projectile.velocity.RotatedBy(MathHelper.ToRadians(90f)).ToRotation(), pointTexture.Size() * 0.5f, new Vector2(0.5f, 0.9f) * 0.035f * fade * randSize * (CurrentChargingFrames == chargeMax ? 1.5f : 1), flipSprite); } return false; } diff --git a/Projectiles/DraedonsArsenal/ImmolationArrow.cs b/Projectiles/DraedonsArsenal/ImmolationArrow.cs index 1ce4b8c049..63426edb7b 100644 --- a/Projectiles/DraedonsArsenal/ImmolationArrow.cs +++ b/Projectiles/DraedonsArsenal/ImmolationArrow.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,7 +16,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref float time => ref Projectile.ai[0]; - public Color mainColor = Color.Lerp(Color.Chartreuse, Color.White, 0.35f); public NPC chosenTarget; public bool stuckInTarget = false; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.timeLeft = 180; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 4; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -70,6 +70,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (stuckInGround) { + Projectile.extraUpdates = 2; Projectile.rotation = storedVelocity.ToRotation() + MathHelper.PiOver2; stuckTimer--; @@ -86,38 +87,31 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (Main.rand.NextBool(3) && canStick) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); - dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlamaDust, -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); dust.noGravity = true; - dust.color = mainColor; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; } if (targetDist < 1400f) { - Particle spark = new SparkParticle(Projectile.Center, -Projectile.velocity, false, 6, 1.3f, mainColor * 0.7f); + Particle spark = new SparkParticle(Projectile.Center, -Projectile.velocity, false, 13, 1.3f, Effects.ArsenalEffects.ArsenalPlamaColor * 0.7f); GeneralParticleHandler.SpawnParticle(spark); if (Main.rand.NextBool(6)) { Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(12, 12); float speed = Main.rand.NextFloat(0.2f, 0.7f); - Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), mainColor); + Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlamaColor); GeneralParticleHandler.SpawnParticle(spark2); } } - if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) - { - Vector2 moveTotarget = (closestTarget.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - if (Projectile.velocity.Length() < 20) - Projectile.velocity = Projectile.velocity * 0.95f + moveTotarget * 0.28f; - else - Projectile.velocity *= 0.8f; - } } } else if (stuckInTarget) { + Projectile.extraUpdates = 2; Projectile.rotation = (storedVelocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2; placementCenter = chosenTarget.Center + placementVelocity * placementDistance; @@ -139,16 +133,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Main.rand.NextBool(8)) { float speed = Main.rand.NextFloat(0.2f, 1.5f); - Particle spark = new SparkParticle(Projectile.Center, -storedVelocity * speed, false, 23, 0.7f * speed, mainColor * 0.7f); + Particle spark = new SparkParticle(Projectile.Center, -storedVelocity * speed, false, 23, 0.7f * speed, Effects.ArsenalEffects.ArsenalPlamaColor * 0.7f); GeneralParticleHandler.SpawnParticle(spark); } if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); - dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : ModContent.DustType(), -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer); dust.noGravity = true; - dust.color = mainColor; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; } } time++; @@ -189,14 +183,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal stuckInTarget = true; storedVelocity = Projectile.velocity; Projectile.velocity = Vector2.Zero; - for (int i = 0; i <= 11; i++) + for (int i = 0; i < 12; i++) { - int dustStyle = Main.rand.NextBool() ? 66 : 263; + int dustStyle = Effects.ArsenalEffects.ArsenalPlamaDust; Dust dust = Dust.NewDustPerfect(Projectile.Center + storedVelocity.SafeNormalize(Vector2.UnitX) * 38 + Main.rand.NextVector2Circular(12, 12), dustStyle, Projectile.velocity); - dust.scale = Main.rand.NextFloat(0.7f, 1.1f); - dust.velocity = storedVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 2.1f); - dust.noGravity = true; - dust.color = mainColor; + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.velocity = storedVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.4f, 1.5f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; + dust.fadeIn = 1.5f; } SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorPreExplode"); SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = 0.5f }, Projectile.Center); @@ -205,15 +200,27 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override void OnKill(int timeLeft) { - float bonus = (stuckInGround ? 2f : 1); + float bonus = (stuckInGround ? 3f : 1.5f); float explosionDamage = (stuckInGround ? 2.3f : 0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * explosionDamage), Projectile.knockBack * 2, Projectile.owner, 0, bonus != 1 ? 1 : 0); - Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.75f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.2f * bonus, 26); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * explosionDamage), Projectile.knockBack * 2, Projectile.owner, 0, stuckInGround ? 1 : 0); + blast.scale = (stuckInGround ? 2 : 1); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlamaColor * 0.75f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.2f * bonus, 26); GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.75f, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.07f * bonus, 14); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlamaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * bonus, 16); GeneralParticleHandler.SpawnParticle(bolt3); + for (int i = 0; i < (int)(15 * bonus); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : stuckInGround ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlamaDust, -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.9f, 1.8f); + dust.velocity = (new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)) * Utils.GetLerpValue(90, 0, stuckTimer); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; + if (dust.type == Effects.ArsenalEffects.ArsenalPlamaDust) + dust.fadeIn = 2f; + } + SoundStyle sound = new("CalamityMod/Sounds/Item/PlasmaBig"); SoundEngine.PlaySound(sound with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); } @@ -226,14 +233,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Asset tex = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ImmolationArrow"); if (!stuckInGround && !stuckInTarget && false) - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], mainColor with { A = 0 }, 1, tex.Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 }, 1, tex.Value); - float randSize = Main.rand.NextFloat(0.7f, 1.2f); - for (int i = 0; i < 3; i++) + float randSize = Main.rand.NextFloat(0.8f, 1.1f); + for (int i = 0; i < 20; i++) { - Vector2 scale = Projectile.scale * new Vector2(0.5f * (1 - i * 0.25f), 1) * 1.5f * (1 - i * 0.3f) * randSize; - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None); + Vector2 scale = Projectile.scale * new Vector2(0.5f, 1) * 1.5f * randSize; + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 3; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * 0.2f, Projectile.rotation, tex.Size() * 0.5f, scale, SpriteEffects.None); } + Vector2 scale2 = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * 0.5f, Projectile.rotation, tex.Size() * 0.5f, scale2, SpriteEffects.None); if (stuckInTarget || stuckInGround) { Vector2 scale = 1.1f * new Vector2(0.5f, 1) * 1.5f * randSize; diff --git a/Projectiles/DraedonsArsenal/ImmolationBurst.cs b/Projectiles/DraedonsArsenal/ImmolationBurst.cs index f73a3757d3..21557b8120 100644 --- a/Projectiles/DraedonsArsenal/ImmolationBurst.cs +++ b/Projectiles/DraedonsArsenal/ImmolationBurst.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = Projectile.height = 150; + Projectile.width = Projectile.height = 235; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; @@ -26,10 +26,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.88f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float minMult = 0.25f; + int hitsToMinMult = (int)(5 * Projectile.scale); + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } diff --git a/Projectiles/DraedonsArsenal/ImmolationSpray.cs b/Projectiles/DraedonsArsenal/ImmolationSpray.cs index 8cde23aa2c..0a74eccc65 100644 --- a/Projectiles/DraedonsArsenal/ImmolationSpray.cs +++ b/Projectiles/DraedonsArsenal/ImmolationSpray.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref float time => ref Projectile.ai[0]; - public Color mainColor = Color.Lerp(Color.Chartreuse, Color.White, 0.35f); public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; @@ -47,14 +46,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(8, 8); float speed = Main.rand.NextFloat(0.2f, 0.7f); - Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), mainColor); + Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 7, Main.rand.NextFloat(0.4f, 0.7f), Effects.ArsenalEffects.ArsenalPlamaColor); GeneralParticleHandler.SpawnParticle(spark); - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); - dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.2f, 0.5f) : Main.rand.NextFloat(0.4f, 1.1f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? Effects.ArsenalEffects.ArsenalDust : Effects.ArsenalEffects.ArsenalPlamaDust, -Projectile.velocity); + dust.scale = dust.type == Effects.ArsenalEffects.ArsenalDust ? Main.rand.NextFloat(0.2f, 0.5f) : Main.rand.NextFloat(0.4f, 1.1f); dust.velocity = (new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.7f)); dust.noGravity = true; - dust.color = mainColor; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; } } time++; @@ -74,8 +73,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); if (targetDist < 1400) { - Particle spark = new GlowOrbParticle(Projectile.Center + oldVelocity.SafeNormalize(Vector2.UnitX) * 11, Projectile.velocity * 0.001f, false, 60, 1.6f, mainColor); - GeneralParticleHandler.SpawnParticle(spark); + Vector2 vel = oldVelocity.SafeNormalize(Vector2.UnitX); + int dustStyle = Effects.ArsenalEffects.ArsenalPlamaDust; + for (int i = 0; i < 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 5, dustStyle, (-vel * Main.rand.NextFloat(5, 8)).RotatedByRandom(0.7f)); + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlamaColor; + dust.fadeIn = 1.2f; + } } return true; } @@ -86,10 +93,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Asset tex = ModContent.Request("CalamityMod/Particles/GlowSpark"); - //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], mainColor with { A = 0 } * 0.3f, 1, tex.Value); float squash = Utils.GetLerpValue(-3, 10, Projectile.velocity.Length(), true); for (int i = 0; i < 2; i++) - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.6f, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, squash) * 0.045f * (i == 0 ? 0.6f : 1), SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlamaColor with { A = 0 } * 0.6f, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, squash) * 0.045f * (i == 0 ? 0.6f : 1), SpriteEffects.None); return false; } } diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index 75c41be684..f9d518e7c2 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -51,6 +51,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.extraUpdates = 2; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index fa67dcad89..f5ba29a1d1 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Enemy Projectile.ignoreWater = true; Projectile.timeLeft = 600; Projectile.alpha = 120; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index 7b1c806410..96d90b3332 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index 740ff708e4..75a229df18 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; Projectile.alpha = 255; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index 296fb9b03d..188e0b38ce 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = 2; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs index a958dd9dc9..3fbe159a25 100644 --- a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs +++ b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/BloodRay.cs b/Projectiles/Magic/BloodRay.cs index 04b524b607..76cc9a31f0 100644 --- a/Projectiles/Magic/BloodRay.cs +++ b/Projectiles/Magic/BloodRay.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 10; Projectile.extraUpdates = 100; Projectile.timeLeft = Lifetime; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index a512651328..bf2299ddcd 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index 40d362af69..4ce8847842 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.coldDamage = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index 441739fc9c..8f43f46666 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 20; Projectile.penetrate = 5; Projectile.tileCollide = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index c5373229e3..0bfd8ae7cc 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 30; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/NightsRayBeam.cs b/Projectiles/Magic/NightsRayBeam.cs index 0e38e73656..f004db67aa 100644 --- a/Projectiles/Magic/NightsRayBeam.cs +++ b/Projectiles/Magic/NightsRayBeam.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 10; Projectile.extraUpdates = 100; Projectile.timeLeft = 150; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/RancorLargeCinder.cs b/Projectiles/Magic/RancorLargeCinder.cs index a27ef75db1..ac874b32c1 100644 --- a/Projectiles/Magic/RancorLargeCinder.cs +++ b/Projectiles/Magic/RancorLargeCinder.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.timeLeft = 300; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 96822f36ce..d33a69bb29 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 1; } public override void AI() @@ -35,10 +37,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 1; - } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 3bd8f7fb9c..36f9ad6e48 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.timeLeft = 30; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index cc1d8ddeb6..a07c9598a1 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.timeLeft = 540; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 74c6d6ee5f..809db702cf 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/WyvernFeatherPink.cs b/Projectiles/Magic/WyvernFeatherPink.cs index c336051740..c4ae4715b3 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/WyvernFeatherPurple.cs b/Projectiles/Magic/WyvernFeatherPurple.cs index fbc4db8a6d..c80d9b0306 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index cb5eb85d89..7f071091f0 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -35,6 +35,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index c9e6cc4e7a..cf2aace6b5 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -39,6 +39,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index 6c3de2de20..65c40923ae 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -39,6 +39,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index f9ad15cf39..6cce44387c 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 200; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index 3fbd52fcf1..0957b0a141 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 5; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index e36d1e29dd..f8d4d6935c 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -70,6 +70,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 0022918305..8c7e3ac1c3 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -37,6 +37,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index 3ce47bbf54..6d1015e6c7 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index 93c4930826..e0c9b5272e 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 200; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 2bcf99ec00..1df4e4245f 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.timeLeft = 60; Projectile.DamageType = DamageClass.Melee; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/MarniteDeconstructorProj.cs b/Projectiles/Melee/MarniteDeconstructorProj.cs index 1d006e1ea9..86d7dff494 100644 --- a/Projectiles/Melee/MarniteDeconstructorProj.cs +++ b/Projectiles/Melee/MarniteDeconstructorProj.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.hide = true; Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index d110a46fa3..f79b3244d9 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -36,6 +36,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.hide = true; Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs index 56c512c9e4..fb19dc0660 100644 --- a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs +++ b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 60; Projectile.timeLeft = 20; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 5b12d990e1..b05763bebb 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -70,6 +70,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 1ae29e68d9..56033def56 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -42,6 +42,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index 6c4ad50df0..89d7090ef5 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = (int)MaxTime; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index 1581375c55..de63e02e4b 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.hide = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index c46d1c22cd..0bb3d152c0 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 5acc6d3ecc..3fcda3e30c 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.ownerHitCheck = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 172fff2d28..0f208bdc5b 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -35,6 +35,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; diff --git a/Projectiles/Ranged/AstralSandgun.cs b/Projectiles/Ranged/AstralSandgun.cs index dd09fb1abf..fca008bd42 100644 --- a/Projectiles/Ranged/AstralSandgun.cs +++ b/Projectiles/Ranged/AstralSandgun.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index 97ec9ede47..26f7ad0d44 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; } public override void AI() @@ -62,8 +64,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 0; - target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Ranged/FetidEmesisHoldout.cs b/Projectiles/Ranged/FetidEmesisHoldout.cs index 36081c683c..6a4d3e1a42 100644 --- a/Projectiles/Ranged/FetidEmesisHoldout.cs +++ b/Projectiles/Ranged/FetidEmesisHoldout.cs @@ -1,17 +1,13 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.GameContent; using Terraria.ModLoader; -using Terraria.ID; -using System; -using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Ranged { @@ -28,8 +24,6 @@ namespace CalamityMod.Projectiles.Ranged public ref float shootingTimer => ref Projectile.ai[2]; // Dual functions for rapid fire shooting cooldown and recoil public bool isTired => cooldownTimer > 0; public float revSpeed = 1; - public bool isHoldingIn = false; - public bool holdingInBonus = false; public bool secondShot = true; public int maxFrames = 420; public int initialFireTime = 45; @@ -37,14 +31,12 @@ namespace CalamityMod.Projectiles.Ranged public override void KillHoldoutLogic() { - if ( !isTired && (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)) + if (!isTired && (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)) Projectile.Kill(); } public override void HoldoutAI() { - isHoldingIn = Owner.Calamity().mouseRight; - if (!isTired && (Owner.CantUseHoldout() || HeldItem.type != Owner.ActiveItem().type)) cooldownTimer = (int)(Utils.Remap(revFrames, 0, 350, 40, 180, true)); if (isTired) @@ -92,81 +84,43 @@ namespace CalamityMod.Projectiles.Ranged revFrames++; shineScale *= 0.77f; - if (revFrames >= maxFrames && !isTired) + if (revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 )) { - if (isHoldingIn) - { - if (revFrames == maxFrames + 120) - { - holdingInBonus = true; - SoundEngine.PlaySound(SoundID.NPCHit14 with { Volume = 1f, Pitch = 0.3f }, Projectile.Center); - for (int i = 0; i < 25; i++) - { - Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 8); - Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.7f); - dust2.scale = Main.rand.NextFloat(0.45f, 0.9f); - dust2.noGravity = true; - dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Chartreuse : Color.Green, 0.7f); - } - Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 14); - GeneralParticleHandler.SpawnParticle(pulse); - } + Owner.Calamity().GeneralScreenShakePower = 6.5f; + OffsetLengthFromArm -= 35f; + cooldownTimer = (int)MathHelper.Lerp((int)(Utils.Remap(revFrames, 0, 350, 40, 180, true)), 180, 0.7f); + SoundStyle bigShot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); + SoundStyle bigShotGun = new("CalamityMod/Sounds/Item/FlakKrakenShoot"); + SoundEngine.PlaySound(bigShot with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(bigShotGun with { Volume = 0.6f }, Projectile.Center); - Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(5) ? 28 : 215, (Projectile.velocity * 2).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); - dust.noGravity = true; - if (revFrames % 20 == 0) - { - SoundStyle tired = new("CalamityMod/Sounds/Custom/OldDukeHuff"); - SoundEngine.PlaySound(tired with { Volume = 0.3f, Pitch = 0.3f }, Projectile.Center); - for (int i = 0; i <= 3; i++) - { - Dust dust5 = Dust.NewDustPerfect(GunTipPosition, 267, (Projectile.velocity * 5f).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.9f, 1.2f)); - dust5.noGravity = true; - dust5.color = Color.Chartreuse; - } - } + int chunkDamage = (int)(Projectile.damage * 2.5f); + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 13; + + Particle pulse3 = new GlowSparkParticle(GunTipPosition - shootVelocity, shootVelocity, false, 12, 0.035f, Color.Chartreuse, new Vector2(2.5f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + + Particle pulse2 = new CustomPulse(GunTipPosition, Projectile.velocity * 14.5f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.13f, 0, 34); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse = new CustomPulse(GunTipPosition, Projectile.velocity * 9f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.25f, 0, 34); + GeneralParticleHandler.SpawnParticle(pulse); + + float velBonus = 1.1f; + for (int i = 0; i <= 5; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(-0.03f * i * velBonus) * (1 - i * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, -i, 0, velBonus); } - else + for (int j = 0; j <= 5; j++) { - Owner.Calamity().GeneralScreenShakePower = 6.5f; - OffsetLengthFromArm -= 35f; - cooldownTimer = holdingInBonus ? 230 : 180; - SoundStyle bigShot = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); - SoundStyle bigShotGun = new("CalamityMod/Sounds/Item/FlakKrakenShoot"); - SoundEngine.PlaySound(bigShot with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); - SoundEngine.PlaySound(bigShotGun with { Volume = 0.6f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(0.03f * j * velBonus) * (1 - j * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, j, 0, velBonus); + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, 20, 0, velBonus); - int chunkDamage = (int)(Projectile.damage * (2f + (holdingInBonus ? 1 : 0))); - Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 13; - if (holdingInBonus) - { - Particle pulse2 = new CustomPulse(GunTipPosition, Projectile.velocity * 14.5f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.13f, 0, 34); - GeneralParticleHandler.SpawnParticle(pulse2); - Particle pulse = new CustomPulse(GunTipPosition, Projectile.velocity * 9f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1f), Projectile.velocity.ToRotation(), 0.25f, 0, 34); - GeneralParticleHandler.SpawnParticle(pulse); - } - for (int y = 0; y < (holdingInBonus ? 3 : 1); y++) - { - float velBonus = 1 - y * 0.2f; - for (int i = 0; i <= 5; i++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(-0.03f * i * velBonus) * (1 - i * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, -i, 0, velBonus); - } - for (int j = 0; j <= 5; j++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedBy(0.03f * j * velBonus) * (1 - j * 0.08f) * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, j, 0, velBonus); - } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * velBonus, ModContent.ProjectileType(), chunkDamage, Projectile.knockBack * 3, Projectile.owner, 20, 0, velBonus); - - for (int i = 0; i <= 18; i++) - { - Dust dust = Dust.NewDustPerfect(GunTipPosition, 66, shootVelocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); - dust.noGravity = true; - dust.color = Color.Chartreuse; - } - Particle pulse = new GlowSparkParticle(GunTipPosition - shootVelocity, shootVelocity * velBonus, false, 12, 0.035f, Color.Chartreuse, new Vector2(2.5f, 0.9f), true); - GeneralParticleHandler.SpawnParticle(pulse); - } + for (int i = 0; i <= 18; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 66, shootVelocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.5f), 0, default, Main.rand.NextFloat(0.6f, 1.4f)); + dust.noGravity = true; + dust.color = Color.Chartreuse; } } } diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index 1c2fca754b..a5eb54f88e 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/OntologicalDespoilerBeam.cs b/Projectiles/Ranged/OntologicalDespoilerBeam.cs index 5aecd11315..181d634eea 100644 --- a/Projectiles/Ranged/OntologicalDespoilerBeam.cs +++ b/Projectiles/Ranged/OntologicalDespoilerBeam.cs @@ -33,6 +33,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 80; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.cs b/Projectiles/Ranged/PlagueExplosionFriendly.cs index 51358b057d..2e5e780578 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 60; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.cs b/Projectiles/Ranged/PrismaticEnergyBlast.cs index e7f29f76f0..2d51675e1c 100644 --- a/Projectiles/Ranged/PrismaticEnergyBlast.cs +++ b/Projectiles/Ranged/PrismaticEnergyBlast.cs @@ -40,6 +40,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 100; Projectile.extraUpdates = 1; Projectile.timeLeft = 450; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool PreAI() diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 7f227bbb77..85150cc826 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -68,9 +68,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item93, Projectile.position); if (Projectile.owner == Main.myPlayer) { - int flash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); - Main.projectile[flash].usesLocalNPCImmunity = true; - Main.projectile[flash].localNPCHitCooldown = 10; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); } for (int k = 0; k < 5; k++) { diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 08be6cba30..719bedb2bc 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/AshenStalactiteDebris.cs b/Projectiles/Rogue/AshenStalactiteDebris.cs index 45e2583878..00bd07fc53 100644 --- a/Projectiles/Rogue/AshenStalactiteDebris.cs +++ b/Projectiles/Rogue/AshenStalactiteDebris.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 50; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 828e638019..f4d204e888 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.ignoreWater = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index 79ce3bb0d0..a7270c0862 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 5; Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/BrimbladeProj.cs b/Projectiles/Rogue/BrimbladeProj.cs index e12364e225..17c0a27023 100644 --- a/Projectiles/Rogue/BrimbladeProj.cs +++ b/Projectiles/Rogue/BrimbladeProj.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 180; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index 99f36ef71e..57b5178d67 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -37,6 +37,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.MaxUpdates = 4; Projectile.timeLeft = 300; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 61cb9505f0..a47d434f18 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.localNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.cs b/Projectiles/Rogue/DynamicPursuerElectricity.cs index 9e44160aad..c8b26e7e8f 100644 --- a/Projectiles/Rogue/DynamicPursuerElectricity.cs +++ b/Projectiles/Rogue/DynamicPursuerElectricity.cs @@ -43,6 +43,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 10; Projectile.timeLeft = 60 * Projectile.extraUpdates; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; // Readjust the velocity magnitude the moment this projectile is created // to make velocity setting outside the scope of this projectile less irritating diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index f101b2cb23..a405ddaa85 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index e485108463..33bc7eb8a3 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/GildedDaggerProj.cs b/Projectiles/Rogue/GildedDaggerProj.cs index bafb14937a..9a13c9403b 100644 --- a/Projectiles/Rogue/GildedDaggerProj.cs +++ b/Projectiles/Rogue/GildedDaggerProj.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/GleamingDaggerProj.cs b/Projectiles/Rogue/GleamingDaggerProj.cs index 2adb2139bb..1546b0b997 100644 --- a/Projectiles/Rogue/GleamingDaggerProj.cs +++ b/Projectiles/Rogue/GleamingDaggerProj.cs @@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index 60d4e259a8..ecc722a3bd 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/InfestedClawmerangProj.cs b/Projectiles/Rogue/InfestedClawmerangProj.cs index ab0c7314d9..d7f2386bdb 100644 --- a/Projectiles/Rogue/InfestedClawmerangProj.cs +++ b/Projectiles/Rogue/InfestedClawmerangProj.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 8ecefdb0c6..507789ee06 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -78,8 +78,6 @@ namespace CalamityMod.Projectiles.Rogue if (flash.WithinBounds(Main.maxProjectiles)) { Main.projectile[flash].DamageType = RogueDamageClass.Instance; - Main.projectile[flash].usesLocalNPCImmunity = true; - Main.projectile[flash].localNPCHitCooldown = 10; } Vector2 pos = new Vector2(Projectile.Center.X + Projectile.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 6d6bd45d06..c048eb3b75 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.DamageType = RogueDamageClass.Instance; Projectile.timeLeft = CalamityUtils.SecondsToFrames(20f); + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs index a33e54ff06..0ec456a0ee 100644 --- a/Projectiles/Rogue/NightsGazeSpark.cs +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -21,6 +21,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.localAI[0] = 10f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index 69829d8f21..5efba5e5e6 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.localAI[0] = 10f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs index dac74b5b0d..14b31a2c20 100644 --- a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs +++ b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs @@ -105,11 +105,6 @@ namespace CalamityMod.Projectiles.Rogue Parent = Main.projectile[(int)Projectile.ai[0]]; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - target.immune[Projectile.owner] = 0; - } - public override bool PreDraw(ref Color lightColor) { for (int i = 1; i < Projectile.oldPos.Length; i++) diff --git a/Projectiles/Rogue/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index d6a3686639..85e86a89df 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.timeLeft = 300; AIType = ProjectileID.Bananarang; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index 7d2c53512d..cde5d6edc4 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index cfa9694d3b..fd4022c0cc 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index dda87de504..3aa6c9ac5d 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; } diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs index 14840d8a11..278ffb7121 100644 --- a/Projectiles/Rogue/WebBallBol.cs +++ b/Projectiles/Rogue/WebBallBol.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; Projectile.aiStyle = ProjAIStyleID.GroundProjectile; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs index 9d79d29582..c03465dcfd 100644 --- a/Projectiles/Summon/BloodRain.cs +++ b/Projectiles/Summon/BloodRain.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Summon AIType = ProjectileID.RainFriendly; Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Summon/DaedalusLightning.cs b/Projectiles/Summon/DaedalusLightning.cs index 23d7b00dda..ee5d8a1c2d 100644 --- a/Projectiles/Summon/DaedalusLightning.cs +++ b/Projectiles/Summon/DaedalusLightning.cs @@ -40,6 +40,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.extraUpdates = 20; Projectile.timeLeft = 45 * Projectile.extraUpdates; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; // Readjust the velocity magnitude the moment this projectile is created // to make velocity setting outside the scope of this projectile less irritating diff --git a/Projectiles/Summon/DeathstareBeam.cs b/Projectiles/Summon/DeathstareBeam.cs index 4c8b737425..19279ec247 100644 --- a/Projectiles/Summon/DeathstareBeam.cs +++ b/Projectiles/Summon/DeathstareBeam.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.timeLeft = 10; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 050a280eea..5821c667dc 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -33,6 +33,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.minion = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index ad59ba6a1f..5b9c20254a 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -69,6 +69,8 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Projectile.timeLeft = 900000; Projectile.scale = 1f; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs index 37970e73a4..91487ce95c 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs index b79ca5a550..efed72d73c 100644 --- a/Projectiles/Summon/VoidConcentrationBlackhole.cs +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -45,6 +45,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.scale = 0.01f; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } private void ApplySucc(NPC npc) diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index bc65e2df07..b601c92938 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.extraUpdates = 1; Projectile.coldDamage = true; Projectile.npcProj = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index c5f95893e9..6a43186f50 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -65,6 +65,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = Projectile.height = 10; Projectile.friendly = true; Projectile.penetrate = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; if (Fired) { diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index 6da5082c5c..89e9e698c0 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.alpha = 255; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/WulfrumDrillProj.cs b/Projectiles/Typeless/WulfrumDrillProj.cs index 0bc98e5c28..e40f380574 100644 --- a/Projectiles/Typeless/WulfrumDrillProj.cs +++ b/Projectiles/Typeless/WulfrumDrillProj.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Projectile.scale = 0.93f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override bool ShouldUpdatePosition() => false; diff --git a/Systems/Collections/SharedStaticIFramesIDSet.cs b/Systems/Collections/SharedStaticIFramesIDSet.cs new file mode 100644 index 0000000000..d01cc7bd6a --- /dev/null +++ b/Systems/Collections/SharedStaticIFramesIDSet.cs @@ -0,0 +1,126 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Magic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A which contains an ProjectileID Set, created with the appropriate factory.
+ ///
+ /// This is populated from a much more human readable set of "shared iframe lists", contained in OnModLoad. + ///
+ public sealed class SharedStaticIFrames : ModSystem + { + public static IDictionary> SharedIFrameSets { get; private set; } + public static int[] SharedIFrameFactorySet { get; private set; } + + public override void PostSetupContent() + { + // This transient structure is used to make the setup of intended shared-iframe sets as easy as possible. + // + // If you want to add a new projectile to share iframes with any existing sets, just add it to that [ area ]. + // + // If you want to create a brand new shared iframe set, just add a new [ area ] at the bottom. + IList> setupLists = + [ + [ // Set 1: Vanilla bees (Hive Pack) + ProjectileID.Bee, + ProjectileID.GiantBee + ], + + [ // Set 2: Vilethorn + ProjectileID.VilethornBase, + ProjectileID.VilethornTip + ], + + [ // Set 3: Harp notes + ProjectileID.QuarterNote, + ProjectileID.EighthNote, + ProjectileID.TiedEighthNote + ], + + [ // Set 4: The North Pole + ProjectileID.NorthPoleWeapon, + ProjectileID.NorthPoleSpear, + ProjectileID.NorthPoleSnowflake, + ], + + [ // Set 5: All spore gas clouds + ProjectileID.SporeTrap, + ProjectileID.SporeTrap2, + ProjectileID.SporeGas, + ProjectileID.SporeGas2, + ProjectileID.SporeGas3 + ], + + [ // Set 6: Astral Staff and Asteroid Staff + ModContent.ProjectileType(), + ModContent.ProjectileType() + ], + + [ // Set 7: All toxic clouds + ProjectileID.ToxicCloud, + ProjectileID.ToxicCloud2, + ProjectileID.ToxicCloud3 + ] + ]; + + // Convert the above list-of-lists into a dictionary, where the key is the shared iframe projectile ID. + SharedIFrameSets = new SortedDictionary>(); + foreach (var innerList in setupLists) + { + int sharedIDForThisSet = innerList[0]; + SharedIFrameSets.Add(sharedIDForThisSet, innerList); + } + + // Now construct a vanilla Terraria Projectile ID Set using the appropriate factory. + + // Calculate the total length of the input buffer to the factory + int totalLength = 0; + foreach(var l in SharedIFrameSets.Values) + totalLength += l.Count; + + // Create the buffer and fill it + int[] buffer = new int[totalLength * 2]; + int idx = 0; + foreach (var sharedFrameList in setupLists) + { + int sharedIDForThisSet = sharedFrameList[0]; + + foreach (var projID in sharedFrameList) + { + buffer[idx++] = projID; + buffer[idx++] = sharedIDForThisSet; + } + } + + SharedIFrameFactorySet = ProjectileID.Sets.Factory.CreateIntSet(-1, buffer); + } + + public override void Unload() + { + SharedIFrameSets = null; + SharedIFrameFactorySet = null; + } + + /// + /// A shorthand method to check if this projectile shares static iframes in any way. + /// + public static bool Includes(int projType) => SharedIFrameFactorySet[projType] != -1; + + /// + /// The intended + /// + /// The projectile type to get the set of shared iframe projectile IDs for. + /// A list of projectile IDs that share static iframes with this projectile ID. This list may be empty. + public static IList GetSharedStaticIFrames(int projType) + { + int sharedSetID = SharedIFrameFactorySet[projType]; + bool setExists = SharedIFrameSets.TryGetValue(sharedSetID, out var ret); + + return setExists ? ret : []; + } + } +} diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index e4fb0c820a..b954995b71 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -153,16 +153,17 @@ namespace CalamityMod.UI.ResourceSets int deadPixels = (int)Math.Floor((snapshot.LifeMax - snapshot.Life) * pixelsPerLife); var bleedPixels = Math.Round(bleed * pixelsPerLife); - Color[] textureData = new Color[width * 12]; - + Color[] textureData = new Color[width * 12]; + // doze 19MAR2025 - I don't know if I could optimize this any further without switching to shaders. + // I don't expect performance issues, but at some point might be worth adding a config to disable the indicator in case of lag or accessibility concerns for (int i = 0; i < textureData.Length; i++) { - var bleedCol = new Color(0, 0, 0, 0); - if ((i % width < bleedPixels + deadPixels) && !(i % width < deadPixels)) + var i_MOD_width = i % width; //minor optimization, calculated here once instead of twice in the loop. + var bleedCol = Color.Transparent; + if ((i_MOD_width < bleedPixels + deadPixels) && !(i_MOD_width < deadPixels)) { bleedCol = barTextureData[((i % 12)+(i/width)*12)]; - //bleedCol = new Color(0f, 0.3f, 0.75f, 0.5f); } textureData[i] = bleedCol;