diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index ad69307241..19733b280f 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -64,8 +64,8 @@ namespace CalamityMod.Balancing // Nerf Luminite Arrow trails by 50%. Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.MoonlordArrowTrail)), - // Nerf Seedler seeds by 66.6%. - Do(new ProjectileResistBalancingRule(1f / 3f, ProjectileID.SeedlerNut, ProjectileID.SeedlerThorn)), + // Nerf Seedler seeds by 25%. + Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.SeedlerNut, ProjectileID.SeedlerThorn)), // Nerf Cursed Dart flames by 50%. Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CursedDartFlame)), @@ -137,12 +137,15 @@ namespace CalamityMod.Balancing // 40% resist to Cryophobia. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 40% resist to Mineral Mortar's Projectile. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + // 15% resist to Snowstorm Staff. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion #region Astrum Aureus - //35% resist to The Ballista's greatarrows. + // 35% resist to The Ballista's greatarrows. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); #endregion @@ -185,6 +188,9 @@ namespace CalamityMod.Balancing // 25% resist to Resurrection Butterfly. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + + // 70% resist to the Stardust Dragon. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); #endregion #region Moon Lord @@ -237,22 +243,19 @@ namespace CalamityMod.Balancing #endregion #region The Devourer of Gods - // 15% vulnerability to Time Bolt stealth strikes. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); + // 40% resist to Eidolic Wail. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); // 35% resist to Venusian Trident's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); - // 40% resist to Eidolic Wail. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 15% vulnerability to Time Bolt stealth strikes. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); #endregion The Devourer of Gods #region Yharon // 15% resist to Time Bolt. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - - // 5% resist to Old Reaper. - //NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.95f, ProjectileType())))); #endregion #region Exo Mechs: Ares @@ -264,9 +267,6 @@ namespace CalamityMod.Balancing // 25% resist to Aetherflux Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); - - // 25% resist to Murasama. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to the Spin Throw part of the Ark of the Cosmos' combo. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo)))); @@ -285,6 +285,9 @@ namespace CalamityMod.Balancing // 15% resist to Enforcer projectiles. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + + // 15% resist to Murasama. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion #region Exo Mechs: Artemis and Apollo @@ -292,14 +295,8 @@ namespace CalamityMod.Balancing // TODO -- NPC sets (mostly worm bosses) should probably be their own holding class. int[] exoTwins = new int[] { NPCType(), NPCType() }; - // 20% resist to Dynamic Pursuer. - NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); - // 10% resist to Eclipse's Fall stealth strike. NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType())))); - - // 10% resist to Seared Pan. - NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType(), ProjectileType(), ProjectileType())))); #endregion #region Exo Mechs: Thanatos @@ -309,12 +306,12 @@ namespace CalamityMod.Balancing // 65% resist to Enforcer projectiles. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); - // 65% resist to Dynamic Pursuer. (Do 40% if lightning pierce is removed) - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType(), ProjectileType(), ProjectileType())))); - // 65% resist to Final Dawn lunge. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + // 60% resist to Dynamic Pursuer. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 50% resist to Chicken Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); @@ -324,12 +321,12 @@ namespace CalamityMod.Balancing // 50% resist to Vehemence skulls. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType())))); - // 50% resist to Wrathwing stealth strike. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Yharim's Crystal. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 45% resist to Wrathwing stealth strike's fireballs. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + // 40% resist to Rancor. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); @@ -339,6 +336,9 @@ namespace CalamityMod.Balancing // 30% resist to Eclipse Fall. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 30% resist to Prismatic Breaker's laser beam. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 30% resist to Pulse Rifle. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); @@ -348,9 +348,6 @@ namespace CalamityMod.Balancing // 30% resist to Dragon Scales and The Wand's tornadoes NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); - // 30% resist to Prismatic Breaker's laser beam. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 25% resist to the Spin Throw part of the Ark of the Cosmos' combo. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo)))); @@ -360,12 +357,6 @@ namespace CalamityMod.Balancing // 25% resist to Gael's Greatsword's big skulls. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter)))); - // 15% resist to Godslayer Slugs. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - - // 15% resist to Luminite Bullets. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileID.MoonlordBullet)))); - // 25% resist to Zenith. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); @@ -375,18 +366,23 @@ namespace CalamityMod.Balancing // 20% resist to Eradicator beams. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + // 20% resist to Plasma Grenade and Dynamic Pursuer's explosions + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(),ProjectileType(), ProjectileType())))); + // 20% resist to Voltaic Climax / Void Vortex hitscan beams. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 20% resist to Plasma grenades and Dynamic Pursuer's explosions - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(),ProjectileType(), ProjectileType())))); - // 15% resist to Final Dawn AoE sweep flames. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 15% resist to Godslayer Slugs. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 15% resist to Gruesome Eminence. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 15% resist to Luminite Bullets. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileID.MoonlordBullet)))); #endregion #region Supreme Calamitas: Brimstone Hearts @@ -404,23 +400,20 @@ namespace CalamityMod.Balancing // 50% resist to Subsuming Vortex. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType()))); - // 30% resist to Murasama. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileType()))); - // 30% resist to Zenith. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileID.FinalFractal))); // 25% resist to Yharim's Crystal. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.75f, ProjectileType()))); - // 10% resist to Surge Driver's alt click comets. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); + // 10% resist to Celestus. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType(), ProjectileType()))); // 10% resist to Executioner's Blade stealth strikes. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); - - // 10% resist to Celestus. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType(), ProjectileType()))); + + // 10% resist to Surge Driver's alt click comets. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); // 15% vulnerability to The Atom Splitter. (Yes, this is kinda weird, but it's what Piky asked for). NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(1.15f, ProjectileType(), ProjectileType()))); diff --git a/Buffs/Summon/IceClasperBuff.cs b/Buffs/Summon/IceClasperBuff.cs index 08a56cc4f1..d7c5d328a7 100644 --- a/Buffs/Summon/IceClasperBuff.cs +++ b/Buffs/Summon/IceClasperBuff.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Buffs.Summon CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { - modPlayer.iClasper = true; + modPlayer.IceClasperBool = true; } - if (!modPlayer.iClasper) + if (!modPlayer.IceClasperBool) { player.DelBuff(buffIndex); buffIndex--; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a3a1f8b752..ffc8d9f04a 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -225,6 +225,7 @@ namespace CalamityMod.CalPlayer public int auralisAurora = 0; public int necroReviveCounter = -1; public int hideOfDeusTimer = 0; + public int murasamaHitCooldown = 0; public int giantShellPostHit = 0; public int tortShellPostHit = 0; public int spiritOriginBullseyeShootCountdown = 0; @@ -509,6 +510,7 @@ namespace CalamityMod.CalPlayer public int ascendantInsigniaCooldown = 0; public bool ascendantTrail = false; public bool eGauntlet = false; + public int gloveLevel = 0; // Used to prevent glove stacking public bool eTalisman = false; public int statisTimer = 0; public bool nucleogenesis = false; @@ -985,7 +987,7 @@ namespace CalamityMod.CalPlayer public bool wDroid = false; public bool resButterfly = false; public bool mWorm = false; - public bool iClasper = false; + public bool IceClasperBool = false; public bool magicHat = false; public bool herring = false; public bool blackhawk = false; @@ -1677,6 +1679,7 @@ namespace CalamityMod.CalPlayer ascendantInsignia = false; ascendantTrail = false; eGauntlet = false; + gloveLevel = 0; eTalisman = false; nucleogenesis = false; nuclearFuelRod = false; @@ -2008,7 +2011,7 @@ namespace CalamityMod.CalPlayer wDroid = false; resButterfly = false; mWorm = false; - iClasper = false; + IceClasperBool = false; magicHat = false; herring = false; blackhawk = false; @@ -2268,6 +2271,7 @@ namespace CalamityMod.CalPlayer auralisAurora = 0; necroReviveCounter = -1; hideOfDeusTimer = 0; + murasamaHitCooldown = 0; RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; holyInfernoFadeIntensity = 0f; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 8788d9ef55..e7987eee79 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1437,6 +1437,8 @@ namespace CalamityMod.CalPlayer titanCooldown--; if (hideOfDeusTimer > 0) hideOfDeusTimer--; + if (murasamaHitCooldown > 0) + murasamaHitCooldown--; if (hellbornBoost > 0) hellbornBoost--; if (persecutedEnchantSummonTimer < 1800) @@ -2623,11 +2625,18 @@ namespace CalamityMod.CalPlayer if (eGauntlet) { - Player.kbGlove = true; Player.GetDamage() += 0.15f; Player.GetCritChance() += 5; } + // Gauntlet Melee Speed, prevents glove stacking for melee speed + if (gloveLevel > 0) + { + // Determine the glove the player benefits from in priority of latest in progression + float gloveAttackSpeed = (gloveLevel == 5 ? 0.15f : gloveLevel == 4 ? 0.14f : gloveLevel == 3 ? 0.12f : gloveLevel <= 2 ? 0.10f : 0); + Player.GetAttackSpeed() += gloveAttackSpeed; // Give the player attack speed based on the glove they have + } + // Bloodflare Core's heal over time if (bloodflareCore && bloodflareCoreRemainingHealOverTime > 0 && Player.miscCounter % BloodflareCore.HealFrameCooldown == 0) { diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index f2ef54de69..dd9088655a 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -162,6 +162,9 @@ namespace CalamityMod // Tile Entities // + case CalamityModMessageType.UnlockAbyssChests: + Abyss.UnlockAllAbyssChests(); + break; case CalamityModMessageType.PowerCellFactory: TEPowerCellFactory.ReadSyncPacket(mod, reader); break; @@ -359,6 +362,7 @@ namespace CalamityMod UpdateCodebreakerConstituents, UpdateCodebreakerContainedStuff, UpdateCodebreakerDecryptCountdown, + UnlockAbyssChests, // Draedon Summoner CodebreakerSummonStuff, diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 4af5ea84f2..edd6b46474 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -120,6 +120,9 @@ namespace CalamityMod.Effects // Used by Acid Eels, presumably to have their snaking movements look more smooth. internal static Effect PrimTextureOverlayShader; + // Used as a default for primitive drawing when no specific shader is supplied. This shader simply renders the vertex color data without modification. + internal static Effect StandardPrimitiveShader; + // Used by Devourer of Gods. Renders the portal that he escapes through at the end of phase 1. internal static Effect DoGPortalShader; @@ -337,6 +340,9 @@ namespace CalamityMod.Effects PrimTextureOverlayShader = LoadShader("PrimTextureOverlayShader"); RegisterMiscShader(PrimTextureOverlayShader, "TrailPass", "PrimitiveTexture"); + StandardPrimitiveShader = LoadShader("StandardPrimitiveShader"); + RegisterMiscShader(StandardPrimitiveShader, "PrimitivePass", "StandardPrimitiveShader"); + DoGPortalShader = LoadShader("ScreenShaders/DoGPortalShader"); RegisterMiscShader(DoGPortalShader, "ScreenPass", "DoGPortal"); diff --git a/Effects/StandardPrimitiveShader.fx b/Effects/StandardPrimitiveShader.fx new file mode 100644 index 0000000000..197b149592 --- /dev/null +++ b/Effects/StandardPrimitiveShader.fx @@ -0,0 +1,57 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// Returns the direct output from the primitive's specified color value. Nothing fancy. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + return input.Color; +} + +technique Technique1 +{ + pass PrimitivePass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/StandardPrimitiveShader.xnb b/Effects/StandardPrimitiveShader.xnb new file mode 100644 index 0000000000..513e94c70a Binary files /dev/null and b/Effects/StandardPrimitiveShader.xnb differ diff --git a/Graphics/Primitives/PrimitiveTrail.cs b/Graphics/Primitives/PrimitiveTrail.cs index 191571bc84..16e3b48dd7 100644 --- a/Graphics/Primitives/PrimitiveTrail.cs +++ b/Graphics/Primitives/PrimitiveTrail.cs @@ -39,7 +39,6 @@ namespace CalamityMod public VertexWidthFunction WidthFunction; public VertexColorFunction ColorFunction; - public static BasicEffect BaseEffect; public MiscShaderData SpecialShader; public TrailPointRetrievalFunction TrailPointFunction; @@ -61,24 +60,10 @@ namespace CalamityMod TrailPointFunction = pointFunction; + SpecialShader = specialShader ?? GameShaders.Misc["CalamityMod:StandardPrimitiveShader"]; + if (specialShader != null) SpecialShader = specialShader; - - if (BaseEffect is null) - BaseEffect = new BasicEffect(Main.instance.GraphicsDevice) - { - VertexColorEnabled = true, - TextureEnabled = false - }; - UpdateBaseEffect(out _, out _); - } - - public void UpdateBaseEffect(out Matrix effectProjection, out Matrix effectView) - { - CalamityUtils.CalculatePerspectiveMatricies(out effectView, out effectProjection); - - BaseEffect.View = effectView; - BaseEffect.Projection = effectProjection; } public static List RigidPointRetreivalFunction(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable _ = null) @@ -253,7 +238,7 @@ namespace CalamityMod if (trailPoints.All(point => point == trailPoints[0])) return; - UpdateBaseEffect(out Matrix projection, out Matrix view); + CalamityUtils.CalculatePerspectiveMatricies(out Matrix view, out Matrix projection); VertexPosition2DColor[] vertices = GetVerticesFromTrailPoints(trailPoints); short[] triangleIndices = GetIndicesFromTrailPoints(trailPoints.Count); @@ -267,13 +252,8 @@ namespace CalamityMod Main.instance.GraphicsDevice.RasterizerState.ScissorTestEnable = true; Main.instance.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); //offscreen culling - if (SpecialShader != null) - { - SpecialShader.Shader.Parameters["uWorldViewProjection"].SetValue(view * projection); - SpecialShader.Apply(); - } - else - BaseEffect.CurrentTechnique.Passes[0].Apply(); + SpecialShader.Shader.Parameters["uWorldViewProjection"].SetValue(view * projection); + SpecialShader.Apply(); Main.instance.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length, triangleIndices, 0, triangleIndices.Length / 3); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); diff --git a/Items/Accessories/Baroclaw.cs b/Items/Accessories/Baroclaw.cs index e7c4cfc4ce..f7fa268081 100644 --- a/Items/Accessories/Baroclaw.cs +++ b/Items/Accessories/Baroclaw.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.width = 30; - Item.height = 44; + Item.width = 40; + Item.height = 26; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; diff --git a/Items/Accessories/Baroclaw.png b/Items/Accessories/Baroclaw.png index 79f8c3c76d..5a4bcd7291 100644 Binary files a/Items/Accessories/Baroclaw.png and b/Items/Accessories/Baroclaw.png differ diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 25cfdf330e..7368dcb571 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories public class DragonScales : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int ShitBaseDamage = 55; + public static int ShitBaseDamage = 57; public static int TornadoBaseDamage = 210; public override void SetDefaults() diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 29d0d45799..54c6c96e52 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Accessories player.kbGlove = true; player.autoReuseGlove = true; player.meleeScaleGlove = true; - player.GetAttackSpeed() += 0.15f; - player.GetDamage() += 0.1f; + modPlayer.gloveLevel = 5; + player.GetDamage() += 0.10f; } public override void AddRecipes() diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index c93e707032..e91ecad2c6 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); Vector2 velocity = new Vector2(0f, -1f); - int baseDamage = 90; + int baseDamage = 50; if (modPlayer.oldFashioned) baseDamage = (int)(baseDamage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs index c738506500..178922a042 100644 --- a/Items/Accessories/WulfrumBattery.cs +++ b/Items/Accessories/WulfrumBattery.cs @@ -36,7 +36,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.GetDamage() += 0.07f; - player.GetModPlayer().battery = true; + if (!hideVisual) + player.GetModPlayer().battery = true; } //Scrappable for 3-6 wulfrum scrap or a 20% chance to get an energy core @@ -66,20 +67,22 @@ namespace CalamityMod.Items.Accessories { if (!projectile.npcProj && !projectile.trap && projectile.minion && !ProjectileID.Sets.MinionShot[projectile.type] && Main.player[projectile.owner].GetModPlayer().battery) { - float lightMult = 2f; + float lightMult = 1f; if (Lighting.UpdateEveryFrame) //The light loks wayyy too bright in retro/trippy - lightMult *= 0.5f; + lightMult *= 0.25f; - Lighting.AddLight(projectile.Center, Color.DeepSkyBlue.ToVector3() * lightMult); + Lighting.AddLight(projectile.Center, Color.LightGreen.ToVector3() * lightMult); - if (Main.rand.NextBool(16)) + if (Main.rand.NextBool(15)) { float size = (projectile.Hitbox.Size() / 2f).Length(); - Dust zapDust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(1f, 1f) * size, 226, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(1f, 2.3f)); + Dust zapDust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(1f, 1f) * size, 66, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(0.5f, 1.3f)); zapDust.noGravity = true; + zapDust.color = Main.rand.NextBool() ? Color.SkyBlue : Color.LightGreen; + zapDust.velocity = projectile.velocity * 0.2f; } } } diff --git a/Items/Ammo/MortarRound.cs b/Items/Ammo/MortarRound.cs index 7c3d361918..b4d74f867d 100644 --- a/Items/Ammo/MortarRound.cs +++ b/Items/Ammo/MortarRound.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,11 +8,13 @@ namespace CalamityMod.Items.Ammo { public class MortarRound : ModItem, ILocalizedModType { + internal static int TileBlastRadiusNormal = 3; + internal static int TileBlastRadiusGFB = 5; + public static int TileBlastRadius => Main.getGoodWorld ? TileBlastRadiusGFB : TileBlastRadiusNormal; + public static int HitboxBlastRadius => TileBlastRadius * 16 + 12; + public new string LocalizationCategory => "Items.Ammo"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } + public override void SetStaticDefaults() => Item.ResearchUnlockCount = 99; public override void SetDefaults() { @@ -23,9 +24,9 @@ namespace CalamityMod.Items.Ammo Item.height = 14; Item.maxStack = 9999; Item.consumable = true; - Item.knockBack = 7.5f; + Item.knockBack = 7f; Item.value = Item.sellPrice(copper: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ItemRarityID.Yellow; Item.ammo = AmmoID.Bullet; Item.shoot = ModContent.ProjectileType(); } @@ -33,9 +34,10 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { CreateRecipe(100). - AddIngredient(ItemID.RocketIV, 100). - AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddIngredient(ItemID.EmptyBullet, 100). + AddIngredient(ItemID.ExplosivePowder, 4). + AddIngredient(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Ammo/RubberMortarRound.cs b/Items/Ammo/RubberMortarRound.cs index 3607df7033..0c328d44a9 100644 --- a/Items/Ammo/RubberMortarRound.cs +++ b/Items/Ammo/RubberMortarRound.cs @@ -1,5 +1,4 @@ using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,22 +8,19 @@ namespace CalamityMod.Items.Ammo public class RubberMortarRound : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Ammo"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } + public override void SetStaticDefaults() => Item.ResearchUnlockCount = 99; public override void SetDefaults() { - Item.damage = 25; + Item.damage = 20; Item.DamageType = DamageClass.Ranged; Item.width = 20; Item.height = 14; Item.maxStack = 9999; Item.consumable = true; - Item.knockBack = 7.5f; + Item.knockBack = 7f; Item.value = Item.sellPrice(copper: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ItemRarityID.Yellow; Item.ammo = AmmoID.Bullet; Item.shoot = ModContent.ProjectileType(); } @@ -34,7 +30,7 @@ namespace CalamityMod.Items.Ammo CreateRecipe(100). AddIngredient(100). AddIngredient(ItemID.PinkGel, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index 7f812503a7..3fef9a2634 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -68,8 +69,8 @@ namespace CalamityMod.Items.Armor.Empyrean player.setBonus = this.GetLocalizedValue("SetBonus"); if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { - player.AddBuff(BuffID.Wrath, 2); - player.AddBuff(BuffID.Rage, 2); + player.AddBuff(ModContent.BuffType(), 2); + player.AddBuff(ModContent.BuffType(), 2); } player.GetDamage() += 0.09f; modPlayer.rogueVelocity += 0.09f; diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index 2179048508..ccfb997b04 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Silva public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetDefaults() { - Item.width = 34; + Item.width = 24; Item.height = 24; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.defense = 44; diff --git a/Items/Armor/Silva/SilvaArmor.png b/Items/Armor/Silva/SilvaArmor.png index a12120e2db..cec323c8f2 100644 Binary files a/Items/Armor/Silva/SilvaArmor.png and b/Items/Armor/Silva/SilvaArmor.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index ae5c57765f..cf28d7c689 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1183,24 +1183,40 @@ namespace CalamityMod.Items if (item.type == ItemID.FireGauntlet) { player.GetDamage() += 0.02f; - player.GetAttackSpeed() += 0.02f; } - //Feral Claws line melee speed adjustments + // Feral Claws line melee speed adjustments and nonstacking + // First removes all their melee speed so it can be given based on which you wear without stacking if (item.type == ItemID.FeralClaws) { - player.GetAttackSpeed() -= 0.02f; + player.GetAttackSpeed() -= 0.12f; // Feral Claws 10% + if (modPlayer.gloveLevel < 1) + modPlayer.gloveLevel = 1; } - - if (item.type == ItemID.PowerGlove) + if (item.type == ItemID.PowerGlove) { - player.GetAttackSpeed() -= 0.02f; + player.GetAttackSpeed() -= 0.12f; // Power Glove 10% + if (modPlayer.gloveLevel < 2) + modPlayer.gloveLevel = 2; } - - if (item.type == ItemID.BerserkerGlove) + if (item.type == ItemID.BerserkerGlove) { - player.GetAttackSpeed() -= 0.12f; + player.GetAttackSpeed() -= 0.12f; // Berserker Glove 0% } + if (item.type == ItemID.MechanicalGlove) + { + player.GetAttackSpeed() -= 0.12f; // Mechanical Glove 12% + if (modPlayer.gloveLevel < 3) + modPlayer.gloveLevel = 3; + } + if (item.type == ItemID.FireGauntlet) + { + player.GetAttackSpeed() -= 0.12f; // Fire Gauntlet 14% + if (modPlayer.gloveLevel < 4) + modPlayer.gloveLevel = 4; + } + if (modPlayer.eGauntlet && modPlayer.gloveLevel < 5) // Elemental Gauntlet 15% + modPlayer.gloveLevel = 5; //Celestial Stone line melee speed removal if (item.type == ItemID.SunStone) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 7e40374264..d30d1425f6 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -670,7 +670,7 @@ namespace CalamityMod.Items if (item.type == ItemID.PowerGlove) { - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12%", "10%")); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "10% increased melee speed, does not stack with downgrades")); EditTooltipByNum(0, (line) => line.Text += "\n10% increased true melee damage"); } @@ -680,13 +680,19 @@ namespace CalamityMod.Items } if (item.type == ItemID.MechanicalGlove) + { + string extraLine = "\n12% increased melee speed, does not stack with downgrades"; + EditTooltipByNum(1, (line) => line.Text = "12% increased melee damage" + extraLine); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "12% increased melee speed, does not stack with downgrades")); EditTooltipByNum(0, (line) => line.Text += "\n10% increased true melee damage"); + } if (item.type == ItemID.FireGauntlet) { EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("fire damage", "Hellfire")); string extraLine = "\n10% increased true melee damage"; - EditTooltipByNum(1, (line) => line.Text = "14% increased melee damage and speed" + extraLine); + string extraLine2 = "\n14% increased melee speed, does not stack with downgrades" + extraLine; + EditTooltipByNum(1, (line) => line.Text = "14% increased melee damage" + extraLine2); } // On Fire! debuff immunities diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 9bde51a84f..e27bc4129e 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Items { ItemID.Flairon, Do(DamageExact(73)) }, { ItemID.Flamarang, Do(DamageExact(43)) }, { ItemID.Flamelash, Do(DamageRatio(1.25f)) }, - { ItemID.Flamethrower, Do(DamageExact(24), ShootSpeedDelta(+3f)) }, + { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, { ItemID.FlowerofFire, Do(AutoReuse, ManaExact(7), UseRatio(0.88f), DamageRatio(0.65f)) }, // Uses ratios due to remix seed { ItemID.FlowerofFrost, Do(AutoReuse, ManaExact(7), UseExact(22), DamageExact(70), ShootSpeedExact(14)) }, { ItemID.FlyingKnife, Do(DamageExact(53)) }, @@ -201,7 +201,7 @@ namespace CalamityMod.Items { ItemID.Sandgun, Do(PointBlank, DamageExact(22), UseExact(20)) }, { ItemID.SapphireStaff, Do(DamageExact(25)) }, { ItemID.SDMG, Do(PointBlank, DamageExact(80)) }, - { ItemID.Seedler, Do(UseMeleeSpeed, DamageRatio(1.5f)) }, + { ItemID.Seedler, Do(UseMeleeSpeed, DamageExact(74), ShootSpeedDelta(+4f)) }, { ItemID.ShadowbeamStaff, Do(DamageExact(100)) }, { ItemID.ShadowFlameBow, Do(PointBlank, DamageExact(55)) }, { ItemID.ShadowFlameHexDoll, Do(DamageExact(40), ShootSpeedExact(30)) }, diff --git a/Items/Materials/PurifiedGel.cs b/Items/Materials/PurifiedGel.cs index e847110929..5698ffcbac 100644 --- a/Items/Materials/PurifiedGel.cs +++ b/Items/Materials/PurifiedGel.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 16; - Item.height = 14; + Item.width = 20; + Item.height = 36; Item.maxStack = 9999; Item.value = Item.buyPrice(0, 2, 50, 0); Item.rare = ItemRarityID.LightRed; diff --git a/Items/Materials/PurifiedGel.png b/Items/Materials/PurifiedGel.png index 37e2e34df9..d470fd7935 100644 Binary files a/Items/Materials/PurifiedGel.png and b/Items/Materials/PurifiedGel.png differ diff --git a/Items/Placeables/Banners/ChaoticPufferBanner.png b/Items/Placeables/Banners/ChaoticPufferBanner.png index a70e888557..ba025e7e53 100644 Binary files a/Items/Placeables/Banners/ChaoticPufferBanner.png and b/Items/Placeables/Banners/ChaoticPufferBanner.png differ diff --git a/Items/Placeables/Banners/RimehoundBanner.png b/Items/Placeables/Banners/RimehoundBanner.png index 5c1a18f578..2e079be130 100644 Binary files a/Items/Placeables/Banners/RimehoundBanner.png and b/Items/Placeables/Banners/RimehoundBanner.png differ diff --git a/Items/Placeables/Banners/ViperfishBanner.png b/Items/Placeables/Banners/ViperfishBanner.png index e247f7fc38..2bebb599c9 100644 Binary files a/Items/Placeables/Banners/ViperfishBanner.png and b/Items/Placeables/Banners/ViperfishBanner.png differ diff --git a/Items/Placeables/Furniture/AbyssTreasureChest.cs b/Items/Placeables/Furniture/AbyssTreasureChest.cs index 1a2d7f22a7..d6b6a6191a 100644 --- a/Items/Placeables/Furniture/AbyssTreasureChest.cs +++ b/Items/Placeables/Furniture/AbyssTreasureChest.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 22; + Item.width = 32; + Item.height = 26; Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/Furniture/AbyssTreasureChest.png b/Items/Placeables/Furniture/AbyssTreasureChest.png index 2998dd9962..dc831b93a2 100644 Binary files a/Items/Placeables/Furniture/AbyssTreasureChest.png and b/Items/Placeables/Furniture/AbyssTreasureChest.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs index d042161323..1bb10b81a0 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { Item.width = 26; - Item.height = 26; + Item.height = 28; Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.png b/Items/Placeables/Furniture/CraftingStations/AncientAltar.png index 7b629db093..1ee432c0a8 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/AncientAltar.png and b/Items/Placeables/Furniture/CraftingStations/AncientAltar.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index 7f398b4025..a09bb66da5 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; + Item.width = 30; + Item.height = 28; Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.png b/Items/Placeables/Furniture/CraftingStations/AshenAltar.png index 76cb7064a7..4221686c9d 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/AshenAltar.png and b/Items/Placeables/Furniture/CraftingStations/AshenAltar.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs index 3ea29c0e85..6331ae04f9 100644 --- a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 28; - Item.height = 20; + Item.width = 30; + Item.height = 26; Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.png b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.png index 698c2ce903..4d852a8e44 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.png and b/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.png differ diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index 97fe389b13..d8c7cb36d2 100644 --- a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void SetDefaults() { - Item.width = 8; - Item.height = 10; + Item.width = 24; + Item.height = 14; Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.png b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.png index 5399f388c3..7a3152f290 100644 Binary files a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.png and b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelPlatform.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientBathtub.png b/Items/Placeables/FurnitureAncient/AncientBathtub.png index 218b48d7a6..866c0e80ab 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientBathtub.png and b/Items/Placeables/FurnitureAncient/AncientBathtub.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientBed.png b/Items/Placeables/FurnitureAncient/AncientBed.png index a3f0c270cd..a18adabc0f 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientBed.png and b/Items/Placeables/FurnitureAncient/AncientBed.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.png b/Items/Placeables/FurnitureAncient/AncientBookcase.png index ebcc4e7b67..4a197acec5 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientBookcase.png and b/Items/Placeables/FurnitureAncient/AncientBookcase.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientChair.png b/Items/Placeables/FurnitureAncient/AncientChair.png index 24a548a067..932d96267b 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientChair.png and b/Items/Placeables/FurnitureAncient/AncientChair.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.png b/Items/Placeables/FurnitureAncient/AncientChandelier.png index 5022594757..244bf1df06 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientChandelier.png and b/Items/Placeables/FurnitureAncient/AncientChandelier.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.png b/Items/Placeables/FurnitureAncient/AncientDoor.png index a0c68e1120..366e553c5b 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientDoor.png and b/Items/Placeables/FurnitureAncient/AncientDoor.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.png b/Items/Placeables/FurnitureAncient/AncientLamp.png index 0f3e6cb3bb..6d933bc767 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientLamp.png and b/Items/Placeables/FurnitureAncient/AncientLamp.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.png b/Items/Placeables/FurnitureAncient/AncientLantern.png index 19ca3c65e4..9d979d8758 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientLantern.png and b/Items/Placeables/FurnitureAncient/AncientLantern.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientPipeOrgan.png b/Items/Placeables/FurnitureAncient/AncientPipeOrgan.png index c5ef3c39b7..38ed47b17c 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientPipeOrgan.png and b/Items/Placeables/FurnitureAncient/AncientPipeOrgan.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientSink.png b/Items/Placeables/FurnitureAncient/AncientSink.png index bc54cb6146..3cf8ae23d7 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientSink.png and b/Items/Placeables/FurnitureAncient/AncientSink.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.png b/Items/Placeables/FurnitureAncient/AncientSofa.png index 3d596b65e9..38e7b5dcdd 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientSofa.png and b/Items/Placeables/FurnitureAncient/AncientSofa.png differ diff --git a/Items/Placeables/FurnitureAncient/AncientTable.png b/Items/Placeables/FurnitureAncient/AncientTable.png index 12e287f60c..439143f957 100644 Binary files a/Items/Placeables/FurnitureAncient/AncientTable.png and b/Items/Placeables/FurnitureAncient/AncientTable.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenBathtub.png b/Items/Placeables/FurnitureAshen/AshenBathtub.png index 98f272a89a..9e975ce04a 100644 Binary files a/Items/Placeables/FurnitureAshen/AshenBathtub.png and b/Items/Placeables/FurnitureAshen/AshenBathtub.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenBed.png b/Items/Placeables/FurnitureAshen/AshenBed.png index 632783e60a..459b633343 100644 Binary files a/Items/Placeables/FurnitureAshen/AshenBed.png and b/Items/Placeables/FurnitureAshen/AshenBed.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenCandelabra.png b/Items/Placeables/FurnitureAshen/AshenCandelabra.png index 6e5a098472..bfbb78efad 100644 Binary files a/Items/Placeables/FurnitureAshen/AshenCandelabra.png and b/Items/Placeables/FurnitureAshen/AshenCandelabra.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.cs b/Items/Placeables/FurnitureAshen/AshenCandle.cs index a37ccc6dd2..cb77030cb3 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandle.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandle.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.width = 26; - Item.height = 26; + Item.width = 16; + Item.height = 20; Item.maxStack = 9999; Item.useTurn = true; Item.autoReuse = true; diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.png b/Items/Placeables/FurnitureAshen/AshenCandle.png index 4605a30a26..acb8e5f5ca 100644 Binary files a/Items/Placeables/FurnitureAshen/AshenCandle.png and b/Items/Placeables/FurnitureAshen/AshenCandle.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenChair.png b/Items/Placeables/FurnitureAshen/AshenChair.png index 7772a4c575..b5790f15c0 100644 Binary files a/Items/Placeables/FurnitureAshen/AshenChair.png and b/Items/Placeables/FurnitureAshen/AshenChair.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenPlatform.png b/Items/Placeables/FurnitureAshen/AshenPlatform.png index 6ab2c5ab18..2c349f8c05 100644 Binary files a/Items/Placeables/FurnitureAshen/AshenPlatform.png and b/Items/Placeables/FurnitureAshen/AshenPlatform.png differ diff --git a/Items/Placeables/FurnitureAshen/AshenSink.png b/Items/Placeables/FurnitureAshen/AshenSink.png index 60b2bf5b4c..63fd42f71d 100644 Binary files a/Items/Placeables/FurnitureAshen/AshenSink.png and b/Items/Placeables/FurnitureAshen/AshenSink.png differ diff --git a/Items/Placeables/FurnitureBotanic/BotanicBathtub.png b/Items/Placeables/FurnitureBotanic/BotanicBathtub.png index 4c3846bf7a..9da9b905b2 100644 Binary files a/Items/Placeables/FurnitureBotanic/BotanicBathtub.png and b/Items/Placeables/FurnitureBotanic/BotanicBathtub.png differ diff --git a/Items/Placeables/FurnitureBotanic/BotanicBed.png b/Items/Placeables/FurnitureBotanic/BotanicBed.png index 3da0811d34..010e60eb8c 100644 Binary files a/Items/Placeables/FurnitureBotanic/BotanicBed.png and b/Items/Placeables/FurnitureBotanic/BotanicBed.png differ diff --git a/Items/Placeables/FurnitureBotanic/BotanicPlatform.png b/Items/Placeables/FurnitureBotanic/BotanicPlatform.png index 1b886edafb..07f2021c29 100644 Binary files a/Items/Placeables/FurnitureBotanic/BotanicPlatform.png and b/Items/Placeables/FurnitureBotanic/BotanicPlatform.png differ diff --git a/Items/Placeables/FurnitureBotanic/BotanicSink.png b/Items/Placeables/FurnitureBotanic/BotanicSink.png index 19cfc9dd09..4671173ded 100644 Binary files a/Items/Placeables/FurnitureBotanic/BotanicSink.png and b/Items/Placeables/FurnitureBotanic/BotanicSink.png differ diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.png b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.png index 0ca75a29e5..ad097997e3 100644 Binary files a/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.png and b/Items/Placeables/FurnitureCosmilite/CosmiliteCandle.png differ diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.png b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.png index e76b0ac466..a3748c4e88 100644 Binary files a/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.png and b/Items/Placeables/FurnitureCosmilite/CosmiliteLantern.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.png b/Items/Placeables/FurnitureEutrophic/EutrophicChest.png index 3337de552f..7fa3661cdf 100644 Binary files a/Items/Placeables/FurnitureEutrophic/EutrophicChest.png and b/Items/Placeables/FurnitureEutrophic/EutrophicChest.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.png b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.png index 829454bdf3..2d8a1d9957 100644 Binary files a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.png and b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.png differ diff --git a/Items/Placeables/FurnitureMonolith/MonolithChest.png b/Items/Placeables/FurnitureMonolith/MonolithChest.png index 1e52409c99..1a0be40c15 100644 Binary files a/Items/Placeables/FurnitureMonolith/MonolithChest.png and b/Items/Placeables/FurnitureMonolith/MonolithChest.png differ diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.png b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.png index 49cc88a643..330719985a 100644 Binary files a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.png and b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.png differ diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.png b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.png index c36b3f5fa5..e47295baf6 100644 Binary files a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.png and b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.png differ diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.png b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.png index 2434cd1bb2..74368df9d5 100644 Binary files a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.png and b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.png differ diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.png b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.png index fc8f3bfde4..09db040dcf 100644 Binary files a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.png and b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.png differ diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.png b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.png index ab6f2860b6..858af7f419 100644 Binary files a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.png and b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPlatform.png differ diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.png b/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.png index 35580549e2..a1b00fdd87 100644 Binary files a/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.png and b/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.png differ diff --git a/Items/Placeables/FurnitureSilva/SilvaBathtub.png b/Items/Placeables/FurnitureSilva/SilvaBathtub.png index 722081457c..d001d59c03 100644 Binary files a/Items/Placeables/FurnitureSilva/SilvaBathtub.png and b/Items/Placeables/FurnitureSilva/SilvaBathtub.png differ diff --git a/Items/Placeables/FurnitureSilva/SilvaBed.png b/Items/Placeables/FurnitureSilva/SilvaBed.png index 43096eca42..8239f4d7f5 100644 Binary files a/Items/Placeables/FurnitureSilva/SilvaBed.png and b/Items/Placeables/FurnitureSilva/SilvaBed.png differ diff --git a/Items/Placeables/FurnitureSilva/SilvaChair.png b/Items/Placeables/FurnitureSilva/SilvaChair.png index ba6118b630..f23097889b 100644 Binary files a/Items/Placeables/FurnitureSilva/SilvaChair.png and b/Items/Placeables/FurnitureSilva/SilvaChair.png differ diff --git a/Items/Placeables/FurnitureSilva/SilvaChandelier.png b/Items/Placeables/FurnitureSilva/SilvaChandelier.png index 464566cc65..1753d693fe 100644 Binary files a/Items/Placeables/FurnitureSilva/SilvaChandelier.png and b/Items/Placeables/FurnitureSilva/SilvaChandelier.png differ diff --git a/Items/Placeables/FurnitureSilva/SilvaChest.png b/Items/Placeables/FurnitureSilva/SilvaChest.png index 6a2a66ce0e..d61fc5cbe0 100644 Binary files a/Items/Placeables/FurnitureSilva/SilvaChest.png and b/Items/Placeables/FurnitureSilva/SilvaChest.png differ diff --git a/Items/Placeables/FurnitureSilva/SilvaPlatform.png b/Items/Placeables/FurnitureSilva/SilvaPlatform.png index 41b774fdfb..c5a800d276 100644 Binary files a/Items/Placeables/FurnitureSilva/SilvaPlatform.png and b/Items/Placeables/FurnitureSilva/SilvaPlatform.png differ diff --git a/Items/Placeables/FurnitureSilva/SilvaSink.png b/Items/Placeables/FurnitureSilva/SilvaSink.png index 38e40fa5a3..61dbebe8aa 100644 Binary files a/Items/Placeables/FurnitureSilva/SilvaSink.png and b/Items/Placeables/FurnitureSilva/SilvaSink.png differ diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png index fa07bcd54f..647ea6512e 100644 Binary files a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png and b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png differ diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index 87804909b9..b4494aea18 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.width = 46; - Item.height = 46; + Item.height = 48; Item.useStyle = ItemUseStyleID.Swing; Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; diff --git a/Items/Tools/Gelpick.png b/Items/Tools/Gelpick.png index 8ebec5de95..026c5359a1 100644 Binary files a/Items/Tools/Gelpick.png and b/Items/Tools/Gelpick.png differ diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index 5647e88358..79be20f88e 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { - Item.damage = 14; + Item.damage = 10; Item.DamageType = DamageClass.Magic; Item.mana = 20; Item.width = 28; Item.height = 32; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useTime = 35; + Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index be196feb1c..c1fd155865 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.width = 62; + Item.width = 44; + Item.height = 70; Item.damage = 38; Item.DamageType = DamageClass.Melee; Item.useAnimation = 30; @@ -23,7 +24,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 62; Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GeliticBlade.png b/Items/Weapons/Melee/GeliticBlade.png index 0369a046ba..130809d1e9 100644 Binary files a/Items/Weapons/Melee/GeliticBlade.png and b/Items/Weapons/Melee/GeliticBlade.png differ diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 7a409e5a71..3208cb9c07 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -3,6 +3,7 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,8 +15,12 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public int frameCounter = 0; public int frame = 0; - public bool IDUnlocked(Player player) => DownedBossSystem.downedYharon || player.name == "Jetstream Sam" || player.name == "Samuel Rodrigues"; + public bool IDUnlocked(Player player) => DownedBossSystem.downedDoG; + public static readonly SoundStyle OrganicHit = new("CalamityMod/Sounds/Item/MurasamaHitOrganic") { Volume = 0.6f }; + public static readonly SoundStyle InorganicHit = new("CalamityMod/Sounds/Item/MurasamaHitInorganic") { Volume = 0.65f }; + public static readonly SoundStyle Swing = new("CalamityMod/Sounds/Item/MurasamaSwing") { Volume = 0.3f }; + public static readonly SoundStyle BigSwing = new("CalamityMod/Sounds/Item/MurasamaBigSwing") { Volume = 0.35f }; public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 13)); @@ -26,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.height = 128; Item.width = 56; - Item.damage = 3001; + Item.damage = 2222; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; @@ -44,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee } // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 30; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 61; public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { diff --git a/Items/Weapons/Melee/SaharaSlicers.png b/Items/Weapons/Melee/SaharaSlicers.png index d9e2b0847c..aecbe93345 100644 Binary files a/Items/Weapons/Melee/SaharaSlicers.png and b/Items/Weapons/Melee/SaharaSlicers.png differ diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index 9de2ff5f31..ae9b2f28c1 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - Item.width = 60; + Item.width = 86; + Item.height = 64; Item.damage = 232; Item.noMelee = true; Item.noUseGraphic = true; @@ -23,7 +24,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.height = 62; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.Rarity12BuyPrice; diff --git a/Items/Weapons/Melee/SeekingScorcher.png b/Items/Weapons/Melee/SeekingScorcher.png index 991e07cd78..7f965ae3fe 100644 Binary files a/Items/Weapons/Melee/SeekingScorcher.png and b/Items/Weapons/Melee/SeekingScorcher.png differ diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index a462d5b460..c447f7e2fe 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 40; - Item.height = 26; + Item.width = 36; + Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 29; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Melee/TheGodsGambit.png b/Items/Weapons/Melee/TheGodsGambit.png index 2d8201ded6..05addcdf2e 100644 Binary files a/Items/Weapons/Melee/TheGodsGambit.png and b/Items/Weapons/Melee/TheGodsGambit.png differ diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index 228c05c4fc..0b0183fbe7 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 33; Item.DamageType = DamageClass.Ranged; - Item.width = 30; - Item.height = 50; + Item.width = 32; + Item.height = 96; Item.useTime = 31; Item.useAnimation = 31; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/Goobow.png b/Items/Weapons/Ranged/Goobow.png index fbec958fc9..7acb164d32 100644 Binary files a/Items/Weapons/Ranged/Goobow.png and b/Items/Weapons/Ranged/Goobow.png differ diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index ee19d870a9..cc9c9c0543 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 23; Item.DamageType = DamageClass.Ranged; - Item.width = 44; - Item.height = 30; + Item.width = 76; + Item.height = 28; Item.useTime = 32; Item.useAnimation = 32; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/GunkShot.png b/Items/Weapons/Ranged/GunkShot.png index c8f9979b94..1c82d85b8d 100644 Binary files a/Items/Weapons/Ranged/GunkShot.png and b/Items/Weapons/Ranged/GunkShot.png differ diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index 8f9160ca2e..c899c03a88 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,34 +11,43 @@ namespace CalamityMod.Items.Weapons.Ranged public class MineralMortar : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() { - Item.damage = 30; + Item.damage = 85; Item.DamageType = DamageClass.Ranged; - Item.width = 58; - Item.height = 26; - Item.useTime = 33; - Item.useAnimation = 33; - Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); + Item.useTime = Item.useAnimation = 60; + Item.shootSpeed = 25f; + Item.knockBack = 20f; + + Item.width = 68; + Item.height = 32; Item.noMelee = true; - Item.knockBack = 5f; + Item.noUseGraphic = true; + Item.channel = true; + Item.useAmmo = AmmoID.Rocket; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; - Item.UseSound = SoundID.Item11; - Item.autoReuse = true; - Item.shootSpeed = 14f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = AmmoID.Rocket; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; + + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile holdout = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.rotation = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero).ToRotation(); + return false; } diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index b1bc3330b9..4f16d0a645 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 2550; + Item.damage = 2850; Item.DamageType = RogueDamageClass.Instance; Item.width = 30; @@ -41,11 +41,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 18f; + Item.shootSpeed = 17f; modItem.UsesCharge = true; modItem.MaxCharge = 300f; // Tesla Cannon = 250f - modItem.ChargePerUse = 0.5f; // Tesla Cannon = 0.9f + modItem.ChargePerUse = 0.4f; // Tesla Cannon = 0.9f } public static float StealthDmgMult = 0.3f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers public override float StealthDamageMultiplier => StealthDmgMult; @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue public static float ReturnMaxSpeed = 24f; public static float RicochetShootingCooldown = 1000f; public static float RicochetVelocityCap = 28f; - public static float ElectricityDmgMult = 0.3f; + public static float ElectricityDmgMult = 0.4f; public static float ElectricityCooldown = 500f; public static float LaserDmgMult = 0.25f; public static float LaserCooldown = 300f; diff --git a/Items/Weapons/Rogue/ElementalDisk.cs b/Items/Weapons/Rogue/ElementalDisk.cs index da1a68cc74..6adb111910 100644 --- a/Items/Weapons/Rogue/ElementalDisk.cs +++ b/Items/Weapons/Rogue/ElementalDisk.cs @@ -11,27 +11,29 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("AccretionDisk")] public class ElementalDisk : RogueWeapon { + public static int stealthTimeMult = 2; public override void SetDefaults() { Item.width = 38; - Item.damage = 100; + Item.damage = 92; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 15; + Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; + Item.useTime = 16; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.height = 38; Item.value = CalamityGlobalItem.Rarity11BuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; + Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; } public override float StealthVelocityMultiplier => 0.7f; + public override float StealthDamageMultiplier => 0.75f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -41,8 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].timeLeft *= 3; - Main.projectile[proj].localNPCHitCooldown *= 2; + Main.projectile[proj].timeLeft *= stealthTimeMult; } return false; } diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs index d1c890d385..3f20d5361a 100644 --- a/Items/Weapons/Rogue/FinalDawn.cs +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/FinalDawnSlash"); public override void SetDefaults() { - Item.damage = 1500; + Item.damage = 2500; Item.DamageType = RogueDamageClass.Instance; Item.width = 78; Item.height = 66; @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; } + public override float StealthDamageMultiplier => 0.6f; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index c672674075..1ae4eeb49b 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 14; - Item.damage = 28; + Item.width = 26; + Item.damage = 54; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/GelDart.png b/Items/Weapons/Rogue/GelDart.png index f01a1c46a1..b410b9e0c9 100644 Binary files a/Items/Weapons/Rogue/GelDart.png and b/Items/Weapons/Rogue/GelDart.png differ diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index cb024ae524..7ce3e20739 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -11,13 +11,9 @@ namespace CalamityMod.Items.Weapons.Rogue { public class HellsSun : RogueWeapon { - private static int damage = 240; - private static int knockBack = 5; - private static float SdamageMult = 0.12f; - public override void SetDefaults() { - Item.damage = damage; + Item.damage = 200; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; @@ -26,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = knockBack; + Item.knockBack = 5; Item.value = CalamityGlobalItem.Rarity11BuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item1; @@ -50,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override float StealthDamageMultiplier => SdamageMult; + public override float StealthDamageMultiplier => 0.10f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index 4668d94a33..05f34b2484 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 82; Item.height = 82; - Item.damage = 300; + Item.damage = 320; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 13; diff --git a/Items/Weapons/Rogue/Wrathwing.cs b/Items/Weapons/Rogue/Wrathwing.cs index 0701c4b7f5..c75d32c93d 100644 --- a/Items/Weapons/Rogue/Wrathwing.cs +++ b/Items/Weapons/Rogue/Wrathwing.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.85f; + public override float StealthDamageMultiplier => 0.9f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index f89c10f34a..2f9eec8aac 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -1,7 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +9,9 @@ namespace CalamityMod.Items.Weapons.Summon { public class AncientIceChunk : ModItem, ILocalizedModType { - #region Other stats + #region Other Stats public static int IFrames = 20; - public static float EnemyDistanceDetection = 1200f; public static float MaxDistanceFromOwner = 400f; // Max distance the minions can be while shooting or idling. public static float DistanceToDash = 250f; // Min distance to start dashing. public static float DistanceToStopDash = 800f; // Max distance the player can be so the minions continue dashing. @@ -21,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public static float ProjectileDMGMultiplier = 1.5f; // They're kinda' weak. #endregion - + public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetStaticDefaults() @@ -29,31 +28,29 @@ namespace CalamityMod.Items.Weapons.Summon Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; } - + public override void SetDefaults() { Item.damage = 25; - Item.mana = 10; - Item.width = 30; - Item.height = 30; - Item.useTime = Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; + + Item.useTime = Item.useAnimation = 25; + Item.mana = 10; + Item.width = 38; + Item.height = 50; + Item.noMelee = true; + Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; + Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item30; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int clasper = Projectile.NewProjectile(source, Main.MouseWorld, new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)), type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(clasper)) - Main.projectile[clasper].originalDamage = Item.damage; - + Projectile.NewProjectileDirect(source, Main.MouseWorld, Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 31195f4d96..0dcb95fb2b 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -13,20 +13,14 @@ namespace CalamityMod.Items.Weapons.Summon public class SlimePuppetStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() - { - // In other words, bootleg mage :TaxEvasion: - Item.staff[Item.type] = true; - } - public override void SetDefaults() { Item.damage = 26; Item.mana = 10; - Item.width = 48; - Item.height = 56; + Item.width = 32; + Item.height = 34; Item.useTime = Item.useAnimation = 29; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3.6f; Item.value = CalamityGlobalItem.Rarity4BuyPrice; diff --git a/Items/Weapons/Summon/SlimePuppetStaff.png b/Items/Weapons/Summon/SlimePuppetStaff.png index 119db86506..f53f142963 100644 Binary files a/Items/Weapons/Summon/SlimePuppetStaff.png and b/Items/Weapons/Summon/SlimePuppetStaff.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index c4456082fe..a3032788f3 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -638,7 +638,8 @@ ElementalGauntlet: { Tooltip: ''' Melee attacks and projectiles inflict Elemental Mix - 15% increased melee speed, damage, and 5% increased melee critical strike chance + 15% increased melee damage and 5% increased melee critical strike chance + 15% increased melee speed, does not stack with downgrades 20% increased true melee damage Increased melee knockback Enables auto swing for melee weapons @@ -1976,7 +1977,7 @@ WulfrumBattery: { DisplayName: Wulfrum Battery Tooltip: ''' - Empowers your summons with wulfrum energy, letting them emit light around them + Empowers your summons with wulfrum energy, letting them emit light around them if visibility is enabled 7% increased summon damage 50% chance to get an extra scrap when killing wulfrum robots Can also be scrapped at an extractinator diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index b7f31471a3..d33e0a3686 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -115,7 +115,8 @@ MortarRound: { DisplayName: Mortar Round Tooltip: ''' - Large blast radius. Will destroy tiles + Specialized high explosive rounds with a large blast radius + Will destroy tiles Used by normal guns ''' } @@ -129,7 +130,7 @@ RubberMortarRound: { DisplayName: Rubber Mortar Round Tooltip: ''' - Large blast radius + Specialized high explosive rounds with a large blast radius Will destroy tiles on each bounce Used by normal guns ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index a6dadc8b56..4e26275b5b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -174,7 +174,6 @@ NecroplasmicBeacon: { Tooltip: ''' Summons Polterghast when used in the Dungeon - Enrages in large spaces Not consumable 'The wails of the spirits disturbed something far more terrifying.' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index e623269f10..88881e201c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -664,7 +664,11 @@ SeethingDischarge: { Serpentine: { DisplayName: Serpentine - Tooltip: Casts a serpent that follows the mouse cursor + Tooltip: + ''' + Casts a serpent that follows the mouse cursor + Ignores 15 points of enemy Defense + ''' } ShadecrystalTome: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 4b269727c2..86dfa23ba2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -752,7 +752,8 @@ Murasama: { Tooltip: ''' A high-frequency blade that can cleanly slice through even the mightiest foe - Prove your worth by slaying Yharon, Dragon of Rebirth to unsheath this sword + Every third swing deals immense damage + Prove your worth by slaying The Devourer of Gods to unsheath this sword [c/F41A31:'There will be blood!'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 92e434e99c..337ee1304b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -742,7 +742,7 @@ MidasPrime: { MineralMortar: { DisplayName: Mineral Mortar - Tooltip: Shoots an onyx bomb that explodes into sand sharks on death + Tooltip: Shoots an onyx bomb that explodes into huge area damage } Kingsbane: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 718ce3861e..80f1e22303 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -124,6 +124,7 @@ MarksmanShot.DisplayName: Marksman Shot MechanicalBarracuda.DisplayName: Barracuda MeowCreature.DisplayName: the creature :3 MeowFire.DisplayName: Purr Fire +MineralMortarProjectile.DisplayName: Onyx Bomb MiniatureFolly.DisplayName: Miniature Folly MiniRocket.DisplayName: Rocket MiniSharkron.DisplayName: Mini Sharkron @@ -139,7 +140,6 @@ NovaShot.DisplayName: Nova Bolt Nuke.DisplayName: Nuke NullShot.DisplayName: Null NullShot2.DisplayName: Null -OnyxSharkBomb.DisplayName: Onyx Shark OpalChargedStrike.DisplayName: Charged Plasma Bolt OpalStrike.DisplayName: Heated Bolt PiercingBullet.DisplayName: Piercing Blow @@ -173,7 +173,6 @@ RicoshotCoin.DisplayName: Ricoshot Coin RocketFire.DisplayName: Fire RubberMortarRoundProj.DisplayName: Rubber Mortar SandstormBullet.DisplayName: Sandstorm -SandyWaifuShark.DisplayName: Shark ScorchedEarthBlast.DisplayName: Earth Scorcher ScorchedEarthClusterBomb.DisplayName: Cluster Bomb ScorchedEarthRocket.DisplayName: Rocket diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index e2e1e2b93d..46243a07e7 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -2032,7 +2032,7 @@ namespace CalamityMod if (args.Length < 2 || args[1] is not int[] npcs) return new ArgumentException("ERROR: The first argument to \"SetNewShopVariable\" must be an integer array of npc ids that should be alerted."); if (args.Length != 3 || args[2] is not bool alreadySet) - return new ArgumentException("ERROR: The third argument to \"SetNewShopVariable\" Must be a bool that determines if the shop alert should show."); + return new ArgumentException("ERROR: The second argument to \"SetNewShopVariable\" Must be a bool that determines if the shop alert should show."); CalamityGlobalNPC.SetNewShopVariable(npcs, alreadySet); return null; } diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index d02666233a..4e0f3ff8a2 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.AstrumDeus { GFBOnly.Add(ItemID.Worm, 1, 1, 9999, true); GFBOnly.Add(ItemID.CanOfWorms, 1, 1, 9999, true); - GFBOnly.Add(ItemID.GummyWorm, 1, 1, 9999); + GFBOnly.Add(ItemID.GummyWorm, 1, 1, 9999, true); GFBOnly.Add(ItemID.TruffleWorm, 1, 1, 9999, true); GFBOnly.Add(ItemID.EnchantedNightcrawler, 1, 1, 9999, true); GFBOnly.Add(ItemID.Spaghetti, 1, 1, 9999, true); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index d6792e3c1c..50451023f8 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1783,15 +1783,10 @@ namespace CalamityMod.NPCs // First kill: Notify of Abyss chests being unlocked. if (!NPC.downedBoss3) { - // Abyss chest auto unlock has been shelved, the bug has still not fucking died despite several attempts to fix it. - // Commented it out just in case someone is willing to fix it in the future - Shade - /* - if (Main.netMode != NetmodeID.MultiplayerClient) //Only the server should do this to prevent already unlocked chests from attempting to be unlocked + if (Main.netMode != NetmodeID.MultiplayerClient) { - World.Abyss.AbleToUnlockChests = true; World.Abyss.UnlockAllAbyssChests(); } - */ string keysk = "Mods.CalamityMod.Status.Progression.SkeletronAbyssChestNotification"; CalamityUtils.DisplayLocalizedText(keysk, new Color(76, 181, 76)); } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index d59b915056..4d81dd69a6 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -209,6 +209,7 @@ namespace CalamityMod.NPCs { "Stan Pines", "Slap Battles", // <@!923504188615450654> (gravityglider.) + "Matt Walsh", // <@!522970788203069442> (phallguy) }; private static readonly string[] TruffleNames = { diff --git a/Particles/Sparkle2.png b/Particles/Sparkle2.png new file mode 100644 index 0000000000..96ba7f3240 Binary files /dev/null and b/Particles/Sparkle2.png differ diff --git a/Particles/SparkleParticle.cs b/Particles/SparkleParticle.cs new file mode 100644 index 0000000000..1ba9dc8c6a --- /dev/null +++ b/Particles/SparkleParticle.cs @@ -0,0 +1,60 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class SparkleParticle : Particle + { + public override string Texture => "CalamityMod/Particles/Sparkle2"; + public bool UseAltVisual = true; + public override bool UseAdditiveBlend => UseAltVisual; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + public override bool Important => imporant; + + public bool imporant; + private float Spin; + private float opacity; + private Color Bloom; + private Color LightColor => Bloom * opacity; + private float BloomScale; + + public SparkleParticle(Vector2 position, Vector2 velocity, Color color, Color bloom, float scale, int lifeTime, float rotationSpeed = 0f, float bloomScale = 1f, bool AddativeBlend = true, bool needed = false) + { + Position = position; + Velocity = velocity; + Color = color; + Bloom = bloom; + Scale = scale; + Lifetime = lifeTime; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Spin = rotationSpeed; + BloomScale = bloomScale; + UseAltVisual = AddativeBlend; + imporant = needed; + } + + public override void Update() + { + opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi); + Lighting.AddLight(Position, LightColor.R / 255f, LightColor.G / 255f, LightColor.B / 255f); + Velocity *= 0.95f; + Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D starTexture = ModContent.Request(Texture).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + //Ajust the bloom's texture to be the same size as the star's + float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; + + spriteBatch.Draw(bloomTexture, Position - Main.screenPosition, null, Bloom * opacity * 0.5f, 0, bloomTexture.Size()/2f, Scale * BloomScale * properBloomSize, SpriteEffects.None, 0); + spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity * 0.5f, Rotation + MathHelper.PiOver4, starTexture.Size() / 2f, Scale * 0.75f, SpriteEffects.None, 0); + spriteBatch.Draw(starTexture, Position - Main.screenPosition, null, Color * opacity, Rotation, starTexture.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs index 18752d5124..06aebb26f5 100644 --- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs @@ -40,18 +40,26 @@ namespace CalamityMod.Projectiles.BaseProjectiles public virtual float MinionSlots => 1f; /// - /// The distance in which the minion can detect an enemy, in pixels.
+ /// The max distance in which the minion can detect an enemy, in pixels.
/// is set to this value.
/// Defaults to 1200f (75 tiles). ///
public virtual float EnemyDistanceDetection => 1200f; + /// + /// The min distance in which the minion can detect an enemy before it goes to its correspondent enemy distance detection. + /// Defaults to 960f (60 tiles), the radius of a 1080p monitor at max zoom. + /// + public virtual float MinEnemyDistanceDetection => 960f; + + private float AdaptiveEnemyDistanceDetection => Target == null ? MinEnemyDistanceDetection : EnemyDistanceDetection; + /// /// The amount of local I-Frames this minion has.
- /// Multiplied by so changing won't affect this.
+ /// Multiplied by so changing the updates won't affect this.
/// Defaults to 10. ///
- public int IFrames { get => Projectile.localNPCHitCooldown / Projectile.MaxUpdates; set => Projectile.localNPCHitCooldown = value * Projectile.MaxUpdates; } + public int IFrames { get; set; } = 10; /// /// If , makes the minion only be able to detect and attack enemies through tiles only when there are any bosses alive.
@@ -65,6 +73,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles ///
public virtual bool PreventTargettingUntilTargetHit => true; + /// + /// The amount of animation frames this minion has.
+ /// Defaults to 1 frame. + ///
+ public virtual int AnimationFrames => 1; + /// /// The frames that it takes to go to the next frame of animation.
/// Defaults to 5. @@ -83,14 +97,15 @@ namespace CalamityMod.Projectiles.BaseProjectiles ///
public int TrailCacheLength { get; set; } = 5; - public Player Owner => Main.player[Projectile.owner]; - public CalamityPlayer ModdedOwner => Owner.Calamity(); + public Player Owner { get; set; } + public CalamityPlayer ModdedOwner { get; set; } public NPC Target { get; set; } #endregion public override void SetStaticDefaults() { + Main.projFrames[Type] = AnimationFrames; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.TrailingMode[Type] = TrailingMode; ProjectileID.Sets.TrailCacheLength[Type] = TrailCacheLength; @@ -119,9 +134,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { + Projectile.localNPCHitCooldown = IFrames * Projectile.MaxUpdates; + SetOwnerTarget(); CheckMinionExistence(); DoAnimation(); - ChooseTarget(); MinionAI(); } @@ -166,9 +182,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles } /// - /// Where the null property is set to a valid target, a non-null value. + /// Where the null property , and is set to a non-null value. /// - public virtual void ChooseTarget() => Target = Owner.Center.MinionHoming(EnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || CalamityPlayer.areThereAnyDamnBosses); + public virtual void SetOwnerTarget() + { + Owner = Main.player[Projectile.owner]; + ModdedOwner = Owner.Calamity(); + Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || CalamityPlayer.areThereAnyDamnBosses); + } #endregion } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index c10aa270f8..4ac7dc1ff9 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -110,6 +110,7 @@ namespace CalamityMod.Projectiles public int stealthStrikeHitCount = 0; public bool extorterBoost = false; public bool LocketClone = false; + public bool CannotProc = false; // Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben // TODO -- uses of this variable are undocumented and unstable. Remove it from the API surface. @@ -2412,71 +2413,74 @@ namespace CalamityMod.Projectiles if (projectile.CountsAsClass()) { - if (modPlayer.nanotech) + if (!LocketClone && !CannotProc) { - if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) + if (modPlayer.nanotech) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) + if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) { - int damage = (int)player.GetTotalDamage().ApplyTo(60); - if (modPlayer.oldFashioned) - damage = (int)(damage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); - - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); - } - } - } - else if (modPlayer.moonCrown) - { - if (Main.player[projectile.owner].miscCounter % 120 == 0 && projectile.FinalExtraUpdate()) - { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) - { - int damage = (int)player.GetTotalDamage().ApplyTo(45); - if (modPlayer.oldFashioned) - damage = (int)(damage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); - - int proj = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Generic; - } - } - } - - if (modPlayer.dragonScales) - { - if (Main.player[projectile.owner].miscCounter % 50 == 0 && projectile.FinalExtraUpdate()) - { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) - { - int damage = (int)player.GetTotalDamage().ApplyTo(DragonScales.ShitBaseDamage); - if (modPlayer.oldFashioned) - damage = (int)(damage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); - - int proj = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), damage, 0f, projectile.owner); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Generic; - } - } - } - - if (modPlayer.daedalusSplit) - { - if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) - { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.CrystalShard] < 15) - { - // Daedalus Rogue Crystals: 2 x 25%, soft cap starts at 120 base damage - int crystalDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30); - if (modPlayer.oldFashioned) - crystalDamage = (int)(crystalDamage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); - - for (int i = 0; i < 2; i++) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileID.CrystalShard, crystalDamage, 0f, projectile.owner); - if (shard.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard].DamageType = DamageClass.Generic; + int damage = (int)player.GetTotalDamage().ApplyTo(60); + if (modPlayer.oldFashioned) + damage = (int)(damage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); + + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); + } + } + } + else if (modPlayer.moonCrown) + { + if (Main.player[projectile.owner].miscCounter % 120 == 0 && projectile.FinalExtraUpdate()) + { + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) + { + int damage = (int)player.GetTotalDamage().ApplyTo(45); + if (modPlayer.oldFashioned) + damage = (int)(damage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); + + int proj = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].DamageType = DamageClass.Generic; + } + } + } + + if (modPlayer.dragonScales) + { + if (Main.player[projectile.owner].miscCounter % 50 == 0 && projectile.FinalExtraUpdate()) + { + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) + { + int damage = (int)player.GetTotalDamage().ApplyTo(DragonScales.ShitBaseDamage); + if (modPlayer.oldFashioned) + damage = (int)(damage * OldFashioned.AccessoryAndSetBonusDamageMultiplier); + + int proj = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 1.2f, ProjectileType(), damage, 0f, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].DamageType = DamageClass.Generic; + Main.projectile[proj].ArmorPenetration = 10; + } + } + } + } + + if (modPlayer.daedalusSplit) + { + if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) + { + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.CrystalShard] < 15) + { + // Daedalus Rogue Crystals: 2 x 25%, soft cap starts at 120 base damage + int crystalDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30); + for (int i = 0; i < 2; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileID.CrystalShard, crystalDamage, 0f, projectile.owner); + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].DamageType = DamageClass.Generic; + } } } } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 6d55863898..cf6e69a93e 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + Lighting.AddLight(Projectile.Center, 1f, 0f, 0f); if (Projectile.localAI[0] == 0f) { Projectile.velocity.X = Projectile.velocity.X + (Main.player[Projectile.owner].velocity.X * 0.5f); @@ -57,6 +58,11 @@ namespace CalamityMod.Projectiles.Magic } } + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 60, 60, Projectile.alpha); + } + public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); diff --git a/Projectiles/Magic/SerpentineBody.cs b/Projectiles/Magic/SerpentineBody.cs index 297b1838a2..88aba041e0 100644 --- a/Projectiles/Magic/SerpentineBody.cs +++ b/Projectiles/Magic/SerpentineBody.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; + Projectile.ArmorPenetration = 15; } public override void AI() diff --git a/Projectiles/Magic/SerpentineHead.cs b/Projectiles/Magic/SerpentineHead.cs index 5c3a143011..eda87d1e9a 100644 --- a/Projectiles/Magic/SerpentineHead.cs +++ b/Projectiles/Magic/SerpentineHead.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; + Projectile.ArmorPenetration = 15; } public override void AI() diff --git a/Projectiles/Magic/SerpentineTail.cs b/Projectiles/Magic/SerpentineTail.cs index d6e384de5a..671cc97aa0 100644 --- a/Projectiles/Magic/SerpentineTail.cs +++ b/Projectiles/Magic/SerpentineTail.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; + Projectile.ArmorPenetration = 15; } public override void AI() diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 8d6181b299..ea5a5226c4 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -1,5 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -14,8 +16,11 @@ namespace CalamityMod.Projectiles.Melee public class MurasamaSlash : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + private Player Owner => Main.player[Projectile.owner]; + public ref int hitCooldown => ref Main.player[Projectile.owner].Calamity().murasamaHitCooldown; public int frameX = 0; public int frameY = 0; + public int time = 0; public int CurrentFrame { @@ -27,23 +32,21 @@ namespace CalamityMod.Projectiles.Melee } } - // A "slash" is only present during 2 specific frames (ones with a slash effect) right before they transition to the next frame. - // Note: This bool is unused. Murasama formerly only dealt damage when on these frames, but it created a few issues with player usability. - public bool Slashing => CurrentFrame % 7 == 0 && Projectile.frameCounter % 3 == 2; + public bool Slashing = false; public override void SetDefaults() { Projectile.width = 236; - Projectile.height = 180; - Projectile.scale = 2f; + Projectile.height = 236; + Projectile.scale = 1f; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Projectile.ownerHitCheck = true; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 21; + Projectile.idStaticNPCHitCooldown = 6; Projectile.frameCounter = 0; + Projectile.alpha = 255; } public override bool PreDraw(ref Color lightColor) @@ -60,7 +63,47 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (time == 0) + { + if (Main.zenithWorld) + Projectile.scale = 2; + CurrentFrame = Main.zenithWorld ? 6 : 10; + Projectile.alpha = 0; + time++; + } Player player = Main.player[Projectile.owner]; + if (CurrentFrame == 0) + { + SoundEngine.PlaySound(Murasama.Swing with { Pitch = -0.1f }, Projectile.Center); + if (hitCooldown == 0) + Slashing = true; + Projectile.numHits = 0; + } + else if (CurrentFrame == 6) + { + SoundEngine.PlaySound(Murasama.BigSwing with { Pitch = 0f }, Projectile.Center); + if (hitCooldown == 0) + Slashing = true; + Projectile.numHits = 0; + } + else if (CurrentFrame == 10) + { + SoundEngine.PlaySound(Murasama.Swing with { Pitch = -0.05f }, Projectile.Center); + if (hitCooldown == 0) + Slashing = true; + Projectile.numHits = 0; + } + else + Slashing = false; + + if (CurrentFrame == 5 && Projectile.frameCounter % 3 == 0) + { + Projectile.damage = (int)(Projectile.damage * 2); + } + if (CurrentFrame == 7 && Projectile.frameCounter % 3 == 0) + { + Projectile.damage = (int)(Projectile.damage * 0.5f); + } //Frames and crap Projectile.frameCounter++; @@ -71,21 +114,8 @@ namespace CalamityMod.Projectiles.Melee CurrentFrame = 0; } - // Play a "droning" noise every so often. - if (Slashing) - { - SoundEngine.PlaySound(SoundID.Item15, Projectile.Center); - } - - // Create idle light and dust. Vector2 origin = Projectile.Center + Projectile.velocity * 3f; - Lighting.AddLight(origin, 3f, 0.2f, 0.2f); - if (Main.rand.NextBool(3)) - { - int redDust = Dust.NewDust(origin - Projectile.Size / 2f, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 2f); - Main.dust[redDust].noGravity = true; - Main.dust[redDust].position -= Projectile.velocity; - } + Lighting.AddLight(origin, Color.Red.ToVector3() * (Slashing == true ? 3.5f : 2f)); Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); if (Main.myPlayer == Projectile.owner) @@ -93,17 +123,24 @@ namespace CalamityMod.Projectiles.Melee if (player.channel && !player.noItems && !player.CCed) HandleChannelMovement(player, playerRotatedPoint); else + { + hitCooldown = Main.zenithWorld ? 0 : 8; Projectile.Kill(); + } } // Rotation and directioning. - float velocityAngle = Projectile.velocity.ToRotation(); - Projectile.rotation = velocityAngle + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; - Projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); + if (Slashing) + { + float velocityAngle = Projectile.velocity.ToRotation(); + Projectile.rotation = velocityAngle + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + } + float velocityAngle2 = Projectile.velocity.ToRotation(); + Projectile.direction = (Math.Cos(velocityAngle2) > 0).ToDirectionInt(); // Positioning close to the end of the player's arm. float offset = 80f * Projectile.scale; - Projectile.position = playerRotatedPoint - Projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * offset; + Projectile.position = playerRotatedPoint - Projectile.Size * 0.5f + velocityAngle2.ToRotationVector2() * offset; // Sprite and player directioning. Projectile.spriteDirection = Projectile.direction; @@ -129,15 +166,65 @@ namespace CalamityMod.Projectiles.Melee Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; // Sync if a velocity component changes. - if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) + if (Slashing) { - Projectile.netUpdate = true; + if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) + { + Projectile.netUpdate = true; + } + Projectile.velocity = newVelocity; } - Projectile.velocity = newVelocity; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target.Organic()) + SoundEngine.PlaySound(Murasama.OrganicHit with { Pitch = (CurrentFrame == 0 ? -0.1f : CurrentFrame == 6 ? 0.1f : CurrentFrame == 10 ? -0.15f : 0) }, Projectile.Center); + else + SoundEngine.PlaySound(Murasama.InorganicHit with { Pitch = (CurrentFrame == 0 ? -0.1f : CurrentFrame == 6 ? 0.1f : CurrentFrame == 10 ? -0.15f : 0) }, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Color impactColor = CurrentFrame == 6 ? Main.rand.NextBool(3) ? Color.LightCoral : Color.White : Main.rand.NextBool(4) ? Color.LightCoral : Color.Crimson; + float impactParticleScale = Main.rand.NextFloat(1f, 1.75f); + + if (CurrentFrame == 6) + { + SparkleParticle impactParticle2 = new SparkleParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.75f, target.height * 0.75f), Vector2.Zero, Color.White, Color.Red, impactParticleScale * 1.2f, 8, 0, 4.5f); + GeneralParticleHandler.SpawnParticle(impactParticle2); + } + SparkleParticle impactParticle = new SparkleParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.75f, target.height * 0.75f), Vector2.Zero, impactColor, Color.Red, impactParticleScale, 8, 0, 2.5f); + GeneralParticleHandler.SpawnParticle(impactParticle); + } + + float sparkCount = MathHelper.Clamp(CurrentFrame == 6 ? 18 - Projectile.numHits * 3 : 5 - Projectile.numHits * 2, 0, 18); + for (int i = 0; i < sparkCount; i++) + { + Vector2 sparkVelocity2 = Projectile.velocity.RotatedBy(CurrentFrame == 0 ? -0.45f * Owner.direction : CurrentFrame == 6 ? 0 : CurrentFrame == 10 ? 0.45f * Owner.direction : 0).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 1.8f); + int sparkLifetime2 = Main.rand.Next(23, 35); + float sparkScale2 = Main.rand.NextFloat(0.95f, 1.8f); + Color sparkColor2 = CurrentFrame == 6 ? Main.rand.NextBool(3) ? Color.Red : Color.IndianRed : Main.rand.NextBool() ? Color.Red : Color.Firebrick; + if (Main.rand.NextBool()) + { + AltSparkParticle spark = new AltSparkParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f) + Projectile.velocity * 1.2f, sparkVelocity2 * (CurrentFrame == 6 ? 1f : 0.65f), false, (int)(sparkLifetime2 * (CurrentFrame == 6 ? 1.2f : 1f)), sparkScale2 * (CurrentFrame == 6 ? 1.4f : 1f), sparkColor2); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + LineParticle spark = new LineParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f) + Projectile.velocity * 1.2f, sparkVelocity2 * (CurrentFrame == 7 ? 1f : 0.65f), false, (int)(sparkLifetime2 * (CurrentFrame == 7 ? 1.2f : 1f)), sparkScale2 * (CurrentFrame == 7 ? 1.4f : 1f), Main.rand.NextBool() ? Color.Red : Color.Firebrick); + GeneralParticleHandler.SpawnParticle(spark); + } + } + float dustCount = MathHelper.Clamp(CurrentFrame == 6 ? 25 - Projectile.numHits * 3 : 12 - Projectile.numHits * 2, 0, 25); + for (int i = 0; i <= dustCount; i++) + { + int dustID = Main.rand.NextBool(3) ? 182 : Main.rand.NextBool() ? CurrentFrame == 6 ? 309 : 296 : 90; + Dust dust2 = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f), dustID, Projectile.velocity.RotatedBy(CurrentFrame == 0 ? -0.45f * Owner.direction : CurrentFrame == 6 ? 0 : CurrentFrame == 10 ? 0.45f * Owner.direction : 0).RotatedByRandom(0.55f) * Main.rand.NextFloat(0.3f, 1.1f)); + dust2.scale = Main.rand.NextFloat(0.9f, 2.4f); + dust2.noGravity = true; + } + } public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 0, 0); - //public override bool? CanDamage() => Slashing; + public override bool? CanDamage() => Slashing == false ? false : null; } } diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index daa9ca8d07..45f05b93e3 100644 --- a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { Projectile.aiStyle = ProjAIStyleID.Yoyo; - Projectile.width = Projectile.height = 16; + Projectile.width = Projectile.height = 22; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.png b/Projectiles/Melee/Yoyos/GodsGambitYoyo.png index a9645fc47f..aba81eadce 100644 Binary files a/Projectiles/Melee/Yoyos/GodsGambitYoyo.png and b/Projectiles/Melee/Yoyos/GodsGambitYoyo.png differ diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index af07834a56..19fa84d005 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -65,11 +65,11 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } + if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -81,12 +81,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType); + int blastRadius = Projectile.RocketBehavior(info); Projectile.ExpandHitboxBy(32); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { for (int j = 0; j < 12; j++) @@ -111,6 +110,10 @@ namespace CalamityMod.Projectiles.Ranged } } } + + if (Main.dedServ) + return; + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int i = 0; i < 5; i++) { @@ -174,44 +177,6 @@ namespace CalamityMod.Projectiles.Ranged gore.velocity.Y -= 1f; } } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 3; - else if (RocketType == ItemID.RocketIV) - blastRadius = 6; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 9; - - Projectile.ExpandHitboxBy(14); - - if (blastRadius > 0) - Projectile.ExplodeandDestroyTiles(blastRadius, true, new List(), new List()); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 3f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 3.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index df1ebf6d5b..fc35291fbd 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } + if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -164,28 +164,28 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ExpandHitboxBy(16); if (blastRadius > 0) - Projectile.ExplodeandDestroyTiles(blastRadius, true, new List(), new List()); + Projectile.ExplodeTiles(blastRadius); - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 5f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 5.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 5f; + if (RocketType == ItemID.DryRocket) + { + DelegateMethods.f_1 = 5.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (RocketType == ItemID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (RocketType == ItemID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + else if (RocketType == ItemID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } } } } diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 1d70dec227..3d6b96b187 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -1,12 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class GoliathRocket : ModProjectile, ILocalizedModType @@ -65,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } + if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool PreDraw(ref Color lightColor) @@ -81,12 +80,16 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) + { + smallRadius = 6, + mediumRadius = 9, + largeRadius = 12 + }; + int blastRadius = Projectile.RocketBehavior(info); Projectile.ExpandHitboxBy(160); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { for (int j = 0; j < 2; j++) @@ -111,112 +114,77 @@ namespace CalamityMod.Projectiles.Ranged } } } - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 20; i++) + + if (!Main.dedServ) { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 3f; - if (Main.rand.NextBool()) + for (int i = 0; i < 20; i++) { - Main.dust[dusty].scale = 0.5f; - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Dust dusty = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 31, Alpha: 100, Scale: 2f); + dusty.velocity *= 3f; + if (Main.rand.NextBool()) + { + dusty.scale = 0.5f; + dusty.fadeIn = Main.rand.NextFloat(1f, 2f); + } } - } - for (int j = 0; j < 30; j++) - { - int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[dusty2].noGravity = true; - Main.dust[dusty2].velocity *= 5f; - dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[dusty2].velocity *= 2f; - } - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + for (int j = 0; j < 30; j++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; + Dust flameDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 6, Alpha: 100, Scale: 3f); + flameDust.noGravity = true; + flameDust.velocity *= 5f; + + flameDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 6, Alpha: 100, Scale: 2f); + flameDust.velocity *= 2f; } + + if (Main.netMode != NetmodeID.Server) + { + Vector2 goreSource = Projectile.Center; + int goreAmt = 3; + Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); + for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + { + float velocityMult = 0.33f; + if (goreIndex < (goreAmt / 3)) + { + velocityMult = 0.66f; + } + if (goreIndex >= (2 * goreAmt / 3)) + { + velocityMult = 1f; + } + int type = Main.rand.Next(61, 64); + int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + } + } + + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 6; - else if (RocketType == ItemID.RocketIV) - blastRadius = 9; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 12; - - Projectile.ExpandHitboxBy(14); - - if (blastRadius > 0) - Projectile.ExplodeandDestroyTiles(blastRadius, true, new List(), new List()); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 3f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 3.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 9d41dde679..bf257aca05 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -1,12 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class HiveBomb : ModProjectile, ILocalizedModType @@ -65,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } + if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool PreDraw(ref Color lightColor) @@ -81,12 +80,16 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) + { + smallRadius = 4, + mediumRadius = 7, + largeRadius = 10 + }; + int blastRadius = Projectile.RocketBehavior(info); Projectile.ExpandHitboxBy(64); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { for (int j = 0; j < 6; j++) @@ -111,6 +114,10 @@ namespace CalamityMod.Projectiles.Ranged } } } + + if (Main.dedServ) + return; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 20; i++) { @@ -174,44 +181,6 @@ namespace CalamityMod.Projectiles.Ranged gore.velocity.Y -= 1f; } } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 4; - else if (RocketType == ItemID.RocketIV) - blastRadius = 7; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 10; - - Projectile.ExpandHitboxBy(14); - - if (blastRadius > 0) - Projectile.ExplodeandDestroyTiles(blastRadius, true, new List(), new List()); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 3f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 3.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 287f415416..0d987f93e3 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -1,11 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { public class HiveMissile : ModProjectile, ILocalizedModType @@ -65,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } + if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override bool PreDraw(ref Color lightColor) @@ -81,12 +80,16 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) + { + smallRadius = 5, + mediumRadius = 8, + largeRadius = 11 + }; + int blastRadius = Projectile.RocketBehavior(info); Projectile.ExpandHitboxBy(80); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.Damage(); + if (Projectile.owner == Main.myPlayer) { for (int j = 0; j < 3; j++) @@ -111,6 +114,10 @@ namespace CalamityMod.Projectiles.Ranged } } } + + if (Main.dedServ) + return; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int i = 0; i < 20; i++) { @@ -174,44 +181,6 @@ namespace CalamityMod.Projectiles.Ranged gore.velocity.Y -= 1f; } } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 5; - else if (RocketType == ItemID.RocketIV) - blastRadius = 8; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 11; - - Projectile.ExpandHitboxBy(14); - - if (blastRadius > 0) - Projectile.ExplodeandDestroyTiles(blastRadius, true, new List(), new List()); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 3f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 3.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } } } } diff --git a/Projectiles/Ranged/MineralMortarHoldout.cs b/Projectiles/Ranged/MineralMortarHoldout.cs new file mode 100644 index 0000000000..6b0d1999db --- /dev/null +++ b/Projectiles/Ranged/MineralMortarHoldout.cs @@ -0,0 +1,147 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MineralMortarHoldout : ModProjectile, ILocalizedModType + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Ranged/MineralMortar"; + + public Player Owner { get; set; } + public ref float Time => ref Projectile.ai[0]; + public ref float OffsetLength => ref Projectile.localAI[0]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 68; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + } + + public override void AI() + { + bool cantUse = Owner == null || !Owner.active || Owner.dead || !Owner.channel || Owner.CCed || Owner.noItems; + if (cantUse) + Projectile.Kill(); + + Vector2 mouse = Owner.Calamity().mouseWorld; + + Time++; + + // If the time reaches Item.useTime, it'll shoot the projectile, consume ammo and reset the timer. + if (Time >= Owner.itemTimeMax) + { + Owner.PickAmmo(Owner.ActiveItem(), out _, out float speed, out int damage, out float knockback, out int usedItemAmmoId); + + Vector2 position = Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.Size.Length() * 0.5f; + + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), position, Owner.SafeDirectionTo(mouse) * speed, ModContent.ProjectileType(), damage, knockback, Projectile.owner, usedItemAmmoId); + + // Doesn't sync this to the server, it's just effects. + if (!Main.dedServ) + { + for (int i = 0; i < 20; i++) + { + Vector2 randomDirectionToMouse = Owner.SafeDirectionTo(mouse).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(8f, 10f); + Dust shootDust = Dust.NewDustPerfect(position, DustID.Torch, randomDirectionToMouse, Scale: Main.rand.NextFloat(1.5f, 2.5f)); + shootDust.noGravity = true; + shootDust.noLight = true; + shootDust.noLightEmittence = true; + } + + for (int i = 0; i < 8; i++) + { + Vector2 randomDirectionToMouse = Owner.SafeDirectionTo(mouse).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(8f, 10f); + Particle shootMist = new MediumMistParticle(position, randomDirectionToMouse, new Color(255, 100, 0), Color.Transparent, Main.rand.NextFloat(.3f, 1f), Main.rand.NextFloat(200f, 400f)); + GeneralParticleHandler.SpawnParticle(shootMist); + } + + for (int i = 0; i < 6; i++) + { + Vector2 randomDirectionToMouse = Owner.SafeDirectionTo(mouse).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(2f, 6f); + Particle shootDebri = new StoneDebrisParticle(position, randomDirectionToMouse, Color.Lerp(Color.White, Color.LightGray, Main.rand.NextFloat()), Main.rand.NextFloat(.6f, .8f), Main.rand.Next(30, 45 + 1)); + GeneralParticleHandler.SpawnParticle(shootDebri); + } + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ScorchedEarthShot", 3) with { Volume = .2f, Pitch = 1.2f, PitchVariance = 1.1f }, Projectile.Center); + } + + // Makes the distance between the projectile and the player 0, this gives a recoil effect. + OffsetLength = 0f; + + Time = 0f; + } + + // If the recoil happened, reset smoothly to default position. + if (OffsetLength != 15f) + OffsetLength = MathHelper.SmoothStep(OffsetLength, 15f, .2f); + + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Vector2 offset = Projectile.rotation.ToRotationVector2() * OffsetLength; + Vector2 armOffset = -Vector2.UnitY.RotatedBy(Projectile.rotation) * Utils.Remap(Vector2.Dot(Projectile.rotation.ToRotationVector2(), -Vector2.UnitY), 0f, -1f, 10f, 3f) * Projectile.direction; + Projectile.Center = armPosition + offset + armOffset; + + Projectile.velocity = Vector2.SmoothStep(Projectile.velocity, (mouse - Owner.MountedCenter).SafeNormalize(Vector2.Zero) * Projectile.Size.Length(), .4f); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + int direction = MathF.Sign(mouse.X - Owner.MountedCenter.X); + Projectile.spriteDirection = Projectile.direction = direction; + Owner.ChangeDir(direction); + + float armRotation = Projectile.rotation - MathHelper.PiOver2; + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armRotation); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation); + + // Multiplayer syncing every second. + if (Time % 60 == 0) + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + } + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLength = 15f; + } + + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 position = Projectile.Center - Main.screenPosition; + float rotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 origin = texture.Size() * 0.5f; + SpriteEffects effects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float shake = Utils.Remap(Time, Owner.itemTimeMax * 0.33f, Owner.itemTimeMax, 0f, 3f); + position += Main.rand.NextVector2Circular(shake, shake); + + Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, effects); + + return false; + } + } +} diff --git a/Projectiles/Ranged/MineralMortarProjectile.cs b/Projectiles/Ranged/MineralMortarProjectile.cs new file mode 100644 index 0000000000..77b5756a05 --- /dev/null +++ b/Projectiles/Ranged/MineralMortarProjectile.cs @@ -0,0 +1,198 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MineralMortarProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public Color FrontTrailColor; + public Color BackTrailColor; + public ref float RocketType => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.width = Projectile.height = 42; + Projectile.friendly = true; + Projectile.ignoreWater = true; + } + + public override void AI() + { + if (Projectile.velocity.Y < 25f) + Projectile.velocity.Y += 0.3f; + + Projectile.rotation = Projectile.velocity.ToRotation(); + + // Effects; no server syncing. + if (!Main.dedServ) + { + bool randomDust = Main.rand.NextBool(); + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, randomDust ? 109 : DustID.Torch, Main.rand.NextFloat(3f), Main.rand.NextFloat(3f), Scale: randomDust ? Main.rand.NextFloat(1f, 1.5f) : Main.rand.NextFloat(1.5f, 2.5f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + + Particle smoke = new MediumMistParticle(Projectile.Center, Main.rand.NextVector2Circular(5f, 5f), new Color(255, 100, 0, 100), Color.Transparent, Main.rand.NextFloat(.3f, 1f), Main.rand.NextFloat(300f, 500f)); + GeneralParticleHandler.SpawnParticle(smoke); + } + + // Multiplayer syncing every second. + if (Projectile.timeLeft % 60 == 0) + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + } + + public override void OnSpawn(IEntitySource source) + { + switch (RocketType) + { + case ItemID.DryRocket: + FrontTrailColor = Color.Transparent; + BackTrailColor = Color.Transparent; + break; + + case ItemID.WetRocket: + FrontTrailColor = Color.DarkCyan; + BackTrailColor = Color.Blue; + break; + + case ItemID.LavaRocket: + FrontTrailColor = Color.Red; + BackTrailColor = Color.DarkRed; + break; + + case ItemID.HoneyRocket: + FrontTrailColor = Color.Yellow; + BackTrailColor = Color.Orange; + break; + + default: + FrontTrailColor = Color.Orange; + BackTrailColor = Color.DarkOrange; + break; + } + } + + public override void OnKill(int timeLeft) + { + const int SmallRadius = 4; + const int MediumRadius = 7; + const int BigRadius = 10; + + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType) + { + smallRadius = SmallRadius, + mediumRadius = MediumRadius, + largeRadius = BigRadius + }; + int blastRadius = Projectile.RocketBehavior(info); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.Damage(); + + // Effects; no server syncing. + if (!Main.dedServ) + { + float radius(float smallBoomRadius, float mediumBoomRadius, float bigBoomRadius) + { + if (blastRadius == SmallRadius) + return smallBoomRadius; + + if (blastRadius == MediumRadius) + return mediumBoomRadius; + + if (blastRadius == BigRadius) + return bigBoomRadius; + + return 0f; + } + + Particle boom = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Orange, Vector2.One, Main.rand.NextFloat(MathHelper.Pi), 0.1f, radius(0.37f, 0.65f, 0.93f), 15); + GeneralParticleHandler.SpawnParticle(boom); + + for (int i = 1; i < 3; i++) + { + Particle boomRing = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkOrange, Vector2.One, 0f, radius(0.06f, 0.1f, 0.14f) * i, radius(0.57f, 1f, 1.43f) * i, 20); + GeneralParticleHandler.SpawnParticle(boomRing); + } + + for (int i = 0; i < 30; i++) + { + bool randomDust = Main.rand.NextBool(); + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, randomDust ? 109 : DustID.Torch, Main.rand.NextVector2Circular(10f, 10f), Scale: randomDust ? Main.rand.NextFloat(1f, 2f) : Main.rand.NextFloat(2.5f, 3f)); + boomDust.noGravity = true; + boomDust.noLight = true; + boomDust.noLightEmittence = true; + } + + int debriAmount = Main.rand.Next(10, 15 + 1); + for (int debriIndex = 0; debriIndex < debriAmount; debriIndex++) + { + float angle = MathHelper.TwoPi / debriAmount * debriIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 8f); + Particle debri = new StoneDebrisParticle(Projectile.Center, velocity, Color.Lerp(Color.White, Color.LightGray, Main.rand.NextFloat()), Main.rand.NextFloat(0.4f, 0.6f), Main.rand.Next(30, 45 + 1), Main.rand.NextFloat(MathHelper.Pi)); + GeneralParticleHandler.SpawnParticle(debri); + } + + int mistAmount = Main.rand.Next(5, 8 + 1); + for (int mistIndex = 0; mistIndex < mistAmount; mistIndex++) + { + float angle = MathHelper.TwoPi / mistAmount * mistIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(5f, 15f); + Particle boomMist = new MediumMistParticle(Projectile.Center, velocity, new Color(255, 100, 0), Color.Transparent, Main.rand.NextFloat(.6f, 1.4f), Main.rand.NextFloat(200f, 400f)); + GeneralParticleHandler.SpawnParticle(boomMist); + } + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/MineralMortarExplode") { PitchVariance = 0.2f }, Projectile.Center); + } + } + + public static float TrailWidthFunction(float completionRatio) => MathHelper.Lerp(20f, 0f, completionRatio); + + public Color ColorTrailFunction(float completionRatio) => Color.Lerp(BackTrailColor, FrontTrailColor, completionRatio); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 position = Projectile.Center - Main.screenPosition; + float rotation = Projectile.rotation + MathHelper.PiOver2; + Vector2 origin = texture.Size() * 0.5f; + + PrimitiveTrail trail = new PrimitiveTrail(TrailWidthFunction, ColorTrailFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SwordSlashTexture")); + trail.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 50); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 0; i < 3; i++) + { + Color afterimageDrawColor = Color.DarkOrange with { A = 75 } * (1f - i / (float)Projectile.oldPos.Length); + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(texture, afterimageDrawPosition, null, afterimageDrawColor, Projectile.oldRot[i] - MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0); + } + } + + Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/OnyxSharkBomb.png b/Projectiles/Ranged/MineralMortarProjectile.png similarity index 100% rename from Projectiles/Ranged/OnyxSharkBomb.png rename to Projectiles/Ranged/MineralMortarProjectile.png diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index a34793aa1a..6e31d88847 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged } CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } + if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + { + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override void OnKill(int timeLeft) @@ -157,28 +157,28 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ExpandHitboxBy(14); if (blastRadius > 0) - Projectile.ExplodeandDestroyTiles(blastRadius, true, new List(), new List()); + Projectile.ExplodeTiles(blastRadius); - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 3f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 3.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 3f; + if (RocketType == ItemID.DryRocket) + { + DelegateMethods.f_1 = 3.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (RocketType == ItemID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (RocketType == ItemID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + else if (RocketType == ItemID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } } } } diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index c1fb552332..686aaf62c3 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -1,12 +1,10 @@ -using CalamityMod.Tiles.Abyss; -using CalamityMod.Walls; +using CalamityMod.Items.Ammo; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -28,6 +26,8 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + // If moving fast enough, produce dust. Since it's a bullet, it should always be moving fast enough. if (Projectile.velocity.Length() >= 8f) { for (int d = 0; d < 2; d++) @@ -57,19 +57,37 @@ namespace CalamityMod.Projectiles.Ranged return false; } - public override void OnKill(int timeLeft) + public override void OnKill(int timeLeft) => Explode(); + + private void Explode() { - Projectile.ExpandHitboxBy(200); + // Apply damage a second time on explosion. This explosion also has double knockback. + Projectile.ExpandHitboxBy(MortarRound.HitboxBlastRadius); Projectile.maxPenetrate = Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.knockBack *= 5f; + Projectile.knockBack *= 2f; Projectile.Damage(); + + // Actually destroy tiles. Blast radius is significantly increased in GFB. + if (Projectile.owner == Main.myPlayer) + Projectile.ExplodeTiles(MortarRound.TileBlastRadius, true); + + // Play standard explosion sound. SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + // Spawn standard explosion dust and gores. + SpawnDust(Projectile); + SpawnExplosionGores(Projectile); + } + + // Spawn explosion dust (smoke and fire). + // Reused by Rubber Mortar Rounds. + internal static void SpawnDust(Projectile p) + { for (int d = 0; d < 40; d++) { - int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); + int smoke = Dust.NewDust(p.position, p.width, p.height, DustID.Smoke, 0f, 0f, 100, default, 2f); Main.dust[smoke].velocity *= 3f; if (Main.rand.NextBool()) { @@ -79,62 +97,59 @@ namespace CalamityMod.Projectiles.Ranged } for (int d = 0; d < 70; d++) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); + int fire = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); + fire = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } + } - if (Main.netMode != NetmodeID.Server) + // Spawn explosion gores (smoke puffs). + // Reused by Rubber Mortar Rounds. + internal static void SpawnExplosionGores(Projectile p) + { + if (Main.netMode == NetmodeID.Server) + return; + + Vector2 goreSource = p.Center; + int goreAmt = 3; + Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); + for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + float velocityMult = 0.33f; + if (goreIndex < (goreAmt / 3)) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; + velocityMult = 0.66f; } - } - - Projectile.ExpandHitboxBy(14); - - if (Projectile.owner == Main.myPlayer) - { - Projectile.ExplodeandDestroyTiles(5, true, new List(), new List()); + if (goreIndex >= (2 * goreAmt / 3)) + { + velocityMult = 1f; + } + int type = Main.rand.Next(61, 64); + int smoke = Gore.NewGore(p.GetSource_FromAI(), source, default, type, 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(p.GetSource_FromAI(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(p.GetSource_FromAI(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(p.GetSource_FromAI(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; } } } diff --git a/Projectiles/Ranged/NovaChargedShot.png b/Projectiles/Ranged/NovaChargedShot.png index a88840b773..3856109fa3 100644 Binary files a/Projectiles/Ranged/NovaChargedShot.png and b/Projectiles/Ranged/NovaChargedShot.png differ diff --git a/Projectiles/Ranged/NovaShot.png b/Projectiles/Ranged/NovaShot.png index 4bcbe3130b..b2e768f137 100644 Binary files a/Projectiles/Ranged/NovaShot.png and b/Projectiles/Ranged/NovaShot.png differ diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 5db379c665..a9a12d7939 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -75,12 +75,12 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[dust].velocity *= 0.05f; } - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - Projectile.ignoreWater = false; - if (Projectile.wet) - Projectile.timeLeft = 1; - } + if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) + { + Projectile.ignoreWater = false; + if (Projectile.wet) + Projectile.timeLeft = 1; + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -180,28 +180,28 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ExpandHitboxBy(22); if (blastRadius > 0) - Projectile.ExplodeandDestroyTiles(blastRadius, true, new List(), new List()); + Projectile.ExplodeTiles(blastRadius); - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 4f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 4.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } + Point center = Projectile.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 4f; + if (RocketType == ItemID.DryRocket) + { + DelegateMethods.f_1 = 4.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + } + else if (RocketType == ItemID.WetRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + } + else if (RocketType == ItemID.LavaRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + } + else if (RocketType == ItemID.HoneyRocket) + { + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs deleted file mode 100644 index 2c4aac70e6..0000000000 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ /dev/null @@ -1,99 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; - -namespace CalamityMod.Projectiles.Ranged -{ - public class OnyxSharkBomb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) - { - for (int i = 0; i < 2; i++) - { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int onyxDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 109, 0f, 0f, 100, default, 0.5f); - Main.dust[onyxDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[onyxDust].velocity *= 0.2f; - Main.dust[onyxDust].noGravity = true; - onyxDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 159, 0f, 0f, 100, default, 0.25f); - Main.dust[onyxDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[onyxDust].velocity *= 0.05f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void OnKill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 32; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 109, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 2; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } -} diff --git a/Projectiles/Ranged/OpalChargedStrike.cs b/Projectiles/Ranged/OpalChargedStrike.cs index faf7b5d975..3276acb60c 100644 --- a/Projectiles/Ranged/OpalChargedStrike.cs +++ b/Projectiles/Ranged/OpalChargedStrike.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -31,21 +32,19 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Main.rand.NextBool()) + if (Main.rand.NextBool(3)) { - Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity); - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 162, 0f, 0f, 0, default, Main.rand.NextFloat(1.2f, 1.5f))]; - dust.position = position; - dust.velocity = Projectile.velocity.RotatedBy(0.2, default) * 0.1f + Projectile.velocity / 8f; - dust.position += Projectile.velocity.RotatedBy(0.2, default); - dust.fadeIn = 0.5f; - dust.noGravity = true; - dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 162, 0f, 0f, 0, default, Main.rand.NextFloat(1.2f, 1.5f))]; - dust.position = position; - dust.velocity = Projectile.velocity.RotatedBy(-0.2, default) * 0.1f + Projectile.velocity / 8f; - dust.position += Projectile.velocity.RotatedBy(-0.2, default); - dust.fadeIn = 0.5f; - dust.noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(7, 7), 162); + dust.scale = 1.3f; + dust.velocity = -Projectile.velocity * 0.4f; + } + + Player Owner = Main.player[Projectile.owner]; + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.timeLeft % 2 == 0 && playerDist < 1400f && Projectile.timeLeft < 290) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3f, -Projectile.velocity * 0.05f, false, 9, 2f, Color.OrangeRed * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } diff --git a/Projectiles/Ranged/OpalStrikerHoldout.cs b/Projectiles/Ranged/OpalStrikerHoldout.cs index cf252d1c7d..c43141bd89 100644 --- a/Projectiles/Ranged/OpalStrikerHoldout.cs +++ b/Projectiles/Ranged/OpalStrikerHoldout.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged } Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.85f; + Vector2 tipPosition = (armPosition + Projectile.velocity * Projectile.width * 0.85f) + (Projectile.velocity * 4).RotatedBy(-0.3f * Projectile.direction); if (SoundEngine.TryGetActiveSound(OpalChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) ChargeSound.Position = Projectile.Center; diff --git a/Projectiles/Ranged/RubberMortarRoundProj.cs b/Projectiles/Ranged/RubberMortarRoundProj.cs index e3ac1df39f..cf92e098f3 100644 --- a/Projectiles/Ranged/RubberMortarRoundProj.cs +++ b/Projectiles/Ranged/RubberMortarRoundProj.cs @@ -1,12 +1,10 @@ -using CalamityMod.Tiles.Abyss; -using CalamityMod.Walls; +using CalamityMod.Items.Ammo; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { @@ -30,6 +28,8 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + // If moving fast enough, produce dust. Since it's a bullet, it should always be moving fast enough. if (Projectile.velocity.Length() >= 8f) { for (int d = 0; d < 2; d++) @@ -59,180 +59,65 @@ namespace CalamityMod.Projectiles.Ranged return false; } - public override bool OnTileCollide(Vector2 oldVelocity) + private void Explode() { - int penetrateAmt = Projectile.penetrate; - Projectile.ExpandHitboxBy(200); + // Apply damage a second time on explosion. This explosion also has double knockback. + Projectile.ExpandHitboxBy(MortarRound.HitboxBlastRadius); Projectile.maxPenetrate = Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.knockBack *= 2f; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.penetrate = penetrateAmt; - - SpawnDust(); - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_FromAI(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_FromAI(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_FromAI(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - Projectile.ExpandHitboxBy(14); + // Actually destroy tiles. Blast radius is significantly increased in GFB. if (Projectile.owner == Main.myPlayer) - { - DestroyTiles(); - } + Projectile.ExplodeTiles(MortarRound.TileBlastRadius, true); - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + // Play standard explosion sound. + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + + // Spawn standard explosion dust and gores. + MortarRoundProj.SpawnDust(Projectile); + MortarRoundProj.SpawnExplosionGores(Projectile); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + // If there are no bounces left, just explode with no other effects. + if (Projectile.penetrate <= 1) { Projectile.Kill(); Projectile.active = false; + return false; } - else + + // Otherwise, the Rubber Mortar Round will explode AND bounce, in that order. + + // Explosions change both the penetrate value and hitbox, so the previous values have to be stored. + Rectangle origHitbox = Projectile.Hitbox; + int origPen = Projectile.penetrate; + Explode(); + Projectile.Hitbox = origHitbox; + Projectile.penetrate = origPen; + + // Each bounce consumes a penetrate value. + --Projectile.penetrate; + + // If bounces are still left, bounce. + if (Projectile.velocity.X != oldVelocity.X) { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - Projectile.velocity *= 1.25f; + Projectile.velocity.X = -oldVelocity.X; } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + Projectile.velocity *= 1.25f; + + // Do not use vanilla tile collide logic. return false; } - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(200); - Projectile.maxPenetrate = Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.knockBack *= 5f; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - - SpawnDust(); - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - Projectile.ExpandHitboxBy(14); - - if (Projectile.owner == Main.myPlayer) - { - DestroyTiles(); - } - } - - private void SpawnDust() - { - for (int d = 0; d < 40; d++) - { - int smoke = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); - Main.dust[smoke].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[smoke].scale = 0.5f; - Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 70; d++) - { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[fire].noGravity = true; - Main.dust[fire].velocity *= 5f; - fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[fire].velocity *= 2f; - } - } - - private void DestroyTiles() - { - Projectile.ExplodeandDestroyTiles(5, true, new List(), new List()); - } + public override void OnKill(int timeLeft) => Explode(); } } diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs deleted file mode 100644 index b83770dba8..0000000000 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ /dev/null @@ -1,76 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class SandyWaifuShark : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 8; - } - - public override void SetDefaults() - { - Projectile.width = 60; - Projectile.height = 60; - Projectile.scale = 0.75f; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.tileCollide = false; - Projectile.penetrate = 1; - Projectile.timeLeft = 240; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 210 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - int sandy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 32, 0f, 0f, 0, default, 0.5f); - Main.dust[sandy].noGravity = true; - Main.dust[sandy].velocity *= 0.2f; - Main.dust[sandy].position = (Main.dust[sandy].position + Projectile.Center) / 2f; - - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 7) - Projectile.frame = 0; - - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - - if (Projectile.timeLeft < 210) - CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - - public override bool PreDraw(ref Color lightColor) - { - SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int framing = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = framing * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); - return false; - } - - public override void OnKill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 159, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } - } -} diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 6e91ce2090..9b19fe325c 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 450; Projectile.DamageType = RogueDamageClass.Instance; } - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 380 && target.CanBeChasedBy(Projectile); + public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 420 && target.CanBeChasedBy(Projectile); public override void AI() { @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - if (Projectile.timeLeft >= 380) + if (Projectile.timeLeft >= 420) { Projectile.velocity *= 1.07f; } diff --git a/Projectiles/Rogue/ElementalDiskProj.cs b/Projectiles/Rogue/ElementalDiskProj.cs index 5dfe7a336f..9d064a8e09 100644 --- a/Projectiles/Rogue/ElementalDiskProj.cs +++ b/Projectiles/Rogue/ElementalDiskProj.cs @@ -5,6 +5,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; namespace CalamityMod.Projectiles.Rogue { @@ -55,15 +56,15 @@ namespace CalamityMod.Projectiles.Rogue } // Returns after some number of frames in the air - int timeMult = Projectile.Calamity().stealthStrike ? 3 : 1; + int timeMult = Projectile.Calamity().stealthStrike ? ElementalDisk.stealthTimeMult : 1; if (Projectile.timeLeft < Lifetime * timeMult - ReboundTime * timeMult) Projectile.ai[0] = 1f; if (Projectile.ai[0] == 1f) { Player player = Main.player[Projectile.owner]; - float returnSpeed = 9f; - float acceleration = 0.4f; + float returnSpeed = 14f; + float acceleration = Projectile.Calamity().stealthStrike ? 0.45f : 0.6f; Vector2 playerVec = player.Center - Projectile.Center; float dist = playerVec.Length(); @@ -136,11 +137,11 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - int counter = Projectile.Calamity().stealthStrike ? 35 : 50; + int counter = Projectile.Calamity().stealthStrike ? 40 : 60; if (Main.player[Projectile.owner].miscCounter % counter == 0) { int splitProj = ModContent.ProjectileType(); - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[splitProj] < 25) + if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[splitProj] < 16) { float spread = 45f * 0.0174f; double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; @@ -153,9 +154,10 @@ namespace CalamityMod.Projectiles.Rogue int disk2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Main.projectile[disk].idStaticNPCHitCooldown = Main.projectile[disk2].idStaticNPCHitCooldown = 6; + Main.projectile[disk].idStaticNPCHitCooldown = Main.projectile[disk2].idStaticNPCHitCooldown = 8; Main.projectile[disk].usesIDStaticNPCImmunity = Main.projectile[disk2].usesIDStaticNPCImmunity = true; - Main.projectile[disk].timeLeft = Main.projectile[disk2].timeLeft = 90; + Main.projectile[disk].timeLeft = Main.projectile[disk2].timeLeft = 60; + Main.projectile[disk].Calamity().CannotProc = Main.projectile[disk2].Calamity().CannotProc = true; } } } diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index e520d9d24c..8a8bffa955 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -107,8 +107,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.owner); Main.projectile[stealth].Calamity().stealthStrike = true; player.Calamity().ConsumeStealthByAttacking(); - Main.player[Projectile.owner].immuneNoBlink = true; - Main.player[Projectile.owner].immuneTime += 20; //Adding iframes in case they get hit before the dash so those iframes are not wasted + //This seems to have stopped working while testing somehow, even without changing Main[projectileOwner] to player + player.immuneNoBlink = true; + player.immuneTime += 20; //Adding iframes in case they get hit before the dash so those iframes are not wasted } else { diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index 7acb1bddfd..629a0f31b7 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -43,10 +43,10 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[Projectile.owner]; //Give iframes to the player - if (player.immuneTime <= 10) + if (player.immuneTime <= 30) { player.immuneNoBlink = true; - player.immuneTime = 10; + player.immuneTime = 30; } // Spawn homing flames that chase the HIT enemy only. This is also limited to one burst @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = Utils.NextVector2Circular(Main.rand, 7.2f, 7.2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.3), Projectile.knockBack, Projectile.owner, 0f, + (int)(Projectile.damage * 0.2), Projectile.knockBack, Projectile.owner, 0f, target.whoAmI); } HasHitEnemy = true; diff --git a/Projectiles/Rogue/LanceofDestiny.cs b/Projectiles/Rogue/LanceofDestiny.cs index 92ad74b352..20b150e0e5 100644 --- a/Projectiles/Rogue/LanceofDestiny.cs +++ b/Projectiles/Rogue/LanceofDestiny.cs @@ -45,16 +45,11 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike) Projectile.extraUpdates = 1; - if (Projectile.timeLeft % 5 == 0) + if (Projectile.timeLeft % 2 == 0) { - float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(10f, 30f, Time, true)); for (int i = 0; i < 4; i++) { - float offsetRotationAngle = Projectile.velocity.ToRotation() + Time / 20f; - float radius = (20f + (float)Math.Cos(Time / 13f) * 6f) * radiusFactor; - Vector2 dustPosition = Projectile.Center; - dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; - CritSpark spark = new CritSpark(dustPosition, -Projectile.velocity, Color.PaleGoldenrod, Color.Goldenrod, Main.rand.NextFloat(1.1f, 1.5f), Main.rand.Next(5, 8), 5f); + CritSpark spark = new CritSpark(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity, Color.PaleGoldenrod, Color.Goldenrod, Main.rand.NextFloat(0.65f, 0.95f), 8, 0, 2.5f); GeneralParticleHandler.SpawnParticle(spark); } } @@ -92,9 +87,11 @@ namespace CalamityMod.Projectiles.Rogue } for (int i = 0; i <= hitsDust; i++) { - Dust dust2 = Main.dust[Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 130 : 133, Projectile.oldVelocity.X * Main.rand.NextFloat(1.1f, 1.3f), Projectile.oldVelocity.Y * Main.rand.NextFloat(1.1f, 1.3f), 0, default, 1.1f)]; + Vector2 sparkVelocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.6f, 1.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity, Main.rand.NextBool(3) ? 130 : 133, sparkVelocity, 0, default, Main.rand.NextFloat(1.2f, 1.5f)); + dust.noGravity = true; } - SoundEngine.PlaySound(Hitsound, Projectile.position); + SoundEngine.PlaySound(Hitsound, Projectile.Center); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Rogue/RealityRuptureLance.cs b/Projectiles/Rogue/RealityRuptureLance.cs index 78420910b8..980e0135fb 100644 --- a/Projectiles/Rogue/RealityRuptureLance.cs +++ b/Projectiles/Rogue/RealityRuptureLance.cs @@ -69,11 +69,14 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - for (int i = 0; i <= 4; i++) + for (int i = 0; i <= 13; i++) { - Dust dust2 = Main.dust[Dust.NewDust(target.position, Projectile.width, Projectile.height, Main.rand.NextBool(4) ? 242 : 310, Projectile.oldVelocity.X * Main.rand.NextFloat(1.1f, 1.3f), Projectile.oldVelocity.Y * Main.rand.NextFloat(1.1f, 1.3f), 0, default, 1.1f)]; + Vector2 sparkVelocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.3f, 1.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 0.5f, Main.rand.NextBool(4) ? 242 : 310, sparkVelocity, 0, default, Main.rand.NextFloat(2.2f, 3.5f)); + dust.noGravity = true; + dust.fadeIn = 0.5f; } - SoundEngine.PlaySound(Hitsound, Projectile.position); + SoundEngine.PlaySound(Hitsound, Projectile.Center); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Rogue/RealityRuptureMini.cs b/Projectiles/Rogue/RealityRuptureMini.cs index c049432ab9..3e7ae26d62 100644 --- a/Projectiles/Rogue/RealityRuptureMini.cs +++ b/Projectiles/Rogue/RealityRuptureMini.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Rogue public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2") { PitchVariance = 0.3f, Volume = 0.5f }; public int framesInAir = 0; - public int SparkChance = 7; + public int SparkChance = 1; public override void SetDefaults() { @@ -41,20 +41,10 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center + Projectile.velocity * 0.6f, 0.6f, 0.2f, 0.5f); } - if (Main.rand.NextBool(SparkChance)) + if (Projectile.timeLeft % 2 == 0 && Main.rand.NextBool(SparkChance) && Projectile.numHits == 0) { - Vector2 SparkVelocity1 = Projectile.velocity.RotatedBy(-3, default) * 0.1f - Projectile.velocity / 2f; - Vector2 SparkPosition1 = Projectile.velocity.RotatedBy(-0.8, default); - SparkParticle spark = new SparkParticle(Projectile.Center + SparkPosition1, SparkVelocity1, false, Main.rand.Next(6, 8), Main.rand.NextFloat(0.6f, 0.8f), Color.Plum); + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 1.3f, Color.Plum * 0.5f); GeneralParticleHandler.SpawnParticle(spark); - - } - if (Main.rand.NextBool(SparkChance)) - { - Vector2 SparkVelocity2 = Projectile.velocity.RotatedBy(3, default) * 0.1f - Projectile.velocity / 2f; - Vector2 SparkPosition2 = Projectile.velocity.RotatedBy(0.8, default); - SparkParticle spark2 = new SparkParticle(Projectile.Center + SparkPosition2, SparkVelocity2, false, Main.rand.Next(6, 8), Main.rand.NextFloat(0.6f, 0.8f), Color.Plum); - GeneralParticleHandler.SpawnParticle(spark2); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; @@ -81,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - SparkChance = 14; + SparkChance = 2; Projectile.extraUpdates = 4; Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); diff --git a/Projectiles/Rogue/RealityRuptureStealth.cs b/Projectiles/Rogue/RealityRuptureStealth.cs index f56fd91c05..7ba28144a7 100644 --- a/Projectiles/Rogue/RealityRuptureStealth.cs +++ b/Projectiles/Rogue/RealityRuptureStealth.cs @@ -39,28 +39,20 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + Time++; Projectile.velocity *= 1.003f; Projectile.scale = 1.3f; Vector3 DustLight = new Vector3(0.209f, 0.140f, 0.202f); Lighting.AddLight(Projectile.Center, DustLight * 8); - //Lighting.AddLight(Projectile.Center + Projectile.velocity * 0.6f, 0.6f, 0.2f, 0.5f); - if (Time % 2 == 0) + if (Time > 10 && playerDist < 1400f) { - Vector2 SparkVelocity1 = Projectile.velocity.RotatedBy(-2.5f, default) * 0.1f - Projectile.velocity / 2f; - Vector2 SparkPosition1 = Projectile.velocity.RotatedBy(-0.8, default); - SparkParticle spark = new SparkParticle(Projectile.Center + SparkPosition1, SparkVelocity1, false, Main.rand.Next(22, 25), Main.rand.NextFloat(1.2f, 1.9f), Color.Plum); - GeneralParticleHandler.SpawnParticle(spark); - - } - if (Time % 2 == 0) - { - Vector2 SparkVelocity2 = Projectile.velocity.RotatedBy(2.5f, default) * 0.1f - Projectile.velocity / 2f; - Vector2 SparkPosition2 = Projectile.velocity.RotatedBy(0.8, default); - SparkParticle spark2 = new SparkParticle(Projectile.Center + SparkPosition2, SparkVelocity2, false, Main.rand.Next(22, 25), Main.rand.NextFloat(1.2f, 1.9f), Color.Plum); - GeneralParticleHandler.SpawnParticle(spark2); + SparkParticle spark3 = new SparkParticle(Projectile.Center - Projectile.velocity, Projectile.velocity * 0.01f, false, 18, 3.4f, Color.Plum * 0.6f); + GeneralParticleHandler.SpawnParticle(spark3); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } @@ -101,7 +93,15 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 15; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 272, Projectile.oldVelocity.X * 0.3f, Projectile.oldVelocity.Y * 0.3f, 0, default, Main.rand.NextFloat(1.7f, 2.1f)); + Vector2 sparkVelocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.6f, 1.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity, 272, sparkVelocity.RotatedByRandom(0.1f), 0, default, Main.rand.NextFloat(1.2f, 1.5f)); + dust.noGravity = true; + + int sparkLifetime = Main.rand.Next(43, 48); + float sparkScale = Main.rand.NextFloat(2.2f, 3f); + Color sparkColor = Color.Plum * 0.8f; + SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); } Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Plum, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 1f, 13); GeneralParticleHandler.SpawnParticle(pulse); diff --git a/Projectiles/Rogue/SearedPanProjectile.cs b/Projectiles/Rogue/SearedPanProjectile.cs index ec550b7f3a..28d7ba76c3 100644 --- a/Projectiles/Rogue/SearedPanProjectile.cs +++ b/Projectiles/Rogue/SearedPanProjectile.cs @@ -56,7 +56,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // Don't increment the Seared Pan counter when hitting dummies - bool dummy = target.type != NPCID.TargetDummy && target.type != ModContent.NPCType(); + //&& target.type != ModContent.NPCType() this is here just in case its needed again + bool dummy = target.type != NPCID.TargetDummy; OnHitEffects(target.whoAmI, target.life, dummy); } diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index ff0585f111..ff055dbf9b 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue public int framesInAir = 0; private bool initialized = false; - public int SparkChance = 8; + public int SparkChance = 1; public override void SetDefaults() { @@ -51,20 +51,10 @@ namespace CalamityMod.Projectiles.Rogue } initialized = true; } - if (Main.rand.NextBool(SparkChance)) + if (Projectile.timeLeft % 2 == 0 && Main.rand.NextBool(SparkChance) && Projectile.numHits == 0) { - Vector2 SparkVelocity1 = Projectile.velocity.RotatedBy(-3, default) * 0.1f - Projectile.velocity / 8f; - Vector2 SparkPosition1 = Projectile.velocity.RotatedBy(-0.8, default); - SparkParticle spark = new SparkParticle(Projectile.Center + SparkPosition1, SparkVelocity1, false, Main.rand.Next(6, 8), Main.rand.NextFloat(0.7f, 1f), Color.PaleGoldenrod); + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 0.7f, Color.PaleGoldenrod * 0.3f); GeneralParticleHandler.SpawnParticle(spark); - - } - if (Main.rand.NextBool(SparkChance)) - { - Vector2 SparkVelocity2 = Projectile.velocity.RotatedBy(3, default) * 0.1f - Projectile.velocity / 8f; - Vector2 SparkPosition2 = Projectile.velocity.RotatedBy(0.8, default); - SparkParticle spark2 = new SparkParticle(Projectile.Center + SparkPosition2, SparkVelocity2, false, Main.rand.Next(6, 8), Main.rand.NextFloat(0.7f, 1f), Color.PaleGoldenrod); - GeneralParticleHandler.SpawnParticle(spark2); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; @@ -91,7 +81,7 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - SparkChance = 16; + SparkChance = 2; Projectile.extraUpdates = 3; Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); diff --git a/Projectiles/Rogue/WrathwingSpear.cs b/Projectiles/Rogue/WrathwingSpear.cs index 8475f4a5cc..83b5a1614f 100644 --- a/Projectiles/Rogue/WrathwingSpear.cs +++ b/Projectiles/Rogue/WrathwingSpear.cs @@ -32,15 +32,15 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - // Spit fireballs constantly, but slightly randomly. Always spits one fireball immediately upon being thrown. + // Spit fireballs constantly. Always spits one fireball immediately upon being thrown. if (Projectile.owner == Main.myPlayer && Projectile.ai[0] <= 0f) { - Projectile.ai[0] = Main.rand.NextFloat(15f, 19f); + Projectile.ai[0] = 20f; int fireballID = ModContent.ProjectileType(); - int damage = (int)(Projectile.damage * 0.8f); + int damage = (int)(Projectile.damage * 0.7f); float angleDiff = Main.rand.NextFloat(-FireballAngleVariance, FireballAngleVariance); - Vector2 velocity = Projectile.velocity.RotatedBy(angleDiff) * 1.06f; + Vector2 velocity = Projectile.velocity.RotatedBy(angleDiff) * 1.04f; float kb = Projectile.knockBack * 0.6f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, fireballID, damage, kb, Projectile.owner); } @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue // Homing // The item's default velocity is 28. Homing speed is intentionally a bit lower. - CalamityUtils.HomeInOnNPC(Projectile, true, 450f, 23f, 30f); + CalamityUtils.HomeInOnNPC(Projectile, true, 450f, 24f, 30f); // Animation Projectile.frameCounter++; @@ -74,8 +74,8 @@ namespace CalamityMod.Projectiles.Rogue int damage = (int)(Projectile.damage * 0.375f); float kb = 0f; - // Spawns 13 erupting fireballs in total. - for (int x = -6; x <= 6; x++) + // Spawns 11 erupting fireballs in total. + for (int x = -5; x <= 5; x++) { Vector2 pos = Projectile.Center + Vector2.UnitY * Main.rand.NextFloat(44f, 60f); pos.X += Main.rand.NextFloat(-14f, 14f); diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index 300cf4f7d7..583c47f688 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Projectiles.Summon public class ApexShark : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public override string Texture => "CalamityMod/Projectiles/Ranged/SandyWaifuShark"; private int HitCooldown = 0; public override void SetStaticDefaults() diff --git a/Projectiles/Ranged/SandyWaifuShark.png b/Projectiles/Summon/ApexShark.png similarity index 100% rename from Projectiles/Ranged/SandyWaifuShark.png rename to Projectiles/Summon/ApexShark.png diff --git a/Projectiles/Summon/BelladonnaPetal.cs b/Projectiles/Summon/BelladonnaPetal.cs index 8b14bf0a79..ad834aeacb 100644 --- a/Projectiles/Summon/BelladonnaPetal.cs +++ b/Projectiles/Summon/BelladonnaPetal.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Summon // A variable where the potential target will be written on. public NPC targetFound; - + public override void SetStaticDefaults() { ProjectileID.Sets.MinionShot[Projectile.type] = true; @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon } // Check for it so it doesn't update the velocity indefinetly, meaning it would be homing. - if (CheckForFiring == 0f) + if (CheckForFiring == 0f) { Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, targetFound, BelladonnaSpiritStaff.PetalVelocity); @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Grass, Projectile.Center); CheckForFiring = 1f; - Projectile.netUpdate= true; + Projectile.netUpdate = true; } // In case the shot was about to fade out, un-fade. @@ -97,7 +97,6 @@ namespace CalamityMod.Projectiles.Summon // If there's target, but 1 second hasn't passed, rotate to point at the target, while still having gravity. else if (target != null && AITimer < BelladonnaSpiritStaff.PetalTimeBeforeTargetting) { - // "(AITimer / It's maxuimum value)" so it's a fraction between 0 and 1. Projectile.rotation = MathHelper.Lerp(Projectile.rotation, (target.Center - Projectile.Center).ToRotation() + MathHelper.PiOver2, @@ -108,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon // Puts the potentialTarget on this variable that won't update constantly so the projectile doesn't become incredibly homing. targetFound = target; - + Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index d6f4fd1daa..ef34e10b5d 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -1,179 +1,126 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class BelladonnaSpirit : ModProjectile, ILocalizedModType + public class BelladonnaSpirit : BaseMinionProjectile { - public new string LocalizationCategory => "Projectiles.Summon"; - - public Player Owner => Main.player[Projectile.owner]; - public CalamityPlayer ModdedOwner => Owner.Calamity(); - public NPC Target => Owner.Center.MinionHoming(BelladonnaSpiritStaff.EnemyDistanceDetection, Owner, CalamityPlayer.areThereAnyDamnBosses); - public ref float PetalFireTimer => ref Projectile.ai[0]; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - } + public override int AssociatedProjectileTypeID => ModContent.ProjectileType(); + public override int AssociatedBuffTypeID => ModContent.BuffType(); + public override ref bool AssociatedMinionBool => ref ModdedOwner.belladonaSpirit; + public override bool PreHardmodeMinionTileVision => true; + public override int AnimationFrames => 5; + public ref float ShootingTimer => ref Projectile.ai[0]; public override void SetDefaults() { - Projectile.minionSlots = 1; - Projectile.penetrate = -1; - + base.SetDefaults(); Projectile.width = 28; Projectile.height = 48; - - Projectile.DamageType = DamageClass.Summon; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.minion = true; - Projectile.tileCollide = false; } - public override void AI() - { - // Checks if the minion can still exist. - CanMinionExist(); - - // Does the animation of the minion. - DoAnimation(Target); - - // Points in the right directions. - PointInDirection(Target); - - // Vibes around the player. + public override void MinionAI() + { FollowPlayer(); + if (Target != null) + AttackTarget(); - // The minions push eachother to not clump. Projectile.MinionAntiClump(); - - // If there's a target, it'll shoot at it. - if (Target is not null) - TargetNPC(); + Projectile.spriteDirection = Target == null ? MathF.Sign(Projectile.velocity.X) : MathF.Sign(Target.Center.X - Projectile.Center.X); Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; } - #region Methods - - public void CanMinionExist() - { - Owner.AddBuff(ModContent.BuffType(), 1); - if (Projectile.type == ModContent.ProjectileType()) - { - if (Owner.dead) - ModdedOwner.belladonaSpirit = false; - if (ModdedOwner.belladonaSpirit) - Projectile.timeLeft = 2; - } - } - - public override void OnSpawn(IEntitySource source) - { - int dustAmount = 45; - for (int dustIndex = 0; dustIndex < dustAmount; dustIndex++) - { - float angle = MathHelper.TwoPi / 45f * dustIndex; - Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 4.5f); - Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 39, velocity); - spawnDust.noGravity = true; - spawnDust.scale = velocity.Length() * 0.1f; - spawnDust.velocity *= 0.3f; - } - } - - public void DoAnimation(NPC target) - { - int speedModifier = (target is not null) ? 2 : 1; - - Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / (Main.projFrames[Projectile.type] * speedModifier) % Main.projFrames[Projectile.type]; - } - - public void PointInDirection(NPC target) - { - // If there's a target look at the target. - if (target is not null) - Projectile.spriteDirection = ((target.Center.X - Projectile.Center.X) < 0).ToDirectionInt(); - - // If there's not a target, the minion just points where it's going. - else - if (Math.Abs(Projectile.velocity.X) > 0.01f) - Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); - } + #region AI Methods public void FollowPlayer() { // If the minion starts to get far, force the minion to go to you. - if (Projectile.WithinRange(Owner.Center, BelladonnaSpiritStaff.EnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, 300f)) + if (Projectile.WithinRange(Owner.Center, EnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, 300f)) Projectile.velocity = (Owner.Center - Projectile.Center) / 30f; // The minion will change directions to you if it's going away from you, meaning it'll just hover around you. - else if (!Projectile.WithinRange(Owner.Center, 160f)) + else if (!Projectile.WithinRange(Owner.Center, 160f)) Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 40f; // Teleport to the owner if sufficiently far away. - if (!Projectile.WithinRange(Owner.Center, BelladonnaSpiritStaff.EnemyDistanceDetection)) + if (!Projectile.WithinRange(Owner.Center, EnemyDistanceDetection)) { Projectile.position = Owner.Center; Projectile.velocity *= 0.3f; } } - public void TargetNPC() + public void AttackTarget() { // The minion will slowly go up until it throws the petal. // This essentially makes the minion stay above you and trigger the "Turn back to player", it'll do this continuously, giving the effect of bouncing. // Yes, it's very wacky. You can make it better if you wish. - Projectile.velocity.Y -= MathHelper.Lerp(0, 0.005f, PetalFireTimer % BelladonnaSpiritStaff.FireRate); - - if (Main.myPlayer == Projectile.owner) - FirePetals(); + Projectile.velocity.Y -= MathHelper.Lerp(0, 0.005f, ShootingTimer % BelladonnaSpiritStaff.FireRate); - if (PetalFireTimer < BelladonnaSpiritStaff.FireRate) - PetalFireTimer++; - } - - public void FirePetals() - { - if (PetalFireTimer == BelladonnaSpiritStaff.FireRate) // Every 75 frames, throws a petal. + ShootingTimer++; + if (ShootingTimer == BelladonnaSpiritStaff.FireRate && Main.myPlayer == Projectile.owner) // Every 75 frames, throws a petal. { // Throws the petal upwards with a random force and inherits the minion's speed. Vector2 petalShootVelocity = (-Vector2.UnitY * Main.rand.NextFloat(7f, 8.5f)) + Vector2.UnitX * Projectile.velocity.X + Vector2.UnitY * Projectile.velocity.Y * 0.35f; - - int petal = Projectile.NewProjectile(Projectile.GetSource_FromThis(), + + Projectile petal = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, petalShootVelocity, - ModContent.ProjectileType(), - Projectile.damage, - Projectile.knockBack, + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, Projectile.owner); - - if (Main.projectile.IndexInRange(petal)) - { - Main.projectile[petal].rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); - } + petal.rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); // Resets the timer. - PetalFireTimer = 0f; + ShootingTimer = 0f; + } + } + + #endregion + + public override void OnSpawn(IEntitySource source) + { + if (!Main.dedServ) + { + int dustAmount = 45; + for (int dustIndex = 0; dustIndex < dustAmount; dustIndex++) + { + float angle = MathHelper.TwoPi / 45f * dustIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 4.5f); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 39, velocity); + spawnDust.noGravity = true; + spawnDust.scale = velocity.Length() * 0.1f; + spawnDust.velocity *= 0.3f; + } } } public override bool? CanDamage() => false; - #endregion + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 position = Projectile.Center - Main.screenPosition; + Rectangle sourceRectangle = texture.Frame(verticalFrames: AnimationFrames, frameY: Projectile.frame); + Vector2 origin = sourceRectangle.Size() * 0.5f; + SpriteEffects effects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, position, sourceRectangle, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, effects); + + return false; + } } } diff --git a/Projectiles/Summon/BelladonnaSpirit.png b/Projectiles/Summon/BelladonnaSpirit.png index 3f62956805..5063d8c384 100644 Binary files a/Projectiles/Summon/BelladonnaSpirit.png and b/Projectiles/Summon/BelladonnaSpirit.png differ diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.cs b/Projectiles/Summon/BrimstoneExplosionMinion.cs index d1cd5185f7..cd75afbbeb 100644 --- a/Projectiles/Summon/BrimstoneExplosionMinion.cs +++ b/Projectiles/Summon/BrimstoneExplosionMinion.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.penetrate = -1; Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index 1b5b7934de..02cdb7dca2 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -71,13 +71,13 @@ namespace CalamityMod.Projectiles.Summon } } - public override void OnKill(int timeLeft) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } + //public override void OnKill(int timeLeft) + //{ + //if (Projectile.owner == Main.myPlayer) + //{ + //Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + //} + //} public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index 045746ff91..bc18a45de9 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -1,248 +1,201 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { - public class IceClasperMinion : ModProjectile, ILocalizedModType + public class IceClasperMinion : BaseMinionProjectile { - public Player Owner => Main.player[Projectile.owner]; + public override int AssociatedProjectileTypeID => ModContent.ProjectileType(); + public override int AssociatedBuffTypeID => ModContent.BuffType(); + public override ref bool AssociatedMinionBool => ref ModdedOwner.IceClasperBool; - public CalamityPlayer ModdedOwner => Owner.Calamity(); - - public enum IceClasperAIState + public enum AIState { Follow, Ram } + public AIState State { - FollowOwner, - Ram - } - - public IceClasperAIState CurrentState - { - get => (IceClasperAIState)Projectile.ai[0]; - set => Projectile.ai[0] = (int)value; + get => (AIState)Projectile.ai[0]; + set + { + Projectile.ai[0] = (int)value; + SyncVariables(); + } } public ref float TimerForShooting => ref Projectile.ai[1]; public ref float AfterimageInterpolant => ref Projectile.localAI[0]; - public bool hasSpawned = false; - - public new string LocalizationCategory => "Projectiles.Summon"; - public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + base.SetStaticDefaults(); + Main.projFrames[Type] = 6; } public override void SetDefaults() { - Projectile.localNPCHitCooldown = AncientIceChunk.IFrames; - Projectile.minionSlots = 1f; - Projectile.penetrate = -1; + base.SetDefaults(); Projectile.coldDamage = true; - - Projectile.width = 62; - Projectile.height = 62; - Projectile.DamageType = DamageClass.Summon; - Projectile.usesLocalNPCImmunity = true; - Projectile.minion = true; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; + Projectile.width = Projectile.height = 62; } - public override void AI() - { - CheckMinionExistence(); - - if (!hasSpawned) + public override void MinionAI() + { + switch (State) { - SpawnEffect(); - hasSpawned = true; - } - - // Detects a target at a given distance. - NPC potentialTarget = Projectile.Center.MinionHoming(AncientIceChunk.EnemyDistanceDetection, Owner); - switch (CurrentState) - { - case IceClasperAIState.FollowOwner: - State_FollowOwner(potentialTarget); + case AIState.Follow: + FollowState(); break; - case IceClasperAIState.Ram: - State_Ram(potentialTarget); + case AIState.Ram: + RamState(); break; } - // Flavor dust visual to show that it is ghostly. - if (Main.rand.NextBool(10)) - { - int ghostDust = Dust.NewDust(Projectile.position, 31, 62, 56, -0.5f * Projectile.rotation.ToRotationVector2().X, -0.5f * Projectile.rotation.ToRotationVector2().Y); - Main.dust[ghostDust].noLight = true; - Main.dust[ghostDust].noLightEmittence = true; - } - - DoAnimation(); - DoRotation(potentialTarget); - Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); Projectile.MinionAntiClump(0.5f); + + if (!Main.dedServ) + { + if (Main.rand.NextBool(10)) + { + Dust ghostDust = Dust.NewDustPerfect(Projectile.Center, 56, -Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(2f, 3f)); + ghostDust.customData = false; + ghostDust.noLight = true; + ghostDust.noLightEmittence = true; + } + + Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); + } } - #region Methods + #region AI Methods - public void State_FollowOwner(NPC target) + public void FollowState() { // If the minion starts to get far, force the minion to go to you. - if (Projectile.WithinRange(Owner.Center, AncientIceChunk.EnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner + 100f)) + if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner)) { - Projectile.velocity = (Owner.Center - Projectile.Center) / 30f; - Projectile.netUpdate = true; - } - - // The minion will change directions to you if it's going away from you, meaning it'll just hover around you. - else if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner)) - { - Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 40f; - Projectile.netUpdate = true; + Projectile.velocity = (Projectile.velocity + Projectile.SafeDirectionTo(Owner.Center)) * 0.9f; + SyncVariables(); } // Teleport to the owner if sufficiently far away. - if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.EnemyDistanceDetection)) + else if (!Projectile.WithinRange(Owner.Center, 1200f)) { Projectile.Center = Owner.Center; - Projectile.velocity *= .3f; - Projectile.netUpdate = true; + SyncVariables(); } // If the target is not null but not in range to dash: shoot. // If in range to dash: dash. - if (target is not null) + if (Target != null) { - if (Owner.WithinRange(target.Center, AncientIceChunk.DistanceToDash)) - { - CurrentState = IceClasperAIState.Ram; - Projectile.netUpdate = true; - } + if (Owner.WithinRange(Target.Center, AncientIceChunk.DistanceToDash)) + State = AIState.Ram; else - ShootTarget(target); + ShootTarget(); + + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(Target.Center), .15f); } + else + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.velocity.ToRotation(), .15f); } - public void State_Ram(NPC target) + public void RamState() { - // If there's no target while dashing or the player's gone far enough from the target: back to shooting. - if (target is null || !Owner.WithinRange(Projectile.Center, AncientIceChunk.DistanceToStopDash)) - { - CurrentState = IceClasperAIState.FollowOwner; - Projectile.netUpdate = true; - } - else if (target is not null) + if (Target is not null && Owner.WithinRange(Projectile.Center, AncientIceChunk.DistanceToStopDash)) { // The distance to the target plus a small number so it's not 0, it'd break calculations. - float distToTarget = Projectile.Distance(target.Center) + .01f; + float distanceToTarget = Projectile.Distance(Target.Center) + .01f; // The minion will head towards it's rotation. // If the target's close, the minion'll speed up, and viceversa, so it doesn't circle around the target doing nothing. - Projectile.velocity = Projectile.rotation.ToRotationVector2() * (AncientIceChunk.MinVelocity + (12f / (distToTarget * .01f))); + Projectile.velocity = Projectile.rotation.ToRotationVector2() * (AncientIceChunk.MinVelocity + (12f / (distanceToTarget * .01f))); Projectile.velocity = Vector2.Clamp(Projectile.velocity, Vector2.One * -25f, Vector2.One * 25f); - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(target.Center), .001f * distToTarget); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(Target.Center), .001f * distanceToTarget); } + + // If there's no target while dashing or the player's gone far enough from the target: back to shooting. + else + State = AIState.Follow; } - public void ShootTarget(NPC target) + public void ShootTarget() { + ++TimerForShooting; if (TimerForShooting >= AncientIceChunk.TimeToShoot && Projectile.owner == Main.myPlayer) { - Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 20f); + Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 25f); - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), - Projectile.Center, - velocity, - ModContent.ProjectileType(), - (int)(Projectile.damage * AncientIceChunk.ProjectileDMGMultiplier), - Projectile.knockBack, - Projectile.owner); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), + Projectile.Center, + velocity, + ModContent.ProjectileType(), + (int)(Projectile.damage * AncientIceChunk.ProjectileDMGMultiplier), + Projectile.knockBack, + Projectile.owner); // Flavor recoil effect. Projectile.velocity -= velocity * .1f; - // For the fucking love of any god you can think of, this sound sucks but I can't find another one that fits better. - SoundEngine.PlaySound(SoundID.Item28, Projectile.Center); + if (!Main.dedServ) + { + // For the fucking love of any god you can think of, this sound sucks but I can't find another one that fits better. + SoundEngine.PlaySound(SoundID.Item28, Projectile.Center); + } TimerForShooting = 0f; - Projectile.netUpdate = true; + SyncVariables(); } - - if (TimerForShooting < AncientIceChunk.TimeToShoot) - TimerForShooting++; } - public void DoRotation(NPC target) + public void SyncVariables() { - if (target is null) - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.velocity.ToRotation(), .15f); - else if (target is not null && !Projectile.WithinRange(target.Center, AncientIceChunk.DistanceToDash)) - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(target.Center), .15f); + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; } - public void DoAnimation() - { - Projectile.frameCounter++; - if (Projectile.frameCounter % 5 == 0) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - } + #endregion - public void CheckMinionExistence() + public override void OnSpawn(IEntitySource source) { - Owner.AddBuff(ModContent.BuffType(), 3600); - if (Projectile.type == ModContent.ProjectileType()) + IFrames = AncientIceChunk.IFrames; + TrailingMode = 2; + TrailCacheLength = 6; + + if (!Main.dedServ) { - if (Owner.dead) - ModdedOwner.iClasper = false; - if (ModdedOwner.iClasper) - Projectile.timeLeft = 2; + int dustAmount = 45; + for (int dustIndex = 0; dustIndex < dustAmount; dustIndex++) + { + float angle = MathHelper.TwoPi / dustAmount * dustIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 7f); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 56, velocity); + spawnDust.customData = false; + spawnDust.noGravity = true; + spawnDust.velocity *= .75f; + spawnDust.scale = velocity.Length() * .2f; + } } } - public void SpawnEffect() - { - int dustAmt = 45; - for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) - { - float angle = MathHelper.TwoPi / dustAmt * dustIndex; - Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(3f, 7f); - Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 56, velocity); - spawnDust.customData = false; - spawnDust.noGravity = true; - spawnDust.velocity *= .75f; - spawnDust.scale = velocity.Length() * .2f; - } - } - - public override bool? CanDamage() => (CurrentState == IceClasperAIState.Ram) ? null : false; + public override bool? CanDamage() => (State == AIState.Ram) ? null : false; public override bool PreDraw(ref Color lightColor) { - NPC target = Projectile.Center.MinionHoming(1200f, Owner); - Texture2D texture = ModContent.Request(Texture).Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; // Flavor fade-in-and-out for afterimages. - AfterimageInterpolant += ((target is not null && Owner.WithinRange(target.Center, 450f)) || CurrentState == IceClasperAIState.Ram) ? .05f : -.05f; + AfterimageInterpolant += ((Target is not null && Owner.WithinRange(Target.Center, 450f)) || State == AIState.Ram) ? .05f : -.05f; AfterimageInterpolant = MathHelper.Clamp(AfterimageInterpolant, 0f, 1f); float AfterimageFade = MathHelper.Lerp(0f, 1f, AfterimageInterpolant); @@ -257,10 +210,8 @@ namespace CalamityMod.Projectiles.Summon } Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation - MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0); - + return false; } - - #endregion } } diff --git a/Projectiles/Summon/IceClasperSummonProjectile.cs b/Projectiles/Summon/IceClasperSummonProjectile.cs index 5e44ade6e2..e94b205c50 100644 --- a/Projectiles/Summon/IceClasperSummonProjectile.cs +++ b/Projectiles/Summon/IceClasperSummonProjectile.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,45 +9,39 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; - public Player Owner => Main.player[Projectile.owner]; - public override void SetStaticDefaults() { - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 5; } public override void SetDefaults() { - Projectile.idStaticNPCHitCooldown = 10; - Projectile.timeLeft = 300; - - Projectile.width = 28; - Projectile.height = 28; Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = 300; + Projectile.width = Projectile.height = 28; + Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; + Projectile.ignoreWater = true; } public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - int trailDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); - Main.dust[trailDust].noGravity = true; - - Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3()); + if (!Main.dedServ) + { + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 172, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.5f); + trailDust.noGravity = true; + } } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn, 180); public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return true; } } diff --git a/Projectiles/Summon/PerditionBeacon.cs b/Projectiles/Summon/PerditionBeacon.cs index 2d76e0a68b..505e9616ee 100644 --- a/Projectiles/Summon/PerditionBeacon.cs +++ b/Projectiles/Summon/PerditionBeacon.cs @@ -34,8 +34,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 90; } - public override void ChooseTarget() + public override void SetOwnerTarget() { + base.SetOwnerTarget(); // Only attack targets if one is explicitly defined. Don't default to a closest target. Target = Owner.HasMinionAttackTargetNPC ? Main.npc[Owner.MinionAttackTargetNPC] : null; } diff --git a/Projectiles/Typeless/AeroExplosive.cs b/Projectiles/Typeless/AeroExplosive.cs index 3ec43df9de..accbe6929b 100644 --- a/Projectiles/Typeless/AeroExplosive.cs +++ b/Projectiles/Typeless/AeroExplosive.cs @@ -1,10 +1,9 @@ using CalamityMod.Items.Weapons.Typeless; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -153,7 +152,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ExplodeandDestroyTiles(Projectile, 7, true, new List() { }, new List() { }); + Projectile.ExplodeTiles(7, true); } } } diff --git a/Sounds/Item/MineralMortarExplode.ogg b/Sounds/Item/MineralMortarExplode.ogg new file mode 100644 index 0000000000..9f981b1356 Binary files /dev/null and b/Sounds/Item/MineralMortarExplode.ogg differ diff --git a/Sounds/Item/MurasamaBigSwing.ogg b/Sounds/Item/MurasamaBigSwing.ogg new file mode 100644 index 0000000000..9af794325e Binary files /dev/null and b/Sounds/Item/MurasamaBigSwing.ogg differ diff --git a/Sounds/Item/MurasamaHitInorganic.ogg b/Sounds/Item/MurasamaHitInorganic.ogg new file mode 100644 index 0000000000..89d1597e1b Binary files /dev/null and b/Sounds/Item/MurasamaHitInorganic.ogg differ diff --git a/Sounds/Item/MurasamaHitOrganic.ogg b/Sounds/Item/MurasamaHitOrganic.ogg new file mode 100644 index 0000000000..4898afa97c Binary files /dev/null and b/Sounds/Item/MurasamaHitOrganic.ogg differ diff --git a/Sounds/Item/MurasamaSwing.ogg b/Sounds/Item/MurasamaSwing.ogg new file mode 100644 index 0000000000..ff604d971f Binary files /dev/null and b/Sounds/Item/MurasamaSwing.ogg differ diff --git a/Tiles/Abyss/AbyssTreasureChest.cs b/Tiles/Abyss/AbyssTreasureChest.cs index 5a3891b147..eed55a4907 100644 --- a/Tiles/Abyss/AbyssTreasureChest.cs +++ b/Tiles/Abyss/AbyssTreasureChest.cs @@ -27,11 +27,9 @@ namespace CalamityMod.Tiles.Abyss public override bool IsLockedChest(int i, int j) => Main.tile[i, j].TileFrameX / 36 == 1; public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) { - //Only unlock if Skeletron is dead - if (NPC.downedBoss3) - return true; - else - return false; + //Skeletron must be dead, NPC.downedBoss3 is added as failsave in case chests fail to open in the Abyss' method. AbleToUnlockChests should be false unless + //the Abyss' unlock method is being run to prevent chests spawning already unlocked. + return World.Abyss.UnlockChests || NPC.downedBoss3; } public override bool RightClick(int i, int j) diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 53a6444f8c..a8840f284a 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -389,6 +389,126 @@ namespace CalamityMod } } } + + public struct RocketBehaviorInfo + { + internal int rocketItemType; + + // Explosion radii for various rocket ammos. Defaults to the sizes used in vanilla launchers. + public int smallRadius = 3; // Rocket I and II + public int mediumRadius = 6; // Rocket III and IV + public int largeRadius = 9; // Mini Nuke and Cluster Rockets + + public bool respectStandardBlastImmunity = true; + public List tilesToCheck = null; + public List wallsToCheck = null; + + public int clusterProjectileID = ProjectileID.ClusterFragmentsI; + public int destructiveClusterProjectileID = ProjectileID.ClusterFragmentsII; + public float clusterSplitDamageMultiplier = 0.5f; + + public RocketBehaviorInfo(int rocketID) + { + rocketItemType = rocketID; + } + } + + /// + /// For a given projectile that is used as a rocket and uses rocket ammo, this utility provides a shorthand way to check for checking what behaviour should each type of ammo do. It can also return you the radius of the explosion that'll happen so you can use it for your effect's size. + /// + /// The projectile in question. + /// Struct containing information on the desired rocket behavior. + public static int RocketBehavior(this Projectile proj, RocketBehaviorInfo info) + { + int explosionRadius = 0; + + // Used for Cluster Rockets to determine damage. + + // Used for Dry Rockets, Water Rockets etc. to place water. Not always needed. + Point center = proj.Center.ToTileCoordinates(); + DelegateMethods.v2_1 = center.ToVector2(); + DelegateMethods.f_1 = 3f; + + void SpawnClusterFragments(bool destructiveVariant = false) + { + if (proj.owner != Main.myPlayer) + return; + + int projID = destructiveVariant ? info.destructiveClusterProjectileID : info.clusterProjectileID; + int clusterDamage = (int)(proj.damage * info.clusterSplitDamageMultiplier); + + float thetaStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); + for (float i = 0; i < 6; ++i) + { + float thetaIter = thetaStart + (i * MathHelper.TwoPi / 6f); + float dist = Main.rand.NextFloat(4f, 6f); + + Vector2 clusterVel = thetaIter.ToRotationVector2() * dist - Vector2.UnitY; + + Projectile clusterFragment = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), proj.Center, clusterVel, projID, clusterDamage, 0f, proj.owner); + clusterFragment.timeLeft -= Main.rand.Next(30); + } + } + + switch (info.rocketItemType) + { + case ItemID.RocketI: + explosionRadius = info.smallRadius; + break; + + case ItemID.RocketII: + explosionRadius = info.smallRadius; + proj.ExplodeTiles(explosionRadius, info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + break; + + case ItemID.RocketIII: + explosionRadius = info.mediumRadius; + break; + + case ItemID.RocketIV: + explosionRadius = info.mediumRadius; + proj.ExplodeTiles(explosionRadius, info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + break; + + case ItemID.MiniNukeI: + explosionRadius = info.largeRadius; + break; + + case ItemID.MiniNukeII: + explosionRadius = info.largeRadius; + proj.ExplodeTiles(explosionRadius, info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + break; + + case ItemID.ClusterRocketI: + explosionRadius = info.largeRadius; + SpawnClusterFragments(false); + break; + + case ItemID.ClusterRocketII: + explosionRadius = info.largeRadius; + SpawnClusterFragments(true); + break; + + case ItemID.DryRocket: + DelegateMethods.f_1 = 3.5f; + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); + break; + + case ItemID.WetRocket: + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); + break; + + case ItemID.LavaRocket: + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); + break; + + case ItemID.HoneyRocket: + Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); + break; + } + + return explosionRadius; + } #endregion public static int FindFirstProjectile(int Type) @@ -601,12 +721,30 @@ namespace CalamityMod } } - public static void ExplodeandDestroyTiles(this Projectile projectile, int explosionRadius, bool checkExplosions, List tilesToCheck, List wallsToCheck) + private static readonly List vanillaBlastImmuneTiles = new List() { - int minTileX = (int)projectile.position.X / 16 - explosionRadius; - int maxTileX = (int)projectile.position.X / 16 + explosionRadius; - int minTileY = (int)projectile.position.Y / 16 - explosionRadius; - int maxTileY = (int)projectile.position.Y / 16 + explosionRadius; + TileID.DemonAltar, + TileID.Cobalt, + TileID.Mythril, + TileID.Adamantite, + TileID.Palladium, + TileID.Orichalcum, + TileID.Titanium, + TileID.Chlorophyte, + TileID.LihzahrdBrick, + TileID.LihzahrdAltar, + TileID.DesertFossil + }; + + public static void ExplodeTiles(this Projectile p, int explosionRadius, bool respectStandardBlastImmunity = true, IEnumerable customBlastImmuneTiles = null, IEnumerable customBlastImmuneWalls = null) + => ExplodeTiles(p.Center, explosionRadius, respectStandardBlastImmunity, customBlastImmuneTiles, customBlastImmuneWalls); + public static void ExplodeTiles(Vector2 explosionPos, int explosionRadius, bool respectStandardBlastImmunity = true, IEnumerable customBlastImmuneTiles = null, IEnumerable customBlastImmuneWalls = null) + { + // Define limits for explosion iteration. + int minTileX = (int)explosionPos.X / 16 - explosionRadius; + int maxTileX = (int)explosionPos.X / 16 + explosionRadius; + int minTileY = (int)explosionPos.Y / 16 - explosionRadius; + int maxTileY = (int)explosionPos.Y / 16 + explosionRadius; if (minTileX < 0) { minTileX = 0; @@ -624,109 +762,130 @@ namespace CalamityMod maxTileY = Main.maxTilesY; } - bool canKillWalls = false; - float projectilePositionX = projectile.position.X / 16f; - float projectilePositionY = projectile.position.Y / 16f; + // This checks for whether the explosion should be allowed to destroy walls. It's rather arbitrary, but it's how vanilla works. + bool allowWallDestruction = false; + float projTileX = explosionPos.X / 16f; + float projTileY = explosionPos.Y / 16f; for (int x = minTileX; x <= maxTileX; x++) { for (int y = minTileY; y <= maxTileY; y++) { - Vector2 explodeArea = new Vector2(Math.Abs(x - projectilePositionX), Math.Abs(y - projectilePositionY)); + Vector2 explodeArea = new Vector2(Math.Abs(x - projTileX), Math.Abs(y - projTileY)); float distance = explodeArea.Length(); if (distance < explosionRadius && Main.tile[x, y] != null && Main.tile[x, y].WallType == WallID.None) { - canKillWalls = true; + allowWallDestruction = true; break; } } } - List tileExcludeList = new List() + // Tiles which can never be exploded under any circumstances. Bad things happen if they blow up. + HashSet blastImmuneTiles = new() { TileID.DemonAltar, TileID.ElderCrystalStand }; - for (int i = 0; i < tilesToCheck.Count; ++i) - tileExcludeList.Add(tilesToCheck[i]); - List wallExcludeList = new List(); - for (int i = 0; i < wallsToCheck.Count; ++i) - wallExcludeList.Add(wallsToCheck[i]); - List explosionCheckList = new List() + // If respecting vanilla blast immunities, toss in that whole list. + if (respectStandardBlastImmunity) { - TileID.DemonAltar, - TileID.Cobalt, - TileID.Mythril, - TileID.Adamantite, - TileID.Palladium, - TileID.Orichalcum, - TileID.Titanium, - TileID.Chlorophyte, - TileID.LihzahrdBrick, - TileID.LihzahrdAltar, - TileID.DesertFossil - }; - AddWithCondition(explosionCheckList, TileID.Hellstone, !Main.hardMode); + foreach (int tileID in vanillaBlastImmuneTiles) + blastImmuneTiles.Add(tileID); - for (int i = minTileX; i <= maxTileX; i++) + // Conditionally toss in Hellstone if it's not Hardmode yet. + if (!Main.hardMode) + blastImmuneTiles.Add(TileID.Hellstone); + } + + // If specified, add custom blast immune tiles. + if (customBlastImmuneTiles is not null) + foreach (int tileID in customBlastImmuneTiles) + blastImmuneTiles.Add(tileID); + + // If specified, define custom blast immune walls. + HashSet blastImmuneWalls = null; + if (customBlastImmuneWalls is not null) { - for (int j = minTileY; j <= maxTileY; j++) + blastImmuneWalls = new(); + foreach (int wallID in customBlastImmuneWalls) + blastImmuneWalls.Add(wallID); + } + + // Actually perform the explosion. + bool refTrue = true, refFalse = false; + for (int tx = minTileX; tx <= maxTileX; tx++) + { + for (int ty = minTileY; ty <= maxTileY; ty++) { - Tile tile = Main.tile[i, j]; - bool t = 1 == 1; bool f = 1 == 2; + Tile tile = Main.tile[tx, ty]; + ushort type = tile.TileType; - Vector2 explodeArea = new Vector2(Math.Abs(i - projectilePositionX), Math.Abs(j - projectilePositionY)); + Vector2 explodeArea = new Vector2(Math.Abs(tx - projTileX), Math.Abs(ty - projTileY)); float distance = explodeArea.Length(); - if (distance < explosionRadius) + if (distance >= explosionRadius) + continue; + + bool canBlastThisTile = true; + if (tile != null && tile.HasTile) { - bool canKillTile = true; - if (tile != null && tile.HasTile) + if (blastImmuneTiles.Contains(type) || // Respects standard blast immunities if enabled, so they're covered + Main.tileContainer[tile.TileType] || // Chests should never be exploded + // Dungeon tiles and TileLoader CanExplode are considered part of respecting standard blast immunities + respectStandardBlastImmunity && (Main.tileDungeon[type] || !TileLoader.CanExplode(tx, ty)) || + // TileLoader CanKillTile can block the destruction of a tile regardless of whether it is via an explosion + !TileLoader.CanKillTile(tx, ty, tile.TileType, ref refTrue) || !TileLoader.CanKillTile(tx, ty, tile.TileType, ref refFalse)) { - if (checkExplosions) - { - if (Main.tileDungeon[tile.TileType] || explosionCheckList.Contains(tile.TileType)) - canKillTile = false; - if (!TileLoader.CanExplode(i, j)) - canKillTile = false; - } - - if (Main.tileContainer[tile.TileType]) - canKillTile = false; - if (!TileLoader.CanKillTile(i, j, tile.TileType, ref t) || !TileLoader.CanKillTile(i, j, tile.TileType, ref f)) - canKillTile = false; - if (tileExcludeList.Contains(tile.TileType)) - canKillTile = false; - - if (canKillTile) - { - WorldGen.KillTile(i, j, false, false, false); - if (!tile.HasTile && Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, i, j, 0f, 0, 0, 0); - } + canBlastThisTile = false; } - if (canKillTile) + // Destroy the tile itself (not the wall). + if (canBlastThisTile) { - for (int x = i - 1; x <= i + 1; x++) - { - for (int y = j - 1; y <= j + 1; y++) - { - bool canExplode = true; - if (checkExplosions) - canExplode = WallLoader.CanExplode(x, y, Main.tile[x, y].WallType); - if (wallExcludeList.Any() && wallExcludeList.Contains(Main.tile[x, y].WallType)) - canKillWalls = false; + WorldGen.KillTile(tx, ty, false, false, false); - if (Main.tile[x, y] != null && Main.tile[x, y].WallType > WallID.None && canKillWalls && canExplode) - { - WorldGen.KillWall(x, y, false); - if (Main.tile[x, y].WallType == WallID.None && Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 2, x, y, 0f, 0, 0, 0); - } - } + // If the tile was actually destroyed (KillTile can fail) then send netcode indicating as such. + if (!tile.HasTile && Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, tx, ty, 0f, 0, 0, 0); + } + } + + // Skip destroying walls if the tile was not blasted + // Also skip destroying walls if this explosion is not allowed to destroy walls by vanilla rules + if (!canBlastThisTile || !allowWallDestruction) + continue; + + // For every destroyed tile, destroy a 3x3 area of walls around it to prevent ugly wall corners + // This is what causes explosion packet spam, btw. + for (int wx = tx - 1; wx <= tx + 1; wx++) + { + for (int wy = ty - 1; wy <= ty + 1; wy++) + { + // Check whether this wall is explodable. + bool canBlastThisWall = !respectStandardBlastImmunity || WallLoader.CanExplode(wx, wy, Main.tile[wx, wy].WallType); + + // If custom wall blast immunities were defined, respect them. + // If this is what stops a wall from being blown up, prevent all further wall destruction to prevent ugly floating walls. + if (blastImmuneWalls is not null && blastImmuneWalls.Contains(Main.tile[wx, wy].WallType)) + { + allowWallDestruction = false; + goto PostWallBlastLoop; // Walls cannot be destroyed for the remainder of this explosion. Stop now. + } + + // Destroy the wall itself. + if (Main.tile[wx, wy] != null && Main.tile[wx, wy].WallType > WallID.None && canBlastThisWall) + { + WorldGen.KillWall(wx, wy, false); + + // If the wall was actually destroyed (KillWall can fail) then send netcode indicating as such. + if (Main.tile[wx, wy].WallType == WallID.None && Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 2, wx, wy, 0f, 0, 0, 0); } } } + + // Label to jump to if wall destruction is aborted. + PostWallBlastLoop:; } } } diff --git a/World/Abyss.cs b/World/Abyss.cs index ba517912e5..a93fc44c13 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -36,7 +36,11 @@ namespace CalamityMod.World public static bool AtLeftSideOfWorld = false; public static int AbyssChasmBottom = 0; - //public static bool AbleToUnlockChests = false; //used for unlocking chests during skeletron's death and so that they cannot be opened beforehand + /// + /// Forces abyss chests to unlock even if is false. Used in as it is ran during Skeletron's death, not after. + /// + public static bool UnlockChests { get; set; } + public static void PlaceAbyss() { int x = Main.maxTilesX; @@ -1155,34 +1159,38 @@ namespace CalamityMod.World WorldGen.PlaceObject(i, j - 2, (ushort)ModContent.TileType()); } - // Commented out the method in case we ever use it again in the future, or some guy in the public github fixes it, - // but for now this is a buggy mess that is too disruptive especially in multiplayer despite several attempts at fixing it - Shade - /* + + /// + /// Unlocks all abyss chests, automatically synced across the server. + /// Only run initally on the server. + /// public static void UnlockAllAbyssChests() { - int genLimit = Main.maxTilesX / 2; - int abyssChasmX = AtLeftSideOfWorld ? genLimit - (genLimit - 135) + 35 : genLimit + (genLimit - 135) - 35; - int abyssMinX = AtLeftSideOfWorld ? 0 : abyssChasmX - 150; - int abyssMaxX = AtLeftSideOfWorld ? abyssChasmX + 150 : Main.maxTilesX; + UnlockChests = true; - //loop to unlock all abyss treasure chests - for (int x = abyssMinX; x < abyssMaxX; x++) + if (Main.netMode == NetmodeID.Server) { - for (int y = Main.remixWorld ? SulphurousSea.YStart - (int)((Main.maxTilesY - 200) * 0.4f) : (int)Main.worldSurface; y < Main.maxTilesY - 300; y++) + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.UnlockAbyssChests); + netMessage.Send(); + } + + for (int c = 0; c < Main.maxChests; c++) + { + var chest = Main.chest[c]; + if (chest == null) { - //make SURE to check for the entire chest at once, otherwise it will break when unlocking - if (Main.tile[x, y].TileType == ModContent.TileType() && //top left - Main.tile[x + 1, y].TileType == ModContent.TileType() && //top right - Main.tile[x, y + 1].TileType == ModContent.TileType() && //bottom left - Main.tile[x + 1, y + 1].TileType == ModContent.TileType()) //bottom right - { - Chest.Unlock(x, y); - NetMessage.SendData(MessageID.LockAndUnlock, -1, -1, null, Main.LocalPlayer.whoAmI, 1f, x, y); - } + continue; + } + + var chestTile = Framing.GetTileSafely(chest.x, chest.y); + if (chestTile.HasTile && chestTile.TileType == ModContent.TileType() && Chest.IsLocked(chest.x, chest.y)) + { + Chest.Unlock(chest.x, chest.y); } } - AbleToUnlockChests = false; //reseting the variable in case players generate multiple worlds to prevent already unlocked chests from spawning + + UnlockChests = false; } - */ } }