diff --git a/BiomeManagers/UndergroundAstralIcon.png b/BiomeManagers/UndergroundAstralIcon.png index 72a2bd0037..1a510e96f2 100644 Binary files a/BiomeManagers/UndergroundAstralIcon.png and b/BiomeManagers/UndergroundAstralIcon.png differ diff --git a/Buffs/Summon/Herring.cs b/Buffs/Summon/Herring.cs index 43a5e6fcfa..8ba470808e 100644 --- a/Buffs/Summon/Herring.cs +++ b/Buffs/Summon/Herring.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.Summon public override void Update(Player player, ref int buffIndex) { CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { modPlayer.herring = true; } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 8c47dde8b1..5350851a53 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2499,6 +2499,10 @@ namespace CalamityMod.CalPlayer public override void ProcessTriggers(TriggersSet triggersSet) { + // Why does this otherwise work when you're dead lmao + if (Player.dead) + return; + if (CalamityKeybinds.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == Player.whoAmI) { if (!Player.CCed && !Player.chaosState) @@ -4542,11 +4546,9 @@ namespace CalamityMod.CalPlayer contactDamageReduction += 0.5; } + // Can't have any cooldowns here because dodges grrrrr.... if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID)) - { - Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, coreOfTheBloodGod ? "bloodgod" : "default"); contactDamageReduction += 0.5; - } if (tarragonCloak && tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID)) contactDamageReduction += 0.5; @@ -4946,6 +4948,13 @@ namespace CalamityMod.CalPlayer #endregion #region On Hit + public override void OnHitByNPC(NPC npc, int damage, bool crit) + { + // ModifyHit (Flesh Totem effect happens here) -> Hurt (includes dodges) -> OnHit + // As such, to avoid cooldowns proccing from dodge hits, do it here + if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID) && damage > 0) + Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, coreOfTheBloodGod ? "bloodgod" : "default"); + } public override void OnHitByProjectile(Projectile proj, int damage, bool crit) { if (sulfurSet && !proj.friendly && damage > 0) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index a3d9d90dd0..1876e5cd94 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2393,7 +2393,6 @@ namespace CalamityMod.CalPlayer Player.magmaStone = true; Player.GetDamage() += 0.15f; Player.GetCritChance() += 5; - Player.lavaMax += 240; } if (bloodPactBoost) @@ -2590,6 +2589,10 @@ namespace CalamityMod.CalPlayer flightTimeMult += 0.1; } + // Reaver Tank set nuke flight time + if (reaverDefense) + flightTimeMult -= 0.2f; + // Increase wing time if (Player.wingTimeMax > 0) Player.wingTimeMax = (int)(Player.wingTimeMax * flightTimeMult); @@ -2822,7 +2825,6 @@ namespace CalamityMod.CalPlayer if (yInsignia) { Player.GetDamage() += 0.1f; - Player.lavaMax += 240; if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) Player.GetDamage() += 0.1f; } @@ -3054,8 +3056,6 @@ namespace CalamityMod.CalPlayer { Player.scope = false; //this is so it doesn't mess with the balance of ranged transform attacks over the others Player.lavaImmune = true; - Player.lavaMax += 420; - Player.lavaRose = true; Player.fireWalk = true; Player.buffImmune[ModContent.BuffType()] = Main.dayTime; Player.buffImmune[ModContent.BuffType()] = !Main.dayTime; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 352ff2093e..514f2d6637 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -610,7 +610,7 @@ namespace CalamityMod.CalPlayer ProjectileType(), ProjectileID.BeeCloakStar, ProjectileID.StarCloakStar, - ProjectileType() + ProjectileID.StarCannonStar }); int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 12f, projectileType, astralStarDamage, 5f, Player.whoAmI); @@ -688,7 +688,7 @@ namespace CalamityMod.CalPlayer ProjectileType(), ProjectileID.BeeCloakStar, ProjectileID.StarCloakStar, - ProjectileType() + ProjectileID.StarCannonStar }); int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 25f, projectileType, astralStarDamage, 5f, Player.whoAmI); diff --git a/Effects/PixelatedSightLine.fx b/Effects/PixelatedSightLine.fx index 702c3677f8..103c80cd3d 100644 --- a/Effects/PixelatedSightLine.fx +++ b/Effects/PixelatedSightLine.fx @@ -43,7 +43,7 @@ float mod(float a, float n) ( float2 origin, float angle, float2 plot, float plotAngle) { - //If the angle between the line's angle and the plot's angle is less than 90° (aka , not BEHIND the half-line), return the distance from the line + //If the angle between the line's angle and the plot's angle is less than 90� (aka , not BEHIND the half-line), return the distance from the line if (abs(mod(angle - plotAngle + 3.1415926, 6.2831853) - 3.1415926) < 1.5707) return distanceFromLine(origin, angle, plot); @@ -75,7 +75,7 @@ float4 main(float2 uv : TEXCOORD) : COLOR //Grabs the distance of the point from the edge line. float distanceFromLine = distanceFromLineCropped(float2(0, 0), laserAngle, mappedUv, angle); - //If we are further from the line than the bloom's blending lenght, just don't. + //If we are further from the line than the bloom's blending length, just don't. if (distanceFromLine > bloomSize + halfLaserWidth) return float4(0, 0, 0, 0); diff --git a/Effects/SpreadTelegraph.fx b/Effects/SpreadTelegraph.fx index eea200f02a..2b59bf9ed7 100644 --- a/Effects/SpreadTelegraph.fx +++ b/Effects/SpreadTelegraph.fx @@ -1,7 +1,7 @@ float3 edgeColor; float3 centerColor; -float edgeBlendLenght; +float edgeBlendLength; float edgeBlendStrength; float mainOpacity; @@ -27,7 +27,7 @@ float distanceFromLine(float2 origin, float angle, float2 plot) //Gets the distance of a plot from a line with a specified origin and angle, but crops the line so it only expands towards the angle float distanceFromLineCropped(float2 origin, float angle, float2 plot, float plotAngle) { - //If the angle between the line's angle and the plot's angle is less than 90° (aka , not BEHIND the half-line), return the distance from the line + //If the angle between the line's angle and the plot's angle is less than 90� (aka , not BEHIND the half-line), return the distance from the line if (abs(angle - plotAngle) < 1.5707) return distanceFromLine(origin, angle, plot); @@ -68,12 +68,12 @@ float4 main(float2 uv : TEXCOORD) : COLOR opacity = centerOpacity * pow(1 - distanceFromCenter, 2); } - //If we are further from the line than the edge's blending lenght, just don't even do the blending. - if (distanceFromLine > edgeBlendLenght) + //If we are further from the line than the edge's blending length, just don't even do the blending. + if (distanceFromLine > edgeBlendLength) return float4(colour * opacity * mainOpacity, opacity * mainOpacity); //The higher this value is, the more we blend with the edge's opacity & color. - float edgeBlendFactor = pow(1 - distanceFromLine / edgeBlendLenght, edgeBlendStrength); + float edgeBlendFactor = pow(1 - distanceFromLine / edgeBlendLength, edgeBlendStrength); colour = lerp(colour, edgeColor, edgeBlendFactor); opacity = lerp(opacity, 1 * pow(1 - distanceFromCenter, 3), edgeBlendFactor) * mainOpacity; diff --git a/Effects/SwingSprite.fx b/Effects/SwingSprite.fx index 62e1157275..f66e28e90a 100644 --- a/Effects/SwingSprite.fx +++ b/Effects/SwingSprite.fx @@ -1,6 +1,6 @@ float rotation; // The rotation of the sword sprite. //float2 spriteDimensions; //The size of the sprite (necessary as the shader only gives us a map between 0 and 1). -float pommelToOriginPercent; //I have no idea for a better variable name. This is the perccentage of the full lenght between the rotation origin and the sword's tip that is an empty gap between it and the bottom left of the sword. +float pommelToOriginPercent; //I have no idea for a better variable name. This is the perccentage of the full length between the rotation origin and the sword's tip that is an empty gap between it and the bottom left of the sword. float4 color; texture sampleTexture; diff --git a/Effects/WulfrumTilePing.fx b/Effects/WulfrumTilePing.fx index fc44e3ecc8..76db6a0a2e 100644 --- a/Effects/WulfrumTilePing.fx +++ b/Effects/WulfrumTilePing.fx @@ -8,7 +8,7 @@ float pingProgress; //How far along the ping progressed float pingTravelTime; //Percent of the ping's duration during which the ping expands to reach its full radius. float pingFadePoint; //Percent of the ping's duration at which to start fading away. float edgeBlendStrength; //How starkly should the ping's edge fade off. -float edgeBlendOutLenght; //Small lenght at the edge of the wave to blend away smoothly. +float edgeBlendOutLength; //Small length at the edge of the wave to blend away smoothly. float tileEdgeBlendStrenght; //How hard the border of a tile should get blended away. float4 baseTintColor; //Color of the tile's overlay @@ -175,7 +175,7 @@ float4 main(float2 uv : TEXCOORD) : COLOR return float4(0, 0, 0, 0); float waveEdgeDistanceFromCenter = max(currentPingRadius - pingWaveThickness, 0); - float edgeBlendFactor = pow(min(max((distanceFromPingOrigin - (waveEdgeDistanceFromCenter)), 0) / (pingWaveThickness - edgeBlendOutLenght), 1), edgeBlendStrength); + float edgeBlendFactor = pow(min(max((distanceFromPingOrigin - (waveEdgeDistanceFromCenter)), 0) / (pingWaveThickness - edgeBlendOutLength), 1), edgeBlendStrength); float3 ColorTotal = lerp(baseTintColor.rgb, waveColor.rgb, edgeBlendFactor); float OpacityTotal = lerp(baseTintColor.a, waveColor.a, edgeBlendFactor); @@ -193,8 +193,8 @@ float4 main(float2 uv : TEXCOORD) : COLOR } //Fade away the border - if (realPingRadius - distanceFromPingOrigin < edgeBlendOutLenght) - OpacityTotal *= (realPingRadius - distanceFromPingOrigin) / edgeBlendOutLenght; + if (realPingRadius - distanceFromPingOrigin < edgeBlendOutLength) + OpacityTotal *= (realPingRadius - distanceFromPingOrigin) / edgeBlendOutLength; //General fade out at the end. OpacityTotal *= 1 - max(pingProgress - pingFadePoint, 0) / (1 - pingFadePoint); diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index a29b22e500..4cb2fab9d6 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -2,6 +2,9 @@ using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -32,5 +35,22 @@ namespace CalamityMod.Items.Accessories player.moveSpeed += 0.1f; player.jumpSpeedBoost += 0.5f; } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.85f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index 84490cef64..a04f55ecfd 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -1,6 +1,9 @@ using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -49,5 +52,22 @@ namespace CalamityMod.Items.Accessories } public override void UpdateEquip(Player player) => player.Calamity().blazingCursorVisuals = true; + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.5f, + drawOffset: new(0f, -4f) + ); + return false; + } } } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index a4b31fbb72..19c838f011 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -6,6 +6,13 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -52,5 +59,22 @@ namespace CalamityMod.Items.Accessories AddTile(). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.8f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index 0adc1c1bd5..e58b21a483 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -3,6 +3,9 @@ using Terraria; using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -35,5 +38,22 @@ Grants immunity to Dragonfire and Electrified"); player.buffImmune[BuffID.Electrified] = true; player.buffImmune[ModContent.BuffType()] = true; } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.95f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 4acd53afeb..53e2bac153 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Melee attacks and projectiles inflict Hellfire\n" + "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + "20% increased true melee damage\n" + - "Temporary immunity to lava\n" + "Increased melee knockback\n" + "Enables auto swing for melee weapons\n" + "Increases the size of melee weapons"); diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 9e99720081..17caff69b8 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -16,8 +16,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("35% decreased movement speed\n" + "Enemies take damage when they hit you\n" + "You move faster and lose 18 defense for 3 seconds if you take damage\n" + - "Temporary immunity to lava\n" + - "Grants immunity to Armor Crunch"); + "Grants immunity to lava and Armor Crunch"); } public override void SetDefaults() @@ -35,7 +34,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.flameLickedShell = true; player.buffImmune[ModContent.BuffType()] = true; - player.lavaMax += 240; + player.lavaImmune = true; float moveSpeedDecrease = modPlayer.shellBoost ? 0.15f : 0.35f; player.moveSpeed -= moveSpeedDecrease; player.thorns += 0.25f; diff --git a/Items/Accessories/Gehenna.cs b/Items/Accessories/Gehenna.cs index 6954a2053b..58471f2ef5 100644 --- a/Items/Accessories/Gehenna.cs +++ b/Items/Accessories/Gehenna.cs @@ -1,8 +1,10 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; +using Terraria.GameContent; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { @@ -53,7 +55,7 @@ namespace CalamityMod.Items.Accessories { Vector2 spawn = baseSpawn; spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / FireProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; int damage = (int)player.GetBestClassDamage().ApplyTo(54); Projectile.NewProjectile(source, spawn.X, spawn.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, 5f, Main.myPlayer, 0f, 0f); @@ -62,5 +64,22 @@ namespace CalamityMod.Items.Accessories } } } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.8f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 6c4a715b2c..5322460d33 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -3,6 +3,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Accessories { @@ -36,5 +39,22 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.heartOfDarkness = true; } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.8f, + drawOffset: new(-2f, -2f) + ); + return false; + } } } diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index 78888d360d..51ce3c0d21 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -2,10 +2,12 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; using static Terraria.ModLoader.ModContent; @@ -90,5 +92,22 @@ namespace CalamityMod.Items.Accessories Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); } } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index 021279169c..00e314c935 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -6,6 +6,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Accessories { @@ -45,5 +48,22 @@ namespace CalamityMod.Items.Accessories AddTile(TileID.LunarCraftingStation). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.9f, + drawOffset: new(2f, -2f) + ); + return false; + } } } diff --git a/Items/Accessories/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs index dbbc5154b5..5584337ca3 100644 --- a/Items/Accessories/QuiverofNihility.cs +++ b/Items/Accessories/QuiverofNihility.cs @@ -3,9 +3,11 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -63,5 +65,26 @@ namespace CalamityMod.Items.Accessories AddTile(TileID.LunarCraftingStation). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + // This item doesn't follow many of the guidelines + // for this method. + // But I (nalyddd) saw the sprite in-game and felt extremely + // sad about how EXTREMELY squished it was. + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.55f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index f3319bab7d..837d3af6a7 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using System.IO; using System.Linq; @@ -10,6 +11,7 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; +using Terraria.GameContent; using Terraria.ModLoader; using Terraria.ModLoader.IO; @@ -173,6 +175,24 @@ namespace CalamityMod.Items.Accessories level = reader.ReadInt32(); totalRageDamage = reader.ReadInt64(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.5f, + drawOffset: new(0f, 2f) + ); + //return false; + return true; // For some reason, putting this item in an accessory slot hides it UNLESS this returns true. + } } public class ShatteredCommunityPlayer : ModPlayer diff --git a/Items/Accessories/StarTaintedGenerator.cs b/Items/Accessories/StarTaintedGenerator.cs index 68902970c3..bbf095bfb3 100644 --- a/Items/Accessories/StarTaintedGenerator.cs +++ b/Items/Accessories/StarTaintedGenerator.cs @@ -3,6 +3,9 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Accessories { @@ -46,5 +49,22 @@ namespace CalamityMod.Items.Accessories AddTile(TileID.MythrilAnvil). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.8f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 648947b53d..2526bc6bce 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -1,9 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -51,5 +54,22 @@ namespace CalamityMod.Items.Accessories AddTile(TileID.LunarCraftingStation). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 6d408fe3e2..e34fd58ae5 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -7,6 +7,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Accessories { @@ -57,5 +60,22 @@ namespace CalamityMod.Items.Accessories AddTile(). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index a8d9dc3ec3..d39f71a198 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -1,12 +1,14 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -122,5 +124,22 @@ namespace CalamityMod.Items.Accessories "Movement speed increased by " + (moveSpeedIncrease*100).ToString("n1") + "%\n" + "Flight time increased by " + (flightTimeIncrease*100).ToString("n1") + "%"; } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.7f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index 5f7172d754..e30da5dfda 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -65,12 +66,43 @@ namespace CalamityMod.Items.Accessories } } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + return Texture != "CalamityMod/Items/Accessories/TheSponge"; + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { if (Texture == "CalamityMod/Items/Accessories/TheSponge") { + float wantedScale = 0.85f; + Vector2 drawOffset = new(-2f, -1f); + + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale, + drawOffset + ); Texture2D tex = ModContent.Request("CalamityMod/Items/Accessories/TheSpongeShield").Value; - spriteBatch.Draw(tex, position, Main.itemAnimations[Item.type].GetFrame(tex), Color.Cyan * 0.4f, 0f, origin, scale, SpriteEffects.None, 0); + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: tex, + position, + Main.itemAnimations[Item.type].GetFrame(tex), + Color.Cyan * 0.4f, + itemColor, + origin, + scale, + wantedScale, + drawOffset + ); } } diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index 32ee0b7b66..f2912a8a76 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -3,6 +3,9 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; using Terraria.DataStructures; +using Terraria.GameContent; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Accessories { @@ -35,5 +38,22 @@ namespace CalamityMod.Items.Accessories modPlayer.transformer = true; modPlayer.aSpark = true; } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.95f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index b298901d6d..fa8b62e0c0 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -23,8 +23,7 @@ namespace CalamityMod.Items.Accessories "12% increase to all damage\n" + "All attacks inflict Brimstone Flames\n" + "Brimstone fire rains down after getting hit\n" + - "Reduces damage from touching lava\n" + - "Grants immunity to Burning, On Fire!, Brimstone Flames and Searing Lava"); + "Grants immunity to lava, Burning, On Fire!, Brimstone Flames and Searing Lava"); } public override void SetDefaults() @@ -62,7 +61,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.OnFire] = true; player.fireWalk = true; - player.lavaRose = true; + player.lavaImmune = true; player.GetDamage() += 0.12f; if (player.immune) { diff --git a/Items/Accessories/WarbanneroftheSun.cs b/Items/Accessories/WarbanneroftheSun.cs index b2122d0518..de51e797e3 100644 --- a/Items/Accessories/WarbanneroftheSun.cs +++ b/Items/Accessories/WarbanneroftheSun.cs @@ -1,10 +1,12 @@ using System; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories { @@ -95,5 +97,22 @@ namespace CalamityMod.Items.Accessories return bonus; } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.6f, + drawOffset: new(0f, -2f) + ); + return false; + } } } diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index 4cc95f09f5..a773ace06f 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -3,11 +3,13 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories.Wings { @@ -27,8 +29,7 @@ namespace CalamityMod.Items.Accessories.Wings "50% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + - "Immunity to the On Fire! debuff\n" + - "Temporary immunity to lava\n" + + "Immunity to lava and On Fire! debuff\n" + "Being hit for over 200 damage will make you immune for an extended period of time"); ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 12f, 3f); } @@ -66,7 +67,7 @@ namespace CalamityMod.Items.Accessories.Wings player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; player.noFallDmg = true; modPlayer.IBoots = !hideVisual; @@ -92,5 +93,22 @@ namespace CalamityMod.Items.Accessories.Wings AddTile(). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.8f, + drawOffset: new(1f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index 304469c9b5..423cef4724 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -3,11 +3,13 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.DataStructures; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories.Wings { @@ -27,8 +29,7 @@ namespace CalamityMod.Items.Accessories.Wings "36% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + - "Immunity to the On Fire! debuff\n" + - "Temporary immunity to lava"); + "Immunity to lava and On Fire! debuff"); ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 10.5f, 2.75f); } @@ -65,7 +66,7 @@ namespace CalamityMod.Items.Accessories.Wings player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; player.noFallDmg = true; modPlayer.IBoots = !hideVisual; @@ -92,5 +93,22 @@ namespace CalamityMod.Items.Accessories.Wings AddTile(). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.9f, + drawOffset: new(1f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 3743c75dda..e5995309cc 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 2.7\n" + "Great vertical speed\n" + "Flight time: 240\n" + - "Temporary immunity to lava and 10% increased movement speed"); + "Grants immunity to lava and 10% increased movement speed"); ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(240, 9.5f, 2.7f); } @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories.Wings { CalamityPlayer modPlayer = player.Calamity(); player.moveSpeed += 0.1f; - player.lavaMax += 240; + player.lavaImmune = true; player.noFallDmg = true; modPlayer.elysianFire = true; if (hideVisual) diff --git a/Items/Accessories/Wings/SeraphTracers.cs b/Items/Accessories/Wings/SeraphTracers.cs index 5c888cd70a..3af9dd28ae 100644 --- a/Items/Accessories/Wings/SeraphTracers.cs +++ b/Items/Accessories/Wings/SeraphTracers.cs @@ -1,10 +1,12 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.GameContent; namespace CalamityMod.Items.Accessories.Wings { @@ -25,8 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings "24% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + - "Immunity to the On Fire! debuff\n" + - "Temporary immunity to lava"); + "Immunity to lava and On Fire! debuff"); ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(140, 9f, 2.6f); } @@ -63,7 +64,7 @@ namespace CalamityMod.Items.Accessories.Wings player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; player.noFallDmg = true; modPlayer.IBoots = !hideVisual; @@ -88,5 +89,22 @@ namespace CalamityMod.Items.Accessories.Wings AddTile(TileID.LunarCraftingStation). Register(); } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.9f, + drawOffset: new(1f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index e3d2c20b17..eb89b9e534 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -4,6 +4,9 @@ using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ID; +using Terraria.GameContent; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Items.Accessories.Wings { @@ -75,5 +78,22 @@ namespace CalamityMod.Items.Accessories.Wings } } } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(0f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index 3991b4f766..210549b135 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -120,9 +120,9 @@ namespace CalamityMod.Items.Accessories /// public int Grapple = 0; /// - /// The lenght of the current rope. Determined when the grapple lands. + /// The length of the current rope. Determined when the grapple lands. /// - public float SwingLenght = 0f; + public float SwingLength = 0f; /// /// Used when we need to store the hook between instructions. /// @@ -145,7 +145,7 @@ namespace CalamityMod.Items.Accessories if (!PlayerOnGround) return false; - if ((Player.Center - Main.projectile[Grapple].Center).Length() > SwingLenght) + if ((Player.Center - Main.projectile[Grapple].Center).Length() > SwingLength) return false; return true; @@ -223,7 +223,7 @@ namespace CalamityMod.Items.Accessories if (Grappled) { - if ((Main.projectile[Grapple].Center - Player.Center).Length() > SwingLenght + 80f) + if ((Main.projectile[Grapple].Center - Player.Center).Length() > SwingLength + 80f) { SoundEngine.PlaySound(WulfrumAcrobaticsPack.ReleaseSound, Main.projectile[Grapple].Center); Main.projectile[Grapple].Kill(); @@ -235,7 +235,7 @@ namespace CalamityMod.Items.Accessories public void SimulateMovement(Projectile grapple) { - Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SwingLenght / SimulationResolution, 50, 0.3f * Player.gravDir); + Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SwingLength / SimulationResolution, 50, 0.3f * Player.gravDir); Vector2 CurrentPosition; diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 7703adcab0..c88ad3caba 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -16,8 +16,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("10% increased damage when under 50% life\n" + "10% increased melee speed\n" + "10% increased melee and true melee damage\n" + - "Melee attacks and melee projectiles inflict holy fire\n" + - "Temporary immunity to lava\n" + + "All melee attacks inflict Holy Flames\n" + "Increased melee knockback"); } diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs index 38a21e90df..d370b247ae 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs @@ -54,7 +54,6 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.godSlayerRanged = true; modPlayer.auricSet = true; player.thorns += 3f; - player.lavaMax += 240; player.ignoreWater = true; player.crimsonRegen = true; diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs index 106f0144f0..a59b968526 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.rogueStealthMax += 1.3f; modPlayer.wearingRogueArmor = true; player.thorns += 3f; - player.lavaMax += 240; player.ignoreWater = true; player.crimsonRegen = true; diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs index b6c33a061e..c68b7bad90 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.godSlayerDamage = true; modPlayer.auricSet = true; player.thorns += 3f; - player.lavaMax += 240; player.ignoreWater = true; player.crimsonRegen = true; player.aggro += 1200; diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs index 4a20f72592..13c3e1eaa1 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.auricSet = true; modPlayer.WearingPostMLSummonerSet = true; player.thorns += 3f; - player.lavaMax += 240; player.ignoreWater = true; player.crimsonRegen = true; player.GetDamage() += 0.75f; diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs index 97a6d30993..c966720fb7 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs @@ -54,7 +54,6 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.silvaMage = true; modPlayer.auricSet = true; player.thorns += 3f; - player.lavaMax += 240; player.ignoreWater = true; player.crimsonRegen = true; } diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index f4f681f6cc..06e7c6c16b 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { SacrificeTotal = 1; DisplayName.SetDefault("Bloodflare Hydra Hood"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "20% increased magic damage, 10% increased magic critical strike chance, +100 max mana and 17% reduced mana usage"); + Tooltip.SetDefault("20% increased magic damage, 10% increased magic critical strike chance, +100 max mana and 17% reduced mana usage"); } public override void SetDefaults() @@ -54,8 +53,6 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void UpdateEquip(Player player) { player.manaCost *= 0.83f; - player.lavaMax += 240; - player.ignoreWater = true; player.GetDamage() += 0.2f; player.GetCritChance() += 10; player.statManaMax2 += 100; diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index 6f263fd506..c71fe90c2d 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { SacrificeTotal = 1; DisplayName.SetDefault("Bloodflare Ram Mask"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased melee damage and critical strike chance"); + Tooltip.SetDefault("10% increased melee damage and critical strike chance"); } public override void SetDefaults() @@ -57,8 +56,6 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; player.GetDamage() += 0.1f; player.GetCritChance() += 10; } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index e6c066fd0a..1f285dadbe 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { SacrificeTotal = 1; DisplayName.SetDefault("Bloodflare Horned Helm"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased ranged damage and critical strike chance"); + Tooltip.SetDefault("10% increased ranged damage and critical strike chance"); } public override void SetDefaults() @@ -58,8 +57,6 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; player.GetDamage() += 0.1f; player.GetCritChance() += 10; } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index d706579ad9..dad3c9f094 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { SacrificeTotal = 1; DisplayName.SetDefault("Bloodflare Imp Mask"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased rogue damage and critical strike chance, 5% increased movement speed"); + Tooltip.SetDefault("10% increased rogue damage and critical strike chance, 5% increased movement speed"); } public override void SetDefaults() @@ -57,8 +56,6 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; player.GetDamage() += 0.1f; player.GetCritChance() += 10; player.moveSpeed += 0.05f; diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 30c8c23940..754b15047f 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Armor.Bloodflare { SacrificeTotal = 1; DisplayName.SetDefault("Bloodflare Wyvern Helm"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "5% increased minion damage"); + Tooltip.SetDefault("5% increased minion damage"); } public override void SetDefaults() @@ -58,8 +57,6 @@ namespace CalamityMod.Items.Armor.Bloodflare public override void UpdateEquip(Player player) { - player.lavaMax += 240; - player.ignoreWater = true; player.GetDamage() += 0.05f; } diff --git a/Items/Armor/Brimflame/BrimflameRobes.cs b/Items/Armor/Brimflame/BrimflameRobes.cs index be9b03a493..857b11b37d 100644 --- a/Items/Armor/Brimflame/BrimflameRobes.cs +++ b/Items/Armor/Brimflame/BrimflameRobes.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.Armor.Brimflame { SacrificeTotal = 1; DisplayName.SetDefault("Brimflame Robes"); - Tooltip.SetDefault("5% increased magic damage and critical strike chance\n" + - "Reduces damage from touching lava"); + Tooltip.SetDefault("5% increased magic damage and critical strike chance"); if (Main.netMode == NetmodeID.Server) return; @@ -37,13 +36,11 @@ namespace CalamityMod.Items.Armor.Brimflame { player.GetDamage() += 0.05f; player.GetCritChance() += 5; - player.lavaRose = true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.ObsidianRose). AddIngredient(8). AddIngredient(4). AddTile(TileID.MythrilAnvil). diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index b15042202f..9b34d05d69 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Armor.Empyrean { SacrificeTotal = 1; DisplayName.SetDefault("Empyrean Mask"); - Tooltip.SetDefault("11% increased rogue damage and critical strike chance, 5% increased movement speed\n" + - "Temporary immunity to lava"); + Tooltip.SetDefault("11% increased rogue damage and critical strike chance, 5% increased movement speed"); if (Main.netMode == NetmodeID.Server) return; @@ -87,7 +86,6 @@ namespace CalamityMod.Items.Armor.Empyrean player.GetDamage() += 0.11f; player.GetCritChance() += 11; player.moveSpeed += 0.05f; - player.lavaMax += 240; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index 511f16eaca..dc90aeaafe 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic SacrificeTotal = 1; DisplayName.SetDefault("Hydrothermic Mask"); Tooltip.SetDefault("12% increased magic damage, +100 max mana, and 10% increased magic critical strike chance\n" + - "Temporary immunity to lava, and immunity to fire damage"); + "Grants immunity to lava and On Fire! debuff"); } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic player.statManaMax2 += 100; player.GetDamage() += 0.12f; player.GetCritChance() += 10; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index af0cb054c7..4011552e24 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic Tooltip.SetDefault("12% increased melee damage and 10% increased melee critical strike chance\n" + "18% increased melee speed\n" + "Melee attacks and melee projectiles inflict on fire\n" + - "Temporary immunity to lava and immunity to fire damage"); + "Grants immunity to lava and On Fire! debuff"); } public override void SetDefaults() @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic player.GetAttackSpeed() += 0.18f; player.GetDamage() += 0.12f; player.GetCritChance() += 10; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index 850b1a363d..1cce9a86ec 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Armor.Hydrothermic SacrificeTotal = 1; DisplayName.SetDefault("Hydrothermic Headgear"); Tooltip.SetDefault("12% increased ranged damage and 10% increased ranged critical strike chance\n" + - "Reduces ammo usage by 25%, temporary immunity to lava, and immunity to fire damage"); + "Reduces ammo usage by 25%\n" + + "Grants immunity to lava and On Fire! debuff"); } public override void SetDefaults() @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic player.ammoCost75 = true; player.GetDamage() += 0.12f; player.GetCritChance() += 10; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index 56eb524c35..128ba83a41 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic DisplayName.SetDefault("Hydrothermic Hood"); Tooltip.SetDefault("12% increased rogue damage and 10% increased rogue critical strike chance\n" + "50% chance to not consume rogue items and 5% increased movement speed\n" + - "Temporary immunity to lava and immunity to fire damage"); + "Grants immunity to lava and On Fire! debuff"); } public override void SetDefaults() @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic player.GetDamage() += 0.12f; player.GetCritChance() += 10; player.moveSpeed += 0.05f; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index af8843c8e4..43e3a05a6b 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic SacrificeTotal = 1; DisplayName.SetDefault("Hydrothermic Helmet"); Tooltip.SetDefault("5% increased minion damage and increased minion knockback\n" + - "Temporary immunity to lava and immunity to fire damage"); + "Grants immunity to lava and On Fire! debuff"); } public override void SetDefaults() @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { player.GetDamage() += 0.05f; player.GetKnockback() += 1.5f; - player.lavaMax += 240; + player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index 633a18c3da..cca55d40cf 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Reaver SacrificeTotal = 1; DisplayName.SetDefault("Reaver Headgear"); Tooltip.SetDefault("40% increased pick speed and block/wall placement speed\n" + - "Temporary immunity to lava and can move freely through liquids"); + "Grants immunity to lava and can move freely through liquids"); } public override void SetDefaults() @@ -74,10 +74,10 @@ namespace CalamityMod.Items.Armor.Reaver public override void UpdateEquip(Player player) { player.ignoreWater = true; + player.lavaImmune = true; player.pickSpeed -= 0.4f; player.tileSpeed += 0.4f; player.wallSpeed += 0.4f; - player.lavaMax += 420; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadMagic.cs b/Items/Armor/Tarragon/TarragonHeadMagic.cs index f6905b09dd..cc4c469fca 100644 --- a/Items/Armor/Tarragon/TarragonHeadMagic.cs +++ b/Items/Armor/Tarragon/TarragonHeadMagic.cs @@ -15,9 +15,7 @@ namespace CalamityMod.Items.Armor.Tarragon { SacrificeTotal = 1; DisplayName.SetDefault("Tarragon Mask"); - Tooltip.SetDefault("Temporary immunity to lava\n" + - "Can move freely through liquids\n" + - "20% increased magic damage and 10% increased magic critical strike chance\n" + + Tooltip.SetDefault("20% increased magic damage and 10% increased magic critical strike chance\n" + "5% increased damage reduction, +100 max mana, and 15% reduced mana usage"); } @@ -60,9 +58,7 @@ namespace CalamityMod.Items.Armor.Tarragon player.GetDamage() += 0.2f; player.GetCritChance() += 10; player.endurance += 0.05f; - player.lavaMax += 240; player.statManaMax2 += 100; - player.ignoreWater = true; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index 435e2de593..e777966d20 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -15,10 +15,8 @@ namespace CalamityMod.Items.Armor.Tarragon { SacrificeTotal = 1; DisplayName.SetDefault("Tarragon Helm"); - Tooltip.SetDefault("Temporary immunity to lava\n" + - "Can move freely through liquids\n" + - "5% increased damage reduction\n" + - "10% increased melee damage and critical strike chance"); + Tooltip.SetDefault("10% increased melee damage and critical strike chance\n" + + "5% increased damage reduction"); } public override void SetDefaults() @@ -61,8 +59,6 @@ namespace CalamityMod.Items.Armor.Tarragon player.GetDamage() += 0.1f; player.GetCritChance() += 10; player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index 5cc259e4be..fac7bbc879 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -15,9 +15,7 @@ namespace CalamityMod.Items.Armor.Tarragon { SacrificeTotal = 1; DisplayName.SetDefault("Tarragon Visage"); - Tooltip.SetDefault("Temporary immunity to lava\n" + - "Can move freely through liquids\n" + - "10% increased ranged damage and critical strike chance\n" + + Tooltip.SetDefault("10% increased ranged damage and critical strike chance\n" + "5% increased damage reduction"); } @@ -57,8 +55,6 @@ namespace CalamityMod.Items.Armor.Tarragon player.GetDamage() += 0.1f; player.GetCritChance() += 10; player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadRogue.cs b/Items/Armor/Tarragon/TarragonHeadRogue.cs index f299a3b901..1373e07754 100644 --- a/Items/Armor/Tarragon/TarragonHeadRogue.cs +++ b/Items/Armor/Tarragon/TarragonHeadRogue.cs @@ -15,10 +15,8 @@ namespace CalamityMod.Items.Armor.Tarragon { SacrificeTotal = 1; DisplayName.SetDefault("Tarragon Helmet"); - Tooltip.SetDefault("Temporary immunity to lava\n" + - "Can move freely through liquids, 5% increased movement speed\n" + - "10% increased rogue damage and critical strike chance\n" + - "5% increased damage reduction"); + Tooltip.SetDefault("10% increased rogue damage and critical strike chance\n" + + "5% increased damage reduction and movement speed"); } public override void SetDefaults() @@ -63,8 +61,6 @@ namespace CalamityMod.Items.Armor.Tarragon player.GetCritChance() += 10; player.moveSpeed += 0.05f; player.endurance += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadSummon.cs b/Items/Armor/Tarragon/TarragonHeadSummon.cs index f193492035..8b8f2472b5 100644 --- a/Items/Armor/Tarragon/TarragonHeadSummon.cs +++ b/Items/Armor/Tarragon/TarragonHeadSummon.cs @@ -15,9 +15,7 @@ namespace CalamityMod.Items.Armor.Tarragon { SacrificeTotal = 1; DisplayName.SetDefault("Tarragon Horned Helm"); - Tooltip.SetDefault("Temporary immunity to lava\n" + - "Can move freely through liquids\n" + - "5% increased damage reduction and minion damage"); + Tooltip.SetDefault("5% increased minion damage and damage reduction"); } public override void SetDefaults() @@ -59,8 +57,6 @@ namespace CalamityMod.Items.Armor.Tarragon { player.endurance += 0.05f; player.GetDamage() += 0.05f; - player.lavaMax += 240; - player.ignoreWater = true; } public override void AddRecipes() diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 26ef6834ff..ce92cdd26f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -145,10 +145,6 @@ namespace CalamityMod.Items if (item.type == ItemID.EoCShield) CannotBeEnchanted = true; - // Star Cannon no longer makes noise. - if (item.type == ItemID.StarCannon) - item.UseSound = null; - // Fix Bones being attracted to the player when you have open ammo slots. if (item.type == ItemID.Bone) item.notAmmo = true; @@ -500,17 +496,6 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.StarCannon) - { - Vector2 muzzleOffset = velocity.SafeNormalize(Vector2.Zero) * 5f; - if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) - { - position += muzzleOffset; - } - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - SoundEngine.PlaySound(SoundID.Item11 with { PitchVariance = 0.05f }, position); - return false; - } if (item.type == ItemID.PearlwoodBow) { for (int i = 0; i < Main.maxProjectiles; i++) diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index 17222cd623..3cfa3507dd 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -4,7 +4,10 @@ using CalamityMod.Tiles; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -12,56 +15,79 @@ namespace CalamityMod.Items.Materials { public class AuricBar : ModItem { - public int frameCounter = 0; - public int frame = 0; + public static Asset GlowTexture { get; private set; } + + public override void Load() + { + if (!Main.dedServ) + { + GlowTexture = ModContent.Request($"{Texture}_Glow"); + } + } + public override void SetStaticDefaults() { SacrificeTotal = 25; - ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Auric Bar"); Tooltip.SetDefault("Boundless power emanates from the metal"); + ItemID.Sets.SortingPriorityMaterials[Type] = 120; + ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.ItemNoGravity[Item.type] = true; + + Main.RegisterItemAnimation( + Type, + new DrawAnimationVertical(5, 12) /* 5 ticks per frame, has 12 frames total */ + ); + } + + public override void Unload() + { + GlowTexture = null; } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); - Item.width = 62; - Item.height = 44; - Item.maxStack = 999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 60); Item.rare = ModContent.RarityType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; } + public override void UseStyle(Player player, Rectangle heldItemFrame) { player.itemLocation += new Vector2(-20f * player.direction, 15f * player.gravDir).RotatedBy(player.itemRotation); } - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBar_Animated").Value; - spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(-1f, 0f) + ); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBar_Animated").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/AuricBarGlow").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12, false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + var frame = Item.GetFrame(whoAmI); + var position = Item.Center - Main.screenPosition; + var origin = frame.Size() / 2f; + spriteBatch.Draw(TextureAssets.Item[Type].Value, position, frame, lightColor, rotation, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(GlowTexture.Value, position, frame, lightColor, rotation, origin, scale, SpriteEffects.None, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/AuricBar.png b/Items/Materials/AuricBar.png index b25eab570d..3f6b3f271a 100644 Binary files a/Items/Materials/AuricBar.png and b/Items/Materials/AuricBar.png differ diff --git a/Items/Materials/AuricBar_Animated.png b/Items/Materials/AuricBar_Animated.png deleted file mode 100644 index 3f6b3f271a..0000000000 Binary files a/Items/Materials/AuricBar_Animated.png and /dev/null differ diff --git a/Items/Materials/AuricBarGlow.png b/Items/Materials/AuricBar_Glow.png similarity index 100% rename from Items/Materials/AuricBarGlow.png rename to Items/Materials/AuricBar_Glow.png diff --git a/Items/Materials/CryonicBar.cs b/Items/Materials/CryonicBar.cs index 091bb752f1..81a5d95cf8 100644 --- a/Items/Materials/CryonicBar.cs +++ b/Items/Materials/CryonicBar.cs @@ -1,6 +1,9 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -12,25 +15,36 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { SacrificeTotal = 25; + DisplayName.SetDefault("Cryonic Bar"); + ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 30; - Item.height = 24; - Item.maxStack = 999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Pink; } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(-2f, 0f) + ); + return false; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Materials/ScoriaBar.cs b/Items/Materials/ScoriaBar.cs index 09ae686d83..6809dbe06f 100644 --- a/Items/Materials/ScoriaBar.cs +++ b/Items/Materials/ScoriaBar.cs @@ -3,6 +3,8 @@ using CalamityMod.Tiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,42 +13,43 @@ namespace CalamityMod.Items.Materials [LegacyName("CruptixBar")] public class ScoriaBar : ModItem { - public int frameCounter = 0; - public int frame = 0; public override void SetStaticDefaults() { SacrificeTotal = 25; + DisplayName.SetDefault("Scoria Bar"); Tooltip.SetDefault("The smoke feels warm"); - ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment + + ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment + ItemID.Sets.AnimatesAsSoul[Type] = true; + + Main.RegisterItemAnimation( + Type, + new DrawAnimationVertical(6, 6) /* 6 ticks per frame, has 6 frames total */ + ); } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.width = 40; - Item.height = 52; - Item.maxStack = 999; + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 1, silver: 20); Item.rare = ItemRarityID.Yellow; } - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/ScoriaBar_Animated").Value; - spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); - return false; - } - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/ScoriaBar_Animated").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(5f, -12f) + ); return false; } diff --git a/Items/Materials/ScoriaBar.png b/Items/Materials/ScoriaBar.png index f1adabf4a3..670ec3fa3a 100644 Binary files a/Items/Materials/ScoriaBar.png and b/Items/Materials/ScoriaBar.png differ diff --git a/Items/Materials/ScoriaBar_Animated.png b/Items/Materials/ScoriaBar_Animated.png deleted file mode 100644 index 670ec3fa3a..0000000000 Binary files a/Items/Materials/ScoriaBar_Animated.png and /dev/null differ diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 11531a20a4..7e88c1677c 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -4,6 +4,8 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,51 +13,55 @@ namespace CalamityMod.Items.Materials { public class ShadowspecBar : ModItem { - public int frameCounter = 0; - public int frame = 0; - public override void SetStaticDefaults() { SacrificeTotal = 25; + DisplayName.SetDefault("Shadowspec Bar"); Tooltip.SetDefault("A vile, black metal, so horrendous and powerful as to defy explanation"); - ItemID.Sets.SortingPriorityMaterials[Type] = 124; + + ItemID.Sets.SortingPriorityMaterials[Type] = 124; + ItemID.Sets.AnimatesAsSoul[Type] = true; + + Main.RegisterItemAnimation( + Type, + new DrawAnimationVertical(8, 8) /* 8 ticks per frame, has 8 frames total */ + ); } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); - Item.width = 38; - Item.height = 40; - Item.maxStack = 999; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(platinum: 1, gold: 92); Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/ShadowspecBar_Animated").Value; - spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), Color.White, 0f, origin, scale, SpriteEffects.None, 0); - return false; - } - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/ShadowspecBar_Animated").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 8), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1f, + drawOffset: new(0f, -6f) + ); return false; } public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe() + .AddIngredient() + .AddIngredient() + .AddIngredient() + .AddTile() + .Register(); } } } diff --git a/Items/Materials/ShadowspecBar.png b/Items/Materials/ShadowspecBar.png index e72285c779..3edf7a49f9 100644 Binary files a/Items/Materials/ShadowspecBar.png and b/Items/Materials/ShadowspecBar.png differ diff --git a/Items/Materials/ShadowspecBar_Animated.png b/Items/Materials/ShadowspecBar_Animated.png deleted file mode 100644 index 3edf7a49f9..0000000000 Binary files a/Items/Materials/ShadowspecBar_Animated.png and /dev/null differ diff --git a/Items/Placeables/Banners/CosmicElementalBanner.png b/Items/Placeables/Banners/CosmicElementalBanner.png index 90ef0d5ef1..94d9a93c61 100644 Binary files a/Items/Placeables/Banners/CosmicElementalBanner.png and b/Items/Placeables/Banners/CosmicElementalBanner.png differ diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index 81c1c9010d..a2e0f6811a 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.SummonItems { SacrificeTotal = 1; DisplayName.SetDefault("Eye of Desolation"); - Tooltip.SetDefault("Tonight is going to be a horrific night...\n" + + Tooltip.SetDefault("This is going to be a horrific night...\n" + "Summons the Calamitas Clone when used during nighttime\n" + "Enrages during the day\n" + "Not consumable"); diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index 9861f2bb5e..6eb1147d27 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 128; + Item.damage = 96; Item.DamageType = DamageClass.Magic; Item.mana = 18; Item.width = 56; diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index b5e9cb1404..b5a1945f04 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.mana = 13; Item.width = 28; Item.height = 30; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = 20; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 391440ceb6..ce1a778a8d 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -11,58 +10,73 @@ namespace CalamityMod.Items.Weapons.Magic { public class ShaderainStaff : ModItem { + #region Other stats + + // Stats for the shaderain. + public const int RainAmount = 3; + public const float LesserRainVELMultiplier = 0.75f; // The lowest speed modifier the rain can get. + public const float HigherRainVELMultiplier = 1.25f; // The highest speed modifier the rain can get. + public const float GravityStrenght = 0.15f; + + // Stats for the shade clouds. + public const int FadeoutSpeed = 2; + public const float CloudDMGMultiplier = 1.25f; + public const float CloudVELMultiplier = 1.25f; + public const float DeaccelerationStrenght = 0.95f; // A number lower than 1, non-including 1, changing it very slightly will have drastic results. + + #endregion + public override void SetStaticDefaults() { DisplayName.SetDefault("Shaderain Staff"); - Tooltip.SetDefault("Fires a shade storm cloud"); + Tooltip.SetDefault("Fires a spray of evil clouds and rain"); + Item.staff[Item.type] = true; SacrificeTotal = 1; } public override void SetDefaults() { Item.damage = 21; - Item.DamageType = DamageClass.Magic; + Item.shootSpeed = 10f; + Item.useTime = Item.useAnimation = 25; Item.mana = 10; - Item.width = 42; - Item.height = 42; - Item.useTime = 25; - Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; + + Item.shoot = ModContent.ProjectileType(); + + Item.width = Item.height = 42; + Item.DamageType = DamageClass.Magic; + Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item66; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.autoReuse = true; + Item.noMelee = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float num72 = Item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + // Shoots the shaderain. + for (int shadeRainIndex = 0; shadeRainIndex < RainAmount; shadeRainIndex++) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + Projectile.NewProjectile(source, + player.Center, + velocity * Main.rand.NextFloat(LesserRainVELMultiplier, HigherRainVELMultiplier), + type, + damage, + knockback, + player.whoAmI); } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num154 = Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - Main.projectile[num154].ai[0] = (float)Main.mouseX + Main.screenPosition.X; - Main.projectile[num154].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; + + // Shoots the small cloud. + Projectile.NewProjectile(source, + player.Center, + velocity * CloudVELMultiplier, + ModContent.ProjectileType(), + (int)(damage * CloudDMGMultiplier), + knockback, + player.whoAmI); + return false; } diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 4a36e0e062..50111eebac 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.mana = 18; Item.width = 28; Item.height = 30; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = 20; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index a85ef0f5e5..dba6012edf 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public float Combo = 0f; public float Charge = 0f; - public const float ComboLenght = 4f; //How many regular swings before the long throw happens + public const float ComboLength = 4f; //How many regular swings before the long throw happens public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap public static float chargeDamageMultiplier = 1.2f; //Extra damage from charge @@ -146,12 +146,12 @@ namespace CalamityMod.Items.Weapons.Melee if (Charge > 0) damage = (int)(chargeDamageMultiplier * damage); - float scissorState = Combo == ComboLenght ? 2 : Combo % 2; + float scissorState = Combo == ComboLength ? 2 : Combo % 2; Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, knockback, player.whoAmI, scissorState, Charge); Combo += 1; - if (Combo > ComboLenght) + if (Combo > ComboLength) Combo = 0; diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index 5995680da1..031860c285 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Carnage"); - Tooltip.SetDefault("Enemies explode into homing blood on death"); + Tooltip.SetDefault("Slain enemies erupt into homing blood"); SacrificeTotal = 1; } @@ -36,58 +36,63 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { + // Spawn occasional blood dust if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } + Dust.NewDust(hitbox.TopLeft(), hitbox.Width, hitbox.Height, DustID.Blood); } + // Carnage's on-hits only occur on valid enemies. Specifically won't trigger on statues. public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - OnHitEffects(player, target.life <= 0, target.Center, target.width, target.height, knockback); + if (target.life > 0 || !target.IsAnEnemy(allowStatues: false)) + return; + OnHitEffects(player, target, knockback); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - OnHitEffects(player, target.statLife <= 0, target.Center, target.width, target.height, Item.knockBack); + if (target.statLife > 0) + return; + OnHitEffects(player, target, Item.knockBack); } - private void OnHitEffects(Player player, bool health, Vector2 targetPos, int targetWidth, int targetHeight, float kBack) + private void OnHitEffects(Player player, Entity target, float kb) { - if (health) + var source = player.GetSource_ItemUse(Item); + + // Play sound + SoundEngine.PlaySound(SoundID.Item74, target.Center); + + // Dust loop 1 + for (int i = 0; i < 15; i++) { - var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item74, targetPos); - targetPos.X += (float)(targetWidth / 2); - targetPos.Y += (float)(targetHeight / 2); - targetPos.X -= (float)(targetWidth / 2); - targetPos.Y -= (float)(targetHeight / 2); - for (int i = 0; i < 15; i++) + int idx = Dust.NewDust(target.position, target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 3f; + if (Main.rand.NextBool(2)) { - int idx = Dust.NewDust(targetPos, targetWidth, targetHeight, 5, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int i = 0; i < 25; i++) - { - int idx = Dust.NewDust(targetPos, targetWidth, targetHeight, 5, 0f, 0f, 100, default, 3f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(targetPos, targetWidth, targetHeight, 5, 0f, 0f, 100, default, 2f); - Main.dust[idx].velocity *= 2f; - } - int bloodAmt = Main.rand.Next(4, 6); - int bloodDamage = player.CalcIntDamage(Item.damage); - for (int i = 0; i < bloodAmt; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(source, targetPos, velocity, ModContent.ProjectileType(), bloodDamage, kBack, player.whoAmI, 0f, 0f); + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } + + // Dust loop 2 + for (int i = 0; i < 25; i++) + { + int idx = Dust.NewDust(target.position, target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 3f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 5f; + idx = Dust.NewDust(target.position, target.width, target.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 2f; + } + + // 6-8 blood projectiles spawned on kill + int bloodAmt = Main.rand.Next(6, 9); + int bloodDamage = player.CalcIntDamage(0.3f * Item.damage); + for (int i = 0; i < bloodAmt; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(source, target.Center, velocity, ModContent.ProjectileType(), bloodDamage, kb, player.whoAmI, 0f, 0f); + } } } } diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index 4da22b6c95..7c198094f3 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 100; Item.height = 100; Item.autoReuse = true; - Item.useAnimation = Item.useTime = 72; + Item.useAnimation = Item.useTime = 64; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs index c3dc632176..fb628294e3 100644 --- a/Items/Weapons/Melee/SeashineSword.cs +++ b/Items/Weapons/Melee/SeashineSword.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.damage = 26; Item.DamageType = DamageClass.Melee; Item.value = CalamityGlobalItem.Rarity2BuyPrice; - Item.width = 38; - Item.height = 38; + Item.width = 40; + Item.height = 40; Item.knockBack = 2; Item.shootSpeed = 11; Item.rare = ItemRarityID.Green; diff --git a/Items/Weapons/Melee/SeashineSword.png b/Items/Weapons/Melee/SeashineSword.png index fa76f21e2c..ec74860678 100644 Binary files a/Items/Weapons/Melee/SeashineSword.png and b/Items/Weapons/Melee/SeashineSword.png differ diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 0a4777805a..d394f580d1 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 84; - Item.height = 90; + Item.width = 90; + Item.height = 100; Item.scale = 1.5f; Item.damage = 480; Item.DamageType = DamageClass.Melee; diff --git a/Items/Weapons/Melee/StellarStriker.png b/Items/Weapons/Melee/StellarStriker.png index c7e784e190..f8932765d9 100644 Binary files a/Items/Weapons/Melee/StellarStriker.png and b/Items/Weapons/Melee/StellarStriker.png differ diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 7b23c08877..dd2f4a44d4 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Clockwork Bow"); - Tooltip.SetDefault("Hold left click to load up to six precision bolts\n" + - "The more precision bolts are loaded, the harder they hit"); + Tooltip.SetDefault("Hold to load up to six homing precision bolts\n" + + "Loads slightly faster when continuously used"); SacrificeTotal = 1; } @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.width = 48; Item.height = 96; - Item.useTime = 60; - Item.useAnimation = 30; + Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 8e190b21d1..411ddcf7b0 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -55,10 +55,10 @@ namespace CalamityMod.Items.Weapons.Ranged Rectangle targetHitbox = target.Hitbox; float collisionPoint = 0f; - float gunLenght = 66f; + float gunLength = 66f; float gunHeight = 15; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLenght), gunHeight, ref collisionPoint) ? null : false; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLength), gunHeight, ref collisionPoint) ? null : false; } 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/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 759a1283eb..db9e17aa8c 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -48,10 +48,10 @@ namespace CalamityMod.Items.Weapons.Ranged Rectangle targetHitbox = target.Hitbox; float collisionPoint = 0f; - float gunLenght = 60f; + float gunLength = 60f; float gunHeight = 26f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLenght), gunHeight, ref collisionPoint) ? null : false; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLength), gunHeight, ref collisionPoint) ? null : false; } 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/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index 38eaf88a45..9ffe57c102 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -106,8 +106,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - float aimLenght = (Main.MouseWorld - player.MountedCenter).Length(); - float damageMult = MathHelper.Lerp(1f, MaxDamageFalloff, Math.Clamp(aimLenght - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance)); + float aimLength = (Main.MouseWorld - player.MountedCenter).Length(); + float damageMult = MathHelper.Lerp(1f, MaxDamageFalloff, Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance)); damage = (int)(damage * damageMult); } @@ -116,8 +116,8 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().GeneralScreenShakePower < 3f) player.Calamity().GeneralScreenShakePower = 3f; - float aimLenght = (Main.MouseWorld - player.MountedCenter).Length(); - float spreadDistance = Math.Clamp(aimLenght - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance); + float aimLength = (Main.MouseWorld - player.MountedCenter).Length(); + float spreadDistance = Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance); float spread = MathHelper.Lerp(MaxSpread, MinSpread, spreadDistance); Vector2 nuzzleDir = velocity.SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index e65d20420f..7a53681bff 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 44; + Item.width = 48; Item.damage = 16; Item.noMelee = true; Item.noUseGraphic = true; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 44; + Item.height = 48; Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/Crystalline.png b/Items/Weapons/Rogue/Crystalline.png index 36c2b34b8f..14a0bd0c4b 100644 Binary files a/Items/Weapons/Rogue/Crystalline.png and b/Items/Weapons/Rogue/Crystalline.png differ diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 65e28f2f96..0236c09c16 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 17; Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); - Item.width = 26; + Item.width = 28; Item.height = 20; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Rogue/ThrowingBrick.png b/Items/Weapons/Rogue/ThrowingBrick.png index 0f749d88f0..d7ecc59d8b 100644 Binary files a/Items/Weapons/Rogue/ThrowingBrick.png and b/Items/Weapons/Rogue/ThrowingBrick.png differ diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 869db11aeb..8219bc29e8 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -12,35 +12,35 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Herring Staff"); - Tooltip.SetDefault("Summons a herring to fight for you\n" + - "Each herring takes only half of a minion slot"); + Tooltip.SetDefault("Summons a group of herrings to fight for you"); SacrificeTotal = 1; } public override void SetDefaults() { Item.damage = 17; + Item.knockBack = 1.25f; Item.mana = 10; + + Item.shoot = ModContent.ProjectileType(); + Item.width = Item.height = 48; Item.useTime = Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 1.25f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item21; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.DamageType = DamageClass.Summon; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item21; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.autoReuse = true; + Item.noMelee = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; - velocity = Vector2.Zero; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 249e94b807..7ea27c4d1d 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -10,6 +10,14 @@ namespace CalamityMod.Items.Weapons.Summon { public class SandSharknadoStaff : ModItem { + #region Other stats for easy modifcation + + public const float ProjVel = 30f; + + public const float FireSpeed = 120f; // In frames. 60 frames = 2 seconds. + + #endregion + public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Sharknado Staff"); @@ -20,32 +28,31 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { Item.damage = 47; + Item.knockBack = 2f; Item.mana = 10; + + Item.shoot = ModContent.ProjectileType(); + Item.width = 48; Item.height = 56; Item.useTime = Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; - Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item44; + Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.noMelee = true; + Item.autoReuse = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + int sandnado = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(sandnado)) + Main.projectile[sandnado].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index d2d5a9e31d..c681b0abe3 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 8; 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/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 9b7a2f5813..2af9ccf7ec 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 40; Item.mana = 10; - Item.width = 52; + Item.width = 50; Item.height = 60; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.png b/Items/Weapons/Summon/TundraFlameBlossomsStaff.png index 6ebaac7b99..0089280c0c 100644 Binary files a/Items/Weapons/Summon/TundraFlameBlossomsStaff.png and b/Items/Weapons/Summon/TundraFlameBlossomsStaff.png differ diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index a767c1fd04..d552b48bef 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -19,6 +19,9 @@ namespace CalamityMod.NPCs.Abyss { DisplayName.SetDefault("Box Jellyfish"); Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y += 10; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index c378537ac9..a5d874d99a 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 78; NPC.height = 78; NPC.defense = 50; - NPC.lifeMax = 5625; + NPC.lifeMax = 5600; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index e6397ddb54..262d7ee739 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.height = 20; NPC.damage = 20; - NPC.lifeMax = 42; + NPC.lifeMax = 45; NPC.defense = 4; NPC.knockBackResist = 0.9f; @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.AcidRain else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 50; - NPC.lifeMax = 176; + NPC.lifeMax = 180; } NPC.value = Item.buyPrice(0, 0, 3, 32); diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 3e779f5f34..9eca536ada 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.AcidRain if (DownedBossSystem.downedPolterghast) { - NPC.lifeMax = 4125; + NPC.lifeMax = 4200; NPC.DR_NERD(0.2f); } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index d33c289336..f96f364d5f 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.height = 44; NPC.damage = 110; - NPC.lifeMax = 5060; + NPC.lifeMax = 5000; NPC.DR_NERD(0.15f); NPC.defense = 25; diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 67c1f92dd0..ad878e3c4c 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.height = 90; NPC.defense = 50; NPC.DR_NERD(0.05f); - NPC.lifeMax = 88500; + NPC.lifeMax = 90000; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 25, 0, 0); @@ -429,6 +429,11 @@ namespace CalamityMod.NPCs.AcidRain return false; } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); + } + public override void FindFrame(int frameHeight) { NPC.frame.Y = CurrentFrame * frameHeight; diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 8993909185..d10fb7ff16 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.AcidRain { DisplayName.SetDefault("Nuclear Toad"); Main.npcFrameCount[NPC.type] = 5; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y += 8; + value.PortraitPositionYOverride = 28f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index e59b688c96..222cfb16df 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.AcidRain if (DownedBossSystem.downedPolterghast) { NPC.damage = 80; - NPC.lifeMax = 4125; + NPC.lifeMax = 4200; NPC.defense = 30; } diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs index d886c3a46c..2b29e67c40 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.width = 60; NPC.height = 88; NPC.defense = 0; - NPC.LifeMaxNERB(2415000, 2898000); + NPC.LifeMaxNERB(2500000, 3000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs index b1fdd1a9d5..06d5c6b80a 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.width = 60; NPC.height = 88; NPC.defense = 0; - NPC.LifeMaxNERB(2415000, 2898000); + NPC.LifeMaxNERB(2500000, 3000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs index 2a251e5c59..9b2ac75d90 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.GetNPCDamage(); NPC.width = 254; NPC.height = 138; - NPC.LifeMaxNERB(2415000, 2898000); + NPC.LifeMaxNERB(2500000, 3000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs index ff211d3d83..c8cf22da2d 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.width = 86; NPC.height = 120; NPC.defense = 0; - NPC.LifeMaxNERB(2415000, 2898000); + NPC.LifeMaxNERB(2500000, 3000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index b471f5aa7b..b788a2a374 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.AquaticScourge AIType = -1; NPC.knockBackResist = 0f; NPC.alpha = 255; - NPC.LifeMaxNERB(77000, 92000, 1000000); + NPC.LifeMaxNERB(80000, 96000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.behindTiles = true; diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index b3ae716c15..658dad1b49 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AquaticScourge AIType = -1; NPC.knockBackResist = 0f; NPC.alpha = 255; - NPC.LifeMaxNERB(77000, 92000, 1000000); + NPC.LifeMaxNERB(80000, 96000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.behindTiles = true; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 1329b31cab..f2afcd0ffd 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.DR_NERD(0.05f); NPC.aiStyle = -1; AIType = -1; - NPC.LifeMaxNERB(77000, 92000, 1000000); + NPC.LifeMaxNERB(80000, 96000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 57007646e4..adde2ab08e 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AquaticScourge AIType = -1; NPC.knockBackResist = 0f; NPC.alpha = 255; - NPC.LifeMaxNERB(77000, 92000, 1000000); + NPC.LifeMaxNERB(80000, 96000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.behindTiles = true; diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 9200399522..b763cff59a 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Astral { NPC.damage = 65; NPC.defense = 18; - NPC.lifeMax = 310; + NPC.lifeMax = 300; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 029e9a2d71..4ea83e8735 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 80; NPC.defense = 18; NPC.knockBackResist = 0.65f; - NPC.lifeMax = 490; + NPC.lifeMax = 500; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/HiveEnemy.cs b/NPCs/Astral/HiveEnemy.cs index dcd115d0d6..d1bfc12987 100644 --- a/NPCs/Astral/HiveEnemy.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 55; NPC.defense = 15; NPC.DR_NERD(0.15f); - NPC.lifeMax = 470; + NPC.lifeMax = 480; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 0, 15, 0); diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index eb7e2568d1..e5dd2d4ab6 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.GameContent.Bestiary; +using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using ReLogic.Content; @@ -24,6 +25,9 @@ namespace CalamityMod.NPCs.Astral if (!Main.dedServ) glowmask = ModContent.Request("CalamityMod/NPCs/Astral/HivelingGlow", AssetRequestMode.ImmediateLoad).Value; Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y -= 8; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index c1234cda7e..9e790f1a11 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.height = 374; NPC.defense = 40; NPC.DR_NERD(0.5f); - NPC.LifeMaxNERB(98000, 117600, 740000); // 30 seconds in boss rush + NPC.LifeMaxNERB(100000, 120000, 740000); // 30 seconds in boss rush NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index deb552ce68..40035f221e 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.height = 100; NPC.defense = 40; NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(190200, 228240, 300000); // Old HP - 227500, 252500 + NPC.LifeMaxNERB(187500, 225000, 300000); // Old HP - 227500, 252500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6e392ddd35..a193eb163c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1159,7 +1159,7 @@ namespace CalamityMod.NPCs break; case NPCID.CultistBoss: - npc.lifeMax = 44500; + npc.lifeMax = 80000; break; case NPCID.CultistDragonBody1: @@ -1168,7 +1168,7 @@ namespace CalamityMod.NPCs case NPCID.CultistDragonBody4: case NPCID.CultistDragonHead: case NPCID.CultistDragonTail: - npc.lifeMax = 41600; + npc.lifeMax = 40000; break; case NPCID.DukeFishron: @@ -1189,7 +1189,7 @@ namespace CalamityMod.NPCs break; case NPCID.HallowBoss: - npc.lifeMax = 105000; + npc.lifeMax = 100000; break; case NPCID.Plantera: @@ -1214,11 +1214,11 @@ namespace CalamityMod.NPCs break; case NPCID.Deerclops: - npc.lifeMax = 10500; + npc.lifeMax = 10000; break; case NPCID.BrainofCthulhu: - npc.lifeMax = 1400; + npc.lifeMax = 1500; break; case NPCID.EaterofWorldsBody: @@ -1228,7 +1228,7 @@ namespace CalamityMod.NPCs break; case NPCID.EyeofCthulhu: - npc.lifeMax = 3050; + npc.lifeMax = 3000; break; } } @@ -5560,6 +5560,10 @@ namespace CalamityMod.NPCs public override Color? GetAlpha(NPC npc, Color drawColor) { + // Don't make this affect the bestiary, that's goofy + if (npc.IsABestiaryIconDummy) + return null; + if (Main.LocalPlayer.Calamity().trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index a93053b77d..f185e393d1 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -480,21 +480,21 @@ namespace CalamityMod.NPCs // Bouncing Eyeball @ 10% Normal, 16.66% Expert+ case NPCID.EyeballFlyingFish: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); - npcLoot.Add(ModContent.ItemType(), 1, 3, 6); + npcLoot.Add(ModContent.ItemType(), 1, 10, 12); break; case NPCID.ZombieMerman: - npcLoot.Add(ModContent.ItemType(), 1, 3, 6); + npcLoot.Add(ModContent.ItemType(), 1, 10, 12); break; case NPCID.GoblinShark: case NPCID.BloodEelHead: - npcLoot.Add(ModContent.ItemType(), 1, 15, 30); + npcLoot.Add(ModContent.ItemType(), 1, 40, 48); break; // Dreadnautilus drops the Blood Moon lore case NPCID.BloodNautilus: - npcLoot.Add(ModContent.ItemType(), 1, 20, 40); + npcLoot.Add(ModContent.ItemType(), 1, 100, 120); npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDreadnautilus, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; #endregion diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 0f9ff97990..b34f9d20ca 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.defense = 80; CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.5f; - NPC.LifeMaxNERB(64400, 77280, 72000); + NPC.LifeMaxNERB(65000, 78000, 72000); NPC.value = Item.buyPrice(2, 0, 0, 0); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 4a1ca6c647..9be846ef22 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -198,69 +198,77 @@ namespace CalamityMod.NPCs.CeaselessVoid public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + Texture2D mainTexture = TextureAssets.Npc[NPC.type].Value; + Texture2D glowTexture = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow2").Value; + Vector2 drawPos = NPC.Center - screenPos; SpriteEffects spriteEffects = SpriteEffects.None; + Vector2 drawOrigin = new Vector2(mainTexture.Width / 2, mainTexture.Height / Main.npcFrameCount[NPC.type] / 2); + + if (NPC.IsABestiaryIconDummy) + { + float scale = 1f; + Main.EntitySpriteDraw(mainTexture, drawPos, NPC.frame, Color.White, NPC.rotation, drawOrigin, scale, spriteEffects, 0); + return false; + } + if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow2").Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White * NPC.Opacity; float amount9 = 0.5f; int num153 = 5; - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + drawPos -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); if (CalamityConfig.Instance.Afterimages) { for (int num155 = 1; num155 < num153; num155 += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color trailColor = drawColor; + trailColor = Color.Lerp(trailColor, color36, amount9); + trailColor = NPC.GetAlpha(trailColor); + trailColor *= (num153 - num155) / 15f; + Vector2 trailPos = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + trailPos -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + trailPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(mainTexture, trailPos, NPC.frame, trailColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(mainTexture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); if (NPC.dontTakeDamage) return false; - texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f) * NPC.Opacity; - Color color42 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; + mainTexture = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow").Value; + Color mainColor = Color.Lerp(Color.White, Color.Cyan, 0.5f) * NPC.Opacity; + Color glowColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color trailColor2 = mainColor; + trailColor2 = Color.Lerp(trailColor2, color36, amount9); + trailColor2 = NPC.GetAlpha(trailColor2); + trailColor2 *= (num153 - num163) / 15f; + Vector2 trailPos2 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + trailPos2 -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + trailPos2 += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(mainTexture, trailPos2, NPC.frame, trailColor2, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); - Color color43 = color42; - color43 = Color.Lerp(color43, color36, amount9); - color43 = NPC.GetAlpha(color43); - color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color trailColor2Glow = glowColor; + trailColor2Glow = Color.Lerp(trailColor2Glow, color36, amount9); + trailColor2Glow = NPC.GetAlpha(trailColor2Glow); + trailColor2Glow *= (num153 - num163) / 15f; + spriteBatch.Draw(glowTexture, trailPos2, NPC.frame, trailColor2Glow, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(mainTexture, drawPos, NPC.frame, mainColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(glowTexture, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 19f8d55f4c..0de082a0ff 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -16,6 +16,10 @@ namespace CalamityMod.NPCs.Crags { DisplayName.SetDefault("Calamity Eye"); Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y -= 10f; + value.PortraitPositionYOverride = -36f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index b318bba5be..cf29e2cc44 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -20,9 +20,10 @@ namespace CalamityMod.NPCs.Crags NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { SpriteDirection = -1, - PortraitPositionYOverride = -16f + PortraitPositionYOverride = -32f }; value.Position.X += 8f; + value.Position.Y -= 8f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 15d3810cb6..b6af305da1 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.chaseable = false; NPC.canGhostHeal = false; } - NPC.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 + NPC.LifeMaxNERB(887500, 1065000, 1500000); // Phase 1 is 355000, Phase 2 is 532500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 26e930e3ff..89b4560131 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.width = 104; NPC.height = 104; NPC.defense = 50; - NPC.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 + NPC.LifeMaxNERB(887500, 1065000, 1500000); // Phase 1 is 355000, Phase 2 is 532500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.takenDamageMultiplier = 1.1f; diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 89776ad721..cf7fc59244 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.width = 66; NPC.height = 66; NPC.defense = 50; - NPC.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 + NPC.LifeMaxNERB(887500, 1065000, 1500000); // Phase 1 is 355000, Phase 2 is 532500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; diff --git a/NPCs/DraedonLabThings/Androomba.cs b/NPCs/DraedonLabThings/Androomba.cs index d55030734f..340a59455b 100644 --- a/NPCs/DraedonLabThings/Androomba.cs +++ b/NPCs/DraedonLabThings/Androomba.cs @@ -22,6 +22,10 @@ namespace CalamityMod.NPCs.DraedonLabThings NPCID.Sets.CountsAsCritter[NPC.type] = true; Main.npcCatchable[NPC.type] = true; NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y += 18; + value.PortraitPositionYOverride = 38f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index 87a99df7e8..e692adbd29 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -58,6 +58,10 @@ namespace CalamityMod.NPCs.DraedonLabThings NPCID.Sets.CountsAsCritter[NPC.type] = true; NPCID.Sets.CantTakeLunchMoney[Type] = true; NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y += 12; + value.PortraitPositionYOverride = 32f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 80a942bf07..ce7558d782 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -918,7 +918,7 @@ namespace CalamityMod.NPCs.ExoMechs effect.Parameters["halfSpreadAngle"].SetValue(MathHelper.PiOver4); effect.Parameters["edgeColor"].SetValue(Color.DarkCyan.ToVector3()); effect.Parameters["centerColor"].SetValue(Color.Cyan.ToVector3()); - effect.Parameters["edgeBlendLenght"].SetValue(0.07f); + effect.Parameters["edgeBlendLength"].SetValue(0.07f); effect.Parameters["edgeBlendStrength"].SetValue(8f); Main.spriteBatch.End(); diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 38a025d8fd..7c33f13cc6 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.height = 100; NPC.defense = 20; NPC.DR_NERD(0.2f); - NPC.LifeMaxNERB(34700, 41600, 260000); + NPC.LifeMaxNERB(35000, 42000, 260000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 79362ae977..90ce761111 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.height = 450; NPC.defense = 40; NPC.DR_NERD(0.35f); - NPC.LifeMaxNERB(60500, 72560, 600000); + NPC.LifeMaxNERB(60000, 72000, 600000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 9d4d5cff7e..8b25ec4a35 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -15,6 +15,10 @@ namespace CalamityMod.NPCs.NormalNPCs { DisplayName.SetDefault("Aero Slime"); Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y -= 6; + value.PortraitPositionYOverride = -36f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 0e8c842b3f..37dfbd353b 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -18,6 +18,10 @@ namespace CalamityMod.NPCs.NormalNPCs { DisplayName.SetDefault("Cosmic Elemental"); Main.npcFrameCount[NPC.type] = 11; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y -= 6f; + value.PortraitPositionYOverride = -32f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index 0faec74453..9bb8074212 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -18,6 +18,10 @@ namespace CalamityMod.NPCs.NormalNPCs DisplayName.SetDefault("Ice Clasper"); Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Rotation = MathHelper.ToRadians(45); + value.Position.Y += 12; + value.PortraitPositionYOverride = 12f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 020935d87e..eefab5d45d 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.GetNPCDamage(); NPC.defense = 90; NPC.DR_NERD(0.5f, null, null, null, true); - NPC.LifeMaxNERB(495000, 594000, 400000); + NPC.LifeMaxNERB(500000, 600000, 400000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs index 396030dfb2..84e85c1ed4 100644 --- a/NPCs/Other/CalamitasEnchantDemon.cs +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Other NPC.defense = 0; // This is meant to be created after SCal is defeated and should be at least a little challenging. - NPC.lifeMax = 101010; + NPC.lifeMax = 100000; NPC.HitSound = SoundID.NPCHit47; NPC.DeathSound = SoundID.NPCDeath18; NPC.noGravity = true; @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Other NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 101010; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 100000; public override void AI() { diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs index 33d38fdb56..a5257b8abd 100644 --- a/NPCs/Other/DemonPortal.cs +++ b/NPCs/Other/DemonPortal.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Other NPC.width = NPC.height = 60; NPC.damage = 0; NPC.defense = 0; - NPC.lifeMax = 24660; + NPC.lifeMax = 25000; NPC.noGravity = true; NPC.noTileCollide = true; NPC.value = 0f; @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Other NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 24660; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 25000; public override void AI() { diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index e77c4c69ce..978e47c14a 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Other NPC.width = NPC.height = 38; NPC.damage = 0; NPC.defense = 0; - NPC.lifeMax = 51740; + NPC.lifeMax = 50000; NPC.noGravity = true; NPC.noTileCollide = true; NPC.value = 0f; @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Other NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 51740; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 50000; public override void AI() { diff --git a/NPCs/Other/LecherousOrb.cs b/NPCs/Other/LecherousOrb.cs index 6093fbd18e..197856269e 100644 --- a/NPCs/Other/LecherousOrb.cs +++ b/NPCs/Other/LecherousOrb.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Other NPC.width = NPC.height = 28; NPC.damage = 0; NPC.defense = 0; - NPC.lifeMax = 181445; + NPC.lifeMax = 180000; NPC.noGravity = true; NPC.noTileCollide = true; NPC.value = 0f; @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.Other NPC.Calamity().VulnerableToWater = true; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 181445; + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => NPC.lifeMax = 180000; public override void AI() { diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index 2675d0cc05..f29500cbde 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -19,6 +19,8 @@ namespace CalamityMod.NPCs.PlagueEnemies DisplayName.SetDefault("Melter"); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.PortraitPositionYOverride = -32f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index d3438f5a4f..a05c86f883 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.height = 198; NPC.defense = 50; NPC.DR_NERD(0.3f); - NPC.LifeMaxNERB(88750, 106500, 370000); + NPC.LifeMaxNERB(87500, 105000, 370000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index e1d95e54af..a5e55f05d3 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.noTileCollide = true; NPC.canGhostHeal = false; NPC.damage = 0; - NPC.LifeMaxNERB(Main.expertMode ? 22500 : 17500, CalamityWorld.death ? 45000 : 37500, 30000); + NPC.LifeMaxNERB(Main.expertMode ? 22500 : 17500, 37500, 30000); NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 24c07b1b8c..517c39e17f 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.height = 120; NPC.defense = 45; NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(Main.expertMode ? 45000 : 35000, CalamityWorld.death ? 90000 : 75000, 60000); + NPC.LifeMaxNERB(62500, 75000, 60000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 10b496f07a..a62d41d57b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.height = 186; NPC.defense = 40; NPC.DR_NERD(0.3f); - NPC.LifeMaxNERB(108000, 129600, 200000); + NPC.LifeMaxNERB(100000, 120000, 200000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 50e413c14e..b9e63c859f 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 55; NPC.value = Item.buyPrice(0, 75, 0, 0); NPC.DR_NERD(0.35f); - NPC.LifeMaxNERB(44600, 53500, 460000); + NPC.LifeMaxNERB(45000, 54000, 460000); if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage = (int)(NPC.damage * 1.5); diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index a36c818052..dd4a6558ee 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 40; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 12788; + NPC.lifeMax = 12500; NPC.knockBackResist = 0f; AIType = -1; NPC.noGravity = true; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index df8541dc6d..a8ea42f9d9 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 40; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 12788; + NPC.lifeMax = 12500; NPC.knockBackResist = 0f; AIType = -1; NPC.netAlways = true; diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 785470be21..fb6bf615c2 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 80; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 19182; + NPC.lifeMax = 20000; NPC.knockBackResist = 0f; AIType = -1; NPC.netAlways = true; diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 3c31161ba6..89baae92cf 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 80; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 9591; + NPC.lifeMax = 10000; NPC.knockBackResist = 0f; AIType = -1; NPC.netAlways = true; diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 74d27b98f4..fce2cb279e 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 60; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 12788; + NPC.lifeMax = 12500; NPC.knockBackResist = 0f; AIType = -1; NPC.netAlways = true; diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 1da616f723..59b929f183 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 60; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 12788; + NPC.lifeMax = 12500; NPC.knockBackResist = 0f; AIType = -1; NPC.netAlways = true; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 88643ced6d..f1b551273f 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.Signus NPC.width = 130; NPC.height = 130; NPC.defense = 60; - NPC.LifeMaxNERB(297000, 356400, 320000); + NPC.LifeMaxNERB(300000, 360000, 320000); NPC.value = Item.buyPrice(2, 0, 0, 0); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 7d93a563c8..5a9155dcfd 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -16,6 +16,9 @@ namespace CalamityMod.NPCs.SlimeGod DisplayName.SetDefault("Corrupt Slime Spawn"); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.PortraitPositionYOverride = -32f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/SlimeGod/CrimulanSlimeGod.cs b/NPCs/SlimeGod/CrimulanSlimeGod.cs index 4b66c33787..3da4c135bb 100644 --- a/NPCs/SlimeGod/CrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/CrimulanSlimeGod.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.height = 92; NPC.scale = 1.1f; NPC.defense = 12; - NPC.LifeMaxNERB(7200, 8640, 160000); + NPC.LifeMaxNERB(7500, 9000, 160000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs index 84c5c8cd90..c2b120d2ac 100644 --- a/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.LifeMaxNERB(1800, 2160, 80000); + NPC.LifeMaxNERB(1875, 2250, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.GetNPCDamage(); diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 0fee142566..a2467b8a70 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.npcSlots = 5f; NPC.width = 40; NPC.height = 40; - NPC.lifeMax = 825500; + NPC.lifeMax = 825000; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 500000); // Phase one settings diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index db114cb346..8e1dd6ed6c 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.npcSlots = 5f; NPC.width = 74; NPC.height = 74; - NPC.lifeMax = 825500; + NPC.lifeMax = 825000; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 500000); NPC.value = Item.buyPrice(2, 0, 0, 0); diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index f50b4a7a8a..a743b5722c 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.npcSlots = 5f; NPC.width = 48; NPC.height = 80; - NPC.lifeMax = 825500; + NPC.lifeMax = 825000; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 500000); // Phase one settings diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 9112cb987a..51861a76ac 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -25,6 +25,8 @@ namespace CalamityMod.NPCs.SulphurousSea { SpriteDirection = 1 }; + value.Position.Y += 8; + value.PortraitPositionYOverride = 28f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } @@ -35,7 +37,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 56; NPC.height = 42; NPC.defense = 22; - NPC.lifeMax = 920; + NPC.lifeMax = 900; NPC.aiStyle = AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit38; diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index dac0e25e12..4922712d86 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -16,6 +16,10 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Urchin"); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y += 12; + value.PortraitPositionYOverride = 32f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 6230f07b31..39cd88091d 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -20,6 +20,10 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { DisplayName.SetDefault("Belching Coral"); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y += 4; + value.PortraitPositionYOverride = 24f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index c52e82f770..8f11e2a9ae 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -16,6 +16,10 @@ namespace CalamityMod.NPCs.SulphurousSea { DisplayName.SetDefault("Sulflounder"); Main.npcFrameCount[NPC.type] = 4; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y -= 10f; + value.PortraitPositionYOverride = -36f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index d8476e8827..44938a6aa0 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { - DisplayName.SetDefault("Cataclysm"); + DisplayName.SetDefault("Supreme Cataclysm"); Main.npcFrameCount[NPC.type] = 9; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 6eadb782bb..58679d1848 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { - DisplayName.SetDefault("Catastrophe"); + DisplayName.SetDefault("Supreme Catastrophe"); Main.npcFrameCount[NPC.type] = 8; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index 68c0945c1c..cb882e66ac 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -21,6 +21,10 @@ namespace CalamityMod.NPCs.TownNPCs DisplayName.SetDefault("Androomba Pal"); Main.npcFrameCount[NPC.type] = 9; Main.npcCatchable[NPC.type] = true; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); + value.Position.Y += 16; + value.PortraitPositionYOverride = 36f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } public override void SetDefaults() diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index d907d22051..eccb7764b6 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.Yharon NPC.width = 200; NPC.height = 200; NPC.defense = 90; - NPC.LifeMaxNERB(1302000, 1562400, 740000); + NPC.LifeMaxNERB(1300000, 1560000, 740000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; diff --git a/Particles/ChargeUpLineVFX.cs b/Particles/ChargeUpLineVFX.cs index b57e12064a..1b3a6f9d7f 100644 --- a/Particles/ChargeUpLineVFX.cs +++ b/Particles/ChargeUpLineVFX.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Particles public float BaseScale; public float Opacity; public float LineDirection; - public float LineLenght = 0f; + public float LineLength = 0f; private Vector2 PrevOffset = Vector2.Zero; private Vector2 BasePosition; public bool Telegraph; //Denotes if the line is used as an enemy telegraph. In that case, it'll be marked as important @@ -63,7 +63,7 @@ namespace CalamityMod.Particles RelativeOffset = offsetPosition() * LineDirection.ToRotationVector2() * BasePosition.Length(); - LineLenght = (BasePosition - RelativeOffset).Length(); + LineLength = (BasePosition - RelativeOffset).Length(); RelativeOffset = RelativeOffset.RotatedBy(MathHelper.PiOver4 / 16f); //LineDirection -= MathHelper.PiOver4 / 16f; diff --git a/Particles/ManaDrainStreak.cs b/Particles/ManaDrainStreak.cs index e282a0713c..2a297a788a 100644 --- a/Particles/ManaDrainStreak.cs +++ b/Particles/ManaDrainStreak.cs @@ -50,8 +50,8 @@ namespace CalamityMod.Particles float currentDisplace = MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(LifetimeCompletion, 2)); float earlierDisplace = MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(Math.Clamp(LifetimeCompletion - 0.2f, 0f, 1f), 2)); - float lenght = (currentDisplace - earlierDisplace) / tex.Height; - Vector2 scale = new Vector2(Scale, lenght); + float Length = (currentDisplace - earlierDisplace) / tex.Height; + Vector2 scale = new Vector2(Scale, Length); Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); diff --git a/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs b/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs index 7f0e3de2ce..55f326c03d 100644 --- a/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseShortswordProjectile.cs @@ -122,8 +122,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 12f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + float bladeLength = 12f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint); } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 0abda53eca..ddda964721 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -174,8 +174,17 @@ namespace CalamityMod.Projectiles pointBlankShotDuration--; // Reduce secondary yoyo damage if the player has Yoyo Glove - if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == 99 && projectile.ai[0] == 1f) - projectile.damage = (int)(projectile.originalDamage * 0.5f); + // Brief behavior documentation of yoyo AI: ai[0, 1] are the x, y co-ords and localAI[0] is the airtime in frames + // All secondary yoyos are spawned with ai[0] of 1 which tells then tell its AI to do secondary yoyo AI + if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == 99) + { + if (projectile.ai[0] == 1f && projectile.localAI[0] == 0f) + projectile.damage = (int)(projectile.originalDamage * 0.5f); + // Reset damage if the yoyo count returns to 1 + // This is possible due to the horrendous yoyo spawning system for limited lifespan yoyos + else if (Main.player[projectile.owner].ownedProjectileCounts[projectile.type] == 1 && projectile.localAI[0] > 0f) + projectile.damage = projectile.originalDamage; + } // Chlorophyte Crystal AI rework. if (projectile.type == ProjectileID.CrystalLeaf) diff --git a/Projectiles/Magic/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index 25e6d8bcde..7dd7bc6f17 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic effect.Parameters["halfSpreadAngle"].SetValue(Spread / 2f); effect.Parameters["edgeColor"].SetValue(Color.Lerp(Color.DeepSkyBlue, Color.Coral, blinkage ).ToVector3()); effect.Parameters["centerColor"].SetValue(Color.Lerp(Color.DodgerBlue, Color.Coral, blinkage).ToVector3()); - effect.Parameters["edgeBlendLenght"].SetValue(0.07f); + effect.Parameters["edgeBlendLength"].SetValue(0.07f); effect.Parameters["edgeBlendStrength"].SetValue(8f); Main.spriteBatch.End(); diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index 79829113c4..efe103e7ae 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.coldDamage = true; Projectile.ignoreWater = true; Projectile.alpha = 255; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/ShadeNimbusCloud.cs b/Projectiles/Magic/ShadeNimbusCloud.cs index c6404f5c34..3bc616fa3c 100644 --- a/Projectiles/Magic/ShadeNimbusCloud.cs +++ b/Projectiles/Magic/ShadeNimbusCloud.cs @@ -1,64 +1,64 @@ -using Terraria; +using CalamityMod.Items.Weapons.Magic; +using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class ShadeNimbusCloud : ModProjectile { + public bool StartFading = false; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Nimbus"); + DisplayName.SetDefault("Shaderain Nimbus"); Main.projFrames[Projectile.type] = 4; } public override void SetDefaults() { - Projectile.width = 28; - Projectile.height = 28; + Projectile.timeLeft = 300; + + Projectile.width = Projectile.height = 28; + Projectile.netImportant = true; - Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; } public override void AI() { - float num410 = Projectile.ai[0]; - float num411 = Projectile.ai[1]; - if (num410 != 0f && num411 != 0f) - { - bool flag12 = false; - bool flag13 = false; - if ((Projectile.velocity.X < 0f && Projectile.Center.X < num410) || (Projectile.velocity.X > 0f && Projectile.Center.X > num410)) - { - flag12 = true; - } - if ((Projectile.velocity.Y < 0f && Projectile.Center.Y < num411) || (Projectile.velocity.Y > 0f && Projectile.Center.Y > num411)) - { - flag13 = true; - } - if (flag12 && flag13) - { - Projectile.Kill(); - } - } - Projectile.rotation += Projectile.velocity.X * 0.02f; + // Makes the projectile deaccelerate. + Projectile.velocity *= ShaderainStaff.DeaccelerationStrenght; + + // Does the animation of the projectile, the number in the middle determines the speed of the animatino. Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frameCounter = 0; - Projectile.frame++; - if (Projectile.frame > 3) - { - Projectile.frame = 0; - return; - } - } + Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; + + // If the projectile is about to die or it collides with a tile, start fading. + // Depending on how strong the fade-out speed is, it'll adapt by the amount of time left for it do die. + // Just be careful to not make it too slow and it starts fading immeadiately. + if (Collision.SolidCollision(Projectile.Center, Projectile.width, Projectile.height) || Projectile.timeLeft < (255 / ShaderainStaff.FadeoutSpeed)) + StartFading = true; + + // The projectile will fade away. + if (StartFading) + Projectile.alpha += ShaderainStaff.FadeoutSpeed; + + Projectile.netUpdate = true; } - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Projectile.owner == Main.myPlayer) + // Makes a dust effect. + for (int dustIndex = 0; dustIndex < 40; dustIndex++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + // I choose .position (Which is the top left) instead of .Center because Dust.NewDust was made to spawn given .position. + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 14, 0, 0, 0, default, 0.5f); } + + // TODO: Make the projectile inflict the future counterpart of Burning Blood. } } } diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index 6719fdc750..27d06825cf 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -1,46 +1,41 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class Shaderain : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/Boss/ShaderainHostile"; + public override string Texture => "CalamityMod/Projectiles/Magic/AuraRain"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Rain"); + DisplayName.SetDefault("Shady Rain"); } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 40; + Projectile.timeLeft = 600; + + Projectile.width = 20; + Projectile.height = 20; + + Projectile.netImportant = true; Projectile.friendly = true; - Projectile.extraUpdates = 1; - Projectile.penetrate = 3; Projectile.ignoreWater = true; - Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; } public override void AI() { - Projectile.alpha = 50; - } + // The projectile will fall. + Projectile.velocity.Y += ShaderainStaff.GravityStrenght; + + // The projectile will look towards where it's going. + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - public override void Kill(int timeLeft) - { - int num310 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, 14, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num310]; - dust.position.X -= 2f; - dust.alpha = 38; - dust.velocity *= 0.1f; - dust.velocity += -Projectile.oldVelocity * 0.25f; - dust.scale = 0.95f; + Projectile.netUpdate = true; } } } diff --git a/Projectiles/Melee/AncientBeam.cs b/Projectiles/Melee/AncientBeam.cs index a19e0b3596..557e72ab54 100644 --- a/Projectiles/Melee/AncientBeam.cs +++ b/Projectiles/Melee/AncientBeam.cs @@ -37,10 +37,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 34f * Projectile.scale; + float bladeLength = 34f * Projectile.scale; Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 8.5f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index b165eb0d7f..18818eeb51 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 80f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + float bladeLength = 80f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint); } public void GeneralParryEffects() @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee if (AlreadyParried == 0) { float collisionPoint = 0f; - float bladeLenght = 80f * Projectile.scale; + float bladeLength = 80f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) { GeneralParryEffects(); diff --git a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs index 9e36f276d6..c39a5cfbdb 100644 --- a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 78f * Projectile.scale; + float bladeLength = 78f * Projectile.scale; Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint); } diff --git a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs index 4fa1f38d2b..d472980cef 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs @@ -89,8 +89,8 @@ namespace CalamityMod.Projectiles.Melee //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = ThrustDisplaceRatio() * 242f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 30, ref collisionPoint); + float bladeLength = ThrustDisplaceRatio() * 242f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 30, ref collisionPoint); } public override bool ShouldUpdatePosition() => false; @@ -319,13 +319,13 @@ namespace CalamityMod.Projectiles.Melee rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f); - float stitchLenght = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; + float stitchLength = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; float stitchScale = (1f + (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.Pi) * 0.3f) * 0.85f; if (CurrentStitches == maxStitches) { stitchScale *= 1 - ((StitchTimer - (MaxTime - SnapTime - HoldTime * 0.5f) * 0.3f) / (MaxTime - SnapTime - HoldTime * 0.5f) * 0.7f) * 0.8f; } - scale = new Vector2(0.2f, stitchLenght) * stitchScale; + scale = new Vector2(0.2f, stitchLength) * stitchScale; Color stitchColor = Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.PiOver2)); diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index fb19cee00d..08b8bf4147 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -49,8 +49,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 142f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 44, ref collisionPoint); + float bladeLength = 142f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 44, ref collisionPoint); } public void GeneralParryEffects() @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee return; float collisionPoint = 0f; - float bladeLenght = 142f * Projectile.scale; + float bladeLength = 142f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) { if (AlreadyParried == 0) { diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 7b6f906dc4..f9ec4937d1 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -94,18 +94,18 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float bladeLenght = 172f * Projectile.scale; + float bladeLength = 172f * Projectile.scale; if (Thrown) { - bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght); + bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLength / 2f, Vector2.One * bladeLength); if (Combo == 2f) return mainCollision; else { Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); - bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLenght); + bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLength); return mainCollision || thrownScissorCollision; } } @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee float collisionPoint = 0f; Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint); } //Swing animation keys diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index 641e655b59..c608283ac9 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 142f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 44, ref collisionPoint); + float bladeLength = 142f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 44, ref collisionPoint); } public void GeneralParryEffects() @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee return; float collisionPoint = 0f; - float bladeLenght = 142f * Projectile.scale; + float bladeLength = 142f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) { if (AlreadyParried == 0) { diff --git a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs index 170a089cc2..623e2e3092 100644 --- a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs +++ b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs @@ -70,8 +70,8 @@ namespace CalamityMod.Projectiles.Melee //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = ThrustDisplaceRatio() * 242f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 30, ref collisionPoint); + float bladeLength = ThrustDisplaceRatio() * 242f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 30, ref collisionPoint); } public override bool ShouldUpdatePosition() => false; @@ -241,13 +241,13 @@ namespace CalamityMod.Projectiles.Melee rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f); - float stitchLenght = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; + float stitchLength = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; float stitchScale = (1f + (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.Pi) * 0.3f) * 0.85f; if (CurrentStitches == maxStitches) { stitchScale *= 1 - ((StitchTimer - (MaxTime - SnapTime - HoldTime * 0.5f) * 0.3f) / (MaxTime - SnapTime - HoldTime * 0.5f) * 0.7f) * 0.8f; } - scale = new Vector2(0.2f, stitchLenght) * stitchScale; + scale = new Vector2(0.2f, stitchLength) * stitchScale; Color stitchColor = Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.PiOver2)); diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index 5c4dd557ff..9a2b2f4bdc 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -92,18 +92,18 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float bladeLenght = 142f * Projectile.scale; + float bladeLength = 142f * Projectile.scale; if (Thrown) { - bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght); + bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLength / 2f, Vector2.One * bladeLength); if (Combo == 2f) return mainCollision; else { Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); - bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLenght); + bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLength); return mainCollision || thrownScissorCollision; } } @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee float collisionPoint = 0f; Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint); } //Swing animation keys diff --git a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs index 21a9600b0d..dfda19ec43 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 94 * Projectile.scale; + float bladeLength = 94 * Projectile.scale; float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } public void Pogo() diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index cb42030743..01bd827a9e 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -78,24 +78,24 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 0f; + float bladeLength = 0f; Vector2 displace = Vector2.Zero; switch (SwingMode) { case 0: - bladeLenght = 90f * Projectile.scale; + bladeLength = 90f * Projectile.scale; break; case 1: - bladeLenght = 110f * Projectile.scale; + bladeLength = 110f * Projectile.scale; break; case 2: - bladeLenght = Projectile.frame <= 2 ? 85f : 150f; //Only use the extended hitbox after the blade actually extends. For realism. - bladeLenght *= Projectile.scale; + bladeLength = Projectile.frame <= 2 ? 85f : 150f; //Only use the extended hitbox after the blade actually extends. For realism. + bladeLength *= Projectile.scale; displace = direction * ThrustDisplaceRatio() * 60f; break; } - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLenght), 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLength), 24, ref collisionPoint); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index a8d63e0d82..5202c852de 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 120f * Projectile.scale; + float bladeLength = 120f * Projectile.scale; Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLenght), 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLength), 24, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs index a3493bd109..3de3c051d0 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs @@ -74,10 +74,10 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { base.ModifyHitNPC(target, ref damage, ref knockback, ref crit, ref hitDirection); - Vector2 projectileHalfLenght = (Projectile.Size / 2f) * Projectile.rotation.ToRotationVector2(); + Vector2 projectileHalfLength = (Projectile.Size / 2f) * Projectile.rotation.ToRotationVector2(); float collisionPoint = 0; //If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage - if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint)) + if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint)) { if (SnapCoyoteTime > 0f) { diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index b4999caab7..3a9e2bda14 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee public PrimitiveTrail PierceAfterimageDrawer = null; - const float BladeLenght = 180; + const float BladeLength = 180; public int GetSwingTime { @@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee { float _ = 0f; Vector2 start = Projectile.Center; - Vector2 end = start + SwordDirection * BladeLenght * Projectile.scale; + Vector2 end = start + SwordDirection * BladeLength * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, Projectile.scale * 30f, ref _); } @@ -317,7 +317,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextFloat() * 3f < RiskOfDust) { - Dust auricDust = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLenght * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.5f, 1f), 0.5f), ModContent.DustType(), SwordDirection.RotatedBy(-MathHelper.PiOver2 * Direction) * 2f); + Dust auricDust = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLength * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.5f, 1f), 0.5f), ModContent.DustType(), SwordDirection.RotatedBy(-MathHelper.PiOver2 * Direction) * 2f); auricDust.noGravity = true; auricDust.alpha = 10; auricDust.scale = 0.5f; @@ -326,7 +326,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextFloat() < RiskOfDust) { Color dustColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.9f); - Dust must = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLenght * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.2f, 1f), 0.5f), 267, SwordDirection.RotatedBy(MathHelper.PiOver2 * Direction) * 2.6f, 0, dustColor); + Dust must = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLength * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.2f, 1f), 0.5f), 267, SwordDirection.RotatedBy(MathHelper.PiOver2 * Direction) * 2.6f, 0, dustColor); must.scale = 0.3f; must.fadeIn = Main.rand.NextFloat() * 1.2f; @@ -442,7 +442,7 @@ namespace CalamityMod.Projectiles.Melee { float progress = MathHelper.Lerp(Progression, TrailEndProgression, i / 40f); - result.Add(DirectionAtProgressScuffed(progress) * (BladeLenght - 50f) * Projectile.scale); + result.Add(DirectionAtProgressScuffed(progress) * (BladeLength - 50f) * Projectile.scale); } return result; @@ -555,7 +555,7 @@ namespace CalamityMod.Projectiles.Melee float lensFlareOpacity = (Progression < 0.3f ? 0f : 0.2f + 0.8f * (float)Math.Sin(MathHelper.Pi * (Progression - 0.3f) / 0.7f)) * 0.6f; Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Plum, (float)Math.Pow(Progression, 3)); lensFlareColor.A = 0; - Main.EntitySpriteDraw(shineTex, Owner.MountedCenter + DirectionAtProgressScuffed(Progression) * Projectile.scale * BladeLenght - Main.screenPosition, null, lensFlareColor * lensFlareOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, 0, 0); + Main.EntitySpriteDraw(shineTex, Owner.MountedCenter + DirectionAtProgressScuffed(Progression) * Projectile.scale * BladeLength - Main.screenPosition, null, lensFlareColor * lensFlareOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, 0, 0); } else diff --git a/Projectiles/Melee/Galaxia_AndromedasStride.cs b/Projectiles/Melee/Galaxia_AndromedasStride.cs index 0599a3be40..6c9e5083f5 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -56,10 +56,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * Projectile.scale; + float bladeLength = 145 * Projectile.scale; float bladeWidth = 25 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3); diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index 8b6371ea98..fe57968b63 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -63,9 +63,9 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * Projectile.scale; + float bladeLength = 145 * Projectile.scale; float bladeWidth = 25 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } diff --git a/Projectiles/Melee/Galaxia_PolarisGaze.cs b/Projectiles/Melee/Galaxia_PolarisGaze.cs index 63898b0946..360529614b 100644 --- a/Projectiles/Melee/Galaxia_PolarisGaze.cs +++ b/Projectiles/Melee/Galaxia_PolarisGaze.cs @@ -60,10 +60,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * Projectile.scale; + float bladeLength = 145 * Projectile.scale; float bladeWidth = 86 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } public override void AI() @@ -102,18 +102,18 @@ namespace CalamityMod.Projectiles.Melee #region sparkles and particles - float bladeLenght = 120 * Projectile.scale; + float bladeLength = 120 * Projectile.scale; for (int i = 0; i < 3; i++) { if (Rings[i] == null) { - Rings[i] = new ConstellationRingVFX(Owner.Center + (direction * (25 + bladeLenght * 0.33f * i)), Color.DarkOrchid, direction.ToRotation(), Projectile.scale * 0.25f * i, new Vector2(0.5f, 1f), spinSpeed: 7, starAmount: 3 + i, important: true); + Rings[i] = new ConstellationRingVFX(Owner.Center + (direction * (25 + bladeLength * 0.33f * i)), Color.DarkOrchid, direction.ToRotation(), Projectile.scale * 0.25f * i, new Vector2(0.5f, 1f), spinSpeed: 7, starAmount: 3 + i, important: true); GeneralParticleHandler.SpawnParticle(Rings[i]); } else { Rings[i].Time = 0; - Rings[i].Position = Owner.Center + Vector2.Lerp(Vector2.Zero, ((0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f - i * 0.5f)) * direction * (25 + bladeLenght * 0.33f * (i + 1))), Bounce(MathHelper.Clamp(Shred - 30 * i, 0, maxShred))); + Rings[i].Position = Owner.Center + Vector2.Lerp(Vector2.Zero, ((0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f - i * 0.5f)) * direction * (25 + bladeLength * 0.33f * (i + 1))), Bounce(MathHelper.Clamp(Shred - 30 * i, 0, maxShred))); Rings[i].Rotation = direction.ToRotation(); Rings[i].Scale = Projectile.scale * 0.25f * (i + 1); (Rings[i] as ConstellationRingVFX).Opacity = 0.5f + 0.5f * ShredRatio; diff --git a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs index 63e0fe101c..deb11d8d5e 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 84 * Projectile.scale; + float bladeLength = 84 * Projectile.scale; float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLength / 2, Projectile.Center + direction * bladeLength / 2, bladeWidth, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 0e930aa032..5ee4bcfe53 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeHalfLenght = 25f * Projectile.scale / 2f; + float bladeHalfLength = 25f * Projectile.scale / 2f; float bladeWidth = 14f * Projectile.scale; Vector2 direction = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeHalfLenght, Projectile.Center + direction * bladeHalfLenght, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeHalfLength, Projectile.Center + direction * bladeHalfLength, bladeWidth, ref collisionPoint); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs index 03f0f69fc6..b5b63b5cda 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs @@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 120 * Projectile.scale; + float bladeLength = 120 * Projectile.scale; float bladeWidth = 20 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3); diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs index fcf1271921..a31cebb3c2 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs @@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Melee if (!WaterMode) return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Bottom, Projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint); - float halfLenght = 66f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, Projectile.Center - Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, 40f, ref collisionPoint); + float halfLength = 66f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, Projectile.Center - Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, 40f, ref collisionPoint); } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index 8305ac13c7..bb5d22da1c 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -60,9 +60,9 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 100 * Projectile.scale; + float bladeLength = 100 * Projectile.scale; float bladeWidth = 20 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs index 22bde2f805..ec11243411 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 120 * Projectile.scale; + float bladeLength = 120 * Projectile.scale; float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } public void Pogo() diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs index 33c3214c80..cb9470eb32 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs @@ -41,10 +41,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 84 * Projectile.scale; + float bladeLength = 84 * Projectile.scale; float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLength / 2, Projectile.Center + direction * bladeLength / 2, bladeWidth, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 988ada6635..bd70aa1730 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -76,22 +76,22 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 0f; + float bladeLength = 0f; Vector2 displace = Vector2.Zero; switch (SwingMode) { case 0: case 1: - bladeLenght = 150 * Projectile.scale; + bladeLength = 150 * Projectile.scale; break; case 2: - bladeLenght = 225f; //In awe e - bladeLenght *= Projectile.scale; + bladeLength = 225f; //In awe e + bladeLength *= Projectile.scale; displace = direction * ThrustDisplaceRatio() * 60f; break; } - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLenght), 26, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLength), 26, ref collisionPoint); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 7698a46699..338a02fdea 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -47,10 +47,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 140f * Projectile.scale; + float bladeLength = 140f * Projectile.scale; Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLenght), 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLength), 24, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index 697f916a12..b9d709c4b5 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -72,10 +72,10 @@ namespace CalamityMod.Projectiles.Melee Vector2 previousPosition = chainPositions[i - 1]; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), position, previousPosition, 6, ref collisionPoint)) return true; - if (i == numPoints - 1) //Extra lenght collision for the blade itself + if (i == numPoints - 1) //Extra length collision for the blade itself { - Vector2 projectileHalfLenght = 85 * Projectile.rotation.ToRotationVector2(); - return (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint)); + Vector2 projectileHalfLength = 85 * Projectile.rotation.ToRotationVector2(); + return (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint)); } } @@ -85,10 +85,10 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Vector2 projectileHalfLenght = 85f * Projectile.rotation.ToRotationVector2(); + Vector2 projectileHalfLength = 85f * Projectile.rotation.ToRotationVector2(); float collisionPoint = 0; //If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage - if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint)) + if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint)) { if (SnapCoyoteTime > 0f) { diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index cbbdacbca3..32f632dc45 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 44f * Projectile.scale; + float bladeLength = 44f * Projectile.scale; Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/RoxShockwave.cs b/Projectiles/Melee/RoxShockwave.cs index 6f6efd755c..c6ece02d9b 100644 --- a/Projectiles/Melee/RoxShockwave.cs +++ b/Projectiles/Melee/RoxShockwave.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.tileCollide = false; Projectile.timeLeft = 40; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } } } diff --git a/Projectiles/Melee/RoxSlam.cs b/Projectiles/Melee/RoxSlam.cs index ca4b32ba14..a3975e70ae 100644 --- a/Projectiles/Melee/RoxSlam.cs +++ b/Projectiles/Melee/RoxSlam.cs @@ -54,7 +54,9 @@ namespace CalamityMod.Projectiles.Melee //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); //Spawns the shockwave - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 300, 12, Projectile.owner); + int slamDamage = (int)player.GetTotalDamage().ApplyTo(300); + float slamKB = player.GetTotalKnockback().ApplyTo(12f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), slamDamage, slamKB, Projectile.owner); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.Kill(); //Pretty things diff --git a/Projectiles/Melee/SeashineSwordProj.png b/Projectiles/Melee/SeashineSwordProj.png index 6cf9a23667..e1f76abbb4 100644 Binary files a/Projectiles/Melee/SeashineSwordProj.png and b/Projectiles/Melee/SeashineSwordProj.png differ diff --git a/Projectiles/Melee/SolarNeedle.cs b/Projectiles/Melee/SolarNeedle.cs index 56f273c3c0..a5c1fb6b9e 100644 --- a/Projectiles/Melee/SolarNeedle.cs +++ b/Projectiles/Melee/SolarNeedle.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 44f * Projectile.scale; + float bladeLength = 44f * Projectile.scale; Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs index e14d02f134..e09f18e860 100644 --- a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs +++ b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs @@ -186,9 +186,9 @@ namespace CalamityMod.Projectiles.Melee.Spears public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 85 * Projectile.scale; + float bladeLength = 85 * Projectile.scale; float bladeWidth = 20 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + AppropriateRotation.ToRotationVector2() * bladeLenght * -0.5f, Projectile.Center + ThrustRotation.ToRotationVector2() * bladeLenght * 0.5f, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + AppropriateRotation.ToRotationVector2() * bladeLength * -0.5f, Projectile.Center + ThrustRotation.ToRotationVector2() * bladeLength * 0.5f, bladeWidth, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/TrueAncientBeam.cs b/Projectiles/Melee/TrueAncientBeam.cs index 56517aee68..7f04c07bfb 100644 --- a/Projectiles/Melee/TrueAncientBeam.cs +++ b/Projectiles/Melee/TrueAncientBeam.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 44f * Projectile.scale; + float bladeLength = 44f * Projectile.scale; Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 06c2a55ac8..f829fd48bc 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 100f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + float bladeLength = 100f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint); } public void GeneralParryEffects() @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee if (AlreadyParried == 0) { float collisionPoint = 0f; - float bladeLenght = 100f * Projectile.scale; + float bladeLength = 100f * Projectile.scale; for (int k = 0; k < Main.maxProjectiles; k++) { @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint)) + Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) { GeneralParryEffects(); diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index 4f6b5104e0..ccd06eb9d8 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 88f * Projectile.scale; + float bladeLength = 88f * Projectile.scale; Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2(); - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint); } diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs index d2ec7ecbc4..04fff5d1cd 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs @@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 145 * Projectile.scale; + float bladeLength = 145 * Projectile.scale; float bladeWidth = 25 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs index 675ecb07e8..1224f53a92 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs @@ -61,10 +61,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 130 * Projectile.scale; + float bladeLength = 130 * Projectile.scale; float bladeWidth = 86 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } public void Pogo() diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index 1777fe10ea..a80a87ef64 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 84 * Projectile.scale; + float bladeLength = 84 * Projectile.scale; float bladeWidth = 76 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLength / 2, Projectile.Center + direction * bladeLength / 2, bladeWidth, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index ec44c58f24..fe5a34c832 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -65,9 +65,9 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 140 * Projectile.scale; + float bladeLength = 140 * Projectile.scale; float bladeWidth = 25 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/UrchinMaceProjectile.cs index 9318d5b68f..dc69847205 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/UrchinMaceProjectile.cs @@ -45,9 +45,9 @@ namespace CalamityMod.Projectiles.Melee return false; float collisionPoint = 0f; - float bladeLenght = 70 * Projectile.scale; + float bladeLength = 70 * Projectile.scale; float bladeWidth = 30 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLenght), bladeWidth, ref collisionPoint); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index 8ebe41919f..4ef8c50a59 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -63,8 +63,8 @@ namespace CalamityMod.Projectiles.Melee { //The hitbox is simplified into a line collision. float collisionPoint = 0f; - float bladeLenght = 78f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + float bladeLength = 78f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint); } public override void AI() @@ -96,8 +96,8 @@ namespace CalamityMod.Projectiles.Melee if (proj.ModProjectile != null && proj.owner == Projectile.owner && proj.ModProjectile is WulfrumScrew screw && screw.BazingaTime == 0) { float collisionPoint = 0f; - float bladeLenght = 86f * Projectile.scale; - if (Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + OffsetFromPlayer, Owner.Center + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 34, ref collisionPoint)) + float bladeLength = 86f * Projectile.scale; + if (Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + OffsetFromPlayer, Owner.Center + OffsetFromPlayer + (Projectile.velocity * bladeLength), 34, ref collisionPoint)) { Vector2 thudVelocity = TrueDirection.ToRotationVector2() * 6f; NPC potentialAimAssist = FindTarget(); diff --git a/Projectiles/Ranged/ClockworkBowHoldout.cs b/Projectiles/Ranged/ClockworkBowHoldout.cs index 9d2a84cf89..ad15675d8b 100644 --- a/Projectiles/Ranged/ClockworkBowHoldout.cs +++ b/Projectiles/Ranged/ClockworkBowHoldout.cs @@ -196,8 +196,6 @@ namespace CalamityMod.Projectiles.Ranged Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } - - public override bool PreDraw(ref Color lightColor) { float loops = LoadedBolts + 1; diff --git a/Projectiles/Ranged/FallenStarProj.cs b/Projectiles/Ranged/FallenStarProj.cs deleted file mode 100644 index 5ebb857d71..0000000000 --- a/Projectiles/Ranged/FallenStarProj.cs +++ /dev/null @@ -1,105 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class FallenStarProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fallen Star"); - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.aiStyle = 0; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; - Projectile.alpha = 50; - Projectile.light = 1f; - Projectile.tileCollide = true; - Projectile.ignoreWater = false; - Projectile.usesLocalNPCImmunity = true; - } - - public override void AI() - { - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); - } - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 1f; - } - Projectile.alpha += (int)(25f * Projectile.localAI[0]); - if (Projectile.alpha > 200) - { - Projectile.alpha = 200; - Projectile.localAI[0] = -1f; - } - if (Projectile.alpha < 50) - { - Projectile.alpha = 50; - Projectile.localAI[0] = 1f; - } - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - float newdamage = Projectile.damage * 0.9375f; - Projectile.damage = (int)newdamage; - if (Projectile.damage < 1) - Projectile.damage = 1; - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - int dustAmt = 10; - int goreAmt = 6; - for (int i = 0; i < dustAmt; i++) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 58, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.2f); - } - for (int i = 0; i < dustAmt; i++) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 57, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.2f); - } - if (Main.netMode != NetmodeID.Server) - { - for (int i = 0; i < goreAmt; i++) - { - Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); - } - } - } - - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, lightColor.A - Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) - { - Projectile.DrawStarTrail(Color.Blue, Color.White); - - //Draw the actual projectile - Texture2D tex = ModContent.Request(Texture).Value; - Vector2 offsets = new Vector2(0f, Projectile.gfxOffY) - Main.screenPosition; - Color alpha = Projectile.GetAlpha(lightColor); - Rectangle spriteRec = new Microsoft.Xna.Framework.Rectangle(0, 0, tex.Width, tex.Height); - Vector2 spriteOrigin = spriteRec.Size() / 2f; - SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Main.EntitySpriteDraw(tex, Projectile.Center + offsets, spriteRec, alpha, Projectile.rotation, spriteOrigin, Projectile.scale + 0.1f, spriteEffects, 0); - return false; - } - } -} diff --git a/Projectiles/Ranged/FallenStarProj.png b/Projectiles/Ranged/FallenStarProj.png deleted file mode 100644 index 7621ac3ff8..0000000000 Binary files a/Projectiles/Ranged/FallenStarProj.png and /dev/null differ diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index b0c9771852..fe175c17cd 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -72,9 +72,9 @@ namespace CalamityMod.Projectiles.Ranged float scale = 0.85f + Main.rand.NextFloat() * 1.15f; int boom = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), blastDamage, Projectile.knockBack, Projectile.owner, 0f, scale); - // Only declare the explosion as ranged class if the bullet itself is ranged class. - if (boom.WithinBounds(Main.maxProjectiles) && Projectile.CountsAsClass()) - Main.projectile[boom].DamageType = DamageClass.Ranged; + // Explosions match the bullet's damage type (e.g. ranged or summon) + if (boom.WithinBounds(Main.maxProjectiles)) + Main.projectile[boom].DamageType = Projectile.DamageType; } // Spawn four shrapnel dust. This deals no damage. diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs index 2d8eff04b7..57943bc042 100644 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ b/Projectiles/Ranged/StarfleetMK2Gun.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Ranged { if (canFire) { - int type = ModContent.ProjectileType(); + int type = ProjectileID.StarCannonStar; float shootSpeed = 16f; int damage = player.GetWeaponDamage(player.ActiveItem()); float knockBack = player.ActiveItem().knockBack; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), + ProjectileID.StarCannonStar, ProjectileID.Starfury }); int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, damage, knockBack, Projectile.owner); diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index 43420c0318..3ab4afceca 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Ranged spreadEffect.Parameters["halfSpreadAngle"].SetValue(halfAngle); spreadEffect.Parameters["edgeColor"].SetValue(sightsColor.ToVector3()); spreadEffect.Parameters["centerColor"].SetValue(sightsColor.ToVector3()); - spreadEffect.Parameters["edgeBlendLenght"].SetValue(0.07f); + spreadEffect.Parameters["edgeBlendLength"].SetValue(0.07f); spreadEffect.Parameters["edgeBlendStrength"].SetValue(8f); Main.spriteBatch.End(); diff --git a/Projectiles/Ranged/TitaniumRailgunShot.cs b/Projectiles/Ranged/TitaniumRailgunShot.cs index c4f6e9d9e1..9e2a73bf02 100644 --- a/Projectiles/Ranged/TitaniumRailgunShot.cs +++ b/Projectiles/Ranged/TitaniumRailgunShot.cs @@ -53,13 +53,13 @@ namespace CalamityMod.Projectiles.Ranged { Vector2 beamVector = Projectile.velocity; - float beamLenght = DetermineLaserLength_CollideWithTiles(12); + float beamLength = DetermineLaserLength_CollideWithTiles(12); //Rapid dust int dustCount = Main.rand.Next(10, 30); for (int i = 0; i < dustCount; i++) { - float dustProgressAlongBeam = beamLenght * Main.rand.NextFloat(0f, 0.8f); + float dustProgressAlongBeam = beamLength * Main.rand.NextFloat(0f, 0.8f); Vector2 dustPosition = Projectile.Center + dustProgressAlongBeam * beamVector + beamVector.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-6f, 6f) * Projectile.scale; Dust dust = Dust.NewDustPerfect(dustPosition, 187, beamVector * Main.rand.NextFloat(5f, 26f), 0, Color.White, 2.2f); @@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Ranged } //Put a titanium shell into the impact tile (if it collided with one) - if (beamLenght < MaxLaserLength) + if (beamLength < MaxLaserLength) { - Vector2 endPoint = beamLenght * beamVector + Projectile.Center + beamVector * 8.5f; + Vector2 endPoint = beamLength * beamVector + Projectile.Center + beamVector * 8.5f; Point anchorPos = new Point((int)endPoint.X / 16, (int)endPoint.Y / 16); Color burnColor = Main.rand.NextBool(4) ? Color.PaleGreen : Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.OrangeRed; diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index 1ede4a828f..753fdb91db 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -10,23 +10,16 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Brick Fragment"); - Main.projFrames[Projectile.type] = 2; } public override void SetDefaults() { Projectile.friendly = true; - Projectile.width = 13; - Projectile.height = 13; + Projectile.width = 16; + Projectile.height = 16; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - //Choose the sprite of the projectile - if (Projectile.ai[0] != 1) - { - Projectile.frame = Main.rand.Next(2); - Projectile.ai[0] += 1; - } //Rotation and gravity Projectile.rotation += 0.6f * Projectile.direction; Projectile.velocity.Y = Projectile.velocity.Y + 0.27f; diff --git a/Projectiles/Rogue/BrickFragment.png b/Projectiles/Rogue/BrickFragment.png index 36e20cc3a8..485869855d 100644 Binary files a/Projectiles/Rogue/BrickFragment.png and b/Projectiles/Rogue/BrickFragment.png differ diff --git a/Projectiles/Rogue/RadiantExplosion.cs b/Projectiles/Rogue/RadiantExplosion.cs index 9102eb6779..49940fbce5 100644 --- a/Projectiles/Rogue/RadiantExplosion.cs +++ b/Projectiles/Rogue/RadiantExplosion.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue { ModContent.ProjectileType(), ProjectileID.StarCloakStar, - ModContent.ProjectileType() + ProjectileID.StarCannonStar }); Projectile star = CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 25f, projType, (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Projectile.owner); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index d057d5908c..f21cd6fd5e 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -231,23 +231,23 @@ namespace CalamityMod.Projectiles.Summon } Vector2 center2 = Projectile.Center; Vector2 playerpos = player.Center - center2 + new Vector2(0f, -60f); - float lenghttoplayer = playerpos.Length(); - if (lenghttoplayer > 200f && speedtoplayer < 8f) + float LengthToPlayer = playerpos.Length(); + if (LengthToPlayer > 200f && speedtoplayer < 8f) { speedtoplayer = 10f; } - if (lenghttoplayer < idledistance && gotoplayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + if (LengthToPlayer < idledistance && gotoplayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { Projectile.ai[0] = 0f; Projectile.netUpdate = true; } - if (lenghttoplayer > 2700f) + if (LengthToPlayer > 2700f) { Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2); Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2); Projectile.netUpdate = true; } - if (lenghttoplayer > 70f) + if (LengthToPlayer > 70f) { playerpos.Normalize(); playerpos *= speedtoplayer; diff --git a/Projectiles/Summon/HerringAI.cs b/Projectiles/Summon/HerringAI.cs new file mode 100644 index 0000000000..9bc6a0993b --- /dev/null +++ b/Projectiles/Summon/HerringAI.cs @@ -0,0 +1,104 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class HerringAI : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public bool CheckForSpawning = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Herring School"); + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + } + + public override void SetDefaults() + { + Projectile.minionSlots = 1f; + Projectile.localNPCHitCooldown = 35; + Projectile.penetrate = -1; + + Projectile.width = Projectile.height = 24; + + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.minion = true; + } + + public override void AI() + { + CheckMinionExistance(); // Checks if the minion can still exist. + OnSpawn(); // Makes a dust spawn effect and spawns decorative herrings. + + Projectile.rotation = (Projectile.spriteDirection == -1) ? Projectile.velocity.ToRotation() + MathHelper.Pi : Projectile.velocity.ToRotation(); + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); + // Although the sprite is invisible, we'll keep track of it's direction and rotation so we can later apply it to the decorative herrings. + + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, true, true, 1); // The AI of the minion. + + Projectile.netUpdate = true; + } + + public void CheckMinionExistance() + { + Owner.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + moddedOwner.herring = false; + if (moddedOwner.herring) + Projectile.timeLeft = 2; + } + } + + public void OnSpawn() + { + if (CheckForSpawning == false) + { + int herringAmount = 3; + for (int herringIndex = 0; herringIndex < herringAmount; herringIndex++) + { + float angle = MathHelper.TwoPi / herringAmount * herringIndex; + Vector2 velocity = angle.ToRotationVector2(); + int herring = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), 0, 0f, Projectile.owner, Projectile.whoAmI, angle); + // We'll keep track of the index of the invisible minion and the offset in which each herring spawns so we can later apply it to the decorative herrings. + if (Main.projectile.IndexInRange(herring)) + Main.projectile[herring].originalDamage = 0; + } + // Spawns the decorative fish. + + int dustAmount = 100; + for (int dustIndex = 0; dustIndex < dustAmount; dustIndex++) + { + float angle = MathHelper.TwoPi / dustAmount * dustIndex; + Vector2 velocity = angle.ToRotationVector2() * 20f; + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, DustID.Water, velocity); + spawnDust.customData = false; + spawnDust.velocity *= 0.3f; + spawnDust.scale = velocity.Length() * 0.1f; + } + // Makes the dust spawn effect. + + CheckForSpawning = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } +} diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 1e34673fcd..f6b9cae114 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -1,7 +1,4 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,74 +9,69 @@ namespace CalamityMod.Projectiles.Summon { public Player Owner => Main.player[Projectile.owner]; - public CalamityPlayer moddedOwner => Owner.Calamity(); - - public int dustEffect = 3; + public ref float MinionOrigin => ref Projectile.ai[0]; + + public ref float HerringPosition => ref Projectile.ai[1]; public override void SetStaticDefaults() { DisplayName.SetDefault("Herring"); Main.projFrames[Projectile.type] = 8; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = 60; - Projectile.height = 24; + Projectile.penetrate = -1; + + Projectile.width = 42; + Projectile.height = 14; + + Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 0.5f; - Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.minion = true; - Projectile.DamageType = DamageClass.Summon; - Projectile.usesIDStaticNPCImmunity= true; - Projectile.idStaticNPCHitCooldown = 8; } public override void AI() { - CheckMinionExistance(); // Checks if the minion can still exist. - SpawnEffect(); // Does a dust effectw where it spawns. + NPC target = Projectile.Center.MinionHoming(1200f, Owner); // Detects a target. + Projectile minionAI = Main.projectile[(int)MinionOrigin]; // Gets the invisible minion. + + if (target is not null) + TargetPosition(minionAI); // The minions position themselves near the invisible minion to seem like they're ramming all together. + else + FollowOrigin(minionAI); // Vibes around their respective invisible minion. + + CheckMinionExistance(); // Checks if the decorative herring can still exist, if the invisible minion despawns, so do these ones. DoAnimation(); // Does the animation of the minion. - PointInRightDirection(); // Points at where it's going. + PointInRightDirection(minionAI, target); // Points in the correct direction. + Projectile.MinionAntiClump(); // Prevents the minion from cluttering on one spot. - Projectile.rotation = Projectile.velocity.X * 0.05f; // Does a little movement effect with it's rotation when it's moving. - - Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, true, true, 1); + Projectile.netUpdate = true; } + #region Methods + public void CheckMinionExistance() { - Owner.AddBuff(ModContent.BuffType(), 1); - if (Projectile.type == ModContent.ProjectileType()) - { - if (Owner.dead) - moddedOwner.herring = false; - if (moddedOwner.herring) - Projectile.timeLeft = 2; - } - } + Projectile minionAI = Main.projectile[(int)MinionOrigin]; - public void SpawnEffect() - { - if (dustEffect > 0) + if (MinionOrigin < 0 || MinionOrigin >= Main.projectile.Length) { - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Water, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - dustEffect--; + Projectile.Kill(); + return; } + + if (!minionAI.active || minionAI.type != ModContent.ProjectileType()) + { + Projectile.Kill(); + return; + } + + Projectile.timeLeft = 2; } public void DoAnimation() @@ -88,12 +80,49 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; } - public void PointInRightDirection() + public void PointInRightDirection(Projectile origin, NPC target) { - if (Math.Abs(Projectile.velocity.X) > 0.1f) - Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); + if (target is not null) + { + Projectile.rotation = origin.rotation; + Projectile.spriteDirection = origin.spriteDirection; + // Because when there's a target, the herrings act like the invisible minion, we call it's direction and rotation so that it has a proper look. + } + else + { + Projectile.rotation = (Projectile.spriteDirection == -1) ? Projectile.velocity.ToRotation() + MathHelper.Pi : Projectile.velocity.ToRotation(); + Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); + // If there isn't a target, just look at where it's going. + } } - public override bool OnTileCollide(Vector2 oldVelocity) => false; + public void FollowOrigin(Projectile origin) + { + if (Projectile.WithinRange(origin.Center, 1200f) && !Projectile.WithinRange(origin.Center, 300f)) // If the minion starts to get far, force the minion to go to you. + Projectile.velocity = (origin.Center - Projectile.Center) / 30f; + else if (!Projectile.WithinRange(origin.Center, 160f)) // The minion will change directions to you if it's going away from you, meaning it'll just hover around you. + Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(origin.Center) * 17f) / 40f; + + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(origin.Center, 1200f)) + { + Projectile.position = origin.Center; + Projectile.velocity *= 0.3f; + } + } + + public void TargetPosition(Projectile origin) + { + Projectile.Center = Vector2.Lerp(Projectile.Center, origin.Center + HerringPosition.ToRotationVector2() * 20f, 0.2f); + Projectile.velocity = Vector2.Zero; + // We set the herrings to their respective offset from the invisible minion's position, and because it's following it's position, we don't give the herring velocity. + + int trailDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Water, -Projectile.velocity.X, -Projectile.velocity.Y); + Main.dust[trailDust].noGravity = true; + Main.dust[trailDust].customData = false; + // When ramming, tries to give the herrings a trail of water, as if they were going fast. + } + + #endregion } } diff --git a/Projectiles/Summon/HerringMinion.png b/Projectiles/Summon/HerringMinion.png index 5e8bef7fba..e4e82c253d 100644 Binary files a/Projectiles/Summon/HerringMinion.png and b/Projectiles/Summon/HerringMinion.png differ diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index 7cbe7da5d2..166b99a53e 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -1,7 +1,4 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -17,78 +14,35 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 32; - Projectile.height = 32; + Projectile.timeLeft = 300; + + Projectile.width = Projectile.height = 32; + + Projectile.netImportant = true; Projectile.minion = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.alpha = 255; - Projectile.minionSlots = 0f; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Projectile.alpha -= 40; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position); - } - if (Projectile.ai[0] >= 45f) - { - Projectile.ai[0] = 45f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.025f; - } - if (Projectile.velocity.X < 0f) - { - Projectile.spriteDirection = -1; - Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X); - } - else - { - Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); - } + Projectile.rotation = Projectile.velocity.ToRotation(); // The projectile looks towards where it's going. + + Projectile.netUpdate = true; } - public override bool PreDraw(ref Color lightColor) + public override void Kill(int timeLeft) // When the projectile hits an enemy, it'll make a dust impact effect. { - SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, spriteEffects, 0); - return false; - } - - public override void Kill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - 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 /= 2; - Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + for (int dustIndex = 0; dustIndex < 36; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Dust.NewDust(Projectile.Center, + Projectile.width, + Projectile.height, + 85, + Projectile.velocity.X / 2f, + Projectile.velocity.Y / 2f); } } } diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 0c0394f20c..20c06308af 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -1,8 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +10,14 @@ namespace CalamityMod.Projectiles.Summon { public class SandnadoMinion : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer ModdedOwner => Owner.Calamity(); + + public ref float TimerForShooting => ref Projectile.ai[0]; + + public bool CheckForSpawning = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sandnado"); @@ -21,15 +28,15 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 28; - Projectile.height = 40; + Projectile.minionSlots = 1f; + Projectile.penetrate = -1; + + Projectile.width = 40; + Projectile.height = 43; + Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; @@ -37,236 +44,127 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[1] == 0f) + NPC potentialTarget = Projectile.Center.MinionHoming(2000f, Owner); // Detects a nearby target at a given distance. + + if (potentialTarget is not null) { - int dustAmt = 36; - for (int d = 0; d < dustAmt; d++) - { - Vector2 source = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 dustVel = source - Projectile.Center; - int sand = Dust.NewDust(source + dustVel, 0, 0, 85, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); - Main.dust[sand].noGravity = true; - Main.dust[sand].noLight = true; - Main.dust[sand].velocity = dustVel; - } - Projectile.localAI[1] += 1f; + MoveToTarget(potentialTarget); + ShootTarget(potentialTarget); + // If there's a target, the minion will go towards the target and will shoot at it. } - bool correctMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (correctMinion) + else + Idle(); + + CanMinionExist(); // Checks if the minion can still exist. + OnSpawn(); // Does something when spawning, like a dust effect. + DoAnimation(); // Does the animation of the minion. + Projectile.MinionAntiClump(); // Prevents the minions from going on top of eachother. + + Projectile.netUpdate = true; + } + + #region Methods + + public void CanMinionExist() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) { - if (player.dead) - { - modPlayer.sandnado = false; - } - if (modPlayer.sandnado) - { + if (Owner.dead) + ModdedOwner.sandnado = false; + if (ModdedOwner.sandnado) Projectile.timeLeft = 2; - } - } - Projectile.MinionAntiClump(0.1f); - if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) - { - Projectile.alpha += 20; - if (Projectile.alpha > 150) - { - Projectile.alpha = 150; - } - } - else - { - Projectile.alpha -= 50; - if (Projectile.alpha < 60) - { - Projectile.alpha = 60; - } - } - Vector2 targetPos = Projectile.position; - float range = 1800f; - bool foundTarget = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float npcDist = Vector2.Distance(npc.Center, Projectile.Center); - if ((!foundTarget && npcDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) - { - range = npcDist; - targetPos = npc.Center; - foundTarget = true; - int num11 = npc.whoAmI; - } - } - } - if (!foundTarget) - { - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC npc = Main.npc[k]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float npcDist = Vector2.Distance(npc.Center, Projectile.Center); - if ((!foundTarget && npcDist < range) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) - { - range = npcDist; - targetPos = npc.Center; - foundTarget = true; - } - } - } - } - float sepAnxietyDist = 1200f; - if (foundTarget) - { - sepAnxietyDist = 3000f; - } - if (Vector2.Distance(player.Center, Projectile.Center) > sepAnxietyDist) - { - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - } - if (foundTarget && Projectile.ai[0] == 0f) - { - Vector2 targetDir = targetPos - Projectile.Center; - float targetDist = targetDir.Length(); - targetDir.Normalize(); - if (targetDist > 400f) - { - float speedMult = 6f; - targetDir *= speedMult; - Projectile.velocity = (Projectile.velocity * 20f + targetDir) / 21f; - } - else - { - Projectile.velocity *= 0.96f; - } - if (targetDist > 200f) - { - float speedMult = 12f; - targetDir *= speedMult; - Projectile.velocity = (Projectile.velocity * 40f + targetDir) / 41f; - } - if (Projectile.velocity.Y > -1f) - { - Projectile.velocity.Y -= 0.1f; - } - } - else - { - if (!Collision.CanHitLine(Projectile.Center, 1, 1, player.Center, 1, 1)) - { - Projectile.ai[0] = 1f; - } - float returnSpeed = 12f; - Vector2 playerVec = player.Center - Projectile.Center + new Vector2(0f, -20f); - float playerDist = playerVec.Length(); - if (playerDist > 200f && returnSpeed < 12f) - { - returnSpeed = 12f; - } - if (playerDist < 100f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) - { - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - if (playerDist > 2000f) - { - Projectile.position = player.position; - Projectile.netUpdate = true; - } - if (Math.Abs(playerVec.X) > 40f || Math.Abs(playerVec.Y) > 10f) - { - playerVec.Normalize(); - playerVec *= returnSpeed; - playerVec *= new Vector2(1.25f, 0.65f); - Projectile.velocity = (Projectile.velocity * 20f + playerVec) / 21f; - } - else - { - if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) - { - Projectile.velocity.X = -0.15f; - Projectile.velocity.Y = -0.05f; - } - Projectile.velocity *= 1.01f; - } - } - Projectile.rotation = Projectile.velocity.X * 0.05f; - Projectile.frameCounter++; - int two = 2; - if (Projectile.frameCounter >= 6 * two) - { - Projectile.frameCounter = 0; - } - Projectile.frame = Projectile.frameCounter / two; - if (Main.rand.NextBool(5)) - { - int sand = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 2f); - Main.dust[sand].velocity *= 0.3f; - Main.dust[sand].noGravity = true; - Main.dust[sand].noLight = true; - } - if (Projectile.velocity.X > 0f) - { - Projectile.spriteDirection = Projectile.direction = -1; - } - else if (Projectile.velocity.X < 0f) - { - Projectile.spriteDirection = Projectile.direction = 1; - } - if (Projectile.ai[1] > 0f) - { - Projectile.ai[1] += 1f; - if (Main.rand.Next(3) != 0) - { - Projectile.ai[1] += 1f; - } - } - if (Projectile.ai[1] > 75f) - { - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } - if (Projectile.ai[0] == 0f) - { - float speed = 14f; - int projType = ModContent.ProjectileType(); - if (foundTarget) - { - if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) - { - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner) - { - Vector2 velocity = targetPos - Projectile.Center; - velocity.Normalize(); - velocity *= speed; - int shark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner); - Main.projectile[shark].originalDamage = Projectile.originalDamage; - Main.projectile[shark].netUpdate = true; - Projectile.netUpdate = true; - } - } - } - } } } - public override bool PreDraw(ref Color lightColor) + public void OnSpawn() { - Texture2D texture = ModContent.Request(Texture).Value; - int frameHeight = texture.Height / Main.projFrames[Projectile.type]; - int frame = frameHeight * Projectile.frame; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frame, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; + if (CheckForSpawning == false) + { + int dustAmount = 75; + for (int dustIndex = 0; dustIndex < dustAmount; dustIndex++) + { + float angle = MathHelper.TwoPi / dustAmount * dustIndex; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(5f, 6.5f); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 85, velocity); + } + CheckForSpawning = true; + } + } + + public void DoAnimation() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; + } + + public void Idle() + { + if (Projectile.WithinRange(Owner.Center, 1200f) && !Projectile.WithinRange(Owner.Center, 300f)) // If the minion starts to get far, force the minion to go to you. + { + Projectile.velocity = (Owner.Center - Projectile.Center) / 30f; + Projectile.netUpdate = true; + } + else if (!Projectile.WithinRange(Owner.Center, 160f)) // The minion will change directions to you if it's going away from you, meaning it'll just hover around you. + { + Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 40f; + Projectile.netUpdate = true; + } + + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 1200f)) + { + Projectile.position = Owner.Center; + Projectile.velocity *= 0.3f; + Projectile.netUpdate = true; + } + } + + public void MoveToTarget(NPC target) + { + Vector2 vecToTarget = target.Center - Projectile.Center; + float targetDist = vecToTarget.Length(); + vecToTarget.Normalize(); + //If farther than 200 pixels, move toward it + if (targetDist > 200f) + { + float speedMult = (targetDist > 400f) ? 12f : (targetDist > 250) ? 6f : 3f; + vecToTarget *= speedMult; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; + } + //Otherwise, back it up slowly + else + { + float speedMult = -3f; + vecToTarget *= speedMult; + Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; + } + } + + public void ShootTarget(NPC target) + { + if (TimerForShooting == SandSharknadoStaff.FireSpeed && Main.myPlayer == Projectile.owner) + { + int sandSharkProj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), + Projectile.Center, + CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, SandSharknadoStaff.ProjVel), + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + + if (Main.projectile.IndexInRange(sandSharkProj)) + Main.projectile[sandSharkProj].originalDamage = Projectile.originalDamage; + + TimerForShooting = 0f; + } + + if (TimerForShooting < SandSharknadoStaff.FireSpeed) + TimerForShooting++; } public override bool? CanDamage() => false; + + #endregion } } diff --git a/Projectiles/Summon/Umbrella/TreeAstral.png b/Projectiles/Summon/Umbrella/TreeAstral.png index a66b9a3d87..178f6d5376 100644 Binary files a/Projectiles/Summon/Umbrella/TreeAstral.png and b/Projectiles/Summon/Umbrella/TreeAstral.png differ diff --git a/Projectiles/Typeless/WulfrumDrillProj.cs b/Projectiles/Typeless/WulfrumDrillProj.cs index 95fd828518..99fd498b3b 100644 --- a/Projectiles/Typeless/WulfrumDrillProj.cs +++ b/Projectiles/Typeless/WulfrumDrillProj.cs @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Typeless public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLenght = 54f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 24, ref collisionPoint); + float bladeLength = 54f * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 24, ref collisionPoint); } public override void AI() diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index bf7b5db93a..00a94addc6 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -113,9 +113,9 @@ namespace CalamityMod.Projectiles.Typeless else { - float lenghtToOwner = BetweenOwner.Length(); + float LengthToOwner = BetweenOwner.Length(); - if (lenghtToOwner > Owner.GetModPlayer().SwingLenght + 60f) + if (LengthToOwner > Owner.GetModPlayer().SwingLength + 60f) { State = HookState.Retracting; } @@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Typeless //Owner.velocity = Vector2.Zero; } - mp.SwingLenght = (Owner.Center - Projectile.Center).Length(); + mp.SwingLength = (Owner.Center - Projectile.Center).Length(); mp.OldPosition = Owner.Center - Owner.velocity; mp.SetSegments(Projectile.Center); mp.Grapple = Projectile.whoAmI; diff --git a/Systems/DifficultyModeSystem.cs b/Systems/DifficultyModeSystem.cs index 26c1f4afbd..a6287835c3 100644 --- a/Systems/DifficultyModeSystem.cs +++ b/Systems/DifficultyModeSystem.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Systems public override void Load() { MostAlternateDifficulties = 1; - Difficulties = new DifficultyMode[] { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty(), new WhereMalice()}; + Difficulties = new DifficultyMode[] { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty()}; //All of this should happen after a hook happens which lets other mods add their own difficulties Difficulties = Difficulties.OrderBy(d => d.DifficultyScale).ToArray(); @@ -287,65 +287,4 @@ namespace CalamityMod.Systems return 0; } } - - public class WhereMalice : DifficultyMode - { - public override bool Enabled - { - get => false; - set { } - } - - private Asset _texture; - public override Asset Texture - { - get - { - if (_texture == null) - _texture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_WhereMalice"); - - return _texture; - } - } - - public override string ExpandedDescription - { - get - { - string realIntentionsHex = (Color.Lerp(Color.White, new Color(255, 148, 122), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly + 0.5f))).Hex3(); - string harderOptionsHex = (Color.Lerp(Color.White, Color.Gold, 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly))).Hex3(); - - return "[c/EDEDED:Malice originally came about from an idea to make obtaining Legendary items less RNG-based]\n" + - "[c/EDEDED:It was meant to allow the player to enrage specific bosses, giving them new phases or attacks, to guarantee the drop]\n" + - "[c/EDEDED:However, this was watered down to what Malice was on release, being a difficulty which affected all bosses, and included RIV(Rare Item Variants)]\n" + - "\n" + - "[c/EDEDED:At the time, Malice was received poorly by a lot of players due to the bosses being overtuned to the point of being unfair, while locking items behind them]\n" + - "[c/939393: ...No tester had beaten the Exo Mechs on Malice Mode when it released]\n" + - "[c/" + realIntentionsHex + ":The explanation was that it was meant to be a \"refight\" mode, but that was never the real intention]\n" + - "\n" + - "[c/EDEDED:Malice-exclusive drops were eventually removed, as we did not want players to feel obligated to play a poorly balanced difficulty]\n" + - "[c/EDEDED:Over time, Malice was balanced to be less unfair, but we realized that with the exclusive drops gone, it was not worth the effort]\n" + - "[c/EDEDED:This is why we came down to deleting Malice, so that dev time and effort may be spent elsewhere, notably Death Mode]\n" + - "\n" + - "[c/" + harderOptionsHex + ":We acknowledge that some players liked Malice because Death isn't challenging enough for their tastes]\n" + - "[c/" + harderOptionsHex + ":If you want more difficulty, try the Infernum Addon, Master Mode, higher Boss HP Config, or for amusement, For The Worthy]"; - - } - } - - public WhereMalice() - { - DifficultyScale = 1000000f; //So its always at the end of the list - Name = "Where's Malice?"; - ShortDescription = "[c/FB7152:Malice Mode has been removed from the mod, but its AI changes will live on in Boss Rush]\n" + - "[c/FB7152:We sincerely apologize for the disappointment if you were planning on a playthrough]"; - - ActivationTextKey = "Mods.CalamityMod.DeathText"; //Copy values from death since clicing on the icon enables death - DeactivationTextKey = ""; - - ActivationSound = DemonshadeHelm.ActivationSound; - - ChatTextColor = Color.MediumOrchid; - } - } -} +} \ No newline at end of file diff --git a/Systems/TilePingerSystem.cs b/Systems/TilePingerSystem.cs index 6908635ad4..9d6a5aa79e 100644 --- a/Systems/TilePingerSystem.cs +++ b/Systems/TilePingerSystem.cs @@ -269,7 +269,7 @@ namespace CalamityMod.Systems tileEffect.Parameters["pingTravelTime"].SetValue(MaxPingTravelTime / (float)MaxPingLife); tileEffect.Parameters["pingFadePoint"].SetValue(0.9f); tileEffect.Parameters["edgeBlendStrength"].SetValue(1f); - tileEffect.Parameters["edgeBlendOutLenght"].SetValue(6f); + tileEffect.Parameters["edgeBlendOutLength"].SetValue(6f); tileEffect.Parameters["tileEdgeBlendStrenght"].SetValue(2f); tileEffect.Parameters["waveColor"].SetValue(Color.GreenYellow.ToVector4()); diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index b50dcfd665..f117c19b5e 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,7 +10,10 @@ namespace CalamityMod.Tiles.Abyss { public class AbyssGravel : ModTile { - int animationFrameWidth = 288; + int animationFrameWidth = 234; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); @@ -17,7 +21,6 @@ namespace CalamityMod.Tiles.Abyss { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileMergeDirt[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); @@ -28,6 +31,9 @@ namespace CalamityMod.Tiles.Abyss MinPick = 65; HitSound = MineSound; DustType = 33; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); } public override bool CanExplode(int i, int j) @@ -154,11 +160,17 @@ namespace CalamityMod.Tiles.Abyss } frameXOffset = uniqueAnimationFrameX * animationFrameWidth; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Abyss/AbyssGravel.png b/Tiles/Abyss/AbyssGravel.png index 05ffefa6d8..08f763cacc 100644 Binary files a/Tiles/Abyss/AbyssGravel.png and b/Tiles/Abyss/AbyssGravel.png differ diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs index 0332801a50..eedd621506 100644 --- a/Tiles/Abyss/HardenedSulphurousSandstone.cs +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -1,5 +1,6 @@ using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,9 @@ namespace CalamityMod.Tiles.Abyss { public class HardenedSulphurousSandstone : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,6 +25,9 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(76, 58, 59)); MineResist = 1.45f; HitSound = SoundID.Dig; + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -35,10 +42,18 @@ namespace CalamityMod.Tiles.Abyss WorldGen.KillTile(i, j + 1); } } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SulphurousShaleMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } public override void RandomUpdate(int i, int j) { diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.png b/Tiles/Abyss/HardenedSulphurousSandstone.png index 32866338ad..50125ca5d2 100644 Binary files a/Tiles/Abyss/HardenedSulphurousSandstone.png and b/Tiles/Abyss/HardenedSulphurousSandstone.png differ diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index fa9f6a0eee..f98043fab9 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -1,6 +1,7 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Walls; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,6 +14,10 @@ namespace CalamityMod.Tiles.Abyss public class PlantyMush : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -29,9 +34,14 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(84, 102, 39), name); MineResist = 1f; HitSound = MineSound; + + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); } - int animationFrameWidth = 288; + int animationFrameWidth = 234; public override bool CanExplode(int i, int j) { @@ -212,10 +222,19 @@ namespace CalamityMod.Tiles.Abyss } } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Abyss/PlantyMush.png b/Tiles/Abyss/PlantyMush.png index 6cf0f42678..dd76751b1f 100644 Binary files a/Tiles/Abyss/PlantyMush.png and b/Tiles/Abyss/PlantyMush.png differ diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index ad8ae03f42..b732dd07ad 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -13,7 +13,11 @@ namespace CalamityMod.Tiles.Abyss public class PyreMantle : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -29,6 +33,11 @@ namespace CalamityMod.Tiles.Abyss MinPick = 180; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(19, 20, 32)); + + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -64,11 +73,19 @@ namespace CalamityMod.Tiles.Abyss } } } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Abyss/PyreMantle.png b/Tiles/Abyss/PyreMantle.png index 4e195458c6..4e9f46053d 100644 Binary files a/Tiles/Abyss/PyreMantle.png and b/Tiles/Abyss/PyreMantle.png differ diff --git a/Tiles/Abyss/PyreMantleMolten.cs b/Tiles/Abyss/PyreMantleMolten.cs index cbf4fe2480..6b21289cc7 100644 --- a/Tiles/Abyss/PyreMantleMolten.cs +++ b/Tiles/Abyss/PyreMantleMolten.cs @@ -14,6 +14,11 @@ namespace CalamityMod.Tiles.Abyss { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; internal static Texture2D GlowTexture; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; public override void SetStaticDefaults() { if (!Main.dedServ) @@ -33,9 +38,12 @@ namespace CalamityMod.Tiles.Abyss MinPick = 180; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(113, 49, 16)); - } - int animationFrameWidth = 288; + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out fourthTileAdjacency); + } public override bool CreateDust(int i, int j, ref int type) { @@ -90,6 +98,11 @@ namespace CalamityMod.Tiles.Abyss TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); glowbrightness += 0.3f; + + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/PyreMantleMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { @@ -107,8 +120,11 @@ namespace CalamityMod.Tiles.Abyss public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out fourthTileAdjacency[i, j]); + return true; } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/Abyss/PyreMantleMolten.png b/Tiles/Abyss/PyreMantleMolten.png index 6a6b60d515..4eeabad9a0 100644 Binary files a/Tiles/Abyss/PyreMantleMolten.png and b/Tiles/Abyss/PyreMantleMolten.png differ diff --git a/Tiles/Abyss/PyreMantleMolten_Glowmask.png b/Tiles/Abyss/PyreMantleMolten_Glowmask.png index 9a9848fa7a..f5ca5205a8 100644 Binary files a/Tiles/Abyss/PyreMantleMolten_Glowmask.png and b/Tiles/Abyss/PyreMantleMolten_Glowmask.png differ diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 807073339f..06dc41394b 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -15,6 +16,10 @@ namespace CalamityMod.Tiles.Abyss [LegacyName("SulphurousSandNoWater")] public class SulphurousSand : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -30,6 +35,11 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(150, 100, 50)); MineResist = 1f; HitSound = SoundID.Dig; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fourthTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -171,11 +181,22 @@ namespace CalamityMod.Tiles.Abyss } } } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SulphurousSandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fourthTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Abyss/SulphurousSand.png b/Tiles/Abyss/SulphurousSand.png index 7a579b87f5..200e715bfc 100644 Binary files a/Tiles/Abyss/SulphurousSand.png and b/Tiles/Abyss/SulphurousSand.png differ diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index 802816d88c..10db7c856f 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -1,5 +1,6 @@ using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,9 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousSandstone : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,6 +25,10 @@ namespace CalamityMod.Tiles.Abyss AddMapEntry(new Color(113, 90, 71)); MineResist = 1.2f; HitSound = SoundID.Dig; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -35,10 +43,18 @@ namespace CalamityMod.Tiles.Abyss WorldGen.KillTile(i, j + 1); } } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSulphurousSandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } public override void RandomUpdate(int i, int j) { diff --git a/Tiles/Abyss/SulphurousSandstone.png b/Tiles/Abyss/SulphurousSandstone.png index bd3c43fa9d..0e05e5ff7f 100644 Binary files a/Tiles/Abyss/SulphurousSandstone.png and b/Tiles/Abyss/SulphurousSandstone.png differ diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs index eb5c6c66d6..05630f1f31 100644 --- a/Tiles/Abyss/SulphurousShale.cs +++ b/Tiles/Abyss/SulphurousShale.cs @@ -14,7 +14,10 @@ namespace CalamityMod.Tiles.Abyss { public class SulphurousShale : ModTile { - int animationFrameWidth = 288; + int animationFrameWidth = 234; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); public override void SetStaticDefaults() @@ -32,6 +35,9 @@ namespace CalamityMod.Tiles.Abyss MinPick = 65; HitSound = MineSound; DustType = 33; + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); } public override bool CanExplode(int i, int j) @@ -213,11 +219,19 @@ namespace CalamityMod.Tiles.Abyss } frameXOffset = uniqueAnimationFrameX * animationFrameWidth; } - + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Abyss/SulphurousShale.png b/Tiles/Abyss/SulphurousShale.png index e23324e5b9..74ac7343f6 100644 Binary files a/Tiles/Abyss/SulphurousShale.png and b/Tiles/Abyss/SulphurousShale.png differ diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 70c79e3dc8..d183965a55 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Tiles.Abyss if (!below.HasTile && below.LiquidType == LiquidID.Water && below.LiquidAmount >= 128) { bool growVine = false; - for (int vineOriginYPos = j; vineOriginYPos > j - MaxVineHeight; j--) + for (int vineOriginYPos = j; vineOriginYPos > j - MaxVineHeight; vineOriginYPos--) { Tile consideredVineOrigin = Main.tile[i, vineOriginYPos]; // Vines won't grow if they are coming out of a bottom-sloped block (which they shouldn't be able to anyway) @@ -100,7 +100,7 @@ namespace CalamityMod.Tiles.Abyss break; } // Vines can continue to grow unimpeded out of any solid block that isn't bottom-sloped. - if (Main.tile[i, vineOriginYPos].HasTile && !Main.tile[i, vineOriginYPos].BottomSlope) + if (Main.tile[i, vineOriginYPos].HasTile && !Main.tile[i, vineOriginYPos].BottomSlope && Main.tileSolid[Main.tile[i, vineOriginYPos].TileType]) { growVine = true; break; diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index c0286f9ad9..09392160d0 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -14,6 +14,9 @@ namespace CalamityMod.Tiles.Abyss { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; internal static Texture2D GlowTexture; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { if (!Main.dedServ) @@ -32,9 +35,13 @@ namespace CalamityMod.Tiles.Abyss MinPick = 180; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(15, 15, 15)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); } - int animationFrameWidth = 288; + int animationFrameWidth = 234; public override bool CreateDust(int i, int j, ref int type) { @@ -255,7 +262,7 @@ namespace CalamityMod.Tiles.Abyss } break; } - xOffset *= 288; + xOffset *= 234; xPos += xOffset; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -270,12 +277,17 @@ namespace CalamityMod.Tiles.Abyss drawColour *= brightness; TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/PyreMantleMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/Abyss/Voidstone.png b/Tiles/Abyss/Voidstone.png index 575da9a843..06b8950560 100644 Binary files a/Tiles/Abyss/Voidstone.png and b/Tiles/Abyss/Voidstone.png differ diff --git a/Tiles/Abyss/Voidstone_Glowmask.png b/Tiles/Abyss/Voidstone_Glowmask.png index 37bdfa2c7e..dd1a8ca1f9 100644 Binary files a/Tiles/Abyss/Voidstone_Glowmask.png and b/Tiles/Abyss/Voidstone_Glowmask.png differ diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index 2df6fef920..25a285bfff 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -1,12 +1,15 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles { public class AerialiteBrick : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -14,10 +17,20 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(68, 58, 145)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } diff --git a/Tiles/Astral/AstralClay.cs b/Tiles/Astral/AstralClay.cs index f1213d9f95..87384a72e2 100644 --- a/Tiles/Astral/AstralClay.cs +++ b/Tiles/Astral/AstralClay.cs @@ -1,6 +1,7 @@  using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,7 @@ namespace CalamityMod.Tiles.Astral { public class AstralClay : ModTile { + public byte[,] tileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -26,12 +28,19 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; + + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + return true; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Astral/AstralClay.png b/Tiles/Astral/AstralClay.png index 836ee276f6..6356f88e2d 100644 Binary files a/Tiles/Astral/AstralClay.png and b/Tiles/Astral/AstralClay.png differ diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 1e957ab8ab..1f6b9d0db7 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.Metadata; using Terraria.ID; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.Astral { public class AstralDirt : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -31,12 +34,23 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; + + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + return true; } public override void RandomUpdate(int i, int j) diff --git a/Tiles/Astral/AstralDirt.png b/Tiles/Astral/AstralDirt.png index 65dd801350..47b54336de 100644 Binary files a/Tiles/Astral/AstralDirt.png and b/Tiles/Astral/AstralDirt.png differ diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index efcdbebc43..bb28683792 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Tiles.Astral private static int sheetWidth = 216; private static int sheetHeight = 72; + public byte[,] tileAdjacency; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -29,6 +31,9 @@ namespace CalamityMod.Tiles.Astral ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(45, 36, 63)); + + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -83,10 +88,14 @@ namespace CalamityMod.Tiles.Astral { Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } + + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); TileFraming.CompactFraming(i, j, resetFrame); return false; } diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 6222d12fb4..572125157c 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -1,6 +1,7 @@  using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,9 @@ namespace CalamityMod.Tiles.Astral { public class AstralStone : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -29,12 +33,25 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.Stone[Type] = true; TileID.Sets.Conversion.Stone[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Astral/AstralStone.png b/Tiles/Astral/AstralStone.png index d89fe8332c..d58c6fa8b9 100644 Binary files a/Tiles/Astral/AstralStone.png and b/Tiles/Astral/AstralStone.png differ diff --git a/Tiles/Astral/NovaeSlag.cs b/Tiles/Astral/NovaeSlag.cs index dbcf9e730c..9caf5c3d44 100644 --- a/Tiles/Astral/NovaeSlag.cs +++ b/Tiles/Astral/NovaeSlag.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,9 @@ namespace CalamityMod.Tiles.Astral [LegacyName("AstralSilt")] public class NovaeSlag : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -28,6 +32,10 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -37,10 +45,19 @@ namespace CalamityMod.Tiles.Astral return false; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + return true; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Astral/NovaeSlag.png b/Tiles/Astral/NovaeSlag.png index 858f680409..d64394fc6d 100644 Binary files a/Tiles/Astral/NovaeSlag.png and b/Tiles/Astral/NovaeSlag.png differ diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index c39eb4c2d1..d3495ad302 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Tiles.Astral; using Terraria; using Terraria.ModLoader; using Terraria.ID; @@ -12,6 +13,8 @@ namespace CalamityMod.Tiles private const short subsheetWidth = 324; private const short subsheetHeight = 90; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -19,6 +22,9 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(128, 128, 158)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -29,6 +35,8 @@ namespace CalamityMod.Tiles public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } @@ -58,6 +66,9 @@ namespace CalamityMod.Tiles double num6 = Main.time * 0.08; TileFraming.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 7589a5532f..c64bde4cee 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Metadata; @@ -11,6 +12,10 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralSand : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -33,13 +38,24 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.Conversion.Sand[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; TileID.Sets.Falling[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fourthTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } - + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { if (j < Main.maxTilesY) @@ -53,9 +69,11 @@ namespace CalamityMod.Tiles.AstralDesert return false; } } - // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fourthTileAdjacency[i, j]); + return true; } public override bool HasWalkDust() diff --git a/Tiles/AstralDesert/AstralSand.png b/Tiles/AstralDesert/AstralSand.png index 5960e4585e..3e1060c2b1 100644 Binary files a/Tiles/AstralDesert/AstralSand.png and b/Tiles/AstralDesert/AstralSand.png differ diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index 7872e56bae..e26478ab7a 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -1,6 +1,7 @@  using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,10 @@ namespace CalamityMod.Tiles.AstralDesert { public class AstralSandstone : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,13 +30,26 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.Conversion.Sandstone[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; - } + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); - return false; + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + return true; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/AstralDesert/AstralSandstone.png b/Tiles/AstralDesert/AstralSandstone.png index 88b58bd4f3..6a496c9761 100644 Binary files a/Tiles/AstralDesert/AstralSandstone.png and b/Tiles/AstralDesert/AstralSandstone.png differ diff --git a/Tiles/AstralDesert/CelestialRemains.cs b/Tiles/AstralDesert/CelestialRemains.cs index 979f464b58..aef3de4c1b 100644 --- a/Tiles/AstralDesert/CelestialRemains.cs +++ b/Tiles/AstralDesert/CelestialRemains.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.AstralDesert [LegacyName("AstralFossil")] public class CelestialRemains : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -26,12 +29,20 @@ namespace CalamityMod.Tiles.AstralDesert AddMapEntry(new Color(59, 50, 77)); TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; - } + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralSandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); + return true; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/AstralDesert/CelestialRemains.png b/Tiles/AstralDesert/CelestialRemains.png index fb18fa05b1..8272b74655 100644 Binary files a/Tiles/AstralDesert/CelestialRemains.png and b/Tiles/AstralDesert/CelestialRemains.png differ diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 21926ac0bc..afd4fc6d63 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -1,5 +1,6 @@  using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,11 @@ namespace CalamityMod.Tiles.AstralDesert { public class HardenedAstralSand : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; + public byte[,] fifthTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,13 +31,30 @@ namespace CalamityMod.Tiles.AstralDesert TileID.Sets.Conversion.HardenedSand[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fifthTileAdjacency); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralSandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fifthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out fourthTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fifthTileAdjacency[i, j]); + return true; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/AstralDesert/HardenedAstralSand.png b/Tiles/AstralDesert/HardenedAstralSand.png index 6e9e3afdaf..463b5fa226 100644 Binary files a/Tiles/AstralDesert/HardenedAstralSand.png and b/Tiles/AstralDesert/HardenedAstralSand.png differ diff --git a/Tiles/AstralSnow/AstralIce.cs b/Tiles/AstralSnow/AstralIce.cs index ea8a5c72b5..be1fc6eb81 100644 --- a/Tiles/AstralSnow/AstralIce.cs +++ b/Tiles/AstralSnow/AstralIce.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Tiles.Astral; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.Metadata; using Terraria.ID; @@ -8,6 +10,8 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralIce : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -32,6 +36,9 @@ namespace CalamityMod.Tiles.AstralSnow TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.Conversion.Ice[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -45,10 +52,17 @@ namespace CalamityMod.Tiles.AstralSnow base.FloorVisuals(player); } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralSnowMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/AstralSnow/AstralIce.png b/Tiles/AstralSnow/AstralIce.png index 2af638e1df..e3891a1e21 100644 Binary files a/Tiles/AstralSnow/AstralIce.png and b/Tiles/AstralSnow/AstralIce.png differ diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index cb16c83920..2ee272205b 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -1,5 +1,6 @@ using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent.Metadata; using Terraria.ID; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.AstralSnow { public class AstralSnow : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -30,18 +33,26 @@ namespace CalamityMod.Tiles.AstralSnow TileID.Sets.Snow[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.SnowBlock, out secondTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SnowMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.SnowBlock, out secondTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/AstralSnow/AstralSnow.png b/Tiles/AstralSnow/AstralSnow.png index 323a795cb8..dd0facc49d 100644 Binary files a/Tiles/AstralSnow/AstralSnow.png and b/Tiles/AstralSnow/AstralSnow.png differ diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index f60e79ba86..6900f5eb10 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Tiles (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), }; diff --git a/Tiles/Crags/BrimstoneSlab.cs b/Tiles/Crags/BrimstoneSlab.cs index 40cf6823dc..941b8c9bd8 100644 --- a/Tiles/Crags/BrimstoneSlab.cs +++ b/Tiles/Crags/BrimstoneSlab.cs @@ -3,13 +3,17 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags { public class BrimstoneSlab : ModTile { - private int sheetWidth = 450; - private int sheetHeight = 270; + private int subsheetWidth = 450; + private int subsheetHeight = 198; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { @@ -27,6 +31,9 @@ namespace CalamityMod.Tiles.Crags MinPick = 100; HitSound = SoundID.Tink; DustType = 235; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); } public override bool CanExplode(int i, int j) @@ -41,12 +48,18 @@ namespace CalamityMod.Tiles.Crags public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - frameXOffset = i % 2 * sheetWidth; - frameYOffset = j % 2 * sheetHeight; + frameXOffset = i % 2 * subsheetWidth; + frameYOffset = j % 2 * subsheetHeight; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/Crags/BrimstoneSlab.png b/Tiles/Crags/BrimstoneSlab.png index 976dccddc8..78865b1026 100644 Binary files a/Tiles/Crags/BrimstoneSlab.png and b/Tiles/Crags/BrimstoneSlab.png differ diff --git a/Tiles/Crags/BrimstoneSlag.cs b/Tiles/Crags/BrimstoneSlag.cs index 3e5945cb29..011ce00174 100644 --- a/Tiles/Crags/BrimstoneSlag.cs +++ b/Tiles/Crags/BrimstoneSlag.cs @@ -1,8 +1,9 @@ -using CalamityMod.Tiles.Ores; +using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags { @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.Crags { private const short subsheetWidth = 450; private const short subsheetHeight = 198; - + public byte[,] TileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,6 +26,7 @@ namespace CalamityMod.Tiles.Crags MinPick = 100; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(53, 33, 56)); + TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out TileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -45,8 +47,13 @@ namespace CalamityMod.Tiles.Crags frameYOffset = j % 2 * subsheetHeight; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, TileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Ash, out TileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } @@ -94,7 +101,7 @@ namespace CalamityMod.Tiles.Crags Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X) + (float)num10, (float)(j * 16 - (int)Main.screenPosition.Y + index4 * 2)) + zero, drawRectangle, drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } - }*/ + } private Color GetDrawColour(int i, int j, Color colour) { @@ -107,6 +114,6 @@ namespace CalamityMod.Tiles.Crags colour.B = (byte)(paintCol.B / 255f * colour.B); } return colour; - } + }*/ } } diff --git a/Tiles/Crags/ScorchedBone.cs b/Tiles/Crags/ScorchedBone.cs index 27eedbcb41..5eda117eed 100644 --- a/Tiles/Crags/ScorchedBone.cs +++ b/Tiles/Crags/ScorchedBone.cs @@ -3,14 +3,17 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags { public class ScorchedBone : ModTile { private int sheetWidth = 450; - private int sheetHeight = 270; + private int sheetHeight = 198; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -26,6 +29,9 @@ namespace CalamityMod.Tiles.Crags MinPick = 100; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(87, 62, 67)); + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); } public override bool CanExplode(int i, int j) @@ -38,8 +44,15 @@ namespace CalamityMod.Tiles.Crags frameXOffset = i % 3 * sheetWidth; frameYOffset = j % 3 * sheetHeight; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/Crags/ScorchedBone.png b/Tiles/Crags/ScorchedBone.png index d2965e7fe8..0567def7fc 100644 Binary files a/Tiles/Crags/ScorchedBone.png and b/Tiles/Crags/ScorchedBone.png differ diff --git a/Tiles/Crags/ScorchedRemains.cs b/Tiles/Crags/ScorchedRemains.cs index d12acfb850..4576360771 100644 --- a/Tiles/Crags/ScorchedRemains.cs +++ b/Tiles/Crags/ScorchedRemains.cs @@ -3,14 +3,17 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags { public class ScorchedRemains : ModTile { - private int sheetWidth = 288; - private int sheetHeight = 270; + private int sheetWidth = 234; + private int sheetHeight = 90; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -26,6 +29,9 @@ namespace CalamityMod.Tiles.Crags MinPick = 100; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(57, 52, 72)); + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); } public override void RandomUpdate(int i, int j) @@ -57,10 +63,16 @@ namespace CalamityMod.Tiles.Crags frameXOffset = i % 3 * sheetWidth; frameYOffset = j % 3 * sheetHeight; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Crags/ScorchedRemains.png b/Tiles/Crags/ScorchedRemains.png index 3fe8139b3c..1de4330750 100644 Binary files a/Tiles/Crags/ScorchedRemains.png and b/Tiles/Crags/ScorchedRemains.png differ diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index 1b47d6509b..6885311858 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -12,11 +12,14 @@ namespace CalamityMod.Tiles.Crags { public class ScorchedRemainsGrass : ModTile { - private const short subsheetWidth = 450; - private const short subsheetHeight = 198; + private const short subsheetWidth = 234; + private const short subsheetHeight = 90; private int extraFrameHeight = 36; private int extraFrameWidth = 90; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -32,6 +35,9 @@ namespace CalamityMod.Tiles.Crags MinPick = 100; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(212, 82, 227)); + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) @@ -154,6 +160,17 @@ namespace CalamityMod.Tiles.Crags DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); + return true; + } #region 'Extra Drapes' Drawing private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) diff --git a/Tiles/Crags/ScorchedRemainsGrass.png b/Tiles/Crags/ScorchedRemainsGrass.png index 540758b1f2..78903f032d 100644 Binary files a/Tiles/Crags/ScorchedRemainsGrass.png and b/Tiles/Crags/ScorchedRemainsGrass.png differ diff --git a/Tiles/CryonicBrick.cs b/Tiles/CryonicBrick.cs index 760ffea73e..ba64c978ae 100644 --- a/Tiles/CryonicBrick.cs +++ b/Tiles/CryonicBrick.cs @@ -1,7 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles { @@ -9,6 +10,9 @@ namespace CalamityMod.Tiles { int subsheetHeight = 90; int subsheetWidth = 234; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -20,6 +24,9 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(99, 131, 199)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.SnowBlock, out secondTileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -28,6 +35,13 @@ namespace CalamityMod.Tiles return false; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.SnowBlock, out secondTileAdjacency[i, j]); + return true; + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int xPos = i % 2; @@ -35,5 +49,11 @@ namespace CalamityMod.Tiles frameXOffset = xPos * subsheetWidth; frameYOffset = yPos * subsheetHeight; } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SnowMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } } } diff --git a/Tiles/DraedonStructures/LaboratoryPanels.cs b/Tiles/DraedonStructures/LaboratoryPanels.cs index a7ea8499bc..dac4cfded4 100644 --- a/Tiles/DraedonStructures/LaboratoryPanels.cs +++ b/Tiles/DraedonStructures/LaboratoryPanels.cs @@ -3,17 +3,20 @@ using Terraria; using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPanels : ModTile { public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileMergeDirt[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.SetMerge(Type, ModContent.TileType()); @@ -23,8 +26,24 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(36, 35, 37)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); } public override bool CanExplode(int i, int j) => false; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + return true; + } } } diff --git a/Tiles/DraedonStructures/LaboratoryPanels.png b/Tiles/DraedonStructures/LaboratoryPanels.png index b2bd3aed59..71cc01fb60 100644 Binary files a/Tiles/DraedonStructures/LaboratoryPanels.png and b/Tiles/DraedonStructures/LaboratoryPanels.png differ diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.cs b/Tiles/DraedonStructures/LaboratoryPipePlating.cs index c0d4c1052c..bd9353b8a4 100644 --- a/Tiles/DraedonStructures/LaboratoryPipePlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPipePlating.cs @@ -3,12 +3,16 @@ using Terraria; using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPipePlating : ModTile { public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,12 +25,23 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(91, 64, 56)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); } public override bool CanExplode(int i, int j) => false; + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/DraedonStructures/LaboratoryPlating.cs b/Tiles/DraedonStructures/LaboratoryPlating.cs index c7c3067041..6650bf0bf4 100644 --- a/Tiles/DraedonStructures/LaboratoryPlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPlating.cs @@ -3,11 +3,15 @@ using Terraria; using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPlating : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public override void SetStaticDefaults() { @@ -21,12 +25,23 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; ItemDrop = ModContent.ItemType (); AddMapEntry(new Color(162, 157, 150)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); } public override bool CanExplode(int i, int j) => false; + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } } diff --git a/Tiles/DraedonStructures/RustedPlating.cs b/Tiles/DraedonStructures/RustedPlating.cs index 283ecee93d..1474e778f8 100644 --- a/Tiles/DraedonStructures/RustedPlating.cs +++ b/Tiles/DraedonStructures/RustedPlating.cs @@ -3,12 +3,17 @@ using Terraria; using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.DraedonStructures { public class RustedPlating : ModTile { public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,12 +26,22 @@ namespace CalamityMod.Tiles.DraedonStructures MinPick = 30; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(128, 90, 77)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } public override bool CanExplode(int i, int j) => false; public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); return TileFraming.BetterGemsparkFraming(i, j, resetFrame); } } diff --git a/Tiles/Merges/AbyssGravelMerge.png b/Tiles/Merges/AbyssGravelMerge.png new file mode 100644 index 0000000000..66ef3f0d95 Binary files /dev/null and b/Tiles/Merges/AbyssGravelMerge.png differ diff --git a/Tiles/Merges/AshMerge.png b/Tiles/Merges/AshMerge.png new file mode 100644 index 0000000000..43cbe883bd Binary files /dev/null and b/Tiles/Merges/AshMerge.png differ diff --git a/Tiles/Merges/AstralDirtMerge.png b/Tiles/Merges/AstralDirtMerge.png new file mode 100644 index 0000000000..c62f199f0c Binary files /dev/null and b/Tiles/Merges/AstralDirtMerge.png differ diff --git a/Tiles/Merges/AstralSandMerge.png b/Tiles/Merges/AstralSandMerge.png new file mode 100644 index 0000000000..f63a874400 Binary files /dev/null and b/Tiles/Merges/AstralSandMerge.png differ diff --git a/Tiles/Merges/AstralSandstoneMerge.png b/Tiles/Merges/AstralSandstoneMerge.png new file mode 100644 index 0000000000..c5e841a495 Binary files /dev/null and b/Tiles/Merges/AstralSandstoneMerge.png differ diff --git a/Tiles/Merges/AstralSnowMerge.png b/Tiles/Merges/AstralSnowMerge.png new file mode 100644 index 0000000000..405cb2e833 Binary files /dev/null and b/Tiles/Merges/AstralSnowMerge.png differ diff --git a/Tiles/Merges/BrimstoneSlagMerge.png b/Tiles/Merges/BrimstoneSlagMerge.png new file mode 100644 index 0000000000..1c1456d1ba Binary files /dev/null and b/Tiles/Merges/BrimstoneSlagMerge.png differ diff --git a/Tiles/Merges/CloudMerge.png b/Tiles/Merges/CloudMerge.png new file mode 100644 index 0000000000..6dd1232de9 Binary files /dev/null and b/Tiles/Merges/CloudMerge.png differ diff --git a/Tiles/Merges/DirtMerge.png b/Tiles/Merges/DirtMerge.png new file mode 100644 index 0000000000..70dd88d208 Binary files /dev/null and b/Tiles/Merges/DirtMerge.png differ diff --git a/Tiles/Merges/EutrophicSandMerge.png b/Tiles/Merges/EutrophicSandMerge.png new file mode 100644 index 0000000000..0e6be6f2ec Binary files /dev/null and b/Tiles/Merges/EutrophicSandMerge.png differ diff --git a/Tiles/Merges/HardenedSandMerge.png b/Tiles/Merges/HardenedSandMerge.png new file mode 100644 index 0000000000..a3148bfa29 Binary files /dev/null and b/Tiles/Merges/HardenedSandMerge.png differ diff --git a/Tiles/Merges/HardenedSulphurousSandstoneMerge.png b/Tiles/Merges/HardenedSulphurousSandstoneMerge.png new file mode 100644 index 0000000000..ec16c036ea Binary files /dev/null and b/Tiles/Merges/HardenedSulphurousSandstoneMerge.png differ diff --git a/Tiles/Merges/LuminiteMerge.png b/Tiles/Merges/LuminiteMerge.png new file mode 100644 index 0000000000..cb2e3e9957 Binary files /dev/null and b/Tiles/Merges/LuminiteMerge.png differ diff --git a/Tiles/Merges/MudMerge.png b/Tiles/Merges/MudMerge.png new file mode 100644 index 0000000000..d5ce5baed4 Binary files /dev/null and b/Tiles/Merges/MudMerge.png differ diff --git a/Tiles/Merges/NavystoneMerge.png b/Tiles/Merges/NavystoneMerge.png new file mode 100644 index 0000000000..9e324540fb Binary files /dev/null and b/Tiles/Merges/NavystoneMerge.png differ diff --git a/Tiles/Merges/PearlstoneMerge.png b/Tiles/Merges/PearlstoneMerge.png new file mode 100644 index 0000000000..d62874ab44 Binary files /dev/null and b/Tiles/Merges/PearlstoneMerge.png differ diff --git a/Tiles/Merges/PyreMantleMerge.png b/Tiles/Merges/PyreMantleMerge.png new file mode 100644 index 0000000000..ba384900dc Binary files /dev/null and b/Tiles/Merges/PyreMantleMerge.png differ diff --git a/Tiles/Merges/RainCloudMerge.png b/Tiles/Merges/RainCloudMerge.png new file mode 100644 index 0000000000..02147f495e Binary files /dev/null and b/Tiles/Merges/RainCloudMerge.png differ diff --git a/Tiles/Merges/SandMerge.png b/Tiles/Merges/SandMerge.png new file mode 100644 index 0000000000..7be248b7e8 Binary files /dev/null and b/Tiles/Merges/SandMerge.png differ diff --git a/Tiles/Merges/SandstoneMerge.png b/Tiles/Merges/SandstoneMerge.png new file mode 100644 index 0000000000..062bb4c2d0 Binary files /dev/null and b/Tiles/Merges/SandstoneMerge.png differ diff --git a/Tiles/Merges/SnowCloudMerge.png b/Tiles/Merges/SnowCloudMerge.png new file mode 100644 index 0000000000..f8becd4751 Binary files /dev/null and b/Tiles/Merges/SnowCloudMerge.png differ diff --git a/Tiles/Merges/SnowMerge.png b/Tiles/Merges/SnowMerge.png new file mode 100644 index 0000000000..a7d3fe3889 Binary files /dev/null and b/Tiles/Merges/SnowMerge.png differ diff --git a/Tiles/Merges/StoneMerge.png b/Tiles/Merges/StoneMerge.png new file mode 100644 index 0000000000..17c26c6e2b Binary files /dev/null and b/Tiles/Merges/StoneMerge.png differ diff --git a/Tiles/Merges/SulphurousSandMerge.png b/Tiles/Merges/SulphurousSandMerge.png new file mode 100644 index 0000000000..3681e53b3f Binary files /dev/null and b/Tiles/Merges/SulphurousSandMerge.png differ diff --git a/Tiles/Merges/SulphurousSandstoneMerge.png b/Tiles/Merges/SulphurousSandstoneMerge.png new file mode 100644 index 0000000000..c18f8d2d73 Binary files /dev/null and b/Tiles/Merges/SulphurousSandstoneMerge.png differ diff --git a/Tiles/Merges/SulphurousShaleMerge.png b/Tiles/Merges/SulphurousShaleMerge.png new file mode 100644 index 0000000000..07f89efbdc Binary files /dev/null and b/Tiles/Merges/SulphurousShaleMerge.png differ diff --git a/Tiles/Merges/VoidstoneMerge.png b/Tiles/Merges/VoidstoneMerge.png new file mode 100644 index 0000000000..b73af35171 Binary files /dev/null and b/Tiles/Merges/VoidstoneMerge.png differ diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index c5b368c0d6..53d7ba4823 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index e7cca19b3c..eba839ec23 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -13,14 +13,18 @@ namespace CalamityMod.Tiles.Ores { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/MagicalRockMine", 3); internal static Texture2D GlowTexture; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; public override void SetStaticDefaults() { if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AerialiteOreGlow", AssetRequestMode.ImmediateLoad).Value; + GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AerialiteOre", AssetRequestMode.ImmediateLoad).Value; Main.tileOreFinderPriority[Type] = 450; Main.tileBlockLight[Type] = false; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileLighted[Type] = true; Main.tileNoSunLight[Type] = false; @@ -45,13 +49,18 @@ namespace CalamityMod.Tiles.Ores MinPick = 65; HitSound = MineSound; Main.tileSpelunker[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, TileID.Cloud, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.RainCloud, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.SnowCloud, out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out fourthTileAdjacency); } public override void PostSetDefaults() { Main.tileNoSunLight[Type] = false; } - int animationFrameWidth = 288; + int animationFrameWidth = 234; public override void NumDust(int i, int j, bool fail, ref int num) { @@ -59,8 +68,11 @@ namespace CalamityMod.Tiles.Ores } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud, false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Cloud, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.RainCloud, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.SnowCloud, out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out fourthTileAdjacency[i, j]); + return true; } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { @@ -251,7 +263,7 @@ namespace CalamityMod.Tiles.Ores } break; } - xOffset *= 288; + xOffset *= 234; xPos += xOffset; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -266,6 +278,11 @@ namespace CalamityMod.Tiles.Ores { Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } + + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/CloudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/RainCloudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SnowCloudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/Ores/AerialiteOre.png b/Tiles/Ores/AerialiteOre.png index 46e8cf4214..2b3d1427f3 100644 Binary files a/Tiles/Ores/AerialiteOre.png and b/Tiles/Ores/AerialiteOre.png differ diff --git a/Tiles/Ores/AerialiteOreDisenchanted.cs b/Tiles/Ores/AerialiteOreDisenchanted.cs index b8436a156b..ca8dca036f 100644 --- a/Tiles/Ores/AerialiteOreDisenchanted.cs +++ b/Tiles/Ores/AerialiteOreDisenchanted.cs @@ -9,12 +9,15 @@ namespace CalamityMod.Tiles.Ores { public class AerialiteOreDisenchanted : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; public override void SetStaticDefaults() { Main.tileOreFinderPriority[Type] = 445; Main.tileBlockLight[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileLighted[Type] = true; //Main.tileNoSunLight[Type] = false; @@ -40,13 +43,18 @@ namespace CalamityMod.Tiles.Ores MinPick = 110; HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, TileID.Cloud, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.RainCloud, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.SnowCloud, out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out fourthTileAdjacency); } public override void PostSetDefaults() { Main.tileNoSunLight[Type] = false; } - int animationFrameWidth = 288; + int animationFrameWidth = 234; public override void NumDust(int i, int j, bool fail, ref int num) { @@ -54,8 +62,11 @@ namespace CalamityMod.Tiles.Ores } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud, false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Cloud, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.RainCloud, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.SnowCloud, out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out fourthTileAdjacency[i, j]); + return true; } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { @@ -147,6 +158,13 @@ namespace CalamityMod.Tiles.Ores } frameXOffset = uniqueAnimationFrameX * animationFrameWidth; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/CloudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/RainCloudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SnowCloudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/Ores/AerialiteOreDisenchanted.png b/Tiles/Ores/AerialiteOreDisenchanted.png index e227f92d3b..bb2a69bc9d 100644 Binary files a/Tiles/Ores/AerialiteOreDisenchanted.png and b/Tiles/Ores/AerialiteOreDisenchanted.png differ diff --git a/Tiles/Ores/AerialiteOreGlow.png b/Tiles/Ores/AerialiteOreGlow.png deleted file mode 100644 index be59ed0610..0000000000 Binary files a/Tiles/Ores/AerialiteOreGlow.png and /dev/null differ diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 78c65587a8..74ec7821c6 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Tiles.Ores { public class AstralOre : ModTile { + public byte[,] TileAdjacency; public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -40,6 +41,8 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out TileAdjacency); } public override void NearbyEffects(int i, int j, bool closer) { @@ -89,11 +92,15 @@ namespace CalamityMod.Tiles.Ores g *= brightness; b *= brightness; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, TileAdjacency, "CalamityMod/Tiles/Merges/AstralDirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out TileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Ores/AstralOre.png b/Tiles/Ores/AstralOre.png index 79bbef0832..80ac96e8d4 100644 Binary files a/Tiles/Ores/AstralOre.png and b/Tiles/Ores/AstralOre.png differ diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index c16d2add30..29f03a3946 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -17,14 +17,16 @@ namespace CalamityMod.Tiles.Ores public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AuricMine", 3); public static bool Animate; internal static Texture2D GlowTexture; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { if (!Main.dedServ) GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow", AssetRequestMode.ImmediateLoad).Value; - AnimationFrameHeight = 270; + AnimationFrameHeight = 90; Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileSpelunker[Type] = true; Main.tileOreFinderPriority[Type] = 1000; @@ -44,6 +46,9 @@ namespace CalamityMod.Tiles.Ores MineResist = 10f; MinPick = 250; HitSound = MineSound; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); } public override bool CanExplode(int i, int j) @@ -92,6 +97,15 @@ namespace CalamityMod.Tiles.Ores Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; TileFraming.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + return true; } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/Ores/AuricOre.png b/Tiles/Ores/AuricOre.png index 15f0aa2a5e..05a4c4cc81 100644 Binary files a/Tiles/Ores/AuricOre.png and b/Tiles/Ores/AuricOre.png differ diff --git a/Tiles/Ores/AuricOreGlow.png b/Tiles/Ores/AuricOreGlow.png index 2b8417d30d..e3c36edd5a 100644 Binary files a/Tiles/Ores/AuricOreGlow.png and b/Tiles/Ores/AuricOreGlow.png differ diff --git a/Tiles/Ores/ExodiumOre.cs b/Tiles/Ores/ExodiumOre.cs index 6238cb575f..cd51d8e0ad 100644 --- a/Tiles/Ores/ExodiumOre.cs +++ b/Tiles/Ores/ExodiumOre.cs @@ -4,11 +4,14 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Ores { public class ExodiumOre : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -32,6 +35,22 @@ namespace CalamityMod.Tiles.Ores base.SetStaticDefaults(); TileID.Sets.ChecksForMerge[Type] = true; + + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.LunarOre, out secondTileAdjacency); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/LuminiteMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.LunarOre, out secondTileAdjacency[i, j]); + return true; } public override bool CanExplode(int i, int j) => false; diff --git a/Tiles/Ores/ExodiumOre.png b/Tiles/Ores/ExodiumOre.png index d18de4c920..9e985d673f 100644 Binary files a/Tiles/Ores/ExodiumOre.png and b/Tiles/Ores/ExodiumOre.png differ diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index 02b2dee863..99aff4cfe2 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -8,6 +9,7 @@ namespace CalamityMod.Tiles.Ores { public class HallowedOre : ModTile { + public byte[,] tileAdjacency; public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -31,6 +33,8 @@ namespace CalamityMod.Tiles.Ores MinPick = 180; HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, TileID.Pearlstone, out tileAdjacency); } public override bool CanExplode(int i, int j) @@ -42,10 +46,14 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/PearlstoneMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Pearlstone, false, false, false); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Pearlstone, out tileAdjacency[i, j]); + return true; } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/Ores/HallowedOre.png b/Tiles/Ores/HallowedOre.png index 221d242e9d..686e35cdfa 100644 Binary files a/Tiles/Ores/HallowedOre.png and b/Tiles/Ores/HallowedOre.png differ diff --git a/Tiles/Ores/InfernalSuevite.cs b/Tiles/Ores/InfernalSuevite.cs index 2a5e5840f6..c8de90b7ac 100644 --- a/Tiles/Ores/InfernalSuevite.cs +++ b/Tiles/Ores/InfernalSuevite.cs @@ -1,17 +1,20 @@ -using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Ores { [LegacyName("CharredOre")] public class InfernalSuevite : ModTile { - private int sheetWidth = 288; - private int sheetHeight = 270; + private int sheetWidth = 234; + private int sheetHeight = 90; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -33,6 +36,9 @@ namespace CalamityMod.Tiles.Ores HitSound = SoundID.Tink; DustType = 235; Main.tileSpelunker[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Ash, out secondTileAdjacency); } public override bool CanExplode(int i, int j) @@ -57,11 +63,16 @@ namespace CalamityMod.Tiles.Ores g = 0.00f; b = 0.00f; } - + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/AshMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/BrimstoneSlagMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Ash, out secondTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Ores/InfernalSuevite.png b/Tiles/Ores/InfernalSuevite.png index 618fe30303..59bd465073 100644 Binary files a/Tiles/Ores/InfernalSuevite.png and b/Tiles/Ores/InfernalSuevite.png differ diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index 1ef8faba51..83e90fd9fe 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -12,6 +12,10 @@ namespace CalamityMod.Tiles.Ores public class PerennialOre : ModTile { internal static Texture2D GlowTexture; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { if (!Main.dedServ) @@ -37,8 +41,12 @@ namespace CalamityMod.Tiles.Ores MinPick = 200; HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); } - int animationFrameWidth = 288; + int animationFrameWidth = 234; public override bool CanExplode(int i, int j) { @@ -63,85 +71,14 @@ namespace CalamityMod.Tiles.Ores //Top row (always y = 0 on tile sheets) new Vector2(0, 0), new Vector2(36, 0), - new Vector2(72, 0), - new Vector2(252, 0), //Second row (always y = 18 on tile sheets) new Vector2(18, 18), new Vector2(54, 18), - new Vector2(252, 18), //Third row (always y = 36 on tile sheets) new Vector2(36, 36), - new Vector2(252, 36), - //Forth row (always y = 54 on tile sheets) - new Vector2(250, 54), - - //Nothing on fifth row (always y = 72 on tile sheets) - - //Sixth row (always y = 90 on tile sheets) - new Vector2(72, 90), - new Vector2(90, 90), - new Vector2(144, 90), - new Vector2(180, 90), - new Vector2(198, 90), - new Vector2(216, 90), - - //Seventh row (always y = 108 on tile sheets) - new Vector2(72, 108), - new Vector2(144, 108), - new Vector2(180, 108), - - //Eighth row (always y = 126 on tile sheets) - new Vector2(0, 126), - new Vector2(18, 126), - new Vector2(36, 126), - new Vector2(54, 126), - new Vector2(144, 126), - new Vector2(162, 126), - new Vector2(180, 126), - new Vector2(198, 126), - new Vector2(216, 126), - - //Ninth row (always y = 144 on tile sheets) - new Vector2(0, 144), - new Vector2(18, 144), - new Vector2(36, 144), - new Vector2(54, 144), - new Vector2(72, 144), - new Vector2(90, 144), - new Vector2(198, 144), - new Vector2(216, 144), - //Tenth row (always y = 162 on tile sheets) - new Vector2(0, 162), - new Vector2(18, 162), - new Vector2(36, 162), - new Vector2(54, 162), - new Vector2(72, 162), - new Vector2(144, 162), - new Vector2(162, 162), - new Vector2(180, 162), - //Eleventh row (always y = 180 on tile sheets) - new Vector2(0, 180), - new Vector2(18, 180), - new Vector2(36, 180), - new Vector2(54, 180), - new Vector2(144, 180), - new Vector2(180, 180), - new Vector2(198, 180), - new Vector2(216, 180), - //Twelfth row (always y = 198 on tile sheets) - new Vector2(18, 198), - new Vector2(72, 198), - new Vector2(108, 198), - new Vector2(144, 198), - //Thirteenth row (always y = 216 on tile sheets) - new Vector2(18, 216), - new Vector2(72, 216), - //Nothing on fourteenth row (always y = 249 on tile sheets) - - //Nothing on fifteenth row (always y = 252 on tile sheets) }; foreach (var positionFlower in positionsFlower) { @@ -343,13 +280,24 @@ namespace CalamityMod.Tiles.Ores } break; } - xOffset *= 288; + xOffset *= 234; xPos += xOffset; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(175, 175, 175, 175)); Tile trackTile = Main.tile[i, j]; TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); + return true; } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/Ores/PerennialOre.png b/Tiles/Ores/PerennialOre.png index 799dc2347c..f33d91d693 100644 Binary files a/Tiles/Ores/PerennialOre.png and b/Tiles/Ores/PerennialOre.png differ diff --git a/Tiles/Ores/PerennialOreGlow.png b/Tiles/Ores/PerennialOreGlow.png index 7a768a55ad..1203725a7d 100644 Binary files a/Tiles/Ores/PerennialOreGlow.png and b/Tiles/Ores/PerennialOreGlow.png differ diff --git a/Tiles/Ores/ScoriaOre.cs b/Tiles/Ores/ScoriaOre.cs index 0386049d93..63f8aa959b 100644 --- a/Tiles/Ores/ScoriaOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Tiles.Ores [LegacyName("ChaoticOre")] public class ScoriaOre : ModTile { + public byte[,] TileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -32,6 +34,9 @@ namespace CalamityMod.Tiles.Ores MineResist = 4f; MinPick = 210; HitSound = SoundID.Tink; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out TileAdjacency); + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); } public override void NearbyEffects(int i, int j, bool closer) @@ -99,10 +104,12 @@ namespace CalamityMod.Tiles.Ores public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out TileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); + return true; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].TileFrameX; @@ -114,8 +121,11 @@ namespace CalamityMod.Tiles.Ores Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; TileFraming.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); - } + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/PyreMantleMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, TileAdjacency, "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + } + private Color GetDrawColour(int i, int j, Color colour) { int colType = Main.tile[i, j].TileColor; diff --git a/Tiles/Ores/ScoriaOre.png b/Tiles/Ores/ScoriaOre.png index 6a5505596b..b8bb0fbd51 100644 Binary files a/Tiles/Ores/ScoriaOre.png and b/Tiles/Ores/ScoriaOre.png differ diff --git a/Tiles/Ores/ScoriaOreGlow.png b/Tiles/Ores/ScoriaOreGlow.png index 3d88cd3b4a..dab9bb39b4 100644 Binary files a/Tiles/Ores/ScoriaOreGlow.png and b/Tiles/Ores/ScoriaOreGlow.png differ diff --git a/Tiles/Ores/UelibloomOre.cs b/Tiles/Ores/UelibloomOre.cs index a71244560b..17fee036da 100644 --- a/Tiles/Ores/UelibloomOre.cs +++ b/Tiles/Ores/UelibloomOre.cs @@ -1,5 +1,6 @@  using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,9 @@ namespace CalamityMod.Tiles.Ores { public class UelibloomOre : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -27,6 +31,11 @@ namespace CalamityMod.Tiles.Ores MinPick = 225; HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; + + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); } public override bool CanExplode(int i, int j) @@ -38,11 +47,19 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Mud, false, false, false, false, resetFrame); - return false; + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); + return true; } } } diff --git a/Tiles/Ores/UelibloomOre.png b/Tiles/Ores/UelibloomOre.png index 040a09a159..dcb7311172 100644 Binary files a/Tiles/Ores/UelibloomOre.png and b/Tiles/Ores/UelibloomOre.png differ diff --git a/Tiles/PerennialBrick.cs b/Tiles/PerennialBrick.cs index 664109ed16..634f06592e 100644 --- a/Tiles/PerennialBrick.cs +++ b/Tiles/PerennialBrick.cs @@ -3,11 +3,15 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles { public class PerennialBrick : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,6 +25,10 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; AddMapEntry(new Color(17, 133, 46)); AnimationFrameHeight = 90; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -29,6 +37,19 @@ namespace CalamityMod.Tiles Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); + return true; + } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs index e27a002fe5..6c595a4af9 100644 --- a/Tiles/ScoriaBrick.cs +++ b/Tiles/ScoriaBrick.cs @@ -12,8 +12,10 @@ namespace CalamityMod.Tiles public class ScoriaBrick : ModTile { int subsheetHeight = 72; - int subsheetWidth = 216; internal static Texture2D GlowTexture; + + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; public override void SetStaticDefaults() { if (!Main.dedServ) @@ -27,6 +29,9 @@ namespace CalamityMod.Tiles ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(85, 87, 101)); HitSound = SoundID.Tink; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -49,6 +54,8 @@ namespace CalamityMod.Tiles public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); TileFraming.CompactFraming(i, j, resetFrame); return false; } @@ -66,7 +73,9 @@ namespace CalamityMod.Tiles Color drawColour = GetDrawColour(i, j, Color.White); Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; - TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + TileFraming.SlopedGlowmask(i, j, 0, GlowTexture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), GetDrawColour(i, j, drawColour), default); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/SunkenSea/CoralPileLarge.cs b/Tiles/SunkenSea/CoralPileLarge.cs new file mode 100644 index 0000000000..22b5133821 --- /dev/null +++ b/Tiles/SunkenSea/CoralPileLarge.cs @@ -0,0 +1,40 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class CoralPileLarge : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(44, 129, 163)); + DustType = DustID.Coralstone; + + base.SetStaticDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/SunkenSea/CoralPileLarge.png b/Tiles/SunkenSea/CoralPileLarge.png new file mode 100644 index 0000000000..edd8ed89b7 Binary files /dev/null and b/Tiles/SunkenSea/CoralPileLarge.png differ diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 0fb911edef..777b88ab45 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Tiles.SunkenSea public class EutrophicSand : ModTile { public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { @@ -32,6 +34,8 @@ namespace CalamityMod.Tiles.SunkenSea MineResist = 2f; TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out thirdTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -41,12 +45,16 @@ namespace CalamityMod.Tiles.SunkenSea public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/SunkenSea/SandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sand, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out thirdTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/SunkenSea/EutrophicSand.png b/Tiles/SunkenSea/EutrophicSand.png index 9a9a252459..7561c14ec6 100644 Binary files a/Tiles/SunkenSea/EutrophicSand.png and b/Tiles/SunkenSea/EutrophicSand.png differ diff --git a/Tiles/SunkenSea/EutrophicSandMerge.png b/Tiles/SunkenSea/EutrophicSandMerge.png deleted file mode 100644 index 409fb0f4a9..0000000000 Binary files a/Tiles/SunkenSea/EutrophicSandMerge.png and /dev/null differ diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index df59392f38..4c7f4f3eda 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -10,6 +10,9 @@ namespace CalamityMod.Tiles.SunkenSea { public byte[,] tileAdjacency; public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; + public byte[,] fifthTileAdjacency; public override void SetStaticDefaults() { @@ -34,6 +37,9 @@ namespace CalamityMod.Tiles.SunkenSea TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out fifthTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -43,14 +49,20 @@ namespace CalamityMod.Tiles.SunkenSea public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/SunkenSea/NavystoneMerge"); - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/SunkenSea/EutrophicSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/NavystoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fifthTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out fourthTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fifthTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.png b/Tiles/SunkenSea/HardenedEutrophicSand.png index cf2a278106..5f80ec3a45 100644 Binary files a/Tiles/SunkenSea/HardenedEutrophicSand.png and b/Tiles/SunkenSea/HardenedEutrophicSand.png differ diff --git a/Tiles/SunkenSea/MediumCoral.cs b/Tiles/SunkenSea/MediumCoral.cs new file mode 100644 index 0000000000..90399e6c3f --- /dev/null +++ b/Tiles/SunkenSea/MediumCoral.cs @@ -0,0 +1,35 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class MediumCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(233, 132, 58)); + DustType = DustID.Coralstone; + + base.SetStaticDefaults(); + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } + + public class MediumCoral2 : MediumCoral + { + } +} diff --git a/Tiles/SunkenSea/MediumCoral.png b/Tiles/SunkenSea/MediumCoral.png new file mode 100644 index 0000000000..09e2f76169 Binary files /dev/null and b/Tiles/SunkenSea/MediumCoral.png differ diff --git a/Tiles/SunkenSea/MediumCoral2.png b/Tiles/SunkenSea/MediumCoral2.png new file mode 100644 index 0000000000..b15d91d590 Binary files /dev/null and b/Tiles/SunkenSea/MediumCoral2.png differ diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 0b8fa1edb1..39d11c8d03 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -9,6 +9,9 @@ namespace CalamityMod.Tiles.SunkenSea public class Navystone : ModTile { public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public byte[,] fourthTileAdjacency; public override void SetStaticDefaults() { @@ -28,6 +31,9 @@ namespace CalamityMod.Tiles.SunkenSea HitSound = SoundID.Tink; TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out thirdTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.HardenedSand, out fourthTileAdjacency); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -37,12 +43,18 @@ namespace CalamityMod.Tiles.SunkenSea public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/SunkenSea/EutrophicSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/SandstoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/SandMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, fourthTileAdjacency, "CalamityMod/Tiles/Merges/HardenedSandMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sandstone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Sand, out thirdTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.HardenedSand, out thirdTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } } diff --git a/Tiles/SunkenSea/Navystone.png b/Tiles/SunkenSea/Navystone.png index 616c1860fb..d81a8b93bb 100644 Binary files a/Tiles/SunkenSea/Navystone.png and b/Tiles/SunkenSea/Navystone.png differ diff --git a/Tiles/SunkenSea/NavystoneMerge.png b/Tiles/SunkenSea/NavystoneMerge.png deleted file mode 100644 index 82a29b4540..0000000000 Binary files a/Tiles/SunkenSea/NavystoneMerge.png and /dev/null differ diff --git a/Tiles/SunkenSea/SandstoneMerge.png b/Tiles/SunkenSea/SandstoneMerge.png deleted file mode 100644 index d482c24a01..0000000000 Binary files a/Tiles/SunkenSea/SandstoneMerge.png and /dev/null differ diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 760994a9d4..43fdb0b3f4 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.SunkenSea public byte[,] tileAdjacency; private const short subsheetWidth = 450; - private const short subsheetHeight = 270; + private const short subsheetHeight = 198; public override void SetStaticDefaults() { @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.SunkenSea public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/SunkenSea/NavystoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/NavystoneMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/SeaPrism.png b/Tiles/SunkenSea/SeaPrism.png index 017707e10b..7729be3702 100644 Binary files a/Tiles/SunkenSea/SeaPrism.png and b/Tiles/SunkenSea/SeaPrism.png differ diff --git a/Tiles/SunkenSea/SeaPrismCrystals.png b/Tiles/SunkenSea/SeaPrismCrystals.png index 5ba9ded01b..c4646c40c6 100644 Binary files a/Tiles/SunkenSea/SeaPrismCrystals.png and b/Tiles/SunkenSea/SeaPrismCrystals.png differ diff --git a/Tiles/SunkenSea/SmallCorals.cs b/Tiles/SunkenSea/SmallCorals.cs new file mode 100644 index 0000000000..bae8229c57 --- /dev/null +++ b/Tiles/SunkenSea/SmallCorals.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SmallCorals : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = false; + Main.tileCut[Type] = false; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = true; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(178, 28, 153)); + DustType = DustID.Coralstone; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -16; + height = 32; + } + } +} diff --git a/Tiles/SunkenSea/SmallCorals.png b/Tiles/SunkenSea/SmallCorals.png new file mode 100644 index 0000000000..6a3fedcf13 Binary files /dev/null and b/Tiles/SunkenSea/SmallCorals.png differ diff --git a/Tiles/SunkenSea/SmallWideCoral.cs b/Tiles/SunkenSea/SmallWideCoral.cs new file mode 100644 index 0000000000..45408576e0 --- /dev/null +++ b/Tiles/SunkenSea/SmallWideCoral.cs @@ -0,0 +1,35 @@ +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; +using System; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SmallWideCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.addTile(Type); + AddMapEntry(new Color(137, 154, 71)); + DustType = DustID.Coralstone; + + base.SetStaticDefaults(); + } + } + public class SmallWideCoral2 : SmallWideCoral + { + } +} diff --git a/Tiles/SunkenSea/SmallWideCoral.png b/Tiles/SunkenSea/SmallWideCoral.png new file mode 100644 index 0000000000..8eeefff167 Binary files /dev/null and b/Tiles/SunkenSea/SmallWideCoral.png differ diff --git a/Tiles/SunkenSea/SmallWideCoral2.png b/Tiles/SunkenSea/SmallWideCoral2.png new file mode 100644 index 0000000000..42a8875d5c Binary files /dev/null and b/Tiles/SunkenSea/SmallWideCoral2.png differ diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index 96c051a829..9181c231e0 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -13,6 +13,10 @@ namespace CalamityMod.Tiles private int extraFrameHeight = 36; private int extraFrameWidth = 90; + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -26,6 +30,10 @@ namespace CalamityMod.Tiles HitSound = SoundID.Tink; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(174, 108, 46)); + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); } public override bool CreateDust(int i, int j, ref int type) @@ -60,8 +68,18 @@ namespace CalamityMod.Tiles DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs index 1a4807ee68..9563f19441 100644 --- a/Tiles/VernalSoil.cs +++ b/Tiles/VernalSoil.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -9,6 +10,9 @@ namespace CalamityMod.Tiles { public class VernalSoil : ModTile { + public byte[,] tileAdjacency; + public byte[,] secondTileAdjacency; + public byte[,] thirdTileAdjacency; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -24,6 +28,10 @@ namespace CalamityMod.Tiles name.SetDefault("Vernal Soil"); AddMapEntry(new Color(80, 120, 0), name); HitSound = SoundID.Dig; + + TileFraming.SetUpUniversalMerge(Type, TileID.Dirt, out tileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Stone, out secondTileAdjacency); + TileFraming.SetUpUniversalMerge(Type, TileID.Mud, out thirdTileAdjacency); } public override void RandomUpdate(int i, int j) @@ -142,6 +150,21 @@ namespace CalamityMod.Tiles } } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TileFraming.DrawUniversalMergeFrames(i, j, thirdTileAdjacency, "CalamityMod/Tiles/Merges/MudMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, secondTileAdjacency, "CalamityMod/Tiles/Merges/StoneMerge"); + TileFraming.DrawUniversalMergeFrames(i, j, tileAdjacency, "CalamityMod/Tiles/Merges/DirtMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, TileID.Dirt, out tileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Stone, out secondTileAdjacency[i, j]); + TileFraming.GetAdjacencyData(i, j, TileID.Mud, out thirdTileAdjacency[i, j]); + return true; + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index 2e8c74f53e..0b2a77959f 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -30,10 +30,10 @@ namespace CalamityMod.UI.ModeIndicator public static bool ClickingMouse => Main.mouseLeft && Main.mouseLeftRelease; public static Vector2 DrawCenter => new Vector2(Main.screenWidth - 400f - WidthForTier(MostAlternateDifficulties) * 0.5f, 82f) + FrameSize * 0.5f; - private static int GlowFadeAnimLenght = 40; + private static int GlowFadeAnimLength = 40; public static int GlowFadeTime = 0; //Lock icon - internal const int LockAnimLenght = 30; + internal const int LockAnimLength = 30; private static int lockClickTime = 0; private static bool previousLockStatus = false; //Expand and shrink on hover @@ -45,7 +45,7 @@ namespace CalamityMod.UI.ModeIndicator public static float MainIconScale => 1f + iconHoverScaleBoost; //Menu state private static bool menuOpen = false; - internal static int MenuAnimLenght => MostAlternateDifficulties > 1 ? 60 : 40; + internal static int MenuAnimLength => MostAlternateDifficulties > 1 ? 60 : 40; private static int menuOpenTransitionTime = 0; private static DifficultyMode previouslyHoveredMode = null; public static float WidthForTier(int alts) => (alts - 1) * 40f; @@ -99,7 +99,7 @@ namespace CalamityMod.UI.ModeIndicator { if (!_hasCheckedItOutYet) { - GlowFadeTime = GlowFadeAnimLenght; + GlowFadeTime = GlowFadeAnimLength; _hasCheckedItOutYet = true; } @@ -116,7 +116,7 @@ namespace CalamityMod.UI.ModeIndicator if (ClickingMouse && menuOpenTransitionTime == 0 && !locked) { SoundEngine.PlaySound(menuOpen ? SoundID.MenuClose : SoundID.MenuOpen); - menuOpenTransitionTime = MenuAnimLenght; + menuOpenTransitionTime = MenuAnimLength; menuOpen = !menuOpen; } } @@ -130,7 +130,7 @@ namespace CalamityMod.UI.ModeIndicator spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); Texture2D bloomTex = ModContent.Request("CalamityMod/UI/ModeIndicator/BloomFlare").Value; - float opacity = !_hasCheckedItOutYet ? 1f : 1f * GlowFadeTime / (float)GlowFadeAnimLenght; + float opacity = !_hasCheckedItOutYet ? 1f : 1f * GlowFadeTime / (float)GlowFadeAnimLength; float scale = 0.4f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.05f; float rot = Main.GlobalTimeWrappedHourly * 0.5f; @@ -244,7 +244,7 @@ namespace CalamityMod.UI.ModeIndicator //Shakes the lock if it automatically changed, because a boss was summoned if (locked != previousLockStatus && lockClickTime == 0) - lockClickTime = LockAnimLenght; + lockClickTime = LockAnimLength; previousLockStatus = locked; @@ -252,7 +252,7 @@ namespace CalamityMod.UI.ModeIndicator if (locked && menuOpen) { menuOpen = false; - menuOpenTransitionTime = MenuAnimLenght - menuOpenTransitionTime; + menuOpenTransitionTime = MenuAnimLength - menuOpenTransitionTime; } //Click handling @@ -260,7 +260,7 @@ namespace CalamityMod.UI.ModeIndicator { if (MouseScreenArea.Intersects(MainClickArea)) { - lockClickTime = LockAnimLenght; + lockClickTime = LockAnimLength; SoundEngine.PlaySound(SoundID.MenuTick); } } @@ -270,15 +270,15 @@ namespace CalamityMod.UI.ModeIndicator private static CurveSegment lockGrow = new CurveSegment(SineOutEasing, 0f, 1f, 0.4f); private static CurveSegment lockShrink = new CurveSegment(SineInEasing, 0.6f, 1.4f, -0.4f); private static CurveSegment lockBump = new CurveSegment(SineBumpEasing, 0.9f, 1f, -0.2f); - internal static float LockShakeScale => PiecewiseAnimation(lockClickTime / (float)LockAnimLenght, new CurveSegment[] { lockGrow, lockShrink, lockBump }); + internal static float LockShakeScale => PiecewiseAnimation(lockClickTime / (float)LockAnimLength, new CurveSegment[] { lockGrow, lockShrink, lockBump }); private static CurveSegment barExpand = new CurveSegment(SineInOutEasing, 0f, 0f, 1f); internal static float BarExpansionProgress { get { - float animLenght = MostAlternateDifficulties == 1 ? (float)MenuAnimLenght : MenuAnimLenght * 2 / 3f; - float progress = (menuOpenTransitionTime / animLenght); + float animLength = MostAlternateDifficulties == 1 ? (float)MenuAnimLength : MenuAnimLength * 2 / 3f; + float progress = (menuOpenTransitionTime / animLength); if (menuOpen) progress = 1 - progress; @@ -294,7 +294,7 @@ namespace CalamityMod.UI.ModeIndicator { get { - float progress = Math.Max(menuOpenTransitionTime - MenuAnimLenght * 2 / 3f, 0f) / (MenuAnimLenght / 3f); + float progress = Math.Max(menuOpenTransitionTime - MenuAnimLength * 2 / 3f, 0f) / (MenuAnimLength / 3f); if (menuOpen) progress = 1 - progress; @@ -305,9 +305,9 @@ namespace CalamityMod.UI.ModeIndicator public static void ManageHexIcons(SpriteBatch spriteBatch, out string text) { int tiers = DifficultyTiers.Count(); - float barLenght = 60 * tiers * BarExpansionProgress; - float progress = menuOpen ? 1 - menuOpenTransitionTime / (float)MenuAnimLenght : menuOpenTransitionTime / (float)MenuAnimLenght; - Vector2 basePosition = DrawCenter + (barLenght / (float)(tiers + 1f)) * Vector2.UnitY; + float barLength = 60 * tiers * BarExpansionProgress; + float progress = menuOpen ? 1 - menuOpenTransitionTime / (float)MenuAnimLength : menuOpenTransitionTime / (float)MenuAnimLength; + Vector2 basePosition = DrawCenter + (barLength / (float)(tiers + 1f)) * Vector2.UnitY; Texture2D outlineTexture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicatorOutline").Value; @@ -323,7 +323,7 @@ namespace CalamityMod.UI.ModeIndicator Texture2D hexIcon = mode.Texture.Value; //Get position - Vector2 iconPosition = basePosition + (barLenght / (float)(tiers + 1f)) * Vector2.UnitY * i; + Vector2 iconPosition = basePosition + (barLength / (float)(tiers + 1f)) * Vector2.UnitY * i; if (modesAtTier > 1) iconPosition += Vector2.UnitX * MathHelper.Lerp(WidthForTier(modesAtTier) * -0.5f, WidthForTier(modesAtTier) * 0.5f, j / (float)(modesAtTier - 1)) * BarWidthExpansionProgress; @@ -365,7 +365,7 @@ namespace CalamityMod.UI.ModeIndicator public static void DrawLock(SpriteBatch spriteBatch) { Texture2D lockTexture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicatorLock").Value; - float rotationShift = lockClickTime == 0 ? 0f : (float)Math.Sin((1 - lockClickTime / (float)LockAnimLenght) * MathHelper.TwoPi * 2f) * 0.5f * (lockClickTime / (float)LockAnimLenght); + float rotationShift = lockClickTime == 0 ? 0f : (float)Math.Sin((1 - lockClickTime / (float)LockAnimLength) * MathHelper.TwoPi * 2f) * 0.5f * (lockClickTime / (float)LockAnimLength); spriteBatch.Draw(lockTexture, DrawCenter + Vector2.UnitY * 12 * MainIconScale, null, Color.White, 0f + rotationShift, lockTexture.Size() * 0.5f, LockShakeScale * MainIconScale, SpriteEffects.None, 0f); } #endregion @@ -450,7 +450,7 @@ namespace CalamityMod.UI.ModeIndicator CalamityNetcode.SyncCalamityWorldDifficulties(Main.myPlayer); menuOpen = false; - menuOpenTransitionTime = MenuAnimLenght; + menuOpenTransitionTime = MenuAnimLength; } #endregion diff --git a/UI/ModeIndicator/ModeIndicator_Malice.png b/UI/ModeIndicator/ModeIndicator_Malice.png deleted file mode 100644 index f8306ffcad..0000000000 Binary files a/UI/ModeIndicator/ModeIndicator_Malice.png and /dev/null differ diff --git a/UI/ModeIndicator/ModeIndicator_WhereMalice.png b/UI/ModeIndicator/ModeIndicator_WhereMalice.png deleted file mode 100644 index 0719d62996..0000000000 Binary files a/UI/ModeIndicator/ModeIndicator_WhereMalice.png and /dev/null differ diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index b1379399cc..1e68c4b026 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -195,6 +195,35 @@ namespace CalamityMod public static Vector2 TileDrawOffset => Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + // TODO: Add helper for drawing an inventory item to fill more of the slot than normal + /// + /// Helper for drawing a simple item with a customized scale in the inventory. + /// Various notes and tips: + /// Only apply this effect to items which get screwed over by effects like a flame animation + /// For consistency, try to keep the physical object inside the slot. + /// Sprited effects like thunder, fire, ect can be fine when allowed outside to bleed outside a slot. However these bleeds should only happen for a few frames, like Auric Tesla and Dyanmo Stem Cells. + /// Exceptions to these rules are the various Tracers, The Community, and Quiver of Nihility.Do not treat their upscales as them as a norm. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static void DrawInventoryCustomScale(SpriteBatch spriteBatch, Texture2D texture, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale, float wantedScale = 1f, Vector2 drawOffset = default) + { + wantedScale = Math.Max(scale, wantedScale * Main.inventoryScale); + float scaleDifference = wantedScale - scale; + position -= frame.Size() / 2f * scaleDifference; + position += drawOffset * wantedScale; + spriteBatch.Draw(texture, position, frame, drawColor, 0f, origin, wantedScale, SpriteEffects.None, 0); + } + /// /// Draws a treasure bag in the world in the exact same way as how Terraria 1.4's bags are drawn. /// @@ -370,6 +399,33 @@ namespace CalamityMod spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Rectangle GetFrame(int itemID, int whoAmI, Texture2D texture = null) + { + texture ??= TextureAssets.Item[itemID].Value; + return Main.itemAnimations[itemID] == null + ? texture.Frame() + : Main.itemAnimations[itemID].GetFrame(texture, Main.itemFrameCounter[whoAmI]); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Rectangle GetFrame(this Item item, int whoAmI, Texture2D texture = null) + { + return GetFrame(item.type, whoAmI, texture); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Rectangle GetFrame(int itemID, Texture2D texture = null) + { + texture ??= TextureAssets.Item[itemID].Value; + return Main.itemAnimations[itemID] == null + ? texture.Frame() + : Main.itemAnimations[itemID].GetFrame(texture); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Rectangle GetFrame(this Item item, Texture2D texture = null) + { + return GetFrame(item.type, texture); + } + public static Rectangle GetCurrentFrame(this Item item, ref int frame, ref int frameCounter, int frameDelay, int frameAmt, bool frameCounterUp = true) { if (frameCounter >= frameDelay) diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 2234c28b8a..b2186da149 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -342,8 +342,8 @@ namespace CalamityMod endPoint = segments[i + 1].startingX; } - float segmentLenght = endPoint - startPoint; - float segmentProgress = (progress - segment.startingX) / segmentLenght; //How far along the specific segment + float segmentLength = endPoint - startPoint; + float segmentProgress = (progress - segment.startingX) / segmentLength; //How far along the specific segment ratio = segment.startingHeight; //Failsafe because somehow it can fail? what diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 5103b627c3..ea612f1fe2 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -322,11 +322,11 @@ namespace CalamityMod public static bool IntoMorseCode(string originalText, float completion) { - int spaceLenght = 13; - int betweenLetterLenght = 7; - int betweenBlipLenght = 4; - int shortLenght = 3; - int longLenght = 8; + int spaceLength = 13; + int betweenLetterLength = 7; + int betweenBlipLength = 4; + int shortLength = 3; + int longLength = 8; char[] TextKeys = { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; @@ -358,18 +358,18 @@ namespace CalamityMod for (int i = 0; i < morseText.Length; i++) { if (morseText[i] == " ".ToCharArray()[0]) - morseState.AddRange(Enumerable.Repeat(false, spaceLenght)); + morseState.AddRange(Enumerable.Repeat(false, spaceLength)); if (morseText[i] == "|".ToCharArray()[0]) - morseState.AddRange(Enumerable.Repeat(false, betweenLetterLenght)); + morseState.AddRange(Enumerable.Repeat(false, betweenLetterLength)); if (morseText[i] == ".".ToCharArray()[0]) - morseState.AddRange(Enumerable.Repeat(true, shortLenght)); + morseState.AddRange(Enumerable.Repeat(true, shortLength)); if (morseText[i] == "-".ToCharArray()[0]) - morseState.AddRange(Enumerable.Repeat(true, longLenght)); + morseState.AddRange(Enumerable.Repeat(true, longLength)); - morseState.AddRange(Enumerable.Repeat(false, betweenBlipLenght)); + morseState.AddRange(Enumerable.Repeat(false, betweenBlipLength)); } return morseState[(int)((morseState.Count - 1) * completion)]; diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index 9eccf7853c..8f5a40acce 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -69,6 +69,7 @@ namespace CalamityMod PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantCheckAgainst[ModContent.TileType()] = new int[2] { ModContent.TileType(), ModContent.TileType() }; + PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; VineToGrass = new Dictionary { diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 00530dd0a5..467c7d153f 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.DataStructures; @@ -65,6 +65,7 @@ namespace CalamityMod.World { if (Main.tile[x, y].TileType == ModContent.TileType()) { + WorldGen.SquareTileFrame(x, y, true); Main.tile[x, y].TileType = (ushort)ModContent.TileType(); } } @@ -73,4 +74,4 @@ namespace CalamityMod.World } } } -} \ No newline at end of file +} diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 9642273722..9c7e747a2e 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -620,53 +620,73 @@ namespace CalamityMod.World } if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { - if (WorldGen.genRand.Next(7) == 0) + if (WorldGen.genRand.Next(10) == 0) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(10) == 0) + if (WorldGen.genRand.Next(20) == 0) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(10) == 0) + if (WorldGen.genRand.Next(8) == 0) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(6) == 0) + if (WorldGen.genRand.Next(30) == 0) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(5) == 0) + if (WorldGen.genRand.Next(30) == 0) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - if (WorldGen.genRand.Next(6) == 0) + if (WorldGen.genRand.Next(20) == 0) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } + //colorful corals + if (WorldGen.genRand.Next(20) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(20) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + if (WorldGen.genRand.Next(20) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + if (WorldGen.genRand.Next(20) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + //stalactites - if (WorldGen.genRand.Next(5) == 0) + if (WorldGen.genRand.Next(15) == 0) { ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(num5, num6 + 2, WorldGen.genRand.Next(Stalactites)); } - if (WorldGen.genRand.Next(5) == 0) + if (WorldGen.genRand.Next(15) == 0) { WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } //stalagmites - if (WorldGen.genRand.Next(5) == 0) + if (WorldGen.genRand.Next(10) == 0) { ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(num5, num6 - 2, WorldGen.genRand.Next(Stalagmites)); } - if (WorldGen.genRand.Next(5) == 0) + if (WorldGen.genRand.Next(10) == 0) { WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); } @@ -675,7 +695,7 @@ namespace CalamityMod.World { if (tile.TileType == ModContent.TileType() || tile.WallType == ModContent.WallType()) { - if (WorldGen.genRand.Next(4) == 0) + if (WorldGen.genRand.Next(10) == 0) { WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); }