diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index bff3bd212f..986d2134c2 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -5,11 +5,18 @@ using Microsoft.Xna.Framework.Graphics; using System; using ReLogic.Content; using Terraria.ID; +using CalamityMod.Graphics; +using System.Reflection; +using Terraria.Graphics.Shaders; namespace CalamityMod.Backgrounds { public class SunkenSeaBurrowsBG : ModSystem { + private static ManagedRenderTarget WaterDistortionTarget; + + private static bool CurrentlyRendering { get; set; } + public override void Load() { if (Main.dedServ) @@ -17,7 +24,10 @@ namespace CalamityMod.Backgrounds return; } + On_Main.CheckMonoliths += DrawToTarget; On_Main.DrawBackgroundBlackFill += On_Main_DrawBackgroundBlackFill; + + Main.QueueMainThreadAction(() => WaterDistortionTarget = new(true, ManagedRenderTarget.CreateScreenSizedTarget)); } /// @@ -33,33 +43,80 @@ namespace CalamityMod.Backgrounds { if (!Main.dedServ && Main.LocalPlayer.InModBiome()) { - for (int i = 0; i < Main.screenWidth / 16; i++) + int drawLimitX = Main.screenWidth / 16; + int drawLimitY = Main.screenHeight / 16; + Point drawPoint = (Main.screenPosition / 16).ToPoint(); + for (int i = 0; i < drawLimitX; i++) { - for (int j = 0; j < Main.screenWidth / 16; j++) + for (int j = 0; j < drawLimitY; j++) { - Point pos = (Main.screenPosition / 16).ToPoint() + new Point(i, j); - + Point pos = drawPoint + new Point(i, j); if (Main.tile[pos.X, pos.Y].Slope != SlopeType.Solid) - { Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.1f); - } } } } } + private void DrawToTarget(On_Main.orig_CheckMonoliths orig) + { + if (Main.gameMenu) + { + orig(); + return; + } + + CurrentlyRendering = true; + WaterDistortionTarget.SwapTo(); + + // 13MAY2025: fryzahh: Note that when other Sunken Sea backgrounds are implemented they should use this same system. + // Leaving this here for other programmers, in case I don't get to doing this myself. + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, CalamityUtils.BackgroundMatrix); + + DrawBurrowsBG(); + + Main.spriteBatch.End(); + + Main.graphics.GraphicsDevice.SetRenderTarget(null); + CurrentlyRendering = false; + + orig(); + } + private void On_Main_DrawBackgroundBlackFill(On_Main.orig_DrawBackgroundBlackFill orig, Main self) { if (Main.gameMenu || Main.screenPosition.Y + Main.screenHeight < ((int)Main.worldSurface) * 16f) { orig(self); - return; } orig(self); - DrawBurrowsBG(); + // This won't render if the Wave Quality setting isn't turned off unfortunately, so don't bother running any of the shader + // rendering code if that setting is on. + if (Main.WaveQuality > 0 || !CalamityClientConfig.Instance.SunkenSeaBackgroundDistortion) + { + DrawBurrowsBG(); + } + else + { + MiscShaderData distortionShader = GameShaders.Misc["CalamityMod:BasicTextureDistortion"]; + Asset distortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Swirls"); + + // Apply a distortion shader to the Sunken Sea backgrounds to give them an underwater ripple-like effect. + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, distortionShader.Shader, CalamityUtils.BackgroundMatrix); + + distortionShader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + distortionShader.Shader.Parameters["distortionXSpeed"].SetValue(-0.012f); + distortionShader.Shader.Parameters["distortionYSpeed"].SetValue(0.02f); + distortionShader.Shader.Parameters["distortionStrength"].SetValue(0.035f); + distortionShader.Shader.Parameters["noiseScale"].SetValue(0.075f); + distortionShader.SetShaderTexture(distortionTexture); + + Main.spriteBatch.Draw(WaterDistortionTarget.Target, new Rectangle(16, 16, Main.screenWidth, Main.screenHeight), Color.White); + } } public static float Transparency; @@ -73,32 +130,29 @@ namespace CalamityMod.Backgrounds Transparency += TransitionSpeed; if (Transparency > 1f) - { Transparency = 1f; - } } else { - //make transparency immediately go down so it doesnt look weird, since vanilla underground backgrounds dont have the fade-in effect this background has + // Make transparency immediately go down so it doesnt look weird, since vanilla underground backgrounds dont have the fade-in effect this background has. Transparency -= 1f; if (Transparency < 0f) - { Transparency = 0f; - } } - //dont bother running any of the background drawing if the transparency is zero (meaning the background isnt actually active) - //also do not run any of the background drawing if you have the vanilla background config option turned off + // Don't bother running any of the background drawing if the transparency is zero (meaning the background isnt actually active). + // Also do not run any of the background drawing if you have the vanilla background config option turned off. if (Transparency > 0f && Main.BackgroundEnabled) { Vector2 vector = Main.screenPosition + new Vector2((Main.screenWidth >> 1), (Main.screenHeight >> 1)); float num = (Main.GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f; float Scale = 1.5f; + float playerDrawPosition = ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f; for (int Layers = 4; Layers >= 0; Layers--) { - //get each background texture + // Get each background texture. Texture2D BGTexture = ModContent.Request("CalamityMod/Backgrounds/SunkenSeaBurrowsBG" + Layers).Value; Vector2 vector2 = new Vector2(BGTexture.Width, BGTexture.Height) * 0.5f; @@ -148,7 +202,7 @@ namespace CalamityMod.Backgrounds { for (int j = LoopX - 2; j < LoopX + 4 + (int)(Main.screenWidth / LoopWidth); j++) { - Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero; + Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), playerDrawPosition) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero; var frame = rectangle; var color = Color.White * Transparency; diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index fd98916dfc..1e5a5fe8b1 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -158,9 +158,6 @@ namespace CalamityMod.Balancing // See Aquatic Scourge comment. NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); - // 50% resist to Aftershock's rocks. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Dormant Brimseeker. NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); @@ -340,9 +337,6 @@ namespace CalamityMod.Balancing // 35% resist to Sulphuric Acid Cannon's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 35% resist to Venusian Trident. - NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 25% resist to Corinth Prime's grenades. NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); @@ -404,9 +398,6 @@ namespace CalamityMod.Balancing // 65% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(ResistTrueMelee(0.35f)))); - // 65% resist to The Enforcer's projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); - // 65% resist to The Final Dawn's lunge. NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); diff --git a/BiomeManagers/BrimstoneCragsBiome.cs b/BiomeManagers/BrimstoneCragsBiome.cs index 4a621108bb..218c9c600e 100644 --- a/BiomeManagers/BrimstoneCragsBiome.cs +++ b/BiomeManagers/BrimstoneCragsBiome.cs @@ -16,7 +16,7 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return BiomeTileCounterSystem.BrimstoneCragTiles > 100 && player.ZoneUnderworldHeight; + return BiomeTileCounterSystem.BrimstoneCragTiles > 500 && player.ZoneUnderworldHeight; } } } diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index c09847564f..f2ef8dfbb5 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -31,10 +31,6 @@ namespace CalamityMod.Buffs player.GetDamage() -= 0.02f; player.GetCritChance() -= 2; } - else if (type == BuffID.Panic) - { - player.moveSpeed -= 0.6f; - } else if (type == BuffID.SugarRush) { player.moveSpeed -= 0.1f; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 30ecff2d9f..56b57b152b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -125,7 +125,7 @@ namespace CalamityMod.CalPlayer public bool noLifeRegen = false; public bool reducedDaybrokenDamage = false; public bool reducedNightwitherDamage = false; - public float rangedAmmoCost = 1f; + public float ammoCost = 1f; public float healingPotionMultiplier = 1f; /// /// Tracks whether or not the player is currently holding Gael's Greatsword.
@@ -727,15 +727,13 @@ namespace CalamityMod.CalPlayer public bool theBee = false; public bool arcFlashRing = false; public bool arcFlashRingVisual = false; + public int generalBandCooldown = 0; public bool bGlassBand = false; // Obsidian band public bool bGlassBandVisual = false; - public int bGlassbandCooldown = 0; public bool batholithBangle = false; // Granite band public bool batholithBangleVisual = false; - public int batholithBangleCooldown = 0; public bool protolithBangle = false; // Marble band public bool protolithBangleVisual = false; - public int protolithBangleCooldown = 0; /// Used to prevent dodges from triggering The Bee's full health damage reduction cooldown. public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; @@ -785,6 +783,7 @@ namespace CalamityMod.CalPlayer public int gloveLevel = 0; public bool alreadyHasFrogLeg = false; // Unused, intended to prevent Frog Leg tinker stacking public bool eTalisman = false; + public bool lastDashWasTabi = false; public bool statisNinjaBelt = false; /// Used to keep track of how many dashes in the same direction you make to prevent dashing away from bosses forever at max efficency. public int statisPenaltyTimer = 0; @@ -806,6 +805,12 @@ namespace CalamityMod.CalPlayer public int transformerCooldown = 0; public int transformerDelay = 0; public int transformerStoredKills = 0; + public bool bloomStone = false; + public bool bloomStoneHookVisuals = false; + public int bloomStoneHealInc = 0; + public int bloomStoneTotalHeal = 0; + public int bloomStoneHealTimer = 0; + public int bloomStoneDR = 0; public bool hideOfDeus = false; public bool dAmulet = false; public bool rampartOfDeities = false; @@ -850,7 +855,6 @@ namespace CalamityMod.CalPlayer public bool sGlyph = false; public bool sRegen = false; public bool tracersDust = false; - public bool elysianWingsDust = false; public bool tracersCelestial = false; public bool tracersElysian = false; public bool tracersSeraph = false; @@ -927,6 +931,11 @@ namespace CalamityMod.CalPlayer public bool spiritOrigin = false; public bool spiritOriginVanity = false; public int spiritOriginCritBoost = 0; +/// +/// The amount of bonus crit damage the player has. +/// At 0f, the player has regular crit damage. At 1f, the player has +100% crit damage. +/// + public float critDamage = 0; public bool darkSunRing = false; public bool crawCarapace = false; public bool baroclaw = false; @@ -951,6 +960,7 @@ namespace CalamityMod.CalPlayer public bool sPauldronVisual = false; public bool XykVisualsBlue = false; public bool XykVisualsOrange = false; + public Color XykFXColor = Color.Black; public bool manaOverloader = false; /// Used for allowing Calamity slimes to be affected by Royal Gel. public bool royalGel = false; @@ -1028,8 +1038,6 @@ namespace CalamityMod.CalPlayer /// Life regeneration is increased while between 600 and 720, with a 10 second cooldown afterwards represented by being below 600. ///
public int phantomicHeartRegen = 0; - public bool silvaWings = false; - public int silvaWingsLifeRegenTimer = 0; /// General cooldown variable for spawning projectiles from wing bonus effects. Used by Soul of Cryogen, Tattered Fairy Wings, and Festive Wings. public int wingProjectileCooldown = 0; public bool RustyMedallionDroplets = false; @@ -2169,6 +2177,10 @@ namespace CalamityMod.CalPlayer arcFlashRingVisual = false; bGlassBand = false; bGlassBandVisual = false; + batholithBangle = false; // Granite band + batholithBangleVisual = false; + protolithBangle = false; // Marble band + protolithBangleVisual = false; aFossil = false; aPowder = false; fallingBlockProtection = false; @@ -2180,11 +2192,16 @@ namespace CalamityMod.CalPlayer bloodyWormTooth = false; vexation = false; badgeOfBravery = false; + // Clear the Warbanner "cooldown" if not wearing Warbanner. This has absolutely zero effect for a casual player, but is useful for resetting the cooldown's duration. + if (!WarbanneroftheRighteous) + cooldowns.Remove(WarbanneroftheRighteousBuff.ID); WarbanneroftheRighteous = false; warbannerGlow = false; ilSpark = false; transformer = false; transformerVisual = false; + bloomStone = false; + bloomStoneHookVisuals = false; hideOfDeus = false; dAmulet = false; rampartOfDeities = false; @@ -2220,8 +2237,10 @@ namespace CalamityMod.CalPlayer eGauntlet = false; eGauntletVisuals = true; gloveLevel = 0; - statisNinjaBelt = false; - statisVoidSash = false; + if (Player.dashDelay != -1) + statisNinjaBelt = false; + if (Player.dashDelay != -1) + statisVoidSash = false; alreadyHasFrogLeg = false; eTalisman = false; nucleogenesis = false; @@ -2283,7 +2302,6 @@ namespace CalamityMod.CalPlayer hallowedPower = false; kamiBoost = false; tracersDust = false; - elysianWingsDust = false; tracersCelestial = false; tracersElysian = false; tracersSeraph = false; @@ -2299,7 +2317,6 @@ namespace CalamityMod.CalPlayer starbusterCore = false; starTaintedGenerator = false; camper = false; - silvaWings = false; corrosiveSpine = false; RustyMedallionDroplets = false; rottenDogTooth = false; @@ -2324,7 +2341,7 @@ namespace CalamityMod.CalPlayer lunicCorpsSet = false; lunicCorpsLegs = false; - rangedAmmoCost = 1f; + ammoCost = 1f; healingPotionMultiplier = 1f; avertorBonus = false; @@ -2349,6 +2366,7 @@ namespace CalamityMod.CalPlayer spiritOriginCritBoost = 0; spiritOrigin = false; spiritOriginVanity = false; + critDamage = 0; astralStarRain = false; @@ -2841,11 +2859,16 @@ namespace CalamityMod.CalPlayer auralisAurora = 0; necroReviveCounter = -1; hideOfDeusTimer = 0; + bloomStoneHealInc = 0; + bloomStoneTotalHeal = 0; + bloomStoneHealTimer = 0; + bloomStoneDR = 0; murasamaHitCooldown = 0; RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; holyInfernoFadeIntensity = 0f; spiritOriginCritBoost = 0; + critDamage = 0f; rage = 0f; adrenaline = 0f; raiderCritLifespan = 0; @@ -3061,7 +3084,7 @@ namespace CalamityMod.CalPlayer bloodfinTimer = 0; healCounter = 300; danceOfLightCharge = 0; - rangedAmmoCost = 1f; + ammoCost = 1f; healingPotionMultiplier = 1f; avertorBonus = false; divineBless = false; @@ -3181,7 +3204,6 @@ namespace CalamityMod.CalPlayer fearmongerRegenFrames = 0; xerocSet = false; tracersDust = false; - elysianWingsDust = false; GemTechState.OnDeathEffects(); shieldOfTheOceanParry = 0; shieldOfTheOceanEmpoweredParry = false; @@ -3221,7 +3243,6 @@ namespace CalamityMod.CalPlayer momentumCapacitorTime = 0; momentumCapacitorBoost = 0f; vortexBoosterStealthDelay = 0; - silvaWingsLifeRegenTimer = 0; LungingDown = false; chaliceBleedoutBuffer = 0D; @@ -4037,42 +4058,37 @@ namespace CalamityMod.CalPlayer // Takes the movement speed bonus and uses it to increase run speed float accRunSpeedMin = Player.accRunSpeed * 0.5f; - Player.accRunSpeed += Player.accRunSpeed * moveSpeedBonus * 0.2f; + Player.accRunSpeed += Player.accRunSpeed * moveSpeedBonus * 0.16f; if (Player.accRunSpeed < accRunSpeedMin) Player.accRunSpeed = accRunSpeedMin; - //Life Jelly regen aura spawn when using a healing potion + // Life Jelly regen aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && lifejelly && !GrandGelatin) Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - //Cleansing Jelly cleansing aura spawn when using a healing potion + // Cleansing Jelly cleansing aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && cleansingjelly && !GrandGelatin) - { Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - } - //Grand Gellatin regen and cleansing aura spawn when using a healing potion + + // Grand Gellatin regen and cleansing aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && GrandGelatin && !absorber) - { Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - } - //Absorber's regen, cleansing, and buffing aura spawn when using a healing potion + + // Absorber's regen, cleansing, and buffing aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && absorber) - { Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - } if (snowman) { if (Player.whoAmI == Main.myPlayer && !snowmanNoseless) Player.AddBuff(BuffType(), 60, true); } + if (abyssalDivingSuit) { Player.AddBuff(BuffType(), 60, true); if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(DivingPlatesBroken.ID)) - { Player.AddBuff(BuffType(), 2); - } if (Player.whoAmI == Main.myPlayer && Player.active && abyssalDivingSuitPlateHits < 3) { @@ -4090,40 +4106,36 @@ namespace CalamityMod.CalPlayer } if (aquaticHeart) - { Player.AddBuff(BuffType(), 60, true); - } + if (aquaticHeart && NPC.downedBoss3) { if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(AquaticHeartIceShield.ID)) - { Player.AddBuff(BuffType(), 2); - } } + if (profanedCrystal) - { Player.AddBuff(BuffType(), 60, true); - } + if (gSabaton) { if (Player.whoAmI == Main.myPlayer) { // While holding hotkey, but before slam, bring Y velocity closer to 0 if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime != 0 && !gSabatonFalling) - { Player.velocity.Y *= (60 - (gSabatonHotkeyHoldTime / 2f)) / 60f; - } + // Play sound a bit early so it goes in time with the fall if (gSabatonHotkeyHoldTime == 15 && !gSabatonFalling) - { SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GravistarCharge") { Volume = 0.3f }); - } + // 0.5 seconds passed, falling time if (gSabatonHotkeyHoldTime == 30) { gSabatonFalling = true; Player.velocity.Y = 0.01f; } + // Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued // Also cancel fall if the player has upwards Y velocity (Goodbye Inner Tube cheese) if ((Player.gravDir == 1 && Player.velocity.Y < 0f) || (Player.gravDir == -1 && Player.velocity.Y > 1f) || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) @@ -4131,6 +4143,7 @@ namespace CalamityMod.CalPlayer gSabatonFall = 0; gSabatonFalling = false; } + if (gSabatonFalling) { SpawnGravistarParticle(); @@ -4141,6 +4154,7 @@ namespace CalamityMod.CalPlayer Player.maxFallSpeed = 40f; Player.gravity = 1.3f; + // If the player can fly during the fall, the physics gets a bit funky Player.controlJump = false; @@ -4148,13 +4162,14 @@ namespace CalamityMod.CalPlayer if (0 == Player.velocity.Y) { var source = Player.GetSource_Accessory(FindAccessory(ItemType())); - //Spawn explosion. ai[0] is used for transferring the recorded falling time + // Spawn explosion. ai[0] is used for transferring the recorded falling time int damage = Player.CalcIntDamage(InterstellarStompers.SlamDamage); Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); gSabatonFall = 0; gSabatonFalling = false; + // Temporary jump speed is granted for 40 frames gSabatonTempJumpSpeed = 40; } @@ -4215,7 +4230,7 @@ namespace CalamityMod.CalPlayer if (Main.myPlayer == Player.whoAmI) { mouseRight = PlayerInput.Triggers.Current.MouseRight; - mouseWorld = Main.MouseWorld; + mouseWorld = LockOnHelper.Enabled ? LockOnHelper.PredictedPosition : Main.MouseWorld; if (rightClickListener && mouseRight != oldMouseRight) { @@ -4355,6 +4370,17 @@ namespace CalamityMod.CalPlayer } } + //Star in a Bottle gives Mana Regeneration instead of it's usual effect when you don't already have Mana Regeneration + if (!Player.manaRegenBuff && Player.HasBuff(BuffID.StarInBottle)) + { + //Cancel out Star In A Bottle's normal effect + Player.manaRegenDelayBonus -= 0.5f; + Player.manaRegenBonus -= 10; + //Apply Mana Regen Potion effect + Player.manaRegenBuff = true; + + } + ForceVariousEffects(); } #endregion @@ -4521,6 +4547,8 @@ namespace CalamityMod.CalPlayer public override void GetHealLife(Item item, bool quickHeal, ref int healValue) { healValue = (int)(healValue * healingPotionMultiplier); + if (bloomStone) + healValue = 0; } #endregion @@ -4837,12 +4865,7 @@ namespace CalamityMod.CalPlayer Vector2 mouse = Player.ClampedMouseWorld(); Vector2 startingPosition = mouse - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; Vector2 directionToMouse = (mouse - startingPosition).SafeNormalize(Vector2.UnitX); - int drop = Projectile.NewProjectile(MedallionSource, startingPosition, directionToMouse * 15f, ProjectileType(), d, 0f, Player.whoAmI, 3); - if (drop.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[drop].penetrate = 2; - Main.projectile[drop].DamageType = DamageClass.Generic; - } + Projectile.NewProjectile(MedallionSource, startingPosition, directionToMouse * 15f, ProjectileType(), d, 0f, Player.whoAmI, 3); RustyMedallionCooldown = RustyMedallion.AcidCreationCooldown; } } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 11c960eb68..b5470a17e4 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.DrawLayers; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; @@ -140,21 +141,6 @@ namespace CalamityMod.CalPlayer } } } - - // Elysian Wings, Elysian TRACERS?! and SERAPH TRACERS?! - if (calamityPlayer.elysianWingsDust && drawInfo.shadow == 0f) - { - if (!Player.StandingStill() && !Player.mount.Active) - { - if (Main.rand.NextBool()) - { - Dust dust = Dust.NewDustDirect(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, DustID.GoldCoin, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); - dust.noGravity = true; - dust.velocity *= 0.5f; - drawInfo.DustCache.Add(dust.dustIndex); - } - } - } #endregion #region Armor Visuals @@ -342,6 +328,20 @@ namespace CalamityMod.CalPlayer GeneralParticleHandler.SpawnParticle(Plus); } } + if (calamityPlayer.bloomStoneDR > 0 && drawInfo.shadow == 0f) + { + if (Main.rand.NextBool(10)) + { + MediumMistParticle pollenCloud = new(Player.Center, Main.rand.NextVector2Circular(1f, 1f), Color.Yellow, Color.Gold, 0.85f, 100f); + GeneralParticleHandler.SpawnParticle(pollenCloud); + } + if (Main.rand.NextBool(4)) + { + Dust pollenDust = Dust.NewDustDirect(Player.position, Player.width, Player.height, ModContent.DustType(), newColor: Color.Gold, Scale: 0.4f); + pollenDust.noLightEmittence = true; + pollenDust.noGravity = true; + } + } if (calamityPlayer.bloodfinBoost && drawInfo.shadow == 0f) { if (Main.rand.NextBool(3)) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index f5c572ea7e..58ec5db97c 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -32,6 +32,7 @@ using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; @@ -510,6 +511,7 @@ namespace CalamityMod.CalPlayer #region Modify Hit NPC public override void ModifyHitNPCWithItem(Item item, NPC target, ref NPC.HitModifiers modifiers) { + modifiers.CritDamage += critDamage; // All Calamity multipliers are added together to prevent insane exponential stacking float totalDamageMult = 1f; @@ -591,6 +593,8 @@ namespace CalamityMod.CalPlayer { if (proj.npcProj || proj.trap) return; + + modifiers.CritDamage += critDamage; // All Calamity multipliers are added together to prevent insane exponential stacking float totalDamageMult = 1f; @@ -2605,7 +2609,8 @@ namespace CalamityMod.CalPlayer Player.immuneTime += iFramesToAdd; // Similar handle to 1.4 Star Cloak: these hits ie. spikes or lava cannot activate hit effects - if (hurtInfo.CooldownCounter != -1 && hurtInfo.CooldownCounter != 1) + bool canTriggerHitEffects = hurtInfo.CooldownCounter == -1 || hurtInfo.CooldownCounter == 1; + if (!canTriggerHitEffects) return; if (aeroSet && hurtInfo.Damage > 25) @@ -2634,20 +2639,25 @@ namespace CalamityMod.CalPlayer } } // TODO -- Make Deific Amulet and Rampart of Deities' retaliation effects way cooler + // In the meantime, gave them homing astral bombers instead of the lame falling stars if (dAmulet) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - for (int n = 0; n < 3; n++) + int projAmount = (rampartOfDeities ? 12 : 6); + for (int n = 0; n < projAmount; n++) { int baseDamage = 130 * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); - int deificStarDamage = (int)Player.GetBestClassDamage().ApplyTo(baseDamage); + int deificProjDamage = (int)Player.GetBestClassDamage().ApplyTo(baseDamage); - Projectile star = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.StarVeilStar, deificStarDamage, 4f, Player.whoAmI); - if (star.whoAmI.WithinBounds(Main.maxProjectiles)) + Projectile onHitProj = Main.projectile[Projectile.NewProjectile(source, Player.Center, new Vector2(0,-15).RotatedBy(MathHelper.TwoPi/projAmount*n), ModContent.ProjectileType(), deificProjDamage, 4f, Player.whoAmI)]; + if (onHitProj.whoAmI.WithinBounds(Main.maxProjectiles)) { - star.DamageType = DamageClass.Generic; - star.usesLocalNPCImmunity = true; - star.localNPCHitCooldown = 5; + onHitProj.DamageType = DamageClass.Generic; + onHitProj.usesLocalNPCImmunity = true; + onHitProj.localNPCHitCooldown = 5; + onHitProj.tileCollide = false; + onHitProj.extraUpdates = 1; + onHitProj.Calamity().conditionalHomingRange = 500f; } } } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index ed7e3ac147..3432974a04 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -685,24 +685,6 @@ namespace CalamityMod.CalPlayer Player.lifeRegenTime += 4; } - if (silvaWings) - { - if (Player.velocity.Y == 0f || Player.wingTime == Player.wingTimeMax) - silvaWingsLifeRegenTimer = 0; - else - { - silvaWingsLifeRegenTimer++; - if (silvaWingsLifeRegenTimer > SilvaWings.LifeRegenTimerMax) - silvaWingsLifeRegenTimer = SilvaWings.LifeRegenTimerMax; - } - - // Life regen boost scales up to 8 HP/s based on how long you stay in the air without resetting flight time - int lifeRegenBoost = (int)MathHelper.Lerp(0f, 16f, silvaWingsLifeRegenTimer / (float)SilvaWings.LifeRegenTimerMax); - Player.lifeRegen += lifeRegenBoost; - } - else - silvaWingsLifeRegenTimer = 0; - if (pinkCandle && !noLifeRegen) { // Every frame, add up 1/60th of the healing value (0.4% max HP per second) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index a5bec51499..e8dde18907 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -78,6 +78,7 @@ using Terraria.GameContent.Events; using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; @@ -142,9 +143,6 @@ namespace CalamityMod.CalPlayer // Limits Limits(); - // This is used to increase horizontal velocity based on the player's movement speed stat. - moveSpeedBonus = Player.moveSpeed - 1f; - // Potions (Quick Buff && Potion Sickness) HandlePotions(); @@ -228,25 +226,82 @@ namespace CalamityMod.CalPlayer if (WulfrumHat.PowerModeEngaged(Player, out _)) Player.moveSpeed *= 0.8f; + if ((XykVisualsBlue || XykVisualsOrange)) + { + bool Orange = XykVisualsOrange; + Color effectColor = Orange ? Color.Gold : Color.DodgerBlue; + + float rate = Main.GlobalTimeWrappedHourly * 12; + List eColors = new List() + { + Orange ? new Color(248, 117, 52) : Color.DodgerBlue, + Orange ? Color.Gold : Color.Cyan, + Orange ? Color.Orange : Color.RoyalBlue + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + bool rageOrAdren = (Player.Calamity().rageModeActive || Player.Calamity().adrenalineModeActive); + bool rageAndAdren = (Player.Calamity().rageModeActive && Player.Calamity().adrenalineModeActive); + Color attemptColor = (rageAndAdren ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Player.Calamity().adrenalineModeActive ? Color.MediumSpringGreen : Player.Calamity().rageModeActive ? Color.Crimson : effectColor); + XykFXColor = Color.Lerp(XykFXColor, attemptColor, rageOrAdren ? 0.05f : 0.25f); + + + int maxWingPieces = 7; + int numOfActiveWings = 0; + foreach (Projectile p in Main.ActiveProjectiles) + if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI && p.ai[1] == 0) + numOfActiveWings++; + bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && !(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0; + if (spawnWings) + { + int wingCount = numOfActiveWings; + Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, wingCount); + } + } + // First Frame dash effects bool dashStart = (Player.dashDelay == -1 && IsFirstDashFrame); int dir = MathF.Sign(Player.velocity.X); + if (dashStart) + { + lastDashWasTabi = false; + } + if (((gShell && giantShellPostHit == 0) || (tortShell && tortShellPostHit == 0)) && dashStart) { Player.velocity.X *= 0.9f; } // Tabi/Master Ninja Gear dash change - if (Player.dashType == 1) + if (lastDashWasTabi) + { + Player.dashType = 1; + } + if (Player.dashType == 1 && !Player.Calamity().statisNinjaBelt && !Player.Calamity().statisVoidSash) { if (dashStart) + { Player.velocity.X *= 3.5f; + lastDashWasTabi = true; + } if (Player.dashDelay == -1) { Player.velocity.X *= 0.9f; } } + + if (Player.Calamity().statisNinjaBelt) + { + Player.Calamity().DashID = StatisNinjaBeltDash.ID; + } + if (Player.Calamity().statisVoidSash) + { + Player.Calamity().DashID = StatisVoidSashDash.ID; + } if ((devilsDevastationKillMode || exaltedKillMode) && !Player.mount.Active) { @@ -338,27 +393,16 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); } if (Player.dashDelay == -1) + { Player.endurance += 0.1f; + Player.noKnockback = true; + } } if (XykVisualsBlue || XykVisualsOrange) { bool Orange = XykVisualsOrange; - Color effectColor = Orange ? Color.Gold : Color.DodgerBlue; - - float rate = Main.GlobalTimeWrappedHourly * 22; - List eColors = new List() - { - Orange ? Color.OrangeRed : Color.DodgerBlue, - Orange ? Color.Gold : Color.Cyan, - Orange ? Color.Orange : Color.RoyalBlue - }; - - int colorIndex = (int)(rate / 2 % eColors.Count); - Color currentColor = eColors[colorIndex]; - Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); if (dashStart) { @@ -366,18 +410,18 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(dash with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0f, 0.2f) + (Orange ? 0 : 0.2f) }, Player.Center); if (Orange) { - Particle spark1 = new CustomPulse(Player.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0.45f, 0.25f, 47); + Particle spark1 = new CustomPulse(Player.Center, Vector2.Zero, XykFXColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0.45f, 0.25f, 47); GeneralParticleHandler.SpawnParticle(spark1); - Particle spark2 = new CustomPulse(Player.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0, 0.8f, 17); + Particle spark2 = new CustomPulse(Player.Center, Vector2.Zero, XykFXColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0, 0.8f, 17); GeneralParticleHandler.SpawnParticle(spark2); } else { - Particle spark1 = new CustomPulse(Player.Center, Player.velocity * 0.3f, effectColor, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Player.velocity.ToRotation(), 0, 1f, 24); + Particle spark1 = new CustomPulse(Player.Center, Player.velocity * 0.3f, XykFXColor, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Player.velocity.ToRotation(), 0, 1f, 24); GeneralParticleHandler.SpawnParticle(spark1); - Particle spark2 = new CustomPulse(Player.Center, Player.velocity * 0.5f, effectColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), Player.velocity.ToRotation(), 0, 0.75f, 17); + Particle spark2 = new CustomPulse(Player.Center, Player.velocity * 0.5f, XykFXColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), Player.velocity.ToRotation(), 0, 0.75f, 17); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -389,33 +433,35 @@ namespace CalamityMod.CalPlayer if (!Orange) { float sine = (float)Math.Sin(Player.miscCounter * 0.875f / MathHelper.Pi); + for (int i = -1; i <= 1; i += 2) + { + Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 18f * i; - Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 17f; - - Particle spark1 = new GlowSparkParticle(Player.Center + offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, false, 25, 0.04f * sparkscale1, effectColor * 0.9f, new Vector2(0.8f, 0.3f), true, false, 0.4f); - GeneralParticleHandler.SpawnParticle(spark1); - Particle spark2 = new GlowSparkParticle(Player.Center - offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, false, 25, 0.04f * sparkscale1, effectColor * 0.9f, new Vector2(1, 0.3f), true, false, 0.4f); - GeneralParticleHandler.SpawnParticle(spark2); + Particle spark1 = new CustomSpark(Player.Center + offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, "CalamityMod/Particles/BloomCircle", false, 15, 0.3f * sparkscale1, XykFXColor * 0.85f, new Vector2(0.9f, 1.4f), true, true, 0, shrinkSpeed: 0.2f, glowOpacity: 0.85f); + GeneralParticleHandler.SpawnParticle(spark1); + } } else { float sparkscale2 = MathF.Min(Player.velocity.X * dir * 0.07f, 1.1f); - Vector2 SparkVelocity2 = Player.velocity.RotatedBy(dir * 2.5f, default) * 0.1f - Player.velocity / 2f; - Particle spark = new LineParticle(Player.Center + (Player.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedBy(2f * dir) * 1.5f, SparkVelocity2, false, 10, sparkscale2, effectColor); - GeneralParticleHandler.SpawnParticle(spark); - Vector2 SparkVelocity3 = Player.velocity.RotatedBy(dir * -2.5f, default) * 0.1f - Player.velocity / 2f; - Particle spark2 = new LineParticle(Player.Center + (Player.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedBy(-2f * dir) * 1.5f, SparkVelocity3, false, 10, sparkscale2, effectColor); - GeneralParticleHandler.SpawnParticle(spark2); + for (int i = -1; i <= 1; i += 2) + { + Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * 17f * i; + + Particle spark1 = new CustomSpark(Player.Center + offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, "CalamityMod/Particles/BloomCircle", false, 20, 0.4f * sparkscale1, XykFXColor * 0.95f, new Vector2(0.3f, 1.2f), true, true, 0, shrinkSpeed: 0.2f, glowOpacity: 0.95f); + GeneralParticleHandler.SpawnParticle(spark1); + } } for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, 267, SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(0.7f, 1.1f) * sparkscale1); + bool altDust = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, altDust ? (Orange ? ModContent.DustType() : ModContent.DustType()) : ModContent.DustType(), SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(1.5f, 1.9f) * sparkscale1); dust.noGravity = true; - dust.color = effectColor; - - Dust dust2 = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, 10, SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(0.9f, 1.4f) * sparkscale1); - dust2.noGravity = true; + dust.color = XykFXColor; + dust.fadeIn = altDust ? 0 : 2; + if (altDust) + dust.scale *= 0.5f; } } } @@ -434,6 +480,17 @@ namespace CalamityMod.CalPlayer IsFirstDashFrame = false; else IsFirstDashFrame = true; + + // THIS MUST BE NEAR THE END OF PostUpdateMiscEffects SO ALL OTHER RUN SPEED IS DONE FIRST. DO NOT PUT ANY RUN SPEED AFTER THIS + + // Multiplies movement speed by 1.5x so that you don't feel like a snail in the early game. + // This applies to movement speed boosts as well as base speed to ensure they are actually worth their listed value compared to base speed + // Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy + if (ExternalMods.overhaul is null && CalamityServerConfig.Instance.FasterBaseSpeed) + Player.moveSpeed *= BalancingConstants.DefaultMoveSpeedBoost; + + // This is used to increase horizontal velocity based on the player's movement speed stat. + moveSpeedBonus = Player.moveSpeed - 1f; } #endregion @@ -737,10 +794,10 @@ namespace CalamityMod.CalPlayer if (Player.velocity.Length() == 0f) return; - Dust dust = Dust.NewDustDirect(Player.Center, 16, 16, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f); + Dust dust = Dust.NewDustDirect(Player.Center, 16, 16, DustID.Firefly, 0.2f, 0f, 0, new Color(117, 55, 15), Main.rand.NextFloat(1f, 2f)); dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } // Ores below here @@ -1247,7 +1304,7 @@ namespace CalamityMod.CalPlayer Player.maxFallSpeed = 20f; } - if (Player.controlDown && ironBoots) + if (Player.controlDown && !Player.controlJump && ironBoots) { Player.maxFallSpeed = 23f; // This is slightly faster than slimy saddle (so it can be viable) if (Player.gravDir == 1 ? Player.velocity.Y <= 0 : Player.velocity.Y >= 0) @@ -1285,10 +1342,16 @@ namespace CalamityMod.CalPlayer } else { - if (Player.mount.Type == MountID.Slime || Player.mount.Type == MountID.PogoStick) + if (Player.mount.Type == MountID.Slime) Player.velocity.X *= 0.91f; else if (Player.mount.Type == MountID.QueenSlime) Player.velocity.X *= 0.95f; + else if (Player.mount.Type == MountID.PogoStick) + { + if (Player.velocity.X > 10 || Player.velocity.X < -10) + Player.velocity.X *= 0.99f; //Stops infinite high-speed movement, but allows fun pogo movement tech still + Player.maxFallSpeed *= 0.75f; // 1.5x fall speed instead of 2x to counterbalance + } } // Increase Rope climb velocities, if enabled @@ -1704,7 +1767,7 @@ namespace CalamityMod.CalPlayer if (ironBoots) { - if (Player.controlDown) + if (Player.controlDown && !Player.controlJump) { if (Player.gravDir == 1 ? Player.velocity.Y > 0 : Player.velocity.Y < 0) fallingBootVelCheckTimer++; @@ -1999,12 +2062,8 @@ namespace CalamityMod.CalPlayer VoidCooldown--; if (ursaSergeantCooldown > 0) ursaSergeantCooldown--; - if (bGlassbandCooldown > 0) - bGlassbandCooldown--; - if (batholithBangleCooldown > 0) - batholithBangleCooldown--; - if (protolithBangleCooldown > 0) - protolithBangleCooldown--; + if (generalBandCooldown > 0) + generalBandCooldown--; if (AlchFlaskCooldown > 0) AlchFlaskCooldown--; if (tarraRangedCooldown > 0) @@ -2023,6 +2082,43 @@ namespace CalamityMod.CalPlayer jetPackDash--; if (theBeeCooldown > 0) theBeeCooldown--; + + if (bloomStoneHealTimer > 0) + { + if (bloomStone && bloomStoneHealTimer % 40 == 0) + { + Player.HealPlayer(Math.Min(bloomStoneHealInc, bloomStoneTotalHeal)); + // Special specifically programmed interaction with Chalice of the Blood God: Healing over time clears bits of the bleedout buffer. + if (chaliceOfTheBloodGod && chaliceBleedoutBuffer > 0D) + { + float amountOfBleedToClear = ChaliceOfTheBloodGod.HealingPotionRatioForBufferClear * bloomStoneHealInc; + chaliceBleedoutBuffer -= amountOfBleedToClear; + // Display text indicating that healing was applied to the bleedout buffer. + if (!Main.dedServ) + { + string text = $"(+{amountOfBleedToClear})"; + Rectangle location = new Rectangle((int)Player.position.X + 4, (int)Player.position.Y - 3, Player.width - 4, Player.height - 4); + CombatText.NewText(location, ChaliceOfTheBloodGod.BleedoutBufferDamageTextColor, Language.GetTextValue(text), dot: true); + } + } + + bloomStoneTotalHeal -= bloomStoneHealInc; + if (bloomStoneTotalHeal < 0) + bloomStoneTotalHeal = 0; + } + bloomStoneHealTimer--; + } + else + { + bloomStoneTotalHeal = 0; + bloomStoneHealInc = 0; + } + if (bloomStoneDR > 0) + { + Player.endurance += bloomStoneHealTimer > 0 ? 0.12f : 0.06f; + bloomStoneDR--; + } + if (summonProjCooldown > 0f) summonProjCooldown -= 1f; if (ataxiaDmg > 0f) @@ -3419,10 +3515,6 @@ namespace CalamityMod.CalPlayer --bloodflareCoreRemainingHealOverTime; } - // Multiplies base movement speed by 1.5x so that you don't feel like a snail in the early game - // Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy - if (ExternalMods.overhaul is null && CalamityServerConfig.Instance.FasterBaseSpeed) - Player.maxRunSpeed *= BalancingConstants.DefaultMoveSpeedBoost; // Reduce how slow Chilled makes the player, because it's cancerous right now // The moveSpeed multiplier for Chilled in vanilla is 0.75, so we just multiply by 1.166667 here to make it 0.875, effectively cutting the reduction in half diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 8a6a023475..f91dcf823d 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -10,7 +10,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Fishing.AstralCatches; -using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; @@ -26,12 +25,10 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; -using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static System.Net.Mime.MediaTypeNames; using static Terraria.ModLoader.ModContent; namespace CalamityMod.CalPlayer @@ -72,7 +69,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; - target.Calamity().IncreasedColdEffects_FrozenWings = frozenWingsCold; target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; target.Calamity().IncreasedElectricityEffects_Unused = false; @@ -80,7 +76,6 @@ namespace CalamityMod.CalPlayer target.Calamity().IncreasedHeatEffects_Fireball = fireball; target.Calamity().IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; target.Calamity().IncreasedHeatEffects_FireBoots = bootLevel; - target.Calamity().IncreasedHeatEffects_FlameWings = flameWingsHeat; target.Calamity().IncreasedSicknessEffects_ToxicHeart = toxicHeart; @@ -148,14 +143,46 @@ namespace CalamityMod.CalPlayer // Ursa Sergeant slash cooldown is reset on kill if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); - if (bGlassBand && bGlassbandCooldown == 0) + + + if (generalBandCooldown == 0) { - var source = item.GetSource_FromThis(); - int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); - Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; - Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); - bGlassbandCooldown = BlackGlassBand.cooldown; + int cooldown = 0; + if (bGlassBand) + { + var source = item.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); + Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; + Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + if (cooldown < BlackGlassBand.cooldown) + cooldown = BlackGlassBand.cooldown; + } + if (protolithBangle && item.DamageType == DamageClass.Ranged) + { + var source = item.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); + Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); + band.DamageType = DamageClass.Ranged; + if (cooldown < ProtolithBangle.cooldown) + cooldown = ProtolithBangle.cooldown; + } + if (batholithBangle && item.DamageType == DamageClass.Magic) + { + var source = item.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BatholithBangle.damage); + Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); + band.DamageType = DamageClass.Magic; + if (cooldown < BatholithBangle.cooldown) + cooldown = BatholithBangle.cooldown; + } + + if (cooldown > 0) // Check if a band effect went off, and apply the highest cooldown + { + generalBandCooldown = cooldown; + Player.AddCooldown(Cooldowns.GenericBandCooldown.ID, cooldown); + } } + if (luxorsGift) luxorHit = true; @@ -209,7 +236,6 @@ namespace CalamityMod.CalPlayer witheringDamageDone += (int)(damageDone * (hit.Crit ? 2D : 1D)); cgn.IncreasedColdEffects_EskimoSet = eskimoSet; - cgn.IncreasedColdEffects_FrozenWings = frozenWingsCold; cgn.IncreasedColdEffects_CryoStone = CryoStone; cgn.IncreasedElectricityEffects_Unused = false; @@ -217,7 +243,6 @@ namespace CalamityMod.CalPlayer cgn.IncreasedHeatEffects_Fireball = fireball; cgn.IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; cgn.IncreasedHeatEffects_FireBoots = bootLevel; - cgn.IncreasedHeatEffects_FlameWings = flameWingsHeat; cgn.IncreasedSicknessEffects_ToxicHeart = toxicHeart; @@ -320,14 +345,47 @@ namespace CalamityMod.CalPlayer // Ursa Sergeant slash cooldown is reset on kill if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - UrsaSergeant.CooldownReducedPerKill, 0, UrsaSergeant.MaxCooldown); - if (bGlassBand && bGlassbandCooldown == 0) + + if (generalBandCooldown == 0) { - var source = proj.GetSource_FromThis(); - int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); - Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; - Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); - bGlassbandCooldown = BlackGlassBand.cooldown; + int cooldown = 0; + // NOTE: Apparently Pulse Pistol/Pulse Rifle projectiles will set spawned projectiles here to inherit the proj ID??? + // No clue why this happens or how to fix it, but it just breaks using multiple band types together on these two weapons + if (bGlassBand) + { + var source = proj.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); + Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; + Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + if (cooldown < BlackGlassBand.cooldown) + cooldown = BlackGlassBand.cooldown; + } + if (protolithBangle && proj.DamageType == DamageClass.Ranged) + { + var source = proj.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); + Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); + band.DamageType = DamageClass.Ranged; + if (cooldown < ProtolithBangle.cooldown) + cooldown = ProtolithBangle.cooldown; + } + if (batholithBangle && proj.DamageType == DamageClass.Magic) + { + var source = proj.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BatholithBangle.damage); + Projectile band = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); + band.DamageType = DamageClass.Magic; + if (cooldown < BatholithBangle.cooldown) + cooldown = BatholithBangle.cooldown; + } + + if (cooldown > 0) // Check if a band effect went off, and apply the highest cooldown + { + generalBandCooldown = cooldown; + Player.AddCooldown(Cooldowns.GenericBandCooldown.ID, cooldown); + } } + if (luxorsGift && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) luxorHit = true; diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index fa4d3f04a2..35de1b7772 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -3,6 +3,7 @@ using System.Security.Policy; using CalamityMod.Dusts; using CalamityMod.Enums; using CalamityMod.Graphics.Metaballs; +using CalamityMod.Items.Accessories; using CalamityMod.Particles; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -47,7 +48,7 @@ namespace CalamityMod.CalPlayer.Dashes if (strongVisuals) { - SoundStyle sound = new("CalamityMod/Sounds/Item/VoidDash"); + SoundStyle sound = StatisVoidSash.VoidDash; SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, player.Center); for (int i = 0; i < 40; i++) { diff --git a/CalPlayer/DrawLayers/AdrenalineTrailLayer.cs b/CalPlayer/DrawLayers/AdrenalineTrailLayer.cs deleted file mode 100644 index 8524e8de6a..0000000000 --- a/CalPlayer/DrawLayers/AdrenalineTrailLayer.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.VanillaArmorChanges; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.CalPlayer.DrawLayers -{ - public class AdrenalineTrailLayer : PlayerDrawLayer - { - public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.LastVanillaLayer); - public int Time = 0; - public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - if (drawInfo.shadow != 0f || drawPlayer.dead) - return false; - - return drawPlayer.Calamity().AdrenalineTrail; - } - - protected override void Draw(ref PlayerDrawSet drawInfo) - { - Time++; - Player drawPlayer = drawInfo.drawPlayer; - List existingDrawData = drawInfo.DrawDataCache; - float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); - for (float i = 0; i < drawPlayer.Calamity().OldPositions.Length; i += 0.9f) - { - float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; - float scale = MathHelper.Lerp(1.1f, 0.1f, completionRatio); - float opacity = MathHelper.Lerp(0.5f, 0.3f, completionRatio) * movementSpeedInterpolant; - List afterimages = new List(); - for (int j = 0; j < existingDrawData.Count; j++) - { - var drawData = existingDrawData[j]; - Vector2 extraPosition = (Time % 6 == 0 ? new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)) : Vector2.Zero); - drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition + extraPosition; - drawData.color = new Color(0, 255, 201) * opacity; - drawData.scale = new Vector2(scale); - afterimages.Add(drawData); - } - drawInfo.DrawDataCache.InsertRange(0, afterimages); - } - } - } -} diff --git a/CalPlayer/DrawLayers/AscendedTrailLayer.cs b/CalPlayer/DrawLayers/AscendedTrailLayer.cs deleted file mode 100644 index 3ec0408121..0000000000 --- a/CalPlayer/DrawLayers/AscendedTrailLayer.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.VanillaArmorChanges; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.CalPlayer.DrawLayers -{ - public class AscendantTrailLayer : PlayerDrawLayer - { - public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.LastVanillaLayer); - - public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail) - return false; - - return drawPlayer.Calamity().ascendantTrail; - } - - protected override void Draw(ref PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - List existingDrawData = drawInfo.DrawDataCache; - float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); - for (float i = 0f; i < drawPlayer.Calamity().OldPositions.Length; i += 1.2f) - { - float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; - float scale = MathHelper.Lerp(1f, 0.7f, completionRatio); - float opacity = MathHelper.Lerp(0.18f, 0.06f, completionRatio) * movementSpeedInterpolant; - List afterimages = new List(); - for (int j = 0; j < existingDrawData.Count; j++) - { - var drawData = existingDrawData[j]; - drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; - drawData.color = Color.Khaki * opacity; - drawData.scale = new Vector2(scale); - afterimages.Add(drawData); - } - drawInfo.DrawDataCache.InsertRange(0, afterimages); - } - } - } -} diff --git a/CalPlayer/DrawLayers/AuricSetTrailLayer.cs b/CalPlayer/DrawLayers/AuricSetTrailLayer.cs deleted file mode 100644 index 985f590c07..0000000000 --- a/CalPlayer/DrawLayers/AuricSetTrailLayer.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.VanillaArmorChanges; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.CalPlayer.DrawLayers -{ - public class AuricSetTrailLayer : PlayerDrawLayer - { - public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.LastVanillaLayer); - - public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail || drawPlayer.Calamity().ascendantTrail) - return false; - - return drawPlayer.Calamity().auricSet; - } - - protected override void Draw(ref PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - List existingDrawData = drawInfo.DrawDataCache; - float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); - for (float i = 0f; i < drawPlayer.Calamity().OldPositions.Length; i += 1.7f) - { - float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; - float scale = MathHelper.Lerp(1f, 0.6f, completionRatio); - float opacity = MathHelper.Lerp(0.12f, 0.03f, completionRatio) * movementSpeedInterpolant; - List afterimages = new List(); - for (int j = 0; j < existingDrawData.Count; j++) - { - var drawData = existingDrawData[j]; - drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; - drawData.color = new Color(105, 209, 248) * opacity; - drawData.scale = new Vector2(scale); - afterimages.Add(drawData); - } - drawInfo.DrawDataCache.InsertRange(0, afterimages); - } - } - } -} diff --git a/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs b/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs deleted file mode 100644 index 6c348fd81c..0000000000 --- a/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.VanillaArmorChanges; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.CalPlayer.DrawLayers -{ - public class CobaltSetTrailLayer : PlayerDrawLayer - { - public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.LastVanillaLayer); - - public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail || drawPlayer.Calamity().ascendantTrail) - return false; - - return drawPlayer.Calamity().CobaltSet; - } - - protected override void Draw(ref PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - List existingDrawData = drawInfo.DrawDataCache; - float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); - for (int i = 0; i < drawPlayer.Calamity().OldPositions.Length; i++) - { - float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; - float scale = MathHelper.Lerp(1f, 0.5f, completionRatio); - float opacity = MathHelper.Lerp(0.23f, 0.07f, completionRatio) * movementSpeedInterpolant; - List afterimages = new List(); - for (int j = 0; j < existingDrawData.Count; j++) - { - var drawData = existingDrawData[j]; - drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; - drawData.color = new Color(100, 164, 219) * opacity; - drawData.color.B = (byte)(drawData.color.B * 1.4); - drawData.scale = new Vector2(scale); - afterimages.Add(drawData); - } - drawInfo.DrawDataCache.InsertRange(0, afterimages); - } - } - } -} diff --git a/CalPlayer/DrawLayers/HatExtensionLayer.cs b/CalPlayer/DrawLayers/HatExtensionLayer.cs index 7b512ea262..2a194db088 100644 --- a/CalPlayer/DrawLayers/HatExtensionLayer.cs +++ b/CalPlayer/DrawLayers/HatExtensionLayer.cs @@ -16,16 +16,19 @@ namespace CalamityMod.CalPlayer.DrawLayers protected override void Draw(ref PlayerDrawSet drawInfo) { - //Todo : Make this work even for accessories by somehow checking for the players.head equipslot's item instead of the head item. Player drawPlayer = drawInfo.drawPlayer; - Item headItem = drawPlayer.armor[0]; - if (drawPlayer.armor[10].type > ItemID.None) - headItem = drawPlayer.armor[10]; + if (drawPlayer.head == -1) + return; - if (ModContent.GetModItem(headItem.type) is IExtendedHat extendedHatDrawer) + if (EquipLoader.GetEquipTexture(EquipType.Head, drawPlayer.head) == null) + return; + + ModItem headItem = EquipLoader.GetEquipTexture(EquipType.Head, drawPlayer.head).Item; + + if (headItem is IExtendedHat extendedHatDrawer) { - string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.ModItem.Name; + string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.Name; int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Head); if (extendedHatDrawer.PreDrawExtension(drawInfo) && !drawInfo.drawPlayer.dead && equipSlot == drawPlayer.head) diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index 029b50fe1b..d5a92f8bfc 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -92,8 +92,6 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexSmallGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow").Value; - else if (itemType == ModContent.ItemType()) - glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Ranged/VernalBolterGlow").Value; else if (itemType == ModContent.ItemType()) diff --git a/CalPlayer/DrawLayers/YanmeiKnifeTrailLayer.cs b/CalPlayer/DrawLayers/YanmeiKnifeTrailLayer.cs deleted file mode 100644 index 0b1ed520c6..0000000000 --- a/CalPlayer/DrawLayers/YanmeiKnifeTrailLayer.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.CalPlayer.DrawLayers -{ - public class YanmeiKnifeTrail : PlayerDrawLayer - { - public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.BackAcc); - - public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - if (drawInfo.shadow != 0f || drawPlayer.dead) - return false; - - return drawPlayer.Calamity().kamiBoost; - } - - protected override void Draw(ref PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - List existingDrawData = drawInfo.DrawDataCache; - for (int i = 0; i < drawPlayer.Calamity().OldPositions.Length; i++) - { - float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; - float scale = MathHelper.Lerp(1f, 0.5f, completionRatio); - float opacity = MathHelper.Lerp(0.25f, 0.08f, completionRatio); - List afterimages = new List(); - for (int j = 0; j < existingDrawData.Count; j++) - { - var drawData = existingDrawData[j]; - drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; - drawData.color = Color.Cyan * opacity; - drawData.color.G = (byte)(drawData.color.G * 1.6); - drawData.color.B = (byte)(drawData.color.B * 1.2); - drawData.scale = new Vector2(scale); - afterimages.Add(drawData); - } - drawInfo.DrawDataCache.InsertRange(0, afterimages); - } - } - } -} diff --git a/CalamityConditions.cs b/CalamityConditions.cs index 7d7f2705c8..13b295e844 100644 --- a/CalamityConditions.cs +++ b/CalamityConditions.cs @@ -42,7 +42,7 @@ namespace CalamityMod // public static readonly Condition DownedDesertScourge = Create("Drops.DownedDS", () => DownedBossSystem.downedDesertScourge); - public static readonly Condition DownedCrabulon = Create("Drops.DownedCrabulon", () => DownedBossSystem.downedDesertScourge); + public static readonly Condition DownedCrabulon = Create("Drops.DownedCrabulon", () => DownedBossSystem.downedCrabulon); public static readonly Condition DownedHiveMind = Create("Drops.DownedHM", () => DownedBossSystem.downedHiveMind); public static readonly Condition DownedPerforator = Create("Drops.DownedPerfs", () => DownedBossSystem.downedPerforator); public static readonly Condition DownedSlimeGod = Create("Drops.DownedSG", () => DownedBossSystem.downedSlimeGod); diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 7db9709350..82b26299a2 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -76,6 +76,10 @@ namespace CalamityMod [DefaultValue(true)] public bool EnableVanillaTextureEdits { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool SunkenSeaBackgroundDistortion { get; set; } + private const int MinParticleLimit = 500; private const int MaxParticleLimit = 10000; diff --git a/Cooldowns/GenericBandCooldown.cs b/Cooldowns/GenericBandCooldown.cs new file mode 100644 index 0000000000..eccf24955e --- /dev/null +++ b/Cooldowns/GenericBandCooldown.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Cooldowns +{ + public class GenericBandCooldown : CooldownHandler + { + public static new string ID => "BandCooldown"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/GenericBandCooldown"; + public override Color OutlineColor => Color.White; + public override Color CooldownStartColor => Color.SlateGray; + public override Color CooldownEndColor => Color.Gray; + } +} diff --git a/Cooldowns/GenericBandCooldown.png b/Cooldowns/GenericBandCooldown.png new file mode 100644 index 0000000000..afdfd5d97a Binary files /dev/null and b/Cooldowns/GenericBandCooldown.png differ diff --git a/Cooldowns/GenericBandCooldownOutline.png b/Cooldowns/GenericBandCooldownOutline.png new file mode 100644 index 0000000000..ece251f504 Binary files /dev/null and b/Cooldowns/GenericBandCooldownOutline.png differ diff --git a/Cooldowns/GenericBandCooldownOverlay.png b/Cooldowns/GenericBandCooldownOverlay.png new file mode 100644 index 0000000000..f89301304d Binary files /dev/null and b/Cooldowns/GenericBandCooldownOverlay.png differ diff --git a/Cooldowns/WarbanneroftheRighteousBuff.cs b/Cooldowns/WarbanneroftheRighteousBuff.cs index 78ddea9b66..17b7d3769c 100644 --- a/Cooldowns/WarbanneroftheRighteousBuff.cs +++ b/Cooldowns/WarbanneroftheRighteousBuff.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Cooldowns { public class WarbanneroftheRighteousBuff : CooldownHandler { - public float CompletionPercentage => Utils.GetLerpValue(80, 0, instance.timeLeft); + public float CompletionPercentage => Utils.GetLerpValue(70, 0, instance.timeLeft); private bool IsEmpty => CompletionPercentage == 0; - private float TextXOffset => (instance.timeLeft <= 20 ? -11 : -18f); + private float TextXOffset => instance.timeLeft <= 20 ? -11f : -18f; private Vector2 TextPosition => new(TextXOffset, 15); private Color TextColor => Color.White; private Color TextBorderColor => Color.Black; diff --git a/Effects/BasicTextureDistortionShader.fx b/Effects/BasicTextureDistortionShader.fx new file mode 100644 index 0000000000..084d452391 --- /dev/null +++ b/Effects/BasicTextureDistortionShader.fx @@ -0,0 +1,26 @@ +sampler baseTexture : register(s0); +sampler distortionTexture : register(s1); + +float time; +float distortionXSpeed; +float distortionYSpeed; +float distortionStrength; +float noiseScale; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float2 distortedCoords = coords + float2(time * distortionXSpeed, time * distortionYSpeed); + distortedCoords *= noiseScale; + float distortion = tex2D(distortionTexture, distortedCoords).r; + + float4 returnColor = tex2D(baseTexture, coords + distortion * distortionStrength); + return returnColor * sampleColor.a; +} + +technique Technique1 +{ + pass DistortionPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/BasicTextureDistortionShader.xnb b/Effects/BasicTextureDistortionShader.xnb new file mode 100644 index 0000000000..7d0177e650 Binary files /dev/null and b/Effects/BasicTextureDistortionShader.xnb differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 5d9a73271a..1b283d531c 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -210,6 +210,14 @@ namespace CalamityMod.Effects internal static Effect FlipScreenShader; #endregion + // + // All below shaders were created by fryzahh + // + #region fryzahh's Shaders + // A simple shader which distorts an image using a provided texture of choice. + internal static Effect BasicTextureDistortionShader; + #endregion + public override void PostSetupContent() { AssetRepository calAss = CalamityMod.Instance.Assets; @@ -417,6 +425,11 @@ namespace CalamityMod.Effects FlipScreenShader = LoadShader("ScreenShaders/FlipScreen"); RegisterScreenShader(FlipScreenShader, "FlipTheScreen", "FlipScreen",EffectPriority.VeryHigh); #endregion + + #region Loading fryzahh's Shaders + BasicTextureDistortionShader = LoadShader("BasicTextureDistortionShader"); + RegisterMiscShader(BasicTextureDistortionShader, "DistortionPass", "BasicTextureDistortion"); + #endregion } // Shorthand to register a loaded shader in Terraria's graphics engine diff --git a/Enums/HerbType.cs b/Enums/HerbType.cs new file mode 100644 index 0000000000..42e672407e --- /dev/null +++ b/Enums/HerbType.cs @@ -0,0 +1,13 @@ +namespace CalamityMod +{ + public enum HerbType + { + Daybloom, + Moonglow, + Blinkroot, + Deathweed, + Waterleaf, + Fireblossom, + Shiverthorn + } +} diff --git a/Enums/PlanterBoxType.cs b/Enums/PlanterBoxType.cs new file mode 100644 index 0000000000..60447d4ac5 --- /dev/null +++ b/Enums/PlanterBoxType.cs @@ -0,0 +1,14 @@ +namespace CalamityMod +{ + public enum PlanterBoxType + { + Daybloom, + Moonglow, + Deathweed, + DeathweedCrimson, + Blinkroot, + Waterleaf, + Shiverthorn, + Fireblossom + } +} diff --git a/Enums/VanillaWingID.cs b/Enums/VanillaWingID.cs index 1604736eea..5e050247a1 100644 --- a/Enums/VanillaWingID.cs +++ b/Enums/VanillaWingID.cs @@ -12,7 +12,7 @@ BoneWings = 8, FlameWings = 9, FrozenWings = 10, - SpectreWings = 11, + GhostWings = 11, // Spectre Wings SteampunkWings = 12, LeafWings = 13, BatWings = 14, diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index d408942aa2..5963ba605b 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -181,7 +181,7 @@ namespace CalamityMod.Events ///
public static void TryStartEvent(bool forceRain = false) { - if (AcidRainEventIsOngoing || (!NPC.downedBoss1 && !Main.hardMode && !DownedBossSystem.downedAquaticScourge) || BossRushEvent.BossRushActive) + if (AcidRainEventIsOngoing || (!NPC.downedBoss1 && !Main.hardMode && !DownedBossSystem.downedAquaticScourge && !DownedBossSystem.downedPolterghast) || BossRushEvent.BossRushActive || Terraria.GameContent.Creative.CreativePowerManager.Instance.GetPower().Enabled) return; int playerCount = Main.CurrentFrameFlags.ActivePlayersCount; diff --git a/ExtraJumps/StatigelJump.cs b/ExtraJumps/StatigelJump.cs index a933dc82ef..e3fd591e74 100644 --- a/ExtraJumps/StatigelJump.cs +++ b/ExtraJumps/StatigelJump.cs @@ -7,7 +7,7 @@ namespace CalamityMod.ExtraJumps { public class StatigelJump : ExtraJump { - public override Position GetDefaultPosition() => BeforeBottleJumps; + public override Position GetDefaultPosition() => new Before(BlizzardInABottle); public override float GetDurationMultiplier(Player player) => 1.25f; // Values equivalent to the Fart in a Jar diff --git a/ExtraTextures/GreyscaleGradients/Pebbles.png b/ExtraTextures/GreyscaleGradients/Pebbles.png new file mode 100644 index 0000000000..5f05401249 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Pebbles.png differ diff --git a/ExtraTextures/GreyscaleGradients/Smudges2.png b/ExtraTextures/GreyscaleGradients/Smudges2.png new file mode 100644 index 0000000000..fcdefedba1 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Smudges2.png differ diff --git a/ExtraTextures/GreyscaleGradients/Swirls.png b/ExtraTextures/GreyscaleGradients/Swirls.png new file mode 100644 index 0000000000..da2c4380b0 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Swirls.png differ diff --git a/ExtraTextures/Miscellaneous/NuclearTorrent.png b/ExtraTextures/Miscellaneous/NuclearTorrent.png new file mode 100644 index 0000000000..14d160d3d5 Binary files /dev/null and b/ExtraTextures/Miscellaneous/NuclearTorrent.png differ diff --git a/ForegroundDrawing/LoopingTextures/LoopingTextureForeground.cs b/ForegroundDrawing/LoopingTextures/LoopingTextureForeground.cs new file mode 100644 index 0000000000..441b8de6c0 --- /dev/null +++ b/ForegroundDrawing/LoopingTextures/LoopingTextureForeground.cs @@ -0,0 +1,123 @@ +using CalamityMod.NPCs.OldDuke; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.ForegroundDrawing.LoopingTextures +{ + public abstract class LoopingTextureForeground : ModSystem + { + public virtual string Texture => "CalamityMod/ExtraTextures/Miscellaneous/NuclearTorrent"; + + /// + /// How much the effect has moved. Increments by Speed. + /// + float Progress = 0f; + + /// + /// The speed at which Progress is incremented every frame. + /// + public virtual float Speed => 60f; + + /// + /// How opaque the visual is. Caps out at IntensityMaximum. + /// + public float Intensity = 0f; + + /// + /// How opaque the visual can become before capping out. + /// + public virtual float IntensityMaximum => 0.15f; + + /// + /// Current parallax. + /// + Vector2 Parallax = Vector2.Zero; + + /// + /// Current parallax depth. + /// + public virtual Vector2 ParallaxDepth => Vector2.Zero; + + /// + /// When true, the Intensity will increase until it caps out. If false it will decrease until it hits 0. + /// + /// Whether or not the visual is active. + public virtual bool DoesThisShow() + { + return false; + } + + public override void PostDrawTiles() + { + if (DoesThisShow()) + { + Intensity = MathHelper.Lerp(Intensity, IntensityMaximum, 0.1f); + } + else + { + Intensity = MathHelper.Lerp(Intensity, 0, 0.1f); + } + + Intensity = MathHelper.Clamp(Intensity, 0f, 1f); + + Parallax += Main.LocalPlayer.velocity * ParallaxDepth; + + Progress += Speed; + + Main.spriteBatch.Begin(); + Draw(); + PostDraw(); + Main.spriteBatch.End(); + + Update(); + } + + public override void PostUpdateEverything() + { + Update(); + } + + /// + /// Extra drawing logic can be placed here. + /// + public virtual void PostDraw() + { + + } + + /// + /// Called every frame. Run behavior such as particle effects here. + /// + public virtual void Update() + { + + } + + /// + /// Override this to replace existing drawing logic. Only recommended if you know what you're doing. + /// + public virtual void Draw() + { + var tex = ModContent.Request(Texture); + + for (var i = -4; i < 14; i++) + { + float wid = tex.Width(); + float hei = tex.Height(); + + var rect = new Rectangle(0, 0, (int)wid, (int)hei); + + var rot = -Main.WindForVisuals; + + var col = new Color(Intensity, Intensity, Intensity, 0f); + + Main.EntitySpriteDraw(tex.Value, new Vector2(Parallax.X % wid, 0).RotatedBy(rot) + new Vector2(tex.Width() * i, 0).RotatedBy(rot), rect, col, rot, new Vector2(0, (hei - Progress) % hei), 1, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, new Vector2(Parallax.X % wid, 0).RotatedBy(rot) + new Vector2(tex.Width() * i, -hei).RotatedBy(rot), rect, col, rot, new Vector2(0, (hei - Progress) % hei), 1, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, new Vector2(Parallax.X % wid, 0).RotatedBy(rot) + new Vector2(tex.Width() * i, -hei * 2).RotatedBy(rot), rect, col, rot, new Vector2(0, (hei - Progress) % hei), 1, SpriteEffects.None); + } + } + } +} diff --git a/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs b/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs new file mode 100644 index 0000000000..59631603b2 --- /dev/null +++ b/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.NPCs.OldDuke; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.ForegroundDrawing.LoopingTextures +{ + public class NuclearTorrentForeground : LoopingTextureForeground + { + public override Vector2 ParallaxDepth => new Vector2(1f, 1f); + + public override float IntensityMaximum => 0.045f; + + public static List Raindrops = new List(); + + public class NuclearRaindrop + { + public Vector2 Position; + public Vector2 Velocity; + + public NuclearRaindrop(Vector2 pos, Vector2 vel) + { + Position = pos; + Velocity = vel; + } + + public void Update(NuclearRaindrop drop, NuclearTorrentForeground foreground) + { + drop.Position += drop.Velocity; + drop.Position -= Main.LocalPlayer.velocity; + + drop.Velocity = new Vector2(0, 20).RotatedBy(-Main.windSpeedCurrent); + + if (drop.Position.Y > Main.screenHeight + 200) + { + RemoveDrop(drop); + } + } + + public void Draw(NuclearRaindrop drop, NuclearTorrentForeground foreground) + { + Asset tex = ModContent.Request("CalamityMod/ForegroundDrawing/LoopingTextures/NuclearTorrentRaindrop"); + + float intensity = foreground.Intensity / foreground.IntensityMaximum / 4f; + + Main.EntitySpriteDraw(tex.Value, drop.Position, tex.Frame(), Color.White.MultiplyRGBA(new Color(intensity, intensity, intensity, intensity)), Vector2.Zero.AngleTo(drop.Velocity) - MathHelper.ToRadians(90f), tex.Size() / 2, new Vector2(1f, 4f), SpriteEffects.None); + } + } + + public static void RemoveDrop(NuclearRaindrop drop) + { + Raindrops.Remove(drop); + } + + public override bool DoesThisShow() => NPC.CountNPCS(ModContent.NPCType()) > 0 && Main.LocalPlayer.Calamity().ZoneSulphur && !CalamityServerConfig.Instance.BossesStopWeather; + + public override void Update() + { + if (NPC.CountNPCS(ModContent.NPCType()) > 0) + { + int duke = NPC.FindFirstNPC(ModContent.NPCType()); + + Main.windSpeedCurrent = MathHelper.Lerp(Main.windSpeedCurrent, MathHelper.ToRadians(50f), 0.005f); + + foreach (Rain rain in Main.rain) + { + rain.velocity = new Vector2(0, 15).RotatedBy(-Main.windSpeedCurrent); + rain.rotation = Vector2.Zero.AngleTo(rain.velocity) + MathHelper.PiOver2; + } + } + + NuclearRaindrop dr = new NuclearRaindrop(new Vector2(Main.screenWidth / 2f, -100) + new Vector2(Main.rand.NextFloat(-Main.screenWidth, Main.screenWidth), -Main.screenWidth * 0.65f).RotatedBy(-Main.windSpeedCurrent), + new Vector2(0, 20).RotatedBy(-Main.windSpeedCurrent)); + Raindrops.Add(dr); + + for (int i = 0; i < Raindrops.Count; i++) + { + NuclearRaindrop drop = Raindrops[i]; + + drop.Update(drop, this); + } + } + + public override void PostDraw() + { + for (int i = 0; i < Raindrops.Count; i++) + { + NuclearRaindrop drop = Raindrops[i]; + + drop.Draw(drop, this); + } + } + } +} diff --git a/ForegroundDrawing/LoopingTextures/NuclearTorrentRaindrop.png b/ForegroundDrawing/LoopingTextures/NuclearTorrentRaindrop.png new file mode 100644 index 0000000000..428091be12 Binary files /dev/null and b/ForegroundDrawing/LoopingTextures/NuclearTorrentRaindrop.png differ diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index d9b9212975..70666e8415 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -652,7 +652,8 @@ namespace CalamityMod.ILEditing if (modPlayer is null) return; - if (modPlayer.chaliceOfTheBloodGod && modPlayer.chaliceBleedoutBuffer > 0D) + // CIT 17MAY2025: Bleedout clear has a special interaction with Bloom Stone handled elsewhere; do not run this if wearing Bloom Stone + if (modPlayer.chaliceOfTheBloodGod && modPlayer.chaliceBleedoutBuffer > 0D && !modPlayer.bloomStone) { // 20FEB2024: Ozzatron: to prevent abuse, buffer clearing is now 50% of the potion instead of 50% of your buffer float amountOfBleedToClear = ChaliceOfTheBloodGod.HealingPotionRatioForBufferClear * player.GetHealLife(potion, true); diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 8fa999b765..17b15c0aba 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index 307cc2620b..d1d22d9a12 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(5). AddIngredient(5). AddIngredient(ItemID.SoulofFlight, 10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/AsgardsValor_Shield.png b/Items/Accessories/AsgardsValor_Shield.png index ea83064192..320b309ddd 100644 Binary files a/Items/Accessories/AsgardsValor_Shield.png and b/Items/Accessories/AsgardsValor_Shield.png differ diff --git a/Items/Accessories/AuricSoulArtifact.cs b/Items/Accessories/AuricSoulArtifact.cs index f20364b034..794f987a70 100644 --- a/Items/Accessories/AuricSoulArtifact.cs +++ b/Items/Accessories/AuricSoulArtifact.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(5). AddIngredient(25). AddIngredient(25). - AddTile(TileID.DemonAltar). + AddTile(). Register(); } } diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 8f68dd37c7..14d252e5f0 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.WarriorEmblem). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/BatholithBangle.cs b/Items/Accessories/BatholithBangle.cs new file mode 100644 index 0000000000..ef0d8c630f --- /dev/null +++ b/Items/Accessories/BatholithBangle.cs @@ -0,0 +1,39 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class BatholithBangle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public static int cooldown = 600; + public static int damage = 225; + public override void SetDefaults() + { + Item.width = 36; + Item.height = 28; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.batholithBangle = true; + modPlayer.batholithBangleVisual = !hideVisual; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddRecipeGroup("Boss2Material", 15). + AddIngredient(ItemID.Granite, 45). + AddIngredient(ItemID.Amber, 3). + AddIngredient(ItemID.FallenStar, 5). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Accessories/BatholithBangle.png b/Items/Accessories/BatholithBangle.png new file mode 100644 index 0000000000..bd19ef3e43 Binary files /dev/null and b/Items/Accessories/BatholithBangle.png differ diff --git a/Items/Accessories/BlackGlassBand.cs b/Items/Accessories/BlackGlassBand.cs index e5bd9dc238..ff767add74 100644 --- a/Items/Accessories/BlackGlassBand.cs +++ b/Items/Accessories/BlackGlassBand.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.Accessories public class BlackGlassBand : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int cooldown = 420; - public static int damage = 40; + public static int cooldown = 300; + public static int damage = 32; public override void SetDefaults() { Item.width = 30; @@ -27,9 +27,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnyGoldBar", 5). - AddIngredient(ItemID.Diamond, 2). - AddIngredient(ItemID.Obsidian, 25). + AddRecipeGroup("AnyGoldBar", 8). + AddIngredient(ItemID.Diamond, 3). + AddIngredient(ItemID.Obsidian, 35). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index c7e084615f..d77f390a86 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().blazingCore = true; + player.noKnockback = true; } public static void HandleStars(Player player) diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 0cc9b6c92a..d045c257a9 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareCore = true; + player.noKnockback = true; } } } diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index 6858aaff91..bd36d30f54 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -22,101 +22,10 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.25f, 0.4f, 0.2f); - // Provide life benefits if the player is standing on ground and has typical gravity. - int x = (int)player.Center.X / 16; - int y = (int)(player.Bottom.Y - 1f) / 16; - Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y + 1); - bool groundTileIsSolid = groundTile.HasUnactuatedTile && (Main.tileSolid[groundTile.TileType] || Main.tileSolidTop[groundTile.TileType]); - if (groundTileIsSolid && player.gravDir == 1f) - modPlayer.BloomStoneRegen = true; - - // Flower boots effects. - if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) - { - Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (!walkTile.HasTile && walkTile.LiquidAmount == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) - { - walkTile.TileFrameY = 0; - walkTile.Get().Slope = SlopeType.Solid; - walkTile.Get().IsHalfBlock = false; - // On dirt blocks, there's a small chance to grow a dye plant. - if (groundTile.TileType == TileID.Dirt) - { - if (Main.rand.NextBool(1000)) - { - walkTile.Get().HasTile = true; - walkTile.TileType = TileID.DyePlants; - walkTile.TileFrameX = (short)(34 * Main.rand.Next(0, 13)); - while (walkTile.TileFrameX == 144) - walkTile.TileFrameX = (short)(34 * Main.rand.Next(0, 13)); - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - - // On grass, grow flowers. - if (groundTile.TileType == TileID.Grass) - { - if (Main.rand.NextBool()) - { - walkTile.Get().HasTile = true; - walkTile.TileType = TileID.Plants; - walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 11)); - - while (walkTile.TileFrameX == 144) - walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 11)); - } - else - { - walkTile.Get().HasTile = true; - walkTile.TileType = TileID.Plants2; - walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 21)); - - while (walkTile.TileFrameX == 144) - walkTile.TileFrameX = (short)(18 * Main.rand.Next(6, 21)); - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - - // On hallowed grass, grow hallowed flowers. - else if (groundTile.TileType == TileID.HallowedGrass) - { - if (Main.rand.NextBool()) - { - walkTile.Get().HasTile = true; - walkTile.TileType = TileID.HallowedPlants; - walkTile.TileFrameX = (short)(18 * Main.rand.Next(4, 7)); - while (walkTile.TileFrameX == 90) - walkTile.TileFrameX = (short)(18 * Main.rand.Next(4, 7)); - } - else - { - walkTile.Get().HasTile = true; - walkTile.TileType = TileID.HallowedPlants2; - walkTile.TileFrameX = (short)(18 * Main.rand.Next(2, 8)); - while (walkTile.TileFrameX == 90) - walkTile.TileFrameX = (short)(18 * Main.rand.Next(2, 8)); - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - - // On jungle grass, grow jungle flowers. - else if (groundTile.TileType == TileID.JungleGrass) - { - walkTile.Get().HasTile = true; - walkTile.TileType = TileID.JunglePlants2; - walkTile.TileFrameX = (short)(18 * Main.rand.Next(9, 17)); - - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - } - } + modPlayer.healingPotionMultiplier += 0.5f; + modPlayer.bloomStone = true; + modPlayer.bloomStoneHookVisuals = true; } + public override void UpdateVanity(Player player) => player.Calamity().bloomStoneHookVisuals = true; } } diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index f702b21117..1a1b2bac13 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(8). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index 41291522ae..58ac8d754c 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -152,7 +152,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(15). AddIngredient(ItemID.LunarBar, 10). AddIngredient(4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 030506fa76..ab510a8525 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.darkSunRing = true; + player.noKnockback = true; } public override void AddRecipes() diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index d017624cdf..16e3459913 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().deadshotBrooch = true; - player.Calamity().rangedAmmoCost *= 0.8f; + player.Calamity().ammoCost *= 0.8f; player.GetDamage() += 0.12f; player.GetCritChance() += 7; } diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index e449c12a33..434063f4be 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(5). AddIngredient(25). AddIngredient(25). - AddTile(TileID.DemonAltar). + AddTile(). Register(); } } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index abbe1e35a3..356c9384cb 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -57,6 +57,7 @@ namespace CalamityMod.Items.Accessories modPlayer.adrenaline = 0f; modPlayer.draedonsHeart = true; + player.noKnockback = true; modPlayer.hadNanomachinesLastFrame = true; modPlayer.AdrenalineDuration = NanomachinesDuration; modPlayer.contactDamageReduction += ContactDamageReduction; diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 5bb6405a7c..0e1299f0ed 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(5). AddIngredient(25). AddIngredient(25). - AddTile(TileID.DemonAltar). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/EnchantedPearl.png b/Items/Accessories/EnchantedPearl.png index db3018d0fe..1dcc3798c7 100644 Binary files a/Items/Accessories/EnchantedPearl.png and b/Items/Accessories/EnchantedPearl.png differ diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 4637cba6cc..4cf105a720 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.flameLickedShell = true; + player.noKnockback = true; } public static void handleParry(Player player) diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index c7b583cea5..104e8933bc 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,8 +1,4 @@ using System; -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,8 +10,8 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.width = 42; - Item.height = 36; + Item.width = 48; + Item.height = 54; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; diff --git a/Items/Accessories/GladiatorsLocket.png b/Items/Accessories/GladiatorsLocket.png index d2e1c67d65..372792ae48 100644 Binary files a/Items/Accessories/GladiatorsLocket.png and b/Items/Accessories/GladiatorsLocket.png differ diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 8ea3582908..223d3dc0c0 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -183,6 +183,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(). + AddIngredient(ItemID.FragmentStardust, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 96480eb4f3..60b9a16ca6 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/OldDukeScales.cs b/Items/Accessories/OldDukeScales.cs index 9e38022feb..0a7355d763 100644 --- a/Items/Accessories/OldDukeScales.cs +++ b/Items/Accessories/OldDukeScales.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Accessories { OldDukeScalesPlayer modPlayer = player.GetModPlayer(); modPlayer.OldDukeScalesOn = true; + player.noKnockback = true; } } diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index 15ea7c2134..12171a8034 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(5). AddIngredient(25). AddIngredient(20). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index 20902eceda..5bd2fdf625 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories player.magicQuiver = true; CalamityPlayer modPlayer = player.Calamity(); modPlayer.deadshotBrooch = true; - modPlayer.rangedAmmoCost *= 0.8f; + modPlayer.ammoCost *= 0.8f; } public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 01232cb368..0450a4c4fe 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(5). AddIngredient(25). AddIngredient(25). - AddTile(TileID.DemonAltar). + AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/ProtolithBangle.cs b/Items/Accessories/ProtolithBangle.cs new file mode 100644 index 0000000000..4c51e063a3 --- /dev/null +++ b/Items/Accessories/ProtolithBangle.cs @@ -0,0 +1,40 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Ranged; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ProtolithBangle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public static int cooldown = 420; + public static int damage = 68; + public override void SetDefaults() + { + Item.width = 34; + Item.height = 34; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.protolithBangle = true; + modPlayer.protolithBangleVisual = !hideVisual; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddRecipeGroup("Boss2Material", 15). + AddIngredient(ItemID.Marble, 45). + AddIngredient(ItemID.Ruby, 3). + AddIngredient(ItemID.Lens, 5). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Accessories/ProtolithBangle.png b/Items/Accessories/ProtolithBangle.png new file mode 100644 index 0000000000..0fc9477145 Binary files /dev/null and b/Items/Accessories/ProtolithBangle.png differ diff --git a/Items/Accessories/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs index 11717b66cd..9efd1466f7 100644 --- a/Items/Accessories/QuiverofNihility.cs +++ b/Items/Accessories/QuiverofNihility.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories AddRecipeGroup("AnyQuiver"). AddIngredient(5). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/RogueEmblem.cs b/Items/Accessories/RogueEmblem.cs index e418c24675..3b6904d7e3 100644 --- a/Items/Accessories/RogueEmblem.cs +++ b/Items/Accessories/RogueEmblem.cs @@ -30,6 +30,18 @@ namespace CalamityMod.Items.Accessories r.AddIngredient(ItemID.SoulofFright, 5); r.AddTile(TileID.TinkerersWorkbench); r.Register(); + + // Sort after recipe with Summoner Emblem as ingredient + // There is no sort after last of X so this process needs to be manual + for (int i = 0; i < Recipe.maxRecipes; i++) + { + Recipe s = Main.recipe[i]; + if (s.createItem.type == ItemID.AvengerEmblem && s.HasIngredient(ItemID.SummonerEmblem)) + { + r.SortAfter(s); + break; + } + } } } } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 804eaeac5d..931dd0c47e 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -153,13 +153,13 @@ namespace CalamityMod.Items.Accessories } } - // If ranged, or any direct subclass thereof, display ranged ammo consumption - if (dc == DamageClass.Ranged || dc.GetModifierInheritance(DamageClass.Ranged).Equals(StatInheritanceData.Full)) - stats2 += "\n" + this.GetLocalization("RangedStats").Format(TwoPlaces(100f * player.GetRangedAmmoCostReduction())); + // If held item uses ammo, display ammo consumption + if (heldItem.useAmmo > 0) + stats2 += "\n" + this.GetLocalization("AmmoStats").Format(OnePlace(100f * player.GetAmmoCostReduction())); - // If magic, or any direct subclass thereof, display mana stats - if (dc == DamageClass.Magic || dc == DamageClass.MagicSummonHybrid || dc.GetModifierInheritance(DamageClass.Magic).Equals(StatInheritanceData.Full)) - stats2 += "\n" + this.GetLocalization("MagicStats").Format(TwoPlaces(100f * player.manaCost), player.manaRegen); + // If held item uses mana, display mana stats + if (heldItem.mana > 0) + stats2 += "\n" + this.GetLocalization("ManaStats").Format(OnePlace(100f * player.manaCost), player.manaRegen); // If summon, or any direct subclass thereof, AND NOT A WHIP, display minion/sentry slots if (dc != DamageClass.SummonMeleeSpeed && (dc == DamageClass.Summon || dc.GetModifierInheritance(DamageClass.Summon).Equals(StatInheritanceData.Full))) @@ -168,7 +168,7 @@ namespace CalamityMod.Items.Accessories // If whip, show whip range float whipRange = player.whipRangeMultiplier - 1f; if (dc == DamageClass.SummonMeleeSpeed || dc.GetModifierInheritance(DamageClass.SummonMeleeSpeed).Equals(StatInheritanceData.Full)) - stats2 += "\n" + this.GetLocalization("WhipStats").Format(Sign(whipRange) + TwoPlaces(100f * whipRange)); + stats2 += "\n" + this.GetLocalization("WhipStats").Format(Sign(whipRange) + OnePlace(100f * whipRange)); // If throwing or rogue, display rogue stats. float rogueVelocity = modPlayer.rogueVelocity - 1f; @@ -178,7 +178,7 @@ namespace CalamityMod.Items.Accessories (int)(100f * modPlayer.rogueStealthMax), TwoPlaces(60f * player.GetStandingStealthRegen()), TwoPlaces(60f * player.GetMovingStealthRegen()), - Sign(rogueVelocity) + TwoPlaces(100f * rogueVelocity)); + Sign(rogueVelocity) + OnePlace(100f * rogueVelocity)); } // If tool, add tool range @@ -199,7 +199,7 @@ namespace CalamityMod.Items.Accessories } list.FindAndReplace("[ITEMS]", stats2); - float moveSpeedBoost = player.moveSpeed - 1f; + float moveSpeedBoost = CalamityServerConfig.Instance.FasterBaseSpeed ? (player.moveSpeed / BalancingConstants.DefaultMoveSpeedBoost) - 1f : player.moveSpeed - 1f; float wingFlightTime = player.wingTimeMax; // Does not use NormalizedLuck. Presents the player's luck exactly as it is used by the game engine. // NormalizedLuck is only used in one place: the Wizard's luck report. Which is entirely obsoleted by this Meter. diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index efe65bb8df..5e6decb0b0 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.FragmentStardust, 10). + AddIngredient(ItemID.FragmentStardust, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 9ac868fe4a..e42a2bbca1 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.FrogFlipper). AddIngredient(25). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); CreateRecipe(). @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.FrogGear). AddIngredient(25). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 8fc1788724..743bc9b28d 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -6,6 +6,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; @@ -17,6 +18,9 @@ namespace CalamityMod.Items.Accessories public class StatisVoidSash : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + + public static SoundStyle VoidDash = new ("CalamityMod/Sounds/Item/VoidDash"); + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 3)); diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index b6f793c7e2..ff7b09897f 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Accessories { if (npc.IsAnEnemy() && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= range) { - int campingFireDamage = (int)player.GetBestClassDamage().ApplyTo(Main.rand.Next(20, 41)); + int campingFireDamage = (int)player.GetBestClassDamage().ApplyTo(Main.rand.Next(100, 121)); Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), campingFireDamage, 0f, player.whoAmI, npc.whoAmI); } } diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index b37ec798aa..6b7a9e6cae 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -87,6 +87,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.sponge = true; + player.noKnockback = true; modPlayer.spongeShieldVisible = !hideVisual; if (modPlayer.SpongeShieldDurability > 0) diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index 4c5043b3ba..9a5304b9f9 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void ModifyTooltips(List list) { - list.IntegrateHotkey(CalamityKeybinds.TransformerHotKey); list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"))); + list.IntegrateHotkey(CalamityKeybinds.TransformerHotKey); } public override void SetStaticDefaults() { diff --git a/Items/Accessories/UnstableGraniteCore.cs b/Items/Accessories/UnstableGraniteCore.cs index c6c5779487..178ce5ca83 100644 --- a/Items/Accessories/UnstableGraniteCore.cs +++ b/Items/Accessories/UnstableGraniteCore.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 40; - Item.height = 44; + Item.width = 46; + Item.height = 48; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; diff --git a/Items/Accessories/UnstableGraniteCore.png b/Items/Accessories/UnstableGraniteCore.png index 309d3cfa45..02230f0bca 100644 Binary files a/Items/Accessories/UnstableGraniteCore.png and b/Items/Accessories/UnstableGraniteCore.png differ diff --git a/Items/Accessories/Vanity/Xyk_Arms.png b/Items/Accessories/Vanity/Xyk_Arms.png deleted file mode 100644 index f7bb6a0d07..0000000000 Binary files a/Items/Accessories/Vanity/Xyk_Arms.png and /dev/null differ diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 9a949d9667..7df7a6b928 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Accessories.Vanity EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body", EquipType.Body, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs", EquipType.Legs, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this); } } @@ -89,6 +90,7 @@ namespace CalamityMod.Items.Accessories.Vanity Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs); Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body); Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); + Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings); } } diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index 98ef8e6afa..29f2d69f89 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Accessories.Vanity EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head2", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body2", EquipType.Body, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs2", EquipType.Legs, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this); } } @@ -89,6 +90,7 @@ namespace CalamityMod.Items.Accessories.Vanity Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs); Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body); Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); + Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings); } } diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index dd7235137c..cd6a16258e 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Accessories public class WarbanneroftheRighteous : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - internal const float MaxBonus = 0.6f; - internal const float MaxDistance = 350f; + internal const float MaxBonus = 0.5f; + internal const float MaxDistance = 700f; public override void SetStaticDefaults() { @@ -57,17 +57,13 @@ namespace CalamityMod.Items.Accessories } int maxValue = (int)(MaxBonus * 100); - float bonus = CalculateBonus(player) - 0.4f; - float displayBonus = (int)((bonus + 0.4f) * 100); // Should range from 0 to the maxValue + float bonus = CalculateBonus(player) - 0.3f; + float displayBonus = (int)((bonus + 0.3f) * 100); // Should range from 0 to the maxValue if (player.Calamity().cooldowns.TryGetValue(WarbanneroftheRighteousBuff.ID, out var cooldown)) - { cooldown.timeLeft = maxValue - (int)displayBonus; - } else - { player.AddCooldown(WarbanneroftheRighteousBuff.ID, maxValue); - } if (bonus > 0) player.GetDamage() += bonus; @@ -83,7 +79,7 @@ namespace CalamityMod.Items.Accessories for (int index = 0; index < Main.npc.Length; index++) { NPC nPC = Main.npc[index]; - float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox + float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f) + 100; // Adds some room so max bonus isnt when you're ON the hitbox float intensity = Utils.Remap(Utils.Distance(player.Center, nPC.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 1, 3, true); // We have to have this seperate from bonus, otherwise all effected enemies take damage based on the closest enemy if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && nPC.CanBeChasedBy()) @@ -104,7 +100,7 @@ namespace CalamityMod.Items.Accessories { modNPC.warbannerBurnIntensity = intensity; modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center); - int burnDamage = (int)player.GetBestClassDamage().ApplyTo(47 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy + int burnDamage = (int)player.GetBestClassDamage().ApplyTo(45 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy modNPC.warbannerBurnDamage = burnDamage; modNPC.warbannerBurnStacks++; modNPC.warbannerBurnTimer = 180; @@ -121,7 +117,7 @@ namespace CalamityMod.Items.Accessories NPC closestTarget = player.Center.ClosestNPCAt(MaxDistance * 7); // extra range is to account for bonus range from massive targets if (closestTarget != null) { - float generousHitboxWidth = Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f) + (100 + 80 * Utils.GetLerpValue(0, 200, Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f))); // Adds some room so max bonus isnt when you're ON the hitbox + float generousHitboxWidth = Math.Max(closestTarget.Hitbox.Width / 2f, closestTarget.Hitbox.Height / 2f) + 100; // Adds some room so max bonus isnt when you're ON the hitbox bonus = Utils.Remap(Utils.Distance(player.Center, closestTarget.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 0, MaxBonus, true); } else diff --git a/Items/Accessories/Wings/AureateBooster.cs b/Items/Accessories/Wings/AureateBooster.cs index d9ac581d6b..0190454c27 100644 --- a/Items/Accessories/Wings/AureateBooster.cs +++ b/Items/Accessories/Wings/AureateBooster.cs @@ -19,6 +19,10 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.5f; public override float BaseAscent => 0.125f; + // How powerful the acceleration increase is while pressing UP + // This also affects the flight time tick rate + public static float BoostPower = 1.5f; + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(120, 8f, 1.5f); public override void SetDefaults() @@ -81,7 +85,19 @@ namespace CalamityMod.Items.Accessories.Wings } } } - player.noFallDmg = true; + } + + public override void AdditionalFlightMovement(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + if (player.TryingToHoverUp) + { + ascentWhenFalling *= BoostPower; + ascentWhenRising *= BoostPower; + maxCanAscendMultiplier *= BoostPower; + maxAscentMultiplier *= BoostPower; + constantAscend *= BoostPower; + player.wingTime -= BoostPower - 1f; + } } public override void AddRecipes() diff --git a/Items/Accessories/Wings/BaseWings.cs b/Items/Accessories/Wings/BaseWings.cs index 0526175386..7637d61087 100644 --- a/Items/Accessories/Wings/BaseWings.cs +++ b/Items/Accessories/Wings/BaseWings.cs @@ -56,8 +56,16 @@ namespace CalamityMod.Items.Accessories.Wings maxCanAscendMultiplier = RisingSpeedThreshold; maxAscentMultiplier = MaxAscentSpeed; constantAscend = BaseAscent; + + AdditionalFlightMovement(player, ref ascentWhenFalling, ref ascentWhenRising, ref maxCanAscendMultiplier, ref maxAscentMultiplier, ref constantAscend); } + /// + /// Addition for any deviations in regular wing movement.
+ /// This is typically for UP boost or hovers. + ///
+ public virtual void AdditionalFlightMovement(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { } + public override void ModifyTooltips(List list) { WingStats stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; @@ -76,7 +84,7 @@ namespace CalamityMod.Items.Accessories.Wings { sb.Append(CalamityUtils.GetText($"Common.WingStatsAcceleration").Format(rAcc.ToMphps(), BaseAscent.ToMphps(), (BaseAscent + BonusAscentWhileRising).ToMphps(), (RisingSpeedThreshold * baseJumpSpeed).ToMph(), - (BaseAscent + BonusAscentWhileRising + BonusAscentWhileFalling).ToMphps())); + (BaseAscent + BonusAscentWhileFalling).ToMphps())); if (hover) { sb.Append('\n'); diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index f9ab4abe57..fb3855fe8d 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -46,7 +46,6 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - player.noFallDmg = true; } } } diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index fde3249493..884655a929 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -14,13 +14,13 @@ namespace CalamityMod.Items.Accessories.Wings [AutoloadEquip(EquipType.Wings)] public class ElysianWings : BaseWings { - public override float BonusAscentWhileFalling => 0.85f; - public override float BonusAscentWhileRising => 0.15f; - public override float RisingSpeedThreshold => 1f; + public override float BonusAscentWhileFalling => 1f; + public override float BonusAscentWhileRising => 0.17f; + public override float RisingSpeedThreshold => 1.2f; public override float MaxAscentSpeed => 3f; - public override float BaseAscent => 0.135f; + public override float BaseAscent => 0.15f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(240, 9.5f, 2.7f); + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(240, 10f, 3f); public override void SetDefaults() { @@ -35,12 +35,6 @@ namespace CalamityMod.Items.Accessories.Wings public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - player.moveSpeed += 0.1f; - player.lavaImmune = true; - player.noFallDmg = true; - modPlayer.elysianWingsDust = false; - if (!hideVisual) DrawWingEffects(player); } diff --git a/Items/Accessories/Wings/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index 0401431942..19ac329482 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -72,7 +72,6 @@ namespace CalamityMod.Items.Accessories.Wings } player.wingTimeMax = 180; - player.noFallDmg = true; } public override void AddRecipes() diff --git a/Items/Accessories/Wings/HadalMantle.cs b/Items/Accessories/Wings/HadalMantle.cs index a9d0f3958a..3e160851d7 100644 --- a/Items/Accessories/Wings/HadalMantle.cs +++ b/Items/Accessories/Wings/HadalMantle.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Accessories.Wings [LegacyName("DiscordianWings")] public class HadalMantle : BaseWings { - public override float BonusAscentWhileFalling => 0.6f; - public override float BonusAscentWhileRising => 0.12f; - public override float RisingSpeedThreshold => 0.7f; - public override float MaxAscentSpeed => 1.75f; - public override float BaseAscent => 0.11f; + public override float BonusAscentWhileFalling => 0.75f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 1.805f; + public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 7.75f, 1.5f); + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(150, 8f, 2f); public override void SetDefaults() { @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - player.noFallDmg = true; } public override void AddRecipes() diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index e75b85cba5..07405c80d2 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Accessories.Wings public class HadarianWings : BaseWings { public override float BonusAscentWhileFalling => 0.8f; - public override float BonusAscentWhileRising => 0.155f; - public override float RisingSpeedThreshold => 1.05f; - public override float MaxAscentSpeed => 2.55f; - public override float BaseAscent => 0.13f; + public override float BonusAscentWhileRising => 0.15f; + public override float RisingSpeedThreshold => 1f; + public override float MaxAscentSpeed => 2f; + public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(90, 9f, 1.75f, true, 11.6f, 11.6f); + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(108, 9f, 2f, true, 11.6f, 11.6f); public override void SetDefaults() { @@ -34,18 +34,6 @@ namespace CalamityMod.Items.Accessories.Wings { if (player.controlJump && player.wingTime > 0f && player.jump == 0) { - bool hovering = player.TryingToHoverDown && !player.merman; - if (hovering) - { - player.velocity.Y *= 0.2f; - if (player.velocity.Y > -2f && player.velocity.Y < 2f) - { - // I can't get the player to have zero y velocity (setting it to 0 doesn't work and I tried a lot of numbers) - player.velocity.Y = 0.105f; - } - player.wingTime += 0.75f; - } - if (player.velocity.Y != 0f && !hideVisual) { float xOffset = 4f; @@ -53,7 +41,7 @@ namespace CalamityMod.Items.Accessories.Wings { xOffset = -40f; } - if (!hovering || Main.rand.NextBool(3)) + if (!player.TryingToHoverDown || Main.rand.NextBool(3)) { int idx = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, ModContent.DustType(), 0f, 0f, 100, default, 1.75f); Main.dust[idx].noGravity = true; @@ -66,7 +54,21 @@ namespace CalamityMod.Items.Accessories.Wings } } } - player.noFallDmg = true; + } + + public override void AdditionalFlightMovement(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + if (player.TryingToHoverDown && player.controlJump && player.wingTime > 0f && !player.merman) + { + player.wingTime += 0.5f; + player.velocity.Y *= 0.8f; + if (player.velocity.Y > -2f && player.velocity.Y < 1f) + player.velocity.Y = 1E-05f; + + ascentWhenFalling *= 0f; + ascentWhenRising *= 0f; + constantAscend *= 0f; + } } } } diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 904c7565bc..c52e62c867 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -90,7 +90,6 @@ namespace CalamityMod.Items.Accessories.Wings player.GetJumpState(ExtraJump.BlizzardInABottle).Enable(); player.jumpBoost = true; player.autoJump = true; - player.noFallDmg = true; player.jumpSpeedBoost += 1.6f; // Mirrors the +5% luck from Lucky Horseshoe (vanilla behavior). diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index 0a7fefdd0f..fde8d8345e 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -21,8 +21,6 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 3.2f; public override float BaseAscent => 0.145f; - public const int LifeRegenTimerMax = 900; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(270, 10.5f, 2.8f); public override void SetDefaults() @@ -36,8 +34,6 @@ namespace CalamityMod.Items.Accessories.Wings public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().silvaWings = true; - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { int dustXOffset = 4; @@ -54,7 +50,6 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - player.noFallDmg = true; } public override void AddRecipes() diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 0c29d76343..6a8d849831 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -20,11 +20,6 @@ namespace CalamityMod.Items.Accessories.Wings Item.rare = ItemRarityID.Orange; } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.noFallDmg = true; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 9d4219fac8..14aedb1d51 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Accessories.Wings { CalamityPlayer modPlayer = player.Calamity(); modPlayer.cryogenSoul = true; - player.noFallDmg = true; if (modPlayer.wingProjectileCooldown <= 0) { if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index 472dab84a3..cdc91e0820 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - player.noFallDmg = true; } public override void AddRecipes() diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 7692df6166..a395ad20ec 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 3f; public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 9.5f, 2.5f); + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(270, 9.5f, 2.5f); public override void SetDefaults() { @@ -33,9 +33,6 @@ namespace CalamityMod.Items.Accessories.Wings public override void UpdateAccessory(Player player, bool hideVisual) { - player.statDefense += 15; - player.lifeRegen += 2; - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { int dustXOffset = 4; @@ -52,7 +49,6 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - player.noFallDmg = true; } public override void AddRecipes() @@ -60,7 +56,7 @@ namespace CalamityMod.Items.Accessories.Wings CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Accessories/Wings/TracersCelestial.cs b/Items/Accessories/Wings/TracersCelestial.cs index 2c6198dd03..eb1ea60ce8 100644 --- a/Items/Accessories/Wings/TracersCelestial.cs +++ b/Items/Accessories/Wings/TracersCelestial.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - player.noFallDmg = true; modPlayer.tracersDust = !hideVisual; modPlayer.tracersCelestial = true; } diff --git a/Items/Accessories/Wings/TracersElysian.cs b/Items/Accessories/Wings/TracersElysian.cs index 403641dcdf..918a418280 100644 --- a/Items/Accessories/Wings/TracersElysian.cs +++ b/Items/Accessories/Wings/TracersElysian.cs @@ -60,9 +60,7 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - player.noFallDmg = true; modPlayer.tracersDust = !hideVisual; - modPlayer.elysianWingsDust = !hideVisual; modPlayer.tracersElysian = true; } diff --git a/Items/Accessories/Wings/TracersSeraph.cs b/Items/Accessories/Wings/TracersSeraph.cs index b157d040ac..2c42494f78 100644 --- a/Items/Accessories/Wings/TracersSeraph.cs +++ b/Items/Accessories/Wings/TracersSeraph.cs @@ -60,9 +60,7 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - player.noFallDmg = true; modPlayer.tracersDust = !hideVisual; - modPlayer.elysianWingsDust = !hideVisual; modPlayer.tracersSeraph = true; // Grants immunity to Auric Rejection and other walk-on-block effects } diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index b1339b3a06..aab707da5b 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Chain, 2). - AddIngredient(6). + AddIngredient(5). AddIngredient(). + AddIngredient(ItemID.Chain, 2). AddTile(TileID.Anvils). Register(); } @@ -132,7 +132,7 @@ namespace CalamityMod.Items.Accessories if (!Grappled) return false; - if (!PlayerOnGround) + if (!PlayerOnGround || !obeyGravity) return false; if ((Player.Center - Main.projectile[Grapple].Center).Length() > SwingLength) @@ -142,6 +142,8 @@ namespace CalamityMod.Items.Accessories } } + public bool obeyGravity => !(Player.miscEquips[4].type == ItemID.AntiGravityHook); + public bool strongerReel => Player.miscEquips[4].type == ItemID.StaticHook; public Vector2 CurrentPosition; public Vector2 OldPosition; public List Segments; @@ -280,7 +282,10 @@ namespace CalamityMod.Items.Accessories } hookCache = -1; - + if (!obeyGravity) + { + Player.gravity = -1f; //Disable player gravity with Anti-Grav hook + } if (Grappled) { if ((Main.projectile[Grapple].Center - Player.Center).Length() > SwingLength + 80f) @@ -299,7 +304,7 @@ namespace CalamityMod.Items.Accessories public void SimulateMovement(Projectile grapple) { - Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SwingLength / SimulationResolution, 50, 0.3f * Player.gravDir); + Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SwingLength / SimulationResolution, 50, (obeyGravity ? 0.3f * Player.gravDir : 0)); Vector2 CurrentPosition; @@ -313,40 +318,83 @@ namespace CalamityMod.Items.Accessories } if (!GrappleMovementDisabled) { - CurrentPosition = Segments[SimulationResolution].position; - Player.velocity = CurrentPosition - Player.Center; - - //let the player swing themselves around if they are under the hook. - if (Player.gravDir * (Player.Center.Y - Segments[0].position.Y) > 0) + if (obeyGravity) { - float swing = 0; - if (Math.Sign(Player.velocity.X) < 0) + + CurrentPosition = Segments[SimulationResolution].position; + Player.velocity = CurrentPosition - Player.Center; + + //let the player swing themselves around if they are under the hook. + if (Player.gravDir * (Player.Center.Y - Segments[0].position.Y) > 0) { - if (Player.controlLeft) - swing -= 0.1f; + float swing = 0; - else if (Player.controlRight) - swing += 0.1f; + if (Math.Sign(Player.velocity.X) < 0) + { + if (Player.controlLeft) + swing -= 0.1f; + + else if (Player.controlRight) + swing += 0.1f; + } + + else if (Math.Sign(Player.velocity.X) > 0) + { + if (Player.controlRight) + swing += 0.1f; + + else if (Player.controlLeft) + swing -= 0.1f; + } + + Player.velocity.X += swing; } - else if (Math.Sign(Player.velocity.X) > 0) + else if (Math.Abs(Player.Center.X - Segments[0].position.X) < 30f && Math.Abs(Player.velocity.X) < 1) { - if (Player.controlRight) - swing += 0.1f; - - else if (Player.controlLeft) - swing -= 0.1f; + Player.velocity.X = Player.velocity.X == 0 ? 1.5f : 1.5f * Math.Sign(Player.velocity.X); } - - Player.velocity.X += swing * (Player.miscEquips[4].type == ItemID.AntiGravityHook ? 1.75f : 1); } - - else if (Math.Abs(Player.Center.X - Segments[0].position.X) < 30f && Math.Abs(Player.velocity.X) < 1) + + else { - Player.velocity.X = Player.velocity.X == 0 ? 1.5f : 1.5f * Math.Sign(Player.velocity.X); - } + if (Player.grappling[0] > -1) + { + var Hook = Main.projectile[Player.grappling[0]]; + if (Hook != null) + { + + if (Player.controlRight) + Player.velocity.X += 0.3f; + else if (Player.controlLeft) + Player.velocity.X -= 0.3f; + Player.velocity -= Player.Center.DirectionTo(Hook.Center); + var estimatedPos = Player.Center + Player.velocity; + var estimatedDir = Hook.Center.DirectionTo(estimatedPos); + var goalPos = Hook.Center + estimatedDir * SwingLength; + var estimatedPosLocked = Hook.Center + Hook.Center.DirectionTo(Player.Center) * SwingLength; + if (estimatedPosLocked.Distance(estimatedPos) < 2) + { + estimatedPos = estimatedPosLocked; + } + var dis = Hook.Center.Distance(estimatedPos); + if (dis > SwingLength && dis < 1000f) + { + var dis2 = Math.Min(Player.Center.Distance(goalPos), SwingLength*3f); + if (dis2 > 0) + { + Player.velocity = Player.Center.DirectionTo(goalPos) * dis2; + } + } + + + if (Player.velocity.Length() < 1.5f) + Player.direction = Hook.Center.X > Player.Center.X ? 1 : -1; + } + } + } } if (Grappled) @@ -512,7 +560,7 @@ namespace CalamityMod.Items.Accessories } if (Grappled && triggersSet.Up) { - SwingLength -= (Player.miscEquips[4].type == ItemID.StaticHook ? StaticHookReelSpeed : ReelSpeed); + SwingLength -= (strongerReel ? StaticHookReelSpeed : ReelSpeed); Player.controlUp = false; //This is required to stop the player from bouncing off platforms when falling down and reeling in. Also prevents gravity swapping while hooked. } if (triggersSet.Down) //Static Hook doesn't effect this speed because it would be faster than your fall speed and feel janky. diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index 83d180aa84..700c009808 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); player.moveSpeed += 0.15f; player.GetDamage() += 0.15f; + player.noKnockback = true; if (!player.StandingStill()) { dragonTimer--; diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index 93de0fc981..6fd88990ef 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Ammo { CreateRecipe(333). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs index 915a56bf28..91630337cb 100644 --- a/Items/Ammo/BloodfireBullet.cs +++ b/Items/Ammo/BloodfireBullet.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Ammo { CreateRecipe(333). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index 7f60191950..52dcc7ba58 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Ammo CreateRecipe(150). AddIngredient(ItemID.HolyArrow, 150). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Ammo/HallowPointRound.cs b/Items/Ammo/HallowPointRound.cs index c3316d90fa..725c8dab0a 100644 --- a/Items/Ammo/HallowPointRound.cs +++ b/Items/Ammo/HallowPointRound.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Ammo CreateRecipe(100). AddIngredient(ItemID.EmptyBullet, 100). AddIngredient(ItemID.HallowedBar). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Ammo/HolyFireBullet.cs b/Items/Ammo/HolyFireBullet.cs index 794853a48b..f92a3dbda8 100644 --- a/Items/Ammo/HolyFireBullet.cs +++ b/Items/Ammo/HolyFireBullet.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Ammo CreateRecipe(333). AddIngredient(ItemID.ExplodingBullet, 333). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs index 7139b25e18..c1fee61ca3 100644 --- a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs +++ b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor.Bloodflare CreateRecipe(). AddIngredient(16). AddIngredient(4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareCuisses.cs b/Items/Armor/Bloodflare/BloodflareCuisses.cs index a34517488d..e604477feb 100644 --- a/Items/Armor/Bloodflare/BloodflareCuisses.cs +++ b/Items/Armor/Bloodflare/BloodflareCuisses.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor.Bloodflare CreateRecipe(). AddIngredient(13). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index f3da4ef71c..8a4569fc13 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Bloodflare CreateRecipe(). AddIngredient(11). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index 542373cdbc..a65be7a702 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Bloodflare CreateRecipe(). AddIngredient(11). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index a1bef0cca6..b8a9e4f5ef 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Bloodflare CreateRecipe(). AddIngredient(11). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index 75e086447a..fbf4e7f488 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Armor.Bloodflare CreateRecipe(). AddIngredient(11). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 0aa577c5bb..20e647a2cb 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Bloodflare CreateRecipe(). AddIngredient(11). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs index bc1b1eaadc..f67aa39d0f 100644 --- a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 1; + Item.defense = 4; } private void ActivateLift(Terraria.On_Player.orig_QuickMount orig, Player self) @@ -155,7 +155,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 2; + Item.defense = 5; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index 86e43aab19..0f02976040 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue AddIngredient(5). AddIngredient(18). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index b40932ff94..9f284fee8e 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue AddIngredient(3). AddIngredient(12). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index 54f1cbbf0a..8c853d54f7 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue AddIngredient(4). AddIngredient(15). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/Prismatic/PrismaticGreaves.cs b/Items/Armor/Prismatic/PrismaticGreaves.cs index ea73d76edf..2af82a1c33 100644 --- a/Items/Armor/Prismatic/PrismaticGreaves.cs +++ b/Items/Armor/Prismatic/PrismaticGreaves.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor.Prismatic AddIngredient(5). AddIngredient(6). AddIngredient(ItemID.Nanites, 300). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/Prismatic/PrismaticHelmet.cs b/Items/Armor/Prismatic/PrismaticHelmet.cs index fa39d36891..d21c375da9 100644 --- a/Items/Armor/Prismatic/PrismaticHelmet.cs +++ b/Items/Armor/Prismatic/PrismaticHelmet.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Armor.Prismatic AddIngredient(5). AddIngredient(4). AddIngredient(ItemID.Nanites, 300). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Prismatic/PrismaticRegalia.cs b/Items/Armor/Prismatic/PrismaticRegalia.cs index fbb6023108..05f840849e 100644 --- a/Items/Armor/Prismatic/PrismaticRegalia.cs +++ b/Items/Armor/Prismatic/PrismaticRegalia.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Armor.Prismatic AddIngredient(5). AddIngredient(8). AddIngredient(ItemID.Nanites, 300). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Tarragon/TarragonBreastplate.cs b/Items/Armor/Tarragon/TarragonBreastplate.cs index 0596b39c82..e8f74b9a7e 100644 --- a/Items/Armor/Tarragon/TarragonBreastplate.cs +++ b/Items/Armor/Tarragon/TarragonBreastplate.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Tarragon Item.height = 18; Item.lifeRegen = 3; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 37; + Item.defense = 40; Item.rare = ModContent.RarityType(); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Armor.Tarragon CreateRecipe(). AddIngredient(15). AddIngredient(18). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/Tarragon/TarragonHeadMagic.cs b/Items/Armor/Tarragon/TarragonHeadMagic.cs index d51fa12857..1faa537056 100644 --- a/Items/Armor/Tarragon/TarragonHeadMagic.cs +++ b/Items/Armor/Tarragon/TarragonHeadMagic.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Tarragon Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 10; //98 + Item.defense = 15; // 90 Item.rare = ModContent.RarityType(); } @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Armor.Tarragon CreateRecipe(). AddIngredient(7). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index 94f2ae5883..c8b34346d0 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Tarragon Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 33; //98 + Item.defense = 42; // 117 Item.rare = ModContent.RarityType(); } @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Tarragon CreateRecipe(). AddIngredient(7). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index 7d29dbab8a..7bc1135d98 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Tarragon Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 21; //98 + Item.defense = 27; // 102 Item.rare = ModContent.RarityType(); } @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Armor.Tarragon CreateRecipe(). AddIngredient(7). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Tarragon/TarragonHeadRogue.cs b/Items/Armor/Tarragon/TarragonHeadRogue.cs index 91f8785758..31fe1ed587 100644 --- a/Items/Armor/Tarragon/TarragonHeadRogue.cs +++ b/Items/Armor/Tarragon/TarragonHeadRogue.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Tarragon Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 15; //98 + Item.defense = 20; // 95 Item.rare = ModContent.RarityType(); } @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Tarragon CreateRecipe(). AddIngredient(7). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Tarragon/TarragonHeadSummon.cs b/Items/Armor/Tarragon/TarragonHeadSummon.cs index ebaadb2a02..b850eaea52 100644 --- a/Items/Armor/Tarragon/TarragonHeadSummon.cs +++ b/Items/Armor/Tarragon/TarragonHeadSummon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Tarragon Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 3; //98 + Item.defense = 10; // 85 Item.rare = ModContent.RarityType(); } @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Armor.Tarragon CreateRecipe(). AddIngredient(7). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Tarragon/TarragonLeggings.cs b/Items/Armor/Tarragon/TarragonLeggings.cs index 4aeeca59c1..fa0a9d0a61 100644 --- a/Items/Armor/Tarragon/TarragonLeggings.cs +++ b/Items/Armor/Tarragon/TarragonLeggings.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Tarragon Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 32; + Item.defense = 35; Item.rare = ModContent.RarityType(); } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor.Tarragon CreateRecipe(). AddIngredient(11). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 69987f14d2..2b9dcc9d35 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -298,7 +298,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddIngredient(). AddTile(TileID.Anvils). Register(); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 105195722a..55cb33990f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -181,32 +181,53 @@ namespace CalamityMod.Items SetStaticDefaults_ShimmerRecipes(); #region Vanilla Wing Tweaks - // 170 -> 240 flight time - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BoneWings].FlyTime = 240; - // 170 -> 200 flight time - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.MothronWings].FlyTime = 200; + // Shorthand to make looking at this easier + WingStats[] stats = ArmorIDs.Wing.Sets.Stats; + // 130 -> 160 flight time, 6.75 -> 7.5 horizontal speed + stats[(int)VanillaWingID.HarpyWings].FlyTime = 160; + stats[(int)VanillaWingID.HarpyWings].AccRunSpeedOverride = 7.5f; + // 6.75 -> 9 horizontal speed, 1 -> 1.5 acceleration multiplier + stats[(int)VanillaWingID.FrozenWings].AccRunSpeedOverride = 9f; + stats[(int)VanillaWingID.FrozenWings].AccRunAccelerationMult = 1.5f; + // 160 -> 130 flight time + stats[(int)VanillaWingID.FlameWings].FlyTime = 130; + // 160 -> 180 flight time, 7.5 -> 6.25 horizontal speed + stats[(int)VanillaWingID.BatWings].FlyTime = 180; + stats[(int)VanillaWingID.BatWings].AccRunSpeedOverride = 6.25f; + // 1 -> 1.5 acceleration multiplier + stats[(int)VanillaWingID.ButterflyWings].AccRunAccelerationMult = 1.5f; + + // 170 -> 240 flight time + stats[(int)VanillaWingID.BoneWings].FlyTime = 240; + // 160 -> 170 flight time, 7.5 -> 9 horizontal speed, 1 -> 1.5 acceleration multiplier + stats[(int)VanillaWingID.LeafWings].FlyTime = 170; + stats[(int)VanillaWingID.LeafWings].AccRunSpeedOverride = 9f; + stats[(int)VanillaWingID.LeafWings].AccRunAccelerationMult = 1.5f; + // (Spectre Wings) 1 -> 2 acceleration multiplier + stats[(int)VanillaWingID.GhostWings].AccRunAccelerationMult = 2f; + + // 170 -> 210 flight time + stats[(int)VanillaWingID.BeetleWings].FlyTime = 210; + // 180 -> 210 flight time + stats[(int)VanillaWingID.TatteredFairyWings].FlyTime = 210; // (Empress Wings) 150 -> 120 flight time - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.RainbowWings].FlyTime = 120; + stats[(int)VanillaWingID.RainbowWings].FlyTime = 120; // 12 -> 10.8 hover stats - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BejeweledValkyrieWing].DownHoverSpeedOverride = 10.8f; // (Lazure) - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BejeweledValkyrieWing].DownHoverAccelerationMult = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.Yoraiz0rWings].DownHoverSpeedOverride = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.Yoraiz0rWings].DownHoverAccelerationMult = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.SkiphsWings].DownHoverSpeedOverride = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.SkiphsWings].DownHoverAccelerationMult = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BetsyWings].DownHoverSpeedOverride = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.BetsyWings].DownHoverAccelerationMult = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsVortex].DownHoverSpeedOverride = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsVortex].DownHoverAccelerationMult = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsNebula].DownHoverSpeedOverride = 10.8f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.WingsNebula].DownHoverAccelerationMult = 10.8f; + stats[(int)VanillaWingID.BejeweledValkyrieWing].DownHoverSpeedOverride = 10.8f; // (Lazure) + stats[(int)VanillaWingID.BejeweledValkyrieWing].DownHoverAccelerationMult = 10.8f; + stats[(int)VanillaWingID.Yoraiz0rWings].DownHoverSpeedOverride = 10.8f; + stats[(int)VanillaWingID.Yoraiz0rWings].DownHoverAccelerationMult = 10.8f; + stats[(int)VanillaWingID.SkiphsWings].DownHoverSpeedOverride = 10.8f; + stats[(int)VanillaWingID.SkiphsWings].DownHoverAccelerationMult = 10.8f; + stats[(int)VanillaWingID.BetsyWings].DownHoverSpeedOverride = 10.8f; + stats[(int)VanillaWingID.BetsyWings].DownHoverAccelerationMult = 10.8f; - // (Celestial Starboard) 4.5 -> 2.75 acceleration multiplier, 16 -> 11.6 hover stats - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.LongRainbowTrailWings].AccRunAccelerationMult = 2.75f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverSpeedOverride = 11.6f; - ArmorIDs.Wing.Sets.Stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverAccelerationMult = 11.6f; + // (Celestial Starboard) 4.5 -> 2.75 acceleration multiplier, 16 -> 12 hover stats + stats[(int)VanillaWingID.LongRainbowTrailWings].AccRunAccelerationMult = 2.75f; + stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverSpeedOverride = 12f; + stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverAccelerationMult = 12f; #endregion } @@ -272,7 +293,7 @@ namespace CalamityMod.Items } // Increase how much health Mushrooms heal. - if (item.type == ItemID.Mushroom && item.healLife == 15) + if (item.type == ItemID.Mushroom && item.healLife < 25) item.healLife = 25; // Allow Beam Sword to change direction when it fires, because vanilla disables it for some reason. @@ -652,6 +673,8 @@ namespace CalamityMod.Items public override bool? UseItem(Item item, Player player) { + var modPlayer = player.Calamity(); + if (Main.zenithWorld && item.type == ItemID.RodOfHarmony) { if (NPC.AnyNPCs(ModContent.NPCType())) @@ -665,6 +688,18 @@ namespace CalamityMod.Items if (item.type == ItemID.Mushroom && player.Calamity().fungalSymbiote) player.AddBuff(ModContent.BuffType(), 3600); + // Trigger Bloom Stone's heal over time from healing items + if (item.healLife > 0 && modPlayer.bloomStone) + { + // Temporarily disable Bloom Stone so that GetHealLife doesn't return 0 + modPlayer.bloomStone = false; + modPlayer.bloomStoneTotalHeal = player.GetHealLife(item); + modPlayer.bloomStone = true; + + modPlayer.bloomStoneHealInc = modPlayer.bloomStoneTotalHeal / 15; + modPlayer.bloomStoneHealTimer = (int)Math.Ceiling(modPlayer.bloomStoneTotalHeal / (double)modPlayer.bloomStoneHealInc) * 40; + } + // Staff/Axe of Regrowth growing Calamity grass if (item.type == ItemID.StaffofRegrowth || item.type == ItemID.AcornAxe) { @@ -970,14 +1005,13 @@ namespace CalamityMod.Items } #endregion - #region ModifyHitNPC + #region Hit NPC public override void ModifyHitNPC(Item item, Player player, NPC target, ref NPC.HitModifiers modifiers) { // This assume all items with a damage hit is a weapon. There appears to be no edge cases for this thus far if (player.Calamity().oldFashioned) modifiers.SourceDamage *= OldFashioned.DamageReductionMultiplier; } - #endregion public override void OnHitNPC(Item item, Player player, NPC target, NPC.HitInfo hit, int damageDone) { @@ -1003,6 +1037,7 @@ namespace CalamityMod.Items } } } + #endregion #region Armor Set Changes public override string IsArmorSet(Item head, Item body, Item legs) @@ -1286,10 +1321,16 @@ namespace CalamityMod.Items if (item.type == ItemID.ArcaneFlower) player.GetDamage() += 0.05f; + + if (item.type == ItemID.EyeoftheGolem) + { + player.Calamity().critDamage += 0.2f; + } if (item.type == ItemID.SniperScope) { - player.GetDamage() -= 0.03f; - player.GetCritChance() -= 3; + player.GetDamage() -= 0.1f; //Total 0% damage + player.GetCritChance() += 2; //Total 12% crit + player.Calamity().critDamage += 0.2f; } if (item.type == ItemID.MagicQuiver) @@ -1406,100 +1447,50 @@ namespace CalamityMod.Items player.maxFallSpeed *= 1.2f; } - if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water + if (item.type == ItemID.DemonWings && !player.mount.Active) + player.maxFallSpeed *= 1.3f; + + if (item.type == ItemID.BeeWings && !player.mount.Active && !player.controlDown) { - if (player.IsUnderwater()) - player.gills = true; + player.gravity *= 0.6f; + player.maxFallSpeed *= 0.6f; + } + + if (item.type == ItemID.FinWings) player.ignoreWater = true; - player.noFallDmg = true; - if (!player.mount.Active) - { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - player.maxFallSpeed = 12f; - } - } - else if (item.type == ItemID.BeeWings) // Honey buff + + // Spawns ornaments which refreshes flight time upon pickup + else if (item.type == ItemID.FestiveWings) { - player.AddBuff(BuffID.Honey, 2); - player.noFallDmg = true; - } - else if (item.type == ItemID.ButterflyWings) // Boost to mana regen - { - player.manaRegen = (int)(player.manaRegen * 1.25f); - player.noFallDmg = true; - } - else if (item.type == ItemID.BatWings) // Greatly increases vision - { - player.noFallDmg = true; - player.nightVision = false; // Does not stack with Night Owl; actual effect is handled in LightingEffectsSystem - } - else if (item.type == ItemID.HarpyWings) - { - player.moveSpeed += 0.1f; - player.noFallDmg = true; - } - else if (item.type == ItemID.FrozenWings) // Increases cold debuff damage - { - player.noFallDmg = true; - player.Calamity().frozenWingsCold = true; - } - else if (item.type == ItemID.FlameWings) // Increases heat debuff damage - { - player.noFallDmg = true; - player.Calamity().flameWingsHeat = true; - } - else if (item.type == ItemID.LeafWings) // Bonus to defensive stats - { - player.noFallDmg = true; - player.statDefense += 10; - player.AddBuff(BuffID.DryadsWard, 2); // Dryad's Blessing - } - else if (item.type == ItemID.FestiveWings) // Drop homing christmas tree bulbs while in flight - { - player.noFallDmg = true; if (modPlayer.wingProjectileCooldown <= 0) { var source = player.GetSource_Accessory(item); - if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) + if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && player.wingTime > 0f && !player.mount.Active && !player.mount.Cart) { - int ornamentDamage = (int)player.GetBestClassDamage().ApplyTo(50); - int p = Projectile.NewProjectile(source, player.Center, Vector2.UnitY * 2f, ProjectileID.OrnamentFriendly, ornamentDamage, 5f, player.whoAmI); + Vector2 ornamentPos = player.Center + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(105f)) * Main.rand.NextFloat(-512f, -320f); + + int p = Projectile.NewProjectile(source, ornamentPos, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[p].DamageType = DamageClass.Generic; - Main.projectile[p].Calamity().lineColor = 1; - modPlayer.wingProjectileCooldown = 15; - } + modPlayer.wingProjectileCooldown = 90; } } } - else if (item.type == ItemID.TatteredFairyWings) // Leave a trail of damaging fairy dust while in flight + // Leaves a trail of black fairy dust which reduces flight time to any player that touches it + else if (item.type == ItemID.TatteredFairyWings) { - player.noFallDmg = true; if (modPlayer.wingProjectileCooldown <= 0) { var source = player.GetSource_Accessory(item); - if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) + if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && player.wingTime > 0f && !player.mount.Active && !player.mount.Cart) { - int fairyDustDamage = (int)player.GetBestClassDamage().ApplyTo(35); Vector2 fairyDustVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.08f, 0.2f); - int p = Projectile.NewProjectile(source, player.Center, fairyDustVel, ModContent.ProjectileType(), fairyDustDamage, 0f, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, fairyDustVel, ModContent.ProjectileType(), 0, 0f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) - modPlayer.wingProjectileCooldown = 10; + modPlayer.wingProjectileCooldown = 8; } } } - else if (item.type == ItemID.FishronWings || item.type == ItemID.BetsyWings || item.type == ItemID.Yoraiz0rWings || - item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || item.type == ItemID.LokisWings || - item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || item.type == ItemID.BejeweledValkyrieWing || - item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || item.type == ItemID.WillsWings || - item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings || item.type == ItemID.CreativeWings || - item.type == ItemID.FoodBarbarianWings || item.type == ItemID.GroxTheGreatWings || item.type == ItemID.GhostarsWings || - item.type == ItemID.SafemanWings || item.type == ItemID.RainbowWings || item.type == ItemID.LongRainbowTrailWings) - { - player.noFallDmg = true; - } if (item.type == ItemID.JellyfishNecklace || item.type == ItemID.JellyfishDivingGear || item.type == ItemID.ArcticDivingGear) modPlayer.jellyfishNecklace = true; @@ -1525,7 +1516,7 @@ namespace CalamityMod.Items public override void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) { CalamityPlayer modPlayer = player.Calamity(); - float moveSpeedBoost = modPlayer.moveSpeedBonus * 0.1f; + float moveSpeedBoost = modPlayer.moveSpeedBonus * 0.06f; float flightSpeedMult = 1f + (modPlayer.soaring ? SoaringPotion.FlightBoost : 0f) + @@ -1540,6 +1531,36 @@ namespace CalamityMod.Items flightAccMult = MathHelper.Clamp(flightAccMult, 0.5f, 1.5f); acceleration *= flightAccMult; } + + public override void VerticalWingSpeeds(Item item, Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) + { + switch (item.type) + { + case ItemID.AngelWings: + maxAscentMultiplier *= 1.3f; + constantAscend *= 1.5f; + break; + case ItemID.DemonWings: + ascentWhenFalling *= 2f; + ascentWhenRising *= 2f; + maxCanAscendMultiplier *= 2f; + break; + case ItemID.FlameWings: + maxAscentMultiplier *= 1.2f; + constantAscend *= 1.35f; + break; + case ItemID.ButterflyWings: + maxAscentMultiplier *= 0.9f; + constantAscend *= 5f; + break; + case ItemID.GhostWings: + maxAscentMultiplier *= 0.904f; + constantAscend *= 5f; + break; + default: + break; + } + } #endregion #region GrabChanges @@ -1561,7 +1582,7 @@ namespace CalamityMod.Items #endregion #region Ammo - public override bool CanConsumeAmmo(Item weapon, Item ammo, Player player) => Main.rand.NextFloat() <= player.Calamity().rangedAmmoCost; + public override bool CanConsumeAmmo(Item weapon, Item ammo, Player player) => Main.rand.NextFloat() <= player.Calamity().ammoCost; public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) { @@ -1634,7 +1655,7 @@ namespace CalamityMod.Items dontConsumeAmmo = true; if (player.ammoCost75 && Main.rand.NextBool(4)) dontConsumeAmmo = true; - if (Main.rand.NextFloat() > player.Calamity().rangedAmmoCost) + if (Main.rand.NextFloat() > player.Calamity().ammoCost) dontConsumeAmmo = true; if (!dontConsumeAmmo && itemAmmo.consumable) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index bfb8475015..bbe4afbd13 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -570,12 +570,17 @@ namespace CalamityMod.Items if (item.healLife > 0 && Main.LocalPlayer.Calamity().healingPotionMultiplier != 1f) EditTooltipByName("HealLife", (line) => line.Text = Language.GetOrRegister("CommonItemTooltip.RestoresLife").Format((int)(item.healLife * Main.LocalPlayer.Calamity().healingPotionMultiplier))); + // Ancient Manipulator also crafts stuff with Astral Bars + if (item.type == ItemID.LunarCraftingStation) + EditTooltipByNum(0, (line) => line.Text = EditedTooltip("LunarCraftingStation")); + + // Reworked Gravity Globe if (item.type == ItemID.GravityGlobe) - EditTooltipByName("Tooltip1", (line) => line.Text = EditedTooltip("GravityGlobe")); - + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("GravityGlobe")); + // "Buffed" Step Stool if (item.type == ItemID.PortableStool) - EditTooltipByName("Tooltip0", (line) => line.Text += AddedTooltip("Stepstool")); + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("PortableStool")); #endregion // For boss summon item clarity @@ -794,6 +799,11 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text = EditedTooltip("EmpressFlightBooster2")); } + if (item.type == ItemID.EyeoftheGolem) + { + EditTooltipByNum(0, (line) => line.Text += AddedTooltip("EyeoftheGolem")); + } + // Rifle Scope visibility change if (item.type == ItemID.RifleScope) { @@ -806,6 +816,7 @@ namespace CalamityMod.Items { EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SniperScope")); EditTooltipByNum(0, (line) => line.Text += AddedTooltip("RifleScope")); + EditTooltipByNum(1, (line) => line.Text += AddedTooltip("EyeoftheGolem")); } // Recon Scope visibility change @@ -1223,7 +1234,7 @@ namespace CalamityMod.Items sb.Append('\n'); if (Main.keyState.IsKeyDown(Keys.LeftShift)) { - sb.Append(CalamityUtils.GetText($"Common.WingStatsAcceleration").Format(rAcc.ToMphps(), asc.ToMphps(), (asc + rise).ToMphps(), (rMax * baseJumpSpeed).ToMph(), (asc + rise + fall).ToMphps())); + sb.Append(CalamityUtils.GetText($"Common.WingStatsAcceleration").Format(rAcc.ToMphps(), asc.ToMphps(), (asc + rise).ToMphps(), (rMax * baseJumpSpeed).ToMph(), (asc + fall).ToMphps())); if (hover) { sb.Append('\n'); @@ -1248,16 +1259,16 @@ namespace CalamityMod.Items AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.AngelWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.95f, 0.15f); if (item.type == ItemID.DemonWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); + AddWingStats(item.wingSlot, 1f, 0.2f, 1f, 1.5f, 0.1f, "DemonWings"); if (item.type == ItemID.Jetpack) AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.ButterflyWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.35f, 0.5f); if (item.type == ItemID.FairyWings) AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); @@ -1266,19 +1277,19 @@ namespace CalamityMod.Items AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "BeeWings"); if (item.type == ItemID.HarpyWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "HarpyWings"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.BoneWings) AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f, "BoneWings"); if (item.type == ItemID.FlameWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "FlameWings"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.8f, 0.135f); if (item.type == ItemID.FrozenWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "FrozenWings"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.GhostWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.5f); if (item.type == ItemID.BeetleWings) AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.66f, 0.1f); @@ -1293,10 +1304,10 @@ namespace CalamityMod.Items AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.805f, 0.1f); if (item.type == ItemID.LeafWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "LeafWings"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); if (item.type == ItemID.BatWings) - AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f, "BatWings"); + AddWingStats(item.wingSlot, 0.5f, 0.1f, 0.5f, 1.5f, 0.1f); // All developer wings have identical stats and no special effects if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index cb454cbecc..ccac4c3858 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -211,7 +211,7 @@ namespace CalamityMod.Items { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20), DamageExact(70)) }, { ItemID.QuadBarrelShotgun, Do(PointBlank, DamageExact(11)) }, { ItemID.RainbowGun, Do(DamageExact(60), ManaExact(40)) }, - { ItemID.RainbowRod, Do(DamageExact(40), ManaExact(13)) }, + { ItemID.RainbowRod, Do(DamageExact(40), ManaExact(13), KnockbackExact(8f)) }, { ItemID.Rally, Do(AutoReuse, DamageExact(18)) }, { ItemID.RavenStaff, Do(AutoReuse, UseExact(20), DamageExact(36)) }, { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, @@ -333,7 +333,7 @@ namespace CalamityMod.Items #endregion #region CATEGORY 3: Tool Balancing - { ItemID.AcornAxe, Do(AxePower(125)) }, // Axe of Regrowth + { ItemID.AcornAxe, Do(AxePower(100)) }, // Axe of Regrowth { ItemID.AdamantiteChainsaw, Do(TrueMeleeNoSpeed, AxePower(90), UseTimeExact(4), TileBoostExact(+0), DamageExact(75)) }, { ItemID.AdamantiteDrill, Do(TrueMeleeNoSpeed, PickPower(180), UseTimeExact(4), TileBoostExact(+1), DamageExact(32)) }, { ItemID.AdamantitePickaxe, Do(PickPower(180), UseTimeExact(8), TileBoostExact(+1)) }, @@ -596,28 +596,9 @@ namespace CalamityMod.Items #endregion #region CATEGORY 9: Sell Prices - { ItemID.Apple, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Apricot, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Banana, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.BlackCurrant, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.BloodOrange, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Cherry, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Coconut, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Dragonfruit, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Elderberry, Do(Value(Item.sellPrice(copper: 40))) }, { ItemID.EncumberingStone, Do(Worthless) }, { ItemID.GlowingMushroom, Do(Worthless) }, - { ItemID.Grapefruit, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Lemon, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Mango, Do(Value(Item.sellPrice(copper: 40))) }, { ItemID.Mushroom, Do(Worthless) }, - { ItemID.Peach, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Pineapple, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Plum, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Pomegranate, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Rambutan, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.SpicyPepper, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Starfruit, Do(Value(Item.sellPrice(copper: 40))) }, { ItemID.PortableStool, Do(Value(Item.sellPrice(copper: 20))) }, // Step Stool { ItemID.UncumberingStone, Do(Worthless) }, { ItemID.ViciousMushroom, Do(Worthless) }, diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index 149fc0e488..08079cd86a 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.DraedonMisc AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index fa92d6cf33..ea7cbacd81 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Fishing.FishingRods CreateRecipe(). AddIngredient(ItemID.WoodFishingPole). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index d7309b4449..c004f3137f 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index 731d9c31c9..de3467dd4f 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Materials AddIngredient(5). AddIngredient(5). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index 494cdca070..fd301108ee 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -94,8 +94,7 @@ namespace CalamityMod.Items.Materials CreateRecipe(5). AddIngredient(50). AddIngredient(). - //Not Cosmic Anvil because making a bar at an anvil is a little odd? also allows pre-moon lord scal for those who really want to do it. win-win. - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); } } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 68cbb03212..2e5607f957 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials AddIngredient(5). AddIngredient(). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index f23f2c5298..ce4728ef24 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Mounts CreateRecipe(). AddIngredient(5). AddIngredient(20). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs index f7b1b676ee..9e5836c203 100644 --- a/Items/Mounts/SquishyBean.cs +++ b/Items/Mounts/SquishyBean.cs @@ -85,7 +85,6 @@ namespace CalamityMod.Items.Mounts player.gravity = 1f; player.maxFallSpeed = 20f; } - player.noFallDmg = true; } } } diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index 12efc351c0..65138dcd96 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items AddIngredient(ItemID.FragmentStardust, 30). AddIngredient(5). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index ad1b42d30f..974b0cbc05 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -73,8 +73,7 @@ namespace CalamityMod.Items.PermanentBoosters AddIngredient(ItemID.LifeFruit, 5). AddIngredient(5). AddIngredient(12). - //Not an anvil because making fruit at an anvil is a little weird, so here's something more magical. - AddTile(TileID.DemonAltar). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/PermanentBoosters/NimbleBounder.cs b/Items/PermanentBoosters/NimbleBounder.cs index e4919d1dfb..81ace67013 100644 --- a/Items/PermanentBoosters/NimbleBounder.cs +++ b/Items/PermanentBoosters/NimbleBounder.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.PermanentBoosters // Same price as Frog Leg, which is used to shimmer into it Item.value = Item.sellPrice(gold: 1); Item.rare = ModContent.RarityType(); - Item.stack = Item.CommonMaxStack; + Item.maxStack = Item.CommonMaxStack; Item.Calamity().devItem = true; } diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index 2ec582f5fd..79b1f0ce12 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Items.PermanentBoosters CreateRecipe(). AddIngredient(5). AddIngredient(25). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/PermanentBoosters/SacredStrawberry.cs b/Items/PermanentBoosters/SacredStrawberry.cs index 623ccd1731..d6e040021e 100644 --- a/Items/PermanentBoosters/SacredStrawberry.cs +++ b/Items/PermanentBoosters/SacredStrawberry.cs @@ -76,8 +76,7 @@ namespace CalamityMod.Items.PermanentBoosters AddIngredient(ItemID.LifeFruit, 5). AddIngredient(5). AddIngredient(). - //Not an anvil because making fruit at an anvil is a little weird, so here's something more magical. - AddTile(TileID.LunarCraftingStation). + AddTile(). Register(); } } diff --git a/Items/PermanentBoosters/SanguineTangerine.cs b/Items/PermanentBoosters/SanguineTangerine.cs index 49ab59f968..1348fda9fe 100644 --- a/Items/PermanentBoosters/SanguineTangerine.cs +++ b/Items/PermanentBoosters/SanguineTangerine.cs @@ -76,8 +76,7 @@ namespace CalamityMod.Items.PermanentBoosters AddIngredient(ItemID.SoulofFright, 5). AddIngredient(ItemID.SoulofMight, 5). AddIngredient(ItemID.SoulofSight, 5). - //Not an anvil because making fruit at an anvil is a little weird, so here's something more magical. - AddTile(TileID.DemonAltar). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/PermanentBoosters/TaintedCloudberry.cs b/Items/PermanentBoosters/TaintedCloudberry.cs index 67207446de..56fc3b45ac 100644 --- a/Items/PermanentBoosters/TaintedCloudberry.cs +++ b/Items/PermanentBoosters/TaintedCloudberry.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.PermanentBoosters AddIngredient(ItemID.LifeFruit, 5). AddIngredient(10). AddIngredient(8). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Placeables/Furniture/AstralBeaconItem.cs b/Items/Placeables/Furniture/AstralBeaconItem.cs index 97e7a66d44..b63a91fa2c 100644 --- a/Items/Placeables/Furniture/AstralBeaconItem.cs +++ b/Items/Placeables/Furniture/AstralBeaconItem.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture AddIngredient(5). AddIngredient(20). AddIngredient(30). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs index 63ab5d8089..bdaac5f684 100644 --- a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.JungleSpores, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 8f6217f917..b7a9a85f65 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddIngredient(ItemID.LunarCraftingStation). AddIngredient(15). AddIngredient(12). - AddIngredient(25). + AddIngredient(15). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs b/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs index da3038d601..38cd253bdc 100644 --- a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs +++ b/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations CreateRecipe(). AddIngredient(10). AddRecipeGroup("AnyGoldBar", 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs index 67c0ddf555..dc9fb777f9 100644 --- a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs +++ b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations CreateRecipe(). AddIngredient(10). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 6def9ed011..fccabfaca5 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -93,6 +93,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Spider Prov", "StipulateVenus", "Triangle", + "TYESKI (Universe)", "Uncle Danny", "Xyk", "YuH", diff --git a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs index 3fd80fc669..ece5bf1f44 100644 --- a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs +++ b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { CreateRecipe(). AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(). Register(); } } diff --git a/Items/Placeables/Furniture/WulfrumLureItem.cs b/Items/Placeables/Furniture/WulfrumLureItem.cs index 4d0318c02b..8f62916f19 100644 --- a/Items/Placeables/Furniture/WulfrumLureItem.cs +++ b/Items/Placeables/Furniture/WulfrumLureItem.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Furniture { CreateRecipe(). AddIngredient(5). - AddIngredient(). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs index 36312630cf..65070a845f 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBathtub.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { CreateRecipe(). AddIngredient(14). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs index f3140813d1..353a1c5f8c 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs index d3df9dcdc5..f3ff94fd47 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyBookcase.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs index 11c794c0f6..033e29b840 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandelabra.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs index ba12961307..d6a2c55a98 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyCandle.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs index d2d7338feb..133d1339f9 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChair.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { CreateRecipe(). AddIngredient(4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs index 3de2820561..d90850b4d3 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChandelier.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs index 88192ef233..d3f1b0136c 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyChest.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs index f0ff836923..1a7282ccef 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyClock.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs index 2a3a1e7b02..b6508de82b 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDoor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { CreateRecipe(). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs index 61a8967584..f347347fb4 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyDresser.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { CreateRecipe(). AddIngredient(16). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs index 65d2590d83..3970db46da 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLamp.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs index 41dcfc2525..1833b7a940 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyLantern.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs index d84715b21d..208c7a75d3 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyPiano.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs index 75ced4a50f..da49bd9456 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlySink.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs index 3e992a78d7..b95b3622d4 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlySofa.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Silk, 2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs index 718a840b8c..3e7acb41e0 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly AddIngredient(). AddIngredient(). AddIngredient(ItemID.Silk, 10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs index d390b64ae9..8517f93ef5 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyTable.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { CreateRecipe(). AddIngredient(8). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs index 2cf9018b78..f1efd85ac8 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyWorkBench.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly { CreateRecipe(). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs index 2100d817a9..6202b9a5e6 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned CreateRecipe(50). AddIngredient(ItemID.Glass, 50). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs index 7a5b532e7c..bb3ca2015c 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned CreateRecipe(50). AddRecipeGroup("AnyStoneBlock", 50). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs b/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs index c3d7fc12d3..f91de46d0a 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedSlab.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned { CreateRecipe(5). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs b/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs index b975aced10..1e8e4c6e6e 100644 --- a/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Items/Placeables/FurnitureProfaned/RunicProfanedBrick.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned CreateRecipe(5). AddIngredient(4). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.cs b/Items/Placeables/FurnitureStratus/StratusBathtub.cs index 3f5e3b6b76..ff810e5010 100644 --- a/Items/Placeables/FurnitureStratus/StratusBathtub.cs +++ b/Items/Placeables/FurnitureStratus/StratusBathtub.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(14). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusBed.cs b/Items/Placeables/FurnitureStratus/StratusBed.cs index 6ce98dccab..65c93798ec 100644 --- a/Items/Placeables/FurnitureStratus/StratusBed.cs +++ b/Items/Placeables/FurnitureStratus/StratusBed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.cs b/Items/Placeables/FurnitureStratus/StratusBookcase.cs index 558a78bfec..ac1226a1f8 100644 --- a/Items/Placeables/FurnitureStratus/StratusBookcase.cs +++ b/Items/Placeables/FurnitureStratus/StratusBookcase.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusBricks.cs b/Items/Placeables/FurnitureStratus/StratusBricks.cs index c8e4ecead9..36f87a04c9 100644 --- a/Items/Placeables/FurnitureStratus/StratusBricks.cs +++ b/Items/Placeables/FurnitureStratus/StratusBricks.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(3). AddIngredient(). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs index 3f4a616950..63228f55f2 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.cs b/Items/Placeables/FurnitureStratus/StratusCandle.cs index 1e0c3bc8ea..f8dd4f71ea 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandle.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandle.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusChair.cs b/Items/Placeables/FurnitureStratus/StratusChair.cs index 20dd9f148d..8a6ff76d53 100644 --- a/Items/Placeables/FurnitureStratus/StratusChair.cs +++ b/Items/Placeables/FurnitureStratus/StratusChair.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.cs b/Items/Placeables/FurnitureStratus/StratusChandelier.cs index 84b7f7fe5d..5f21142e57 100644 --- a/Items/Placeables/FurnitureStratus/StratusChandelier.cs +++ b/Items/Placeables/FurnitureStratus/StratusChandelier.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusChest.cs b/Items/Placeables/FurnitureStratus/StratusChest.cs index 9137ca711c..753df53dec 100644 --- a/Items/Placeables/FurnitureStratus/StratusChest.cs +++ b/Items/Placeables/FurnitureStratus/StratusChest.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusClock.cs b/Items/Placeables/FurnitureStratus/StratusClock.cs index 35591f9dac..01b94235d7 100644 --- a/Items/Placeables/FurnitureStratus/StratusClock.cs +++ b/Items/Placeables/FurnitureStratus/StratusClock.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.cs b/Items/Placeables/FurnitureStratus/StratusDoor.cs index c0086b86cc..9182e72e40 100644 --- a/Items/Placeables/FurnitureStratus/StratusDoor.cs +++ b/Items/Placeables/FurnitureStratus/StratusDoor.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.cs b/Items/Placeables/FurnitureStratus/StratusDresser.cs index 3371fd2794..12e18ed01a 100644 --- a/Items/Placeables/FurnitureStratus/StratusDresser.cs +++ b/Items/Placeables/FurnitureStratus/StratusDresser.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(16). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.cs b/Items/Placeables/FurnitureStratus/StratusLamp.cs index 10dd94a614..3d1e1f2488 100644 --- a/Items/Placeables/FurnitureStratus/StratusLamp.cs +++ b/Items/Placeables/FurnitureStratus/StratusLamp.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.cs b/Items/Placeables/FurnitureStratus/StratusLantern.cs index 96d8746e51..050ea27365 100644 --- a/Items/Placeables/FurnitureStratus/StratusLantern.cs +++ b/Items/Placeables/FurnitureStratus/StratusLantern.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.cs b/Items/Placeables/FurnitureStratus/StratusPiano.cs index daf3753343..8d305c2cc2 100644 --- a/Items/Placeables/FurnitureStratus/StratusPiano.cs +++ b/Items/Placeables/FurnitureStratus/StratusPiano.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusSink.cs b/Items/Placeables/FurnitureStratus/StratusSink.cs index adbc891824..82c625509b 100644 --- a/Items/Placeables/FurnitureStratus/StratusSink.cs +++ b/Items/Placeables/FurnitureStratus/StratusSink.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.cs b/Items/Placeables/FurnitureStratus/StratusSofa.cs index 53c00d843d..705a35948b 100644 --- a/Items/Placeables/FurnitureStratus/StratusSofa.cs +++ b/Items/Placeables/FurnitureStratus/StratusSofa.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Silk, 2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusTable.cs b/Items/Placeables/FurnitureStratus/StratusTable.cs index dd7749ac4f..3e21e4e5b8 100644 --- a/Items/Placeables/FurnitureStratus/StratusTable.cs +++ b/Items/Placeables/FurnitureStratus/StratusTable.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(8). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusWorkBench.cs b/Items/Placeables/FurnitureStratus/StratusWorkBench.cs index 12f8d5edcd..69f1b33b25 100644 --- a/Items/Placeables/FurnitureStratus/StratusWorkBench.cs +++ b/Items/Placeables/FurnitureStratus/StratusWorkBench.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index b90fd18f95..4866fe0c39 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables CreateRecipe(50). AddRecipeGroup("AnyStoneBlock", 50). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.AdamantiteForge). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index 15c37e5d1a..df301e6121 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions.Alcohol public static int HealValue = 200; public static int RegenLoss = 1; - public static int SecondDuration = 15; + public static int SecondDuration = 30; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenLoss.ToRegenPerSecond(), SecondDuration); public override void SetStaticDefaults() diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 1b60432d04..7b3e79c937 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.SummonItems AddIngredient(). AddIngredient(). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register() .DisableDecraft(); @@ -63,7 +63,7 @@ namespace CalamityMod.Items.SummonItems AddIngredient(ItemID.LunarBar, 40). AddIngredient(10). AddIngredient(40). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/SummonItems/DeathWhistle.cs b/Items/SummonItems/DeathWhistle.cs index 017f3eddee..7fa4d05df6 100644 --- a/Items/SummonItems/DeathWhistle.cs +++ b/Items/SummonItems/DeathWhistle.cs @@ -52,7 +52,14 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(ItemID.LunarTabletFragment, 15). AddIngredient(ItemID.LihzahrdBrick, 25). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.DemonAltar). + Register(); + + + CreateRecipe(). + AddIngredient(ItemID.LunarTabletFragment, 15). + AddIngredient(ItemID.LihzahrdBrick, 25). + AddTile(TileID.LihzahrdAltar). Register(); } } diff --git a/Items/SummonItems/MarkofProvidence.cs b/Items/SummonItems/MarkofProvidence.cs index d41c16641b..fb8b8032d1 100644 --- a/Items/SummonItems/MarkofProvidence.cs +++ b/Items/SummonItems/MarkofProvidence.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Items.SummonItems AddIngredient(ItemID.LunarBar, 3). AddIngredient(40). AddIngredient(ItemID.FragmentSolar, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index ff4eabadb1..93b6e698ef 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddRecipeGroup("Wood", 25). AddIngredient(50). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index 11a1a9a4df..4899ececdd 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(25). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/SummonItems/YharonEgg.cs b/Items/SummonItems/YharonEgg.cs index ccd197a89e..2a91bbe100 100644 --- a/Items/SummonItems/YharonEgg.cs +++ b/Items/SummonItems/YharonEgg.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(10). AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 415c44514a..c6055399d2 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -104,6 +104,7 @@ namespace CalamityMod.Items r = Recipe.Create(ItemID.TargetDummy); r.AddIngredient(); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.TargetDummy); } } } diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 6030917674..3af6f63a84 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Tools { CreateRecipe(). AddIngredient(7). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 4d95f705b3..ed226d2ac1 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools { CreateRecipe(). AddRecipeGroup("AnySilverBar", 18). - AddRecipeGroup("Wood", 18). + AddIngredient(ItemID.RichMahogany, 18). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index dfa90262bf..1cd4cc87d7 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Tools AddIngredient(). AddRecipeGroup("LunarHamaxe"). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs index 76181d9eeb..828c7d88a9 100644 --- a/Items/Tools/WulfrumDiggingTurtle.cs +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { - CreateRecipe(3). - AddIngredient(ItemID.Gel, 5). //Gel is a default combustible item to fuel the motors of the lil guys + CreateRecipe(15). AddIngredient(3). + AddIngredient(). Register(); } } diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index 0d829fad72..99ac145eee 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs index 165d179cd3..504ab951c3 100644 --- a/Items/Tools/WulfrumTreasurePinger.cs +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -281,7 +281,7 @@ namespace CalamityMod.Items.Tools { //Intentionally craftable anywhere. CreateRecipe(). - AddIngredient(6). + AddIngredient(5). Register() .DisableDecraft(); } diff --git a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs index 983ac2f023..eb5436ff16 100644 --- a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs +++ b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs @@ -55,8 +55,8 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags expertPlus.Add(ModContent.ItemType(), 1, 1, 3); expertPlus.Add(ModContent.ItemType(), 1, 1, 3); expertPlus.Add(ModContent.ItemType(), 1, 1, 3); - normalOnly.Add(ModContent.ItemType(), 2); - normalOnly.Add(ModContent.ItemType(), 3); + expertPlus.Add(ModContent.ItemType(), 2); + expertPlus.Add(ModContent.ItemType(), 3); } } } diff --git a/Items/Weapons/DraedonsArsenal/PhalanxSurge.cs b/Items/Weapons/DraedonsArsenal/PhalanxSurge.cs index e7cf6bd724..00ab2ba3b1 100644 --- a/Items/Weapons/DraedonsArsenal/PhalanxSurge.cs +++ b/Items/Weapons/DraedonsArsenal/PhalanxSurge.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal AddIngredient(8). AddIngredient(ItemID.LunarBar, 4). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index 544c5818aa..cbeeac183f 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal AddIngredient(8). AddIngredient(ItemID.LunarBar, 4). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index 25fd1376a2..321f65a022 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal AddIngredient(8). AddIngredient(ItemID.LunarBar, 4). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 1b041e028e..f5ca444db6 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal AddIngredient(8). AddIngredient(ItemID.LunarBar, 4). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index cd2d2ec4c1..26be6ef44b 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal AddIngredient(8). AddIngredient(ItemID.LunarBar, 4). AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Func condition), condition). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 1332539641..fea1b480a5 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -63,8 +63,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(35). - AddIngredient(10). + AddIngredient(15). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/AethersWhisper.cs b/Items/Weapons/Magic/AethersWhisper.cs index ebb944edd7..1dbbdb3623 100644 --- a/Items/Weapons/Magic/AethersWhisper.cs +++ b/Items/Weapons/Magic/AethersWhisper.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/AsteroidStaff.cs b/Items/Weapons/Magic/AsteroidStaff.cs deleted file mode 100644 index 78a029f901..0000000000 --- a/Items/Weapons/Magic/AsteroidStaff.cs +++ /dev/null @@ -1,201 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class AsteroidStaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - - #region GFB Projectile Array - public static int[] CorekeeperChaos = - { - ProjectileID.BallofFire, - ProjectileID.BallofFrost, - ProjectileID.MagicMissile, - ProjectileID.WaterStream, - ProjectileID.Flamelash, - ProjectileID.RainbowRodBullet, - ProjectileID.UnholyTridentFriendly, - ProjectileID.AmethystBolt, - ProjectileID.AmberBolt, - ProjectileID.TopazBolt, - ProjectileID.DiamondBolt, - ProjectileID.SapphireBolt, - ProjectileID.RubyBolt, - ProjectileID.EmeraldBolt, - ProjectileID.RainCloudMoving, - ProjectileID.BloodCloudMoving, - ProjectileID.ShadowBeamFriendly, - ProjectileID.InfernoFriendlyBlast, - ProjectileID.LostSoulFriendly, - ProjectileID.Bat, - - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - }; - #endregion - public override void SetStaticDefaults() - { - Item.staff[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 50; - Item.height = 50; - Item.damage = 146; - Item.DamageType = DamageClass.Magic; - Item.mana = 18; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 6.75f; - Item.UseSound = SoundID.Item88; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 20f; - - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (Main.zenithWorld) - { - for (int i = 0; i < 4; i++) - { - int projType; - projType = CorekeeperChaos[Main.rand.Next(CorekeeperChaos.Length)]; - float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f; - int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, projType, damage, knockback, player.whoAmI); - - } - } - else - { - float meteorSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float meteorSpawnXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float meteorSpawnYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - meteorSpawnYPos = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float meteorSpawnDist = (float)Math.Sqrt((double)(meteorSpawnXPos * meteorSpawnXPos + meteorSpawnYPos * meteorSpawnYPos)); - if ((float.IsNaN(meteorSpawnXPos) && float.IsNaN(meteorSpawnYPos)) || (meteorSpawnXPos == 0f && meteorSpawnYPos == 0f)) - for (int i = 0; i < 4; i++) - { - meteorSpawnXPos = (float)player.direction; - meteorSpawnYPos = 0f; - meteorSpawnDist = meteorSpeed; - } - else - { - meteorSpawnDist = meteorSpeed / meteorSpawnDist; - } - - int asteroidAmt = 3; - for (int i = 0; i < asteroidAmt; i++) - { - realPlayerPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - meteorSpawnXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X + (float)Main.rand.Next(-40, 41) * 0.03f; - meteorSpawnYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (meteorSpawnYPos < 0f) - { - meteorSpawnYPos *= -1f; - } - if (meteorSpawnYPos < 20f) - { - meteorSpawnYPos = 20f; - } - meteorSpawnDist = (float)Math.Sqrt((double)(meteorSpawnXPos * meteorSpawnXPos + meteorSpawnYPos * meteorSpawnYPos)); - meteorSpawnDist = meteorSpeed / meteorSpawnDist; - meteorSpawnXPos *= meteorSpawnDist; - meteorSpawnYPos *= meteorSpawnDist; - float meteorSpawnXOffset = meteorSpawnXPos; - float meteorSpawnYOffset = meteorSpawnYPos + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, meteorSpawnXOffset * 0.75f, meteorSpawnYOffset * 0.75f, type, damage, knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); - } - } - return false; - } - - public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.MeteorStaff). - AddIngredient(ItemID.LunarBar, 5). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/AsteroidStaff.png b/Items/Weapons/Magic/AsteroidStaff.png deleted file mode 100644 index 623294885e..0000000000 Binary files a/Items/Weapons/Magic/AsteroidStaff.png and /dev/null differ diff --git a/Items/Weapons/Magic/ChronomancersScythe.cs b/Items/Weapons/Magic/ChronomancersScythe.cs index 2902fe0d98..7785365ef0 100644 --- a/Items/Weapons/Magic/ChronomancersScythe.cs +++ b/Items/Weapons/Magic/ChronomancersScythe.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.FastClock). AddIngredient(ItemID.LunarBar, 10). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index a54e500163..feef2c3ed4 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(6). AddIngredient(5). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index bfb28a081d..ed3956944a 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(10). AddIngredient(20). AddIngredient(30). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index 91f0211d95..c45ed84228 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(8). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 971a031c93..e594491c7e 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.BubbleGun). AddIngredient(ItemID.LunarBar, 5). AddIngredient(ItemID.ShimmerBlock, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 3168b9b7ef..2dfac6fc97 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -57,9 +57,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.HellstoneBar, 6). - AddIngredient(ItemID.Obsidian, 9). - AddIngredient(ItemID.Fireblossom, 2). + AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.Fireblossom, 5). AddIngredient(ItemID.Ruby). AddTile(TileID.Bookcases). Register(); diff --git a/Items/Weapons/Magic/Genesis.cs b/Items/Weapons/Magic/Genesis.cs index 20af5325b0..85f3e019ea 100644 --- a/Items/Weapons/Magic/Genesis.cs +++ b/Items/Weapons/Magic/Genesis.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.LaserRifle). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index fcf8c4aeb8..fa31df187f 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,6 +31,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.Calamity().donorItem = true; } + public override bool? CanAutoReuseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 4e98d6301c..11717fe7c5 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.AshWood, 7). + AddIngredient(ItemID.AshWood, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 0e5266cef6..c3a329728b 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.MagnetSphere). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index 17811fcf7d..426c3841ea 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.LeafBlower). AddIngredient(5). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/NanoPurge.cs b/Items/Weapons/Magic/NanoPurge.cs index c5cd65b095..d78bf8a75f 100644 --- a/Items/Weapons/Magic/NanoPurge.cs +++ b/Items/Weapons/Magic/NanoPurge.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.LaserMachinegun). AddIngredient(7). AddIngredient(ItemID.Nanites, 100). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/NebulousCataclysm.cs b/Items/Weapons/Magic/NebulousCataclysm.cs index ad891db07e..9ba21a61be 100644 --- a/Items/Weapons/Magic/NebulousCataclysm.cs +++ b/Items/Weapons/Magic/NebulousCataclysm.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -52,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.NebulaBlaze). AddIngredient(8). AddIngredient(20). - AddTile(TileID.LunarCraftingStation). + AddTile(). Register(); } } diff --git a/Items/Weapons/Magic/Nucleosynthesis.cs b/Items/Weapons/Magic/Nucleosynthesis.cs index f00df0ee15..76e953984c 100644 --- a/Items/Weapons/Magic/Nucleosynthesis.cs +++ b/Items/Weapons/Magic/Nucleosynthesis.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentNebula, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index 3713f53c6e..52190729cf 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(15). - AddIngredient(18). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index 067916b491..194bc9e44f 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 60; - Item.damage = 197; + Item.damage = 190; Item.DamageType = DamageClass.Magic; - Item.mana = 60; + Item.mana = 80; Item.useTime = 3; Item.useAnimation = 45; Item.reuseDelay = 75; @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.SpectreStaff). AddIngredient(2). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index b7771ca946..a4eff61271 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -20,6 +20,9 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBShot"); + public static readonly SoundStyle VacuumStart = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumStart") with { Volume = 0.75f }; + public static readonly SoundStyle VacuumLoop = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumLoop") with { Volume = 0.75f }; + public static readonly SoundStyle VacuumEnd = new SoundStyle("CalamityMod/Sounds/Item/SHPCVacuumEnd") with { Volume = 0.75f }; public const int ShotsPerSoul = 50; public int storedSoulpower = 0; @@ -41,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 124; Item.height = 52; - Item.damage = 94; + Item.damage = 110; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useAnimation = Item.useTime = 60; @@ -157,6 +160,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool CanUseItem(Player player) { Item.channel = Item.noUseGraphic = player.altFunctionUse == 2; + Item.UseSound = player.altFunctionUse == 2 ? null : FireSound; return ((player.altFunctionUse == 0 && (storedSoulpower > 0 || (FindSoulForAmmo(player) != -1))) || player.altFunctionUse == 2) && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; } @@ -206,7 +210,7 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, 0f, player.whoAmI); return false; } else diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 8ec88cc393..90da4ae001 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 56; Item.height = 60; - Item.damage = 1000; + Item.damage = 1050; Item.DamageType = DamageClass.Magic; - Item.mana = 22; + Item.mana = 36; Item.useTime = 25; Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Shoot; @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index c5073452b4..c3c932f9a3 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 56; - Item.damage = 260; + Item.damage = 205; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.useTime = 12; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.ShadowbeamStaff). AddIngredient(2). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index ad97b003f3..6c97761796 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ItemRarityID.Lime; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool CanUseItem(Player player) => !player.channel; public override void AddRecipes() { diff --git a/Items/Weapons/Magic/TacticiansTrumpCard.cs b/Items/Weapons/Magic/TacticiansTrumpCard.cs index 4e26e129e7..f6e98b2b9f 100644 --- a/Items/Weapons/Magic/TacticiansTrumpCard.cs +++ b/Items/Weapons/Magic/TacticiansTrumpCard.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(5). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); CreateRecipe(). AddIngredient(ItemID.TinShortsword). @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(5). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/Teslastaff.cs b/Items/Weapons/Magic/Teslastaff.cs index ac23efa9d6..ac1a2b30c9 100644 --- a/Items/Weapons/Magic/Teslastaff.cs +++ b/Items/Weapons/Magic/Teslastaff.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic AddRecipeGroup("AnyCopperBar", 20). AddIngredient(6). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index 2cf5bc192a..7aec53e0f5 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(15). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index e727186d01..d948d7f944 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(10). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 1095523651..6dc127929d 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.AquaScepter). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index 407eaf612a..ea4d77de37 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 70; Item.height = 68; - Item.damage = 2156; + Item.damage = 2800; Item.DamageType = DamageClass.Magic; Item.mana = 40; Item.useTime = 65; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.InfernoFork). AddIngredient(2). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index ec75d92d53..72b80b47bd 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Magic/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs index 08f1946933..1028f4af5a 100644 --- a/Items/Weapons/Magic/WulfrumProsthesis.cs +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -145,7 +145,6 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(10). - AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/Aftershock.cs b/Items/Weapons/Melee/Aftershock.cs deleted file mode 100644 index aa4dcc8de9..0000000000 --- a/Items/Weapons/Melee/Aftershock.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class Aftershock : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - - internal const float ShootSpeed = 12f; - - public override void SetDefaults() - { - Item.width = 54; - Item.height = 58; - Item.damage = 65; - Item.DamageType = DamageClass.Melee; - Item.useTime = 28; - Item.useAnimation = 28; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 9f; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.shootSpeed = ShootSpeed; - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - Vector2 destination = target.Center; - Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)) + (Vector2.UnitX * Main.rand.Next(-160, 161)); - Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); - int rockDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), rockDamage, hit.Knockback, player.whoAmI, 0f, (float)Main.rand.Next(10), target.Center.Y); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - Vector2 destination = target.Center; - Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f)) + (Vector2.UnitX * Main.rand.Next(-160, 161)); - Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed * Main.rand.NextFloat(0.9f, 1.1f); - int rockDamage = player.CalcIntDamage(Item.damage); - Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType(), rockDamage, Item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10), target.Center.Y); - } - } -} diff --git a/Items/Weapons/Melee/Aftershock.png b/Items/Weapons/Melee/Aftershock.png deleted file mode 100644 index 3a6a2d76a2..0000000000 Binary files a/Items/Weapons/Melee/Aftershock.png and /dev/null differ diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 39b95d5473..8a65882035 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -211,7 +211,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentSolar, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs deleted file mode 100644 index 46e95a74f6..0000000000 --- a/Items/Weapons/Melee/AstralBlade.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.Weapons.Melee -{ - public class AstralBlade : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetDefaults() - { - Item.width = 80; - Item.height = 80; - Item.damage = 142; - Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useTime = 12; - Item.useAnimation = 12; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 6f; - Item.value = CalamityGlobalItem.RarityCyanBuyPrice; - Item.rare = ItemRarityID.Cyan; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25; - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 300); - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(ModContent.BuffType(), 300); - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - for (int i = 0; i < 3; i++) - { - Dust d = CalamityUtils.MeleeDustHelper(player, Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType(), 0.7f, 55, 110, -0.07f, 0.07f); - if (d != null) - d.customData = 0.03f; - } - } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - // Avoid dividing by 0 at all costs. - if (target.lifeMax <= 0) - return; - - float lifeRatio = MathHelper.Clamp(target.life / (float)target.lifeMax, 0f, 1f); - float maxMultiplier = 1.25f; - float multiplier = MathHelper.Lerp(1f, maxMultiplier, lifeRatio); - - modifiers.SourceDamage *= multiplier; - modifiers.Knockback *= multiplier; - - if (Main.rand.NextBool((int)MathHelper.Clamp((Item.crit + player.GetCritChance()) * multiplier, 0f, 99f), 100)) - modifiers.SetCrit(); - - SoundEngine.PlaySound(SoundID.Item105, player.Center); - - bool blue = Main.rand.NextBool(); - float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); - float var = 0.05f + (maxMultiplier - multiplier); - for (float angle = 0f; angle < MathHelper.TwoPi; angle += var) - { - blue = !blue; - Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); - Dust d = Dust.NewDustPerfect(target.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); - d.customData = 0.025f; - d.scale = multiplier; - d.noLight = false; - } - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(8). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/AstralBlade.png b/Items/Weapons/Melee/AstralBlade.png deleted file mode 100644 index 96c91d0c8b..0000000000 Binary files a/Items/Weapons/Melee/AstralBlade.png and /dev/null differ diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index e050f25e6f..a880589f9f 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(15). AddIngredient(12). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index ec16818ed4..cf51e42102 100644 --- a/Items/Weapons/Melee/BlightedCleaver.cs +++ b/Items/Weapons/Melee/BlightedCleaver.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.BrokenHeroSword). AddIngredient(ItemID.ChlorophyteBar, 15). AddIngredient(ItemID.VialofVenom, 10). - AddTile(TileID.DemonAltar). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index 2da5be69b2..02a837769c 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -324,8 +324,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddRecipeGroup("AnyWoodenSword"). - AddIngredient(ItemType(), 5). - AddIngredient(ItemID.HellstoneBar, 5). + AddIngredient(ItemType(), 10). + AddIngredient(ItemID.HellstoneBar, 10). AddIngredient(ItemID.DirtBlock, 50). AddIngredient(ItemID.StoneBlock, 50). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Melee/BurningRevelation.cs b/Items/Weapons/Melee/BurningRevelation.cs index b4523d58ba..c0bdd8753b 100644 --- a/Items/Weapons/Melee/BurningRevelation.cs +++ b/Items/Weapons/Melee/BurningRevelation.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 40; - Item.height = 38; + Item.height = 48; Item.DamageType = DamageClass.MeleeNoSpeed; Item.damage = 300; Item.knockBack = 7.5f; diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index 4452ea6789..d873cada7f 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(8). AddIngredient(3). AddIngredient(16). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index a71bc50700..b180aeca3d 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(4). AddIngredient(ItemID.SoulofNight, 15). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/DefiledGreatsword.cs b/Items/Weapons/Melee/DefiledGreatsword.cs index b46bdb4425..b5f9b9150a 100644 --- a/Items/Weapons/Melee/DefiledGreatsword.cs +++ b/Items/Weapons/Melee/DefiledGreatsword.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(). AddIngredient(15). - AddTile(TileID.DemonAltar). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index 0706ed19c2..99c244a22e 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.Terragrim). AddIngredient(25). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index a1b1ac172f..7ba9adab64 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.VampireKnives). AddIngredient(). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index d729006844..046c14ccfa 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -297,7 +297,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index eeddb62413..93ba5d4a87 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.StarWrath). AddIngredient(10). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index fa34986a90..d8f2e8341b 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(8). AddIngredient(5). AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index 05109ea63c..5be0d1d2a9 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } public override void OnSpawn(IEntitySource source) diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index f0b0564e82..a23c35ba04 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/LifehuntScythe.cs b/Items/Weapons/Melee/LifehuntScythe.cs index 54c3aaf1e1..488dc49969 100644 --- a/Items/Weapons/Melee/LifehuntScythe.cs +++ b/Items/Weapons/Melee/LifehuntScythe.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index c04ecb3315..672286eabd 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(6). AddIngredient(6). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 91c8905696..7b14d34968 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(6). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index 6b59d9ff1b..9be51a7c3a 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.BlueMoon). AddIngredient(ItemID.LunarBar, 5). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index f7fb0a7c67..f3fb9c7c19 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 86; Item.height = 64; - Item.damage = 718; + Item.damage = 1100; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = Item.useTime = 55; Item.knockBack = 8.5f; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.PossessedHatchet). AddIngredient(5). AddIngredient(8). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/StarburstShiv.cs b/Items/Weapons/Melee/StarburstShiv.cs index 5fdd6a0f4f..88897649f7 100644 --- a/Items/Weapons/Melee/StarburstShiv.cs +++ b/Items/Weapons/Melee/StarburstShiv.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentSolar, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/TaintedBlade.cs b/Items/Weapons/Melee/TaintedBlade.cs index eb0e887f73..82b65ddff0 100644 --- a/Items/Weapons/Melee/TaintedBlade.cs +++ b/Items/Weapons/Melee/TaintedBlade.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(10). AddRecipeGroup("Boss2Material", 8). AddIngredient(ItemID.Deathweed, 2). - AddTile(TileID.DemonAltar). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 519bed62e3..b8b499265d 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.TerraBlade). AddIngredient(7). AddIngredient(9). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/TerrorBlade.cs b/Items/Weapons/Melee/TerrorBlade.cs index e85ba3366f..4d786f1baf 100644 --- a/Items/Weapons/Melee/TerrorBlade.cs +++ b/Items/Weapons/Melee/TerrorBlade.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee; +using System.Collections.Generic; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -37,6 +38,16 @@ namespace CalamityMod.Items.Weapons.Melee { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow").Value); } + public override void UpdateInventory(Player player) + { + if (Main.zenithWorld) + Item.SetNameOverride(this.GetLocalizedValue("GFBName")); + } + public override void ModifyTooltips(List tooltips) + { + string GFBflavour = this.GetLocalizedValue("GFB"); + tooltips.FindAndReplace("[STATUS]", Main.zenithWorld ? "\n" + GFBflavour : ""); + } public override void MeleeEffects(Player player, Rectangle hitbox) { diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs deleted file mode 100644 index b027454e91..0000000000 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ /dev/null @@ -1,150 +0,0 @@ -using System; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class TheEnforcer : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetDefaults() - { - Item.width = 100; - Item.height = 100; - Item.damage = 890; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 17; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 17; - Item.useTurn = true; - Item.knockBack = 9f; - Item.UseSound = SoundID.Item20; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow").Value); - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item73, player.Center); - int i = Main.myPlayer; - float flameSpeed = 3f; - player.itemTime = Item.useTime; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = Main.mouseX + Main.screenPosition.X + realPlayerPos.X; - float mouseYDist = Main.mouseY + Main.screenPosition.Y + realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + Main.screenHeight + Main.mouseY + realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt(mouseXDist * mouseXDist + mouseYDist * mouseYDist); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = player.direction; - mouseYDist = 0f; - mouseDistance = flameSpeed; - } - else - { - mouseDistance = flameSpeed / mouseDistance; - } - - int essenceDamage = player.CalcIntDamage(0.25f * Item.damage); - for (int j = 0; j < 5; j++) - { - realPlayerPos = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(401) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + Main.rand.Next(-400, 401); - realPlayerPos.Y -= 100 * j; - mouseXDist = Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt(mouseXDist * mouseXDist + mouseYDist * mouseYDist); - mouseDistance = flameSpeed / mouseDistance; - Projectile.NewProjectile(source, realPlayerPos, Vector2.Zero, ModContent.ProjectileType(), essenceDamage, 0f, i, 0f, Main.rand.Next(3)); - } - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item73, player.Center); - int j = Main.myPlayer; - float flameSpeed = 3f; - player.itemTime = Item.useTime; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = Main.mouseX + Main.screenPosition.X + realPlayerPos.X; - float mouseYDist = Main.mouseY + Main.screenPosition.Y + realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + Main.screenHeight + Main.mouseY + realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt(mouseXDist * mouseXDist + mouseYDist * mouseYDist); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = player.direction; - mouseYDist = 0f; - mouseDistance = flameSpeed; - } - else - { - mouseDistance = flameSpeed / mouseDistance; - } - - int essenceDamage = player.CalcIntDamage(0.25f * Item.damage); - for (int i = 0; i < 5; i++) - { - realPlayerPos = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(401) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + Main.rand.Next(-400, 401); - realPlayerPos.Y -= 100 * i; - mouseXDist = Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt(mouseXDist * mouseXDist + mouseYDist * mouseYDist); - mouseDistance = flameSpeed / mouseDistance; - Projectile.NewProjectile(source, realPlayerPos, Vector2.Zero, ModContent.ProjectileType(), essenceDamage, 0f, i, 0f, Main.rand.Next(3)); - } - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(12). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/TheEnforcer.png b/Items/Weapons/Melee/TheEnforcer.png deleted file mode 100644 index 1bebf830c6..0000000000 Binary files a/Items/Weapons/Melee/TheEnforcer.png and /dev/null differ diff --git a/Items/Weapons/Melee/TheEnforcerGlow.png b/Items/Weapons/Melee/TheEnforcerGlow.png deleted file mode 100644 index b1041824c6..0000000000 Binary files a/Items/Weapons/Melee/TheEnforcerGlow.png and /dev/null differ diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index ebe94fe490..8f59702b28 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.SoulofNight, 30). AddIngredient(5). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 36f630ecd4..f1b8d996c2 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class TheMutilator : BaseSwordHoldoutItem, ILocalizedModType { - public static int MaximumCharge = 10; + public static int MaximumCharge = 7; public int Charge = 0; public int DecayTimer = 0; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 90; - Item.damage = 1111; + Item.damage = 1005; Item.DamageType = DamageClass.Melee; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; @@ -84,7 +84,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/TrueCausticEdge.cs b/Items/Weapons/Melee/TrueCausticEdge.cs index ccfead5620..8a73810a4e 100644 --- a/Items/Weapons/Melee/TrueCausticEdge.cs +++ b/Items/Weapons/Melee/TrueCausticEdge.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddRecipeGroup("CursedFlameIchor", 8). AddIngredient(ItemID.SpiderFang, 8). - AddTile(TileID.DemonAltar). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Weapons/Melee/VanishingPoint.cs b/Items/Weapons/Melee/VanishingPoint.cs index 5aee60aefa..3ff7b24a5e 100644 --- a/Items/Weapons/Melee/VanishingPoint.cs +++ b/Items/Weapons/Melee/VanishingPoint.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentSolar, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index a4e12b4d79..1d0ded5ccb 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 25; + Item.useAnimation = 60; Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 9f; @@ -27,16 +27,28 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); - Item.channel = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; + Item.channel = true; } - public override bool CanUseItem(Player player) => player.altFunctionUse == 2 || player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, velocity.ToRotation()); + if (player.altFunctionUse == 2) + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + player.itemAnimation = player.itemAnimationMax = player.itemTime = player.itemTimeMax = 60; + Projectile.NewProjectile(source, position, velocity*1.6666f, type, (int)(damage * 20), knockback, player.whoAmI, 0f, velocity.ToRotation(), 0); + } + else + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, velocity.ToRotation(), 1); return false; } } diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index 74a3d5142f..2fc8fc039a 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -85,8 +85,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). - AddIngredient(). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index 4057a09072..3f2a2b21ce 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.SunplateBlock, 75). AddIngredient(15). AddIngredient(7). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 79856f0ca1..d38736af8d 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 44; Item.height = 100; - Item.damage = 500; + Item.damage = 256; Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 40; @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged shotArrow.tileCollide = false; (shotArrow.ModProjectile as BloodfireArrowProj).DisableEffects = true; shotArrow.Calamity().conditionalHomingRange = 175f; - shotArrow.Calamity().BloodstoneOrbValue = 20; + shotArrow.Calamity().BloodstoneOrbValue = 15; shotNum++; if (shotNum > 4) shotNum = 0; return false; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/AstralBow.cs b/Items/Weapons/Ranged/AstralBow.cs deleted file mode 100644 index 308327e530..0000000000 --- a/Items/Weapons/Ranged/AstralBow.cs +++ /dev/null @@ -1,46 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - [LegacyName("AstralRepeater")] - public class AstralBow : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 38; - Item.height = 78; - Item.damage = 92; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 6; - Item.useAnimation = 18; - Item.reuseDelay = 18; - Item.useLimitPerAnimation = 3; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.RarityCyanBuyPrice; - Item.rare = ItemRarityID.Cyan; - Item.UseSound = SoundID.Item5; - Item.autoReuse = true; - Item.shoot = ProjectileID.WoodenArrowFriendly; - Item.shootSpeed = 16f; - Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25; - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(7). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/AstralBow.png b/Items/Weapons/Ranged/AstralBow.png deleted file mode 100644 index 25d1c56e14..0000000000 Binary files a/Items/Weapons/Ranged/AstralBow.png and /dev/null differ diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 4bef0633a7..0c957b8304 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 40; Item.height = 78; - Item.damage = 159; + Item.damage = 160; Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 20; @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.ShadowFlameBow). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index 1d5ca3004e..8de3d051de 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(5). AddIngredient(5). AddIngredient(50). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 87895c9b14..086e5fb6b6 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.PiranhaGun). AddIngredient(ItemID.LunarBar, 5). AddIngredient(ItemID.SharkFin, 2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 894f37aa5e..3067ec1c17 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index 4bee81bf6d..eda730ce49 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAnimation = Item.useTime = 75; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; + Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Bullet; Item.UseSound = SoundID.Item38; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { type = Item.shoot; - int bulletAmt = 30; + int bulletAmt = 40; for (int i = 0; i < bulletAmt; i++) { float newSpeedX = velocity.X + Main.rand.NextFloat(-15f, 15f); diff --git a/Items/Weapons/Ranged/ChromaticEruption.cs b/Items/Weapons/Ranged/ChromaticEruption.cs index dd1cab2c5d..050e7ec691 100644 --- a/Items/Weapons/Ranged/ChromaticEruption.cs +++ b/Items/Weapons/Ranged/ChromaticEruption.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentVortex, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs deleted file mode 100644 index 422f865ff1..0000000000 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ /dev/null @@ -1,69 +0,0 @@ -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class ClockGatlignum : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 66; - Item.height = 34; - Item.damage = 55; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 3; - Item.useAnimation = 9; - Item.reuseDelay = 12; - Item.useLimitPerAnimation = 3; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.UseSound = SoundID.Item31; - Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 20f; - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; - } - - public override Vector2? HoldoutOffset() => new Vector2(-14, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; - - if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ProjectileID.BulletHighVelocity, damage, knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - - return false; - } - - public override bool CanConsumeAmmo(Item ammo, Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.ClockworkAssaultRifle). - AddIngredient(ItemID.Gatligator). - AddIngredient(ItemID.VenusMagnum). - AddIngredient(3). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/ClockGatlignum.png b/Items/Weapons/Ranged/ClockGatlignum.png deleted file mode 100644 index d9483a7d49..0000000000 Binary files a/Items/Weapons/Ranged/ClockGatlignum.png and /dev/null differ diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index d2de85e06e..78a96f7bd5 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(ItemID.Cog, 50). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/CorinthPrime.cs b/Items/Weapons/Ranged/CorinthPrime.cs index 2bcfaa60db..77b516c7f8 100644 --- a/Items/Weapons/Ranged/CorinthPrime.cs +++ b/Items/Weapons/Ranged/CorinthPrime.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.VortexBeater). AddIngredient(ItemID.IllegalGunParts). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index f36fde133d..5e7c814098 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(ItemID.LunarBar, 15). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index 51ecdc5739..766db7e7b6 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -92,6 +92,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.FlareGun). AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.IllegalGunParts). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/FreedomStar.cs b/Items/Weapons/Ranged/FreedomStar.cs index cf45be4de1..2f24196d9f 100644 --- a/Items/Weapons/Ranged/FreedomStar.cs +++ b/Items/Weapons/Ranged/FreedomStar.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(18). AddIngredient(8). AddIngredient(ItemID.LunarBar, 4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 4068714c06..5ba8938841 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(6). AddIngredient(4). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index aec808cfbe..9e0189cacd 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddRecipeGroup("IronBar", 50). AddIngredient(5). AddIngredient(ItemID.TigerSkin). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 0efe846d37..803457a30d 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(6). AddIngredient(10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/NettlevineGreatbow.cs b/Items/Weapons/Ranged/NettlevineGreatbow.cs index db0811ac93..683f4a03bd 100644 --- a/Items/Weapons/Ranged/NettlevineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlevineGreatbow.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/NullificationPistol.cs b/Items/Weapons/Ranged/NullificationPistol.cs index f196a583e4..4cbb64ff49 100644 --- a/Items/Weapons/Ranged/NullificationPistol.cs +++ b/Items/Weapons/Ranged/NullificationPistol.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public bool shotType = true; // true = positive shot, false = negative shot public float mult = 0; + public static SoundStyle HitSound = new("CalamityMod/Sounds/Item/NullHit"); public override void SetStaticDefaults() { diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs index 935f42b12a..5e8eb56f16 100644 --- a/Items/Weapons/Ranged/OntologicalDespoiler.cs +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(2). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index 659e5b422e..e0ec40a167 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.OnyxBlaster). AddIngredient(ItemID.ChainGun). AddIngredient(ItemID.LunarBar, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index d5b25e3154..60f8d757f1 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -159,7 +159,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(5). AddIngredient(2). AddIngredient(ItemID.WhitePearl). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 6838dd2b28..380832d89e 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentVortex, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs index ee3f0273a3..66574816ed 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged player.itemAnimation = 200; player.Calamity().GeneralScreenShakePower = 26f; player.AddBuff(BuffID.Obstructed, 600); - Main.NewText("Too much love...", 255, 0, 0); + Main.NewText(CalamityUtils.GetTextValue("Misc.Polaris0"), 255, 0, 0); SoundEngine.PlaySound(Squeak with { Pitch = -1f }, player.Center); SoundStyle roar = new("CalamityMod/Sounds/Custom/CeaselessVoidDeathBuild"); SoundEngine.PlaySound(roar with { Pitch = 0.5f }, player.Center); diff --git a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs index fd0a634b5e..baefda8bf8 100644 --- a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.Uzi). AddIngredient(ItemID.LunarBar, 5). AddIngredient(ItemID.FragmentVortex, 10). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 6e4b33c8a2..39ca453361 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(9). AddIngredient(10). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index 25edac78bc..a31575ec1d 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index beed00b0e5..fb63f652a9 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(ItemID.VenusMagnum). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 52c0aa0e0a..739a788ce0 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(). AddIngredient(ItemID.Stynger). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index d3797af0c3..48e4980900 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 15f; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item92; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(6). AddIngredient(4). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index 9f5f5c080d..45a7d7984d 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentVortex, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/TauCannon.cs b/Items/Weapons/Ranged/TauCannon.cs index 189682bcad..e1cbe89f59 100644 --- a/Items/Weapons/Ranged/TauCannon.cs +++ b/Items/Weapons/Ranged/TauCannon.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(15). AddIngredient(10). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index 81342eb7a0..5a2e736fee 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(3). AddIngredient(20). AddIngredient(50). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index 347ed65b3a..eb856b5f04 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -169,12 +169,11 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.CoinGun). - AddIngredient(). AddIngredient(ItemID.PlatinumCoin, 7). AddIngredient(ItemID.GoldCoin, 77). AddIngredient(ItemID.LunarBar, 12). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 51ad67d868..87580560b6 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -45,8 +46,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(15). + AddIngredient(15). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 4d64603325..ced1680bb9 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -53,7 +53,6 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.PulseBow). AddIngredient(ItemID.LaserRifle). AddIngredient(). - AddIngredient(). AddIngredient(8). AddIngredient(8). AddIngredient(15). diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index 5b74101f5d..caa91297a0 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -185,7 +185,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.cs b/Items/Weapons/Rogue/AcidicRainBarrel.cs deleted file mode 100644 index 162324b036..0000000000 --- a/Items/Weapons/Rogue/AcidicRainBarrel.cs +++ /dev/null @@ -1,57 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class AcidicRainBarrel : RogueWeapon - { - public override void SetDefaults() - { - Item.width = 48; - Item.height = 48; - Item.damage = 43; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.useAnimation = 22; - Item.useTime = 22; - Item.knockBack = 8f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; - Item.DamageType = RogueDamageClass.Instance; - } - - public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - position = position - Vector2.UnitY * 12f; - velocity.Y *= 0.667f; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (p.WithinBounds(Main.maxProjectiles)) - Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(). - AddIngredient(15). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.png b/Items/Weapons/Rogue/AcidicRainBarrel.png deleted file mode 100644 index 2a8d7fd74b..0000000000 Binary files a/Items/Weapons/Rogue/AcidicRainBarrel.png and /dev/null differ diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 5f608b05d3..cd545b0e47 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 1; Item.damage = 75; Item.DamageType = RogueDamageClass.Instance; + Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 15; diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index f2387e8a45..6c1da5bf6e 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index 1fbc6ca7a2..68c8965605 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.85f; + public override float StealthDamageMultiplier => 1.4f; public override float StealthVelocityMultiplier => 0.9f; public override float StealthKnockbackMultiplier => 0.5f; @@ -35,9 +35,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - for (int i = -1; i <= 1; i++) + for (float i = -1.5f; i <= 1.5f; i++) { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 9f)); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 7f)); int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/FishboneBoomerang.cs b/Items/Weapons/Rogue/FishboneBoomerang.cs index a6d0facb12..fac499e9df 100644 --- a/Items/Weapons/Rogue/FishboneBoomerang.cs +++ b/Items/Weapons/Rogue/FishboneBoomerang.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 27; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; + Item.useTime = 30; Item.knockBack = 5.5f; Item.UseSound = null; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; @@ -32,10 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; } - public override bool CanUseItem(Player player) - { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType()); - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index eacb33e1bc..13ec831929 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.Obsidian, 9). + AddIngredient(ItemID.AshWood, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index 82b1ec85be..b910cf3358 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(6). AddIngredient(15). AddIngredient(2). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 04afde8631..a986396917 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(7). AddIngredient(4). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index c6d2aec7aa..51b0207b43 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(25). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/RealityRupture.cs b/Items/Weapons/Rogue/RealityRupture.cs index f88d479661..715d4575c6 100644 --- a/Items/Weapons/Rogue/RealityRupture.cs +++ b/Items/Weapons/Rogue/RealityRupture.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/ReboundingRainbow.cs b/Items/Weapons/Rogue/ReboundingRainbow.cs index a874f6347d..e006335ca7 100644 --- a/Items/Weapons/Rogue/ReboundingRainbow.cs +++ b/Items/Weapons/Rogue/ReboundingRainbow.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index f873ac1eba..cb65e3f227 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -14,12 +14,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 30; Item.height = 28; - Item.damage = 26; + Item.damage = 20; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.5f; Item.autoReuse = true; @@ -27,34 +26,17 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; - } - - public override bool CanUseItem(Player player) - { - if (player.ownedProjectileCounts[Item.shoot] >= 2 && !player.Calamity().StealthStrikeAvailable()) - { - return false; - } - else - { - return true; - } + Item.shootSpeed = 8f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int spread = 2; - for (int i = 0; i < 2; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2, 3), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); - int stealth = Projectile.NewProjectile(source, position.X, position.Y, perturbedspeed.X * 1.5f, perturbedspeed.Y * 1.5f, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - spread -= Main.rand.Next(1, 3); - } + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; } return true; diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 0c81d9d686..1aa1b4dd1f 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/ShatteredDawn.cs b/Items/Weapons/Rogue/ShatteredDawn.cs index ddd03e1541..0602d4e927 100644 --- a/Items/Weapons/Rogue/ShatteredDawn.cs +++ b/Items/Weapons/Rogue/ShatteredDawn.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(6). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs deleted file mode 100644 index c3158a2b17..0000000000 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ /dev/null @@ -1,83 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class SkyStabber : RogueWeapon - { - private static int knockBack = 2; - - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.damage = 50; - Item.DamageType = RogueDamageClass.Instance; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useTime = 15; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = knockBack; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item1; - - Item.shootSpeed = 2.2f; - Item.shoot = ModContent.ProjectileType(); - } - - public override float StealthDamageMultiplier => 0.5f; - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.shoot = ProjectileID.None; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - Item.shoot = ModContent.ProjectileType(); - return player.ownedProjectileCounts[ModContent.ProjectileType()] < 4; - } - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; - if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; - } - - public override bool AltFunctionUse(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddIngredient(ItemID.SunplateBlock, 8). - AddTile(TileID.Anvils). - Register(); - } - - } -} diff --git a/Items/Weapons/Rogue/SkyStabber.png b/Items/Weapons/Rogue/SkyStabber.png deleted file mode 100644 index cd4be4f0a2..0000000000 Binary files a/Items/Weapons/Rogue/SkyStabber.png and /dev/null differ diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index f03534a050..33d8971e0f 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -40,5 +41,14 @@ namespace CalamityMod.Items.Weapons.Rogue } return true; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(15). + AddTile(TileID.Anvils). + Register(); + } } } diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index cc2beb46e3..d76c7cc2d6 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 6d48b1f18c..f5605f6e5f 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(ItemID.FastClock). AddIngredient(5). AddIngredient(20). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/TwistingThunder.cs b/Items/Weapons/Rogue/TwistingThunder.cs index 55cfb38d91..1ff0517975 100644 --- a/Items/Weapons/Rogue/TwistingThunder.cs +++ b/Items/Weapons/Rogue/TwistingThunder.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(15). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 57a97d0e19..440167f3fd 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/AquasScepter.cs b/Items/Weapons/Summon/AquasScepter.cs index f97b61c3c5..8ac9423c62 100644 --- a/Items/Weapons/Summon/AquasScepter.cs +++ b/Items/Weapons/Summon/AquasScepter.cs @@ -50,12 +50,12 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - Recipe recipe = Recipe.Create(ModContent.ItemType()); - recipe.AddIngredient(ItemID.NimbusRod); - recipe.AddIngredient(ItemID.AquaScepter); - recipe.AddIngredient(3); - recipe.AddTile(TileID.LunarCraftingStation); //LunarCraftingStation = Ancient Manipulator - recipe.Register(); + CreateRecipe(). + AddIngredient(ItemID.NimbusRod). + AddIngredient(ItemID.AquaScepter). + AddIngredient(3). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index 5b822be2c0..f3c3d7e3fc 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -86,6 +86,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } + public override bool? CanAutoReuseItem(Player player) => false; + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value; diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 2adca37808..c27c8fb840 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index 9f7230b417..c9078ba8ce 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -67,6 +67,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.Calamity().CannotBeEnchanted = true; } + public override bool? CanAutoReuseItem(Player player) => false; + public static bool SpaceForLargeMech(Player player, bool visuals = true) { bool sufficientSpace = true; diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index 2778b1c5a0..ee43914ad1 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentStardust, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index c8e3d512af..f8c677a7a7 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(ItemID.DarkShard). AddIngredient(ItemID.LightShard). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Bookcases). Register(); } } diff --git a/Items/Weapons/Summon/LegionofCelestia.cs b/Items/Weapons/Summon/LegionofCelestia.cs index 227aa6aed1..4e49f639e6 100644 --- a/Items/Weapons/Summon/LegionofCelestia.cs +++ b/Items/Weapons/Summon/LegionofCelestia.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddIngredient(ItemID.FragmentStardust, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index deee425550..4c39a7837c 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(5). AddIngredient(2). AddIngredient(12). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 2540e43a21..23e2df9b9d 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(ItemID.XenoStaff). AddIngredient(ItemID.FragmentStardust, 6). AddIngredient(3). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index f29284f1c7..2a672d25f5 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 0da9bba37e..affd241fee 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index b346171917..edc2b0338b 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(10). AddIngredient(5). AddIngredient(5). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 8aae13745f..9dff85b70b 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Typeless/ClaretCannon.cs b/Items/Weapons/Typeless/ClaretCannon.cs index 3903e15e5c..655a33eefa 100644 --- a/Items/Weapons/Typeless/ClaretCannon.cs +++ b/Items/Weapons/Typeless/ClaretCannon.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Typeless public int ClaretCooldown = 0; - public static int ClaretCooldownMax = 300; + public static int ClaretCooldownMax = 600; public float baseUseDir = 0; public override void SetDefaults() @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Typeless { CreateRecipe(). AddIngredient(4). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index 83678e425a..44fffe4fd3 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -136,6 +136,7 @@ PrismBack: Far too slow and bulky to hunt normally, these turtles subsist on a d PrismaticGuppy: Is it a crystal? Is it a candy? No, it's a little Guppy! Thanks to the unique prismatic sheen of their scales and their striking geometric shapes, these fish can camouflage as Sea Prisms to escape pursuing predators. Probesnout: One of just a few known seahorse species who miraculously survived the Incineration. Its efficient snout allows it to streamline nutrients from the abundant sponge in the reefs that it lives in. SandProwler: These colorful sea serpents prowl through the sand, looking for the gleam of an unsuspecting Guppy to snack on. Due to this creature’s habit of mistakenly capturing dropped coins, Ilmerians fond of avarice began to share the namesake. +Scavenger: This odd species of crab migrated to Ilmeris after its fateful incineration. Gifted with a remarkable sense of ownership and value, they hoard any scavenged treasures as a display of social status. Trade is not a foreign concept to their tribe, and they value Pearls above all else. SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices to find kelp due to their thin bodies. These particular flatworms are incredibly skittish, and thus fled with plenty of time to be spared from the infernal carnage. SeaMinnow: Large schools of Sea Minnows were one of the most beautiful things one could witness during the days when Ilmeris was unsundered. Though the kingdom's grandeur has been lost like ashes in the wind, the tranquil fish continue to swim at peace, a breathtaking reminder that not all was lost. Searslug: A distant cousin of the Slugbuns which can withstand the extreme heat of molten basalt. Their skin is scalding to the touch, a side effect of their adaptations to the many lava dips needed to squirm around the regions it lives in. diff --git a/Localization/en-US/Mods.CalamityMod.Biomes.hjson b/Localization/en-US/Mods.CalamityMod.Biomes.hjson index fe35c7b3ef..85d0d89c43 100644 --- a/Localization/en-US/Mods.CalamityMod.Biomes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Biomes.hjson @@ -72,7 +72,7 @@ SunkenSeaBiome: { } AstralUnderground: { - DisplayName: Astral Underground + DisplayName: Underground Astral TownNPCDialogueName: Underground Astral Infection } diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 4a4a5ed657..e1ae0e199d 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -104,10 +104,10 @@ CalamityClientConfig: { DisableGravityScreenSwap: { Label: Disable Gravity Screen Flip Tooltip: - ''' - Disables vanilla's screen-flipping from changing gravity, flipping the player instead. - Enable this if the screen-flipping is distracting or induces motion sickness. - ''' + ''' + Disables vanilla's screen-flipping from changing gravity, flipping the player instead. + Enable this if the screen-flipping is distracting or induces motion sickness. + ''' } EnableVanillaTextureEdits: { @@ -347,6 +347,16 @@ CalamityClientConfig: { ''' } + SunkenSeaBackgroundDistortion: { + Label: "[i:CalamityMod/SeaRemains] Sunken Sea Background Distortion" + Tooltip: + ''' + Whether or not the Sunken Sea's custom backgrounds should have an additional distortion shader applied to them to give the + illusion of underwater distortion. + [c/FF232C:Note that this will ONLY work if your "Wave Quality" setting is turned off.] + ''' + } + VanillaCooldownDisplay: { Label: "[i:HealingPotion] Display Vanilla Cooldowns" Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 9fbc0e3b60..1d3d11350b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -3,6 +3,7 @@ AureateBooster: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} + {$CommonItemTooltip.PressUpToBooster} 'Mach speed with style!' ''' } @@ -21,7 +22,6 @@ ElysianWings: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - 10% increased movement speed and grants immunity to lava Blessed by the Profaned Flame ''' } @@ -71,8 +71,6 @@ SilvaWings: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - Grants a scaling life regeneration boost while you remain in the air without resetting flight time - This boost caps at 8 HP/s after 15 seconds 'The purest of nature' ''' } @@ -105,7 +103,6 @@ TarragonWings: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - +15 defense and +1 HP/s life regen 'Born of the jungle' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 97c8a4c75a..5525cb5e24 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -284,12 +284,25 @@ Baroclaw: { ''' } +BatholithBangle: { + DisplayName: Batholith Bangle + Tooltip: + ''' + Magic enemy hits create a powerful granite flash that always critically strikes + This effect has a 10 second cooldown, but is halved if the flash kills an enemy + Visual and audio effects are reduced if visibility is disabled + [c/0189D7:'The solid granite radiates energy throughout your body'] + ''' +} + BlackGlassBand: { DisplayName: Black Glass Band Tooltip: ''' - Enemy hits create an obsidian blast that always critically strikes - This effect has a 7 second cooldown, but is halved if the blast kills an enemy + Enemy hits create an obsidian flash that always critically strikes + This effect has a 5 second cooldown, but is halved if the flash kills an enemy + Visual and audio effects are reduced if visibility is disabled + [c/655DC5:'A shining band with boundless potential'] ''' } @@ -297,6 +310,7 @@ BlazingCore: { DisplayName: Blazing Core Tooltip: ''' + Grants immunity to knockback The searing core of the Profaned Goddess Pressing [KEY] will activate a parry, encasing you in luminous profaned crystal Being hit shortly after encasement will shatter the crystal @@ -311,6 +325,7 @@ BloodflareCore: { DisplayName: Bloodflare Core Tooltip: ''' + Grants immunity to knockback Recovering defense damage heals you, each defense recovered gives 1 HP Taking damage converts at least half of your total defense in defense damage ''' @@ -345,11 +360,10 @@ BloomStone: { DisplayName: Bloom Stone Tooltip: ''' - Grants between +1 HP/s and +3 HP/s life regen depending on time of day - Accelerates life regen based on time of day - Both of these effects are maximized from noon to sunset - Flowers grow on the grass you walk on - Random dye plants will grow while standing on grassless dirt + Healing Potions are 50% more effective, but provide their healing over time + Grappling hooks retract and pull the player 50% faster, and grow a flower at hookpoints + Touching a flower makes it burst into pollen which gives a temporary 6% damage reduction boost + The damage reduction boost increases to 12% while receiving healing over time 'One of the ancient relics' ''' } @@ -532,6 +546,7 @@ DarkSunRing: { DisplayName: Dark Sun Ring Tooltip: ''' + Grants immunity to knockback 12% increased damage +0.5 HP/s life regen and +2 max minions Increased minion knockback @@ -600,6 +615,7 @@ DraedonsHeart: { Tooltip: ''' {0}% reduced contact damage from enemies + Grants immunity to knockback [NANODESC] With full Nanomachines, press [KEY] to heal {1} health over {2} {^2:second;seconds} While healing, you take [DR]% less damage @@ -769,6 +785,7 @@ FlameLickedShell: { DisplayName: Flame-Licked Shell Tooltip: ''' + Grants immunity to knockback Pressing [KEY] will activate a parry, encasing you in rocks Being hit shortly after encasement will implode the rocks Upon implosion, a ring of brimstone hellfire is launched outwards and you receive 90% DR for that hit @@ -1232,6 +1249,7 @@ OldDukeScales: { DisplayName: Old Duke's Scales Tooltip: ''' + Grants immunity to knockback 10% increased damage reduction, max movement speed, and acceleration 25% increased dash velocity and length Adds a stamina tracker to the cooldown rack @@ -1362,6 +1380,17 @@ ProfanedSoulCrystal: { ''' } +ProtolithBangle: { + DisplayName: Protolith Bangle + Tooltip: + ''' + Ranged enemy hits create a marble flash that always critically strikes and can hit multiple enemies + This effect has a 7 second cooldown, but is halved if the flash kills the first enemy it hits + Visual and audio effects are reduced if visibility is disabled + [c/C5B965:'The cold marble against your wrist puts your mind at ease'] + ''' +} + QuiverofNihility: { DisplayName: Quiver of Nihility Tooltip: @@ -1621,8 +1650,9 @@ SlagsplitterPauldron: { DisplayName: Slagsplitter Pauldron Tooltip: ''' - You gain 10% damage reduction while dashing, and enemies are inflicted with Armor Crunch - Your dashes are empowered by fire, shredding enemies near you with violent explosions + Your dashes become empowered by flame, erupting on contact with enemies + Grants immunity to knockback and 10% damage reduction while dashing + Enemies hit by your dashes have their armor crushed Visual effects are reduced if visibility is disabled ''' } @@ -1762,8 +1792,8 @@ StatMeter: { AttackSpeed: Attack Speed: {0}% WhipMeleeInheritance: " [{0}% from melee]" // Class stats - RangedStats: Ammo Consumption Chance: {0} - MagicStats: Mana Usage: {0}% | Mana Regen: {1} + AmmoStats: Ammo Consumption Chance: {0}% + ManaStats: Mana Usage: {0}% | Mana Regen: {1} SummonStats: Minion Slots: {0} | Sentry Slots: {1} WhipStats: Whip Range: {0}% RogueStats: @@ -1868,7 +1898,7 @@ TheCamper: { DisplayName: The Camper Tooltip: ''' - You deal 90% less damage unless stationary + You deal 50% less damage unless stationary Standing still grants buffs depending on held item, and creates a damaging aura around you While moving, you regenerate health as if standing still {$Common.AbyssLightLevel1} @@ -1918,6 +1948,7 @@ TheSponge: { DisplayName: The Sponge Tooltip: ''' + Grants immunity to knockback Gain a barrier with 180 health The barrier grants 20 defense and 10% damage reduction while active [ADREN] @@ -2038,7 +2069,8 @@ WarbanneroftheRighteous: { DisplayName: Warbanner of the Righteous Tooltip: ''' - Damage is increased by 20% when close to enemies, but decreased by 40% when none are nearby + Grants a scaling damage boost based on how close you are to enemies + Maximum damage boost is 20%, minimum damage boost is -30% Emit a blazing aura that burns and repels nearby enemies Enemies take increasing damage the closer they are to you and the longer they are near you Effects are transparent and silent if visibility is disabled @@ -2065,6 +2097,7 @@ WulfrumAcrobaticsPack: { ''' Provides a wulfrum slingshot grappling hook This slingshot's stats scale with your equipped hook + If the hook has special effects, the slingshot also benefits from them The slingshot allows for advanced rope-swinging physics Hold UP or DOWN to retract or extend the slingshot's rope Automatically grapples nearby walls if a lethal fall is detected @@ -2088,6 +2121,7 @@ YharimsGift: { DisplayName: Yharim's Gift Tooltip: ''' + Grants immunity to knockback Flaming meteors rain down after getting hit Volatile dragon dust trails behind you Increases damage and movement speed by 15% diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 91905b3659..08fb1ba71e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -481,7 +481,7 @@ ReaverHeadMobility: { ''' Grants immunity to fall damage and allows constant jumping 10% increased flight time and horizontal wing speed - Hooks fly out and retract 10% faster + Hooks fly out and retract 50% faster Reduces the cooldown of dashes ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 927906d00d..8886653a5d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -106,17 +106,6 @@ ArtAttack: { ''' } -AsteroidStaff: { - DisplayName: Asteroid Staff - Tooltip: "[GFB]" - TooltipNormal: Summons asteroids from the sky - TooltipGFB: - ''' - Core Keeper Chaos Staff - bottom text - ''' -} - AstralachneaStaff: { DisplayName: Astralachnea Staff Tooltip: Fires a spread of homing astral spider fangs diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 5a4c972a71..7e26effb43 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -31,11 +31,6 @@ AegisBlade: { ''' } -Aftershock: { - DisplayName: Aftershock - Tooltip: Summons boulders from the sky on enemy hits -} - AirSpinner: { DisplayName: Air Spinner Tooltip: @@ -116,11 +111,6 @@ ArkoftheElements: { ''' } -AstralBlade: { - DisplayName: Astral Blade - Tooltip: Deals more damage the more life an enemy has left -} - AstralPike: { DisplayName: Astral Pike Tooltip: Summons astral star swarms on hit @@ -1300,11 +1290,13 @@ Terratomere: { TerrorBlade: { DisplayName: Terror Blade + GFBName: TERROR BLADD4 Tooltip: ''' Fires a terror beam that bounces off tiles - On every bounce it emits an explosion + On every bounce it emits an explosion[STATUS] ''' + GFB: "'Ignore my spelling.'" } TheBurningSky: { @@ -1330,11 +1322,6 @@ TheDarkMaster: { ''' } -TheEnforcer: { - DisplayName: The Enforcer - Tooltip: Spawns essence flames on hit -} - TheGodsGambit: { DisplayName: The God's Gambit Tooltip: @@ -1480,7 +1467,12 @@ UltimusCleaver: { UrchinMace: { DisplayName: Urchin Mace - Tooltip: Throws out a whirlpool when released + Tooltip: + ''' + Throws out a whirlpool when released + [c/5C95A1:'The people of the sea were adept hunters, but they abhorred unnecessary violence.] + [c/5C95A1:Unfortunately, neighboring nations were brutish, so they fashioned their tools for war.'] + ''' } VanishingPoint: { @@ -1499,7 +1491,12 @@ VeinBurster: { Violence: { DisplayName: Violence - Tooltip: Releases a blazing fork which stays near the mouse and shreds enemies + Tooltip: + ''' + A demonic pitchfork, cursed to cause endless bloodshed + commands the trident to follow your cursor and shred enemies with devastating speed + throws the trident, violently tearing through enemies with immense power and inflicting Vulnerability Hex + ''' } Virulence: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index b758d92ecd..1350fd856a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -124,11 +124,6 @@ AstralBlaster: { Tooltip: Converts musket balls into homing astral rounds } -AstralBow: { - DisplayName: Astral Bow - Tooltip: Fires a burst of three arrows -} - AstrealDefeat: { DisplayName: Astreal Defeat Tooltip: All arrows are converted to Astreal Arrows that emit flames as they travel @@ -237,6 +232,7 @@ BulletFilledShotgun: { Tooltip: ''' Fires a massive spread of bouncing bullets + Bullets attempt to bounce towards enemies after bouncing twice Consumes five bullets per-use 'Aim? What's that?' ''' @@ -282,15 +278,6 @@ CleansingBlaze: { ''' } -ClockGatlignum: { - DisplayName: Clock Gatlignum - Tooltip: - ''' - Converts musket balls into strings of 3 high velocity bullets - 33% chance to save ammo - ''' -} - ClockworkBow: { DisplayName: Clockwork Bow Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index cc686427ce..7274743e98 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -1,12 +1,3 @@ -AcidicRainBarrel: { - DisplayName: Acidic Rain Barrel - Tooltip: - ''' - Throws a rolling barrel that explodes on wall collision - Stealth strikes make it rain on collision - ''' -} - AdamantiteThrowingAxe: { DisplayName: Adamantite Throwing Axe Tooltip: Stealth strikes ignore gravity and rain down lightning on enemy hits @@ -146,7 +137,7 @@ Cinquedea: { CobaltKunai: { DisplayName: Cobalt Kunai - Tooltip: Stealth strikes fire three homing cobalt energy bolts + Tooltip: Stealth strikes fire four homing cobalt energy bolts } ConsecratedWater: { @@ -957,8 +948,9 @@ SandDollar: { DisplayName: Sand Dollar Tooltip: ''' - Throws up to 2 returning sand dollars - Stealth strikes throw 2 long ranged sand dollars that explode into coral shards on enemy hits + Throws gliding sand dollars which can pierce enemies or bounce off floors + After bouncing, sand dollars lose their pierce but split into damaging shards on impact + Stealth strikes linger in place after bouncing, creating a small sandstorm around them ''' } @@ -1082,16 +1074,6 @@ SkyfinBombers: { ''' } -SkyStabber: { - DisplayName: Sky Stabber - Tooltip: - ''' - Throws up to 4 gravity-defying spiky balls - Stealth strikes make the balls rain feathers onto enemies when they hit - Press to delete all existing spiky balls - ''' -} - SlickCane: { DisplayName: Slick Cane Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index a3751a23b3..571c8256a9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -589,9 +589,10 @@ Perdition: { DisplayName: Perdition Tooltip: ''' + {$CommonItemTooltip.Sentry} Summons a beacon at the position of the mouse When a target is manually selected via right click it releases torrents of souls from below onto the target - Requires 5 minion slots to summon and only one beacon may exist at a time + Requires one sentry slot to summon, and only one beacon may exist at a time ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 0de017e498..5af63cdf49 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -16,7 +16,7 @@ ClaretCannon: { The explosion shreds enemies, inflicting [Laceration] and dramatically reducing their defense Picking up the blood orbs will reduce [Potion Sickness] when possible If you do not have [Potion Sickness], your natural regeneration will be enhanced - Can only fire once every 5 seconds + Can only fire once every 10 seconds ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index b4354adc85..95cd1221f7 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -1,21 +1,22 @@ -// Recipe Groups +# Recipe Groups +# {$LegacyMisc.37} is the vanilla localization used in recipe groups, that reads "Any" in English. RecipeGroup: { - HardmodeAnvil: Any Hardmode Anvil - HardmodeForge: Any Hardmode Forge - AnyLargeGem: Any Large Gem - AnyFood: Any Food Item - AnyEvilBar: Any Evil Bar - AnyEvilPowder: Any Evil Powder + HardmodeAnvil: "{$LegacyMisc.37} Hardmode Anvil" + HardmodeForge: "{$LegacyMisc.37} Hardmode Forge" + AnyLargeGem: "{$LegacyMisc.37} Large Gem" + AnyFood: "{$LegacyMisc.37} Food Item" + AnyEvilBar: "{$LegacyMisc.37} Evil Bar" + AnyEvilPowder: "{$LegacyMisc.37} Evil Powder" Boss2Material: Shadow Scale or Tissue Sample CursedFlameIchor: Cursed Flame or Ichor - AnyEvilWater: Any Evil Water - AnyEvilFlask: Any Evil Flask - AnyEvilBlock: Any Evil Block - AnyGoodBlock: Any Good Block - LunarPickaxe: Any Lunar Pickaxe - LunarHamaxe: Any Lunar Hamaxe - AnyQuiver: Any Quiver - AnyWings: Any Wings + AnyEvilWater: "{$LegacyMisc.37} Evil Water" + AnyEvilFlask: "{$LegacyMisc.37} Evil Flask" + AnyEvilBlock: "{$LegacyMisc.37} Evil Block" + AnyGoodBlock: "{$LegacyMisc.37} Good Block" + LunarPickaxe: "{$LegacyMisc.37} Lunar Pickaxe" + LunarHamaxe: "{$LegacyMisc.37} Lunar Hamaxe" + AnyQuiver: "{$LegacyMisc.37} Quiver" + AnyWings: "{$LegacyMisc.37} Wings" } // Status @@ -69,6 +70,7 @@ EtherealCoreText: You have already used an Ethereal Core. Your brain would escap PhantomHeartText: You have already used a Phantom Heart. The voices are telling you it's a bad idea to use it again. SulphurSwitchLeft: The Sulphurous Sea is now on the left side of the world. SulphurSwitchRight: The Sulphurous Sea is now on the right side of the world. +Polaris0: Too much love... Polaris1: You give Polaris belly rubs Polaris2: You give Polaris a small treat Polaris3: You tell Polaris she's a good girl diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index f376f08317..906f6e26e7 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -305,6 +305,7 @@ RadiantPrismaticGuppy: Radiant Prismatic Guppy RadiantSlugbun: Radiant Slugbun SandProwler.DisplayName: Sand Prowler SandProwlerNested.DisplayName: Sand Prowler +Scavenger.DisplayName: Scavenger SeaFloaty.DisplayName: Sea Floaty SeaMinnow.DisplayName: Sea Minnow SeaMinnowGold.DisplayName: Gold Sea Minnow diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 5ae6b83005..26d561887b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -13,7 +13,6 @@ AquamarineBolt.DisplayName: Aqua Bolt ArcticBearPawProj.DisplayName: Arctic Bear Paw ArtAttackStar.DisplayName: Artsy Star ArtAttackStrike.DisplayName: Art Attack -Asteroid.DisplayName: Asteroid AsteroidMolten.DisplayName: Molten Asteroid AstralachneaFang.DisplayName: Astral Fang AstralCrystal.DisplayName: Astral Crystal diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 952a0416ff..58bcdbcfba 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -4,7 +4,6 @@ AegisBeam.DisplayName: Aegis Beam AegisBlast.DisplayName: Aegis Blast AegisBlast2.DisplayName: Aegis Blast AegisFlame.DisplayName: Aegis Flame -AftershockRock.DisplayName: Afterrock AmidiasWhirlpool.DisplayName: Whirlpool AncientBeam.DisplayName: Ancient Beam AncientStar.DisplayName: Ancient Star @@ -105,7 +104,6 @@ ElementalGlassStar.DisplayName: Glass Star EmpyreanKnife.DisplayName: Empyrean Knife EntropicFlechette.DisplayName: Entropic Flechette EonBolt.DisplayName: Eon Bolt -EssenceFlame2.DisplayName: Essence Flame EssenceScythe.DisplayName: Essence Scythe ExaltedOathbladeThrownBlade.DisplayName: Exalted Oathblade Thrown Blade ExcelsusBlue.DisplayName: Excelsus diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 97efe5b804..f1b18a5670 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -206,7 +206,6 @@ SicknessRound.DisplayName: Round SicknessRound2.DisplayName: Round SlagRound.DisplayName: Slag Round SlimeBolt.DisplayName: Slime Bolt -SmallCoral.DisplayName: Small Coral SparkSpreaderFire.DisplayName: Sparked Flames SpeedBlasterShot.DisplayName: Splatter Shot SporeBomb.DisplayName: Spore Bomb diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 275aa51dbc..5328e2d17b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -1,6 +1,4 @@ AbyssalMirrorProjectile.DisplayName: Lumenyl Fluid -AcidBarrelDrop.DisplayName: Barrel Acid Drop -AcidShrapnel.DisplayName: Acidic Shrapnel AdamantiteThrowingAxeProjectile.DisplayName: Adamantite Throwing Axe AntlionSkewerProj.DisplayName: Antlion on a Stick AntlionSkewerSandBlast.DisplayName: Antlion Blast @@ -130,7 +128,6 @@ GleamingDaggerProj.DisplayName: Gleaming Dagger GodsParanoiaDart.DisplayName: God's Paranoia Dart GodsParanoiaProj.DisplayName: God's Paranoia GraveGrimreaverProjectile.DisplayName: Grave Grimreaver -GreenDonkeyKongReference.DisplayName: Acidic Rain Barrel GrimreaverBat.DisplayName: Grim Bat GrimreaverSkull.DisplayName: Grim Skull HeavenfallenEnergy.DisplayName: Heavenfallen Energy @@ -210,6 +207,8 @@ ProfanedPartisanSpear.DisplayName: Profaned Spear RadiantExplosion.DisplayName: Radiant Explosion RadiantStar2.DisplayName: Radiant Star RadiantStarKnife.DisplayName: Radiant Star +RadiationBurst.DisplayName: Radiation Burst +RadiationRain.DisplayName: Radiation Rain RealityRuptureLance.DisplayName: Lance of Reality RealityRuptureMini.DisplayName: Reality Shard RealityRuptureStealth.DisplayName: Ruptured Reality @@ -217,14 +216,17 @@ ReaperProjectile.DisplayName: The Old Reaper ReboundingRainbowProj.DisplayName: Rebounding Rainbow ReboundingRainbowSplit.DisplayName: Rebounding Rainbow RefractionRotorProjectile.DisplayName: Prism Shuriken +RefractionRotorSlashCreator.DisplayName: Refraction Rotor Slash Creator +RefractionSlash.DisplayName: Refraction Slash RegulusEnergy.DisplayName: Regulus Energy RegulusRiotProj.DisplayName: Regulus Riot RotBallProjectile.DisplayName: Rot Ball SacrificeProjectile.DisplayName: Sacrificial Dagger SamsaraSlicerProjectile.DisplayName: Samsara Slicer SamsaraSlicerSmallDisk.DisplayName: Samsara Slicer +SandDollarFrag.DisplayName: Sand Dollar Frag SandDollarProj.DisplayName: Sand Dollar -SandDollarStealth.DisplayName: Sand Dollar +SandDollarStealth.DisplayName: Sand Dollar Duststorm ScarletBlast.DisplayName: Scarlet Blast ScarletDevilBullet.DisplayName: Gungnir Bullet ScarletDevilProjectile.DisplayName: Spear the Gungnir @@ -253,7 +255,6 @@ ShockTeslaAura.DisplayName: Electrifying Aura ShroomerangSpore.DisplayName: Infested Spore SkyBomberGas.DisplayName: Irradiated Cloud SkyfinNuke.DisplayName: Skyfin Nuke -SkyStabberProj.DisplayName: Sky Stabber SludgeSplotchProj1.DisplayName: Sludge Splotch SludgeSplotchProj2.DisplayName: Sludge Splotch SnapClamProj.DisplayName: Snap Clam @@ -267,6 +268,8 @@ SphereBladed.DisplayName: Bladed Sphere SphereBlue.DisplayName: Blue Thruster Sphere SphereSpiked.DisplayName: Spiked Sphere SphereYellow.DisplayName: Yellow Thruster Sphere +SporeKnifeBud.DisplayName: Spore Knife Bud +SporeKnifeProj.DisplayName: Spore Knife StealthNimbus.DisplayName: Nimbus StealthNimbusCloud.DisplayName: Nimbus StealthRain.DisplayName: Rain @@ -319,9 +322,3 @@ WrathwingCinder.DisplayName: Wrathwing Eruption WrathwingFireball.DisplayName: Wrathwing Fireball WrathwingSpear.DisplayName: Wrathwing WulfrumKnifeProj.DisplayName: Wulfrum Knife -RadiationBurst.DisplayName: Radiation Burst -RadiationRain.DisplayName: Radiation Rain -RefractionRotorSlashCreator.DisplayName: Refraction Rotor Slash Creator -RefractionSlash.DisplayName: Refraction Slash -SporeKnifeProj.DisplayName: Spore Knife -SporeKnifeBud.DisplayName: Spore Knife Bud diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 06fbcda6ad..ec59c3406c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -23,6 +23,7 @@ BlazingSun2.DisplayName: Blazing Sun BlissfulBombardierDustProjectile.DisplayName: Dust BloodBomb.DisplayName: Bomb BloodBombExplosion.DisplayName: Explosion +BloomStoneFlower.DisplayName: Bloom Stone Flower BlunderBoosterAura.DisplayName: Red Lightning Aura BobbitHead.DisplayName: Bobbit Head BossRushEffectThing.DisplayName: Boss Rush Effect Thing @@ -60,6 +61,7 @@ ExoTankLaser.DisplayName: Mini Exo Pulse Laser ExoTankMissile.DisplayName: Miracle Missile ExoTankMuzzleFlash.DisplayName: Mini Exo Flash FeralDoubleBobber.DisplayName: Feral Bobber +FestiveWingsOrnament.DisplayName: Ornament FlameLickedBarrage.DisplayName: Flame Licked Barrage FlameLickedHellblast.DisplayName: Flame Licked Hellblast FlashBolt.DisplayName: The Reminder @@ -104,6 +106,7 @@ PauldronExplosion.DisplayName: Pauldron Explosion PearlAuraShard.DisplayName: Prism Shard PlaguePulse.DisplayName: Plague Pulse PoisonousSeawater.DisplayName: Seawater +ProtolithBangleProjectile.DisplayName: Marble Shatter PscTransformAnimation.DisplayName: Psc Transform Animation PscTransformRocks.DisplayName: Psc Transform Rocks PuddleSplash.DisplayName: Puddle Splash @@ -113,6 +116,7 @@ RedLabSeeker.DisplayName: Seeking Mechanism RelicGuard.DisplayName: Relic Guard RetaliationProjectile.DisplayName: Retaliation Shard RiftReelerBobber.DisplayName: Chaotic Bobber +RustyMedallionDroplet.DisplayName: Acid Droplet SandCloakVeil.DisplayName: Dust Veil SandExplosion.DisplayName: Sand SCalAltarArenaVisual.DisplayName: Supreme Calamitas Arena Visual @@ -155,3 +159,5 @@ YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism VoidofExtinctionCrit.DisplayName: Void of Extinction Crit XykDeathAnim.DisplayName: Xyk Death Animation +XykWings.DisplayName: Xyk Wings +BatholithBangleProjectile.DisplayName: Batholith Bangle Projectile diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 93fe806e1f..0691f76312 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,4 +1,7 @@ SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" +// Main Menu Name +MainMenu: Calamity Style +MainMenuClassic: Calamity Style - Classic // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines @@ -91,6 +94,7 @@ Cooldowns: { FleshTotem: Contact Damage Halving Cooldown FuryFuel: Crystal Powder GaelsRage: Gael's Greatsword Rage Cooldown + BandCooldown: Band Cooldown GlobalDodge: Dodge Cooldown GodSlayerDash: God Slayer Dash Cooldown HellbornShots: Hellborn Shots @@ -586,8 +590,11 @@ Lecherous: { Disenchant: Disenchant // Worldgen Tasks -BetterUnderworld: Creating a smoother underworld -AshIslandLavaRemoval: Removing lava from ash island +BetterUnderworld: Creating a smoother Underworld +UnderworldStructures: Remnants of an Azafurian and Demonic war +UnderworldPillars: Constructing Underworld pillars +UnderworldTreesAndGrass: Growing Underworld flora +UnderworldGeyserTraps: Adding an Underworld minefield EvilIslandCorrupt: Adding a putrid floating island EvilIslandCrimson: Adding a grotesque floating island AstralChest: Placing an astral chest @@ -597,8 +604,14 @@ GiantBeehive: Building a giant beehive MechanicShed: Placing mechanic shed VernalPass: Blessing a flourishing jungle grove SunkenSea: Partially flooding an overblown desert +TimelessShores: Digging a subaquatic graveyard +RadiantReefs: Making the sea sparkle and shine +PolypForest: Adding life to nutrient-rich waters +GleamingBurrows: Burying pearls and catching caustics +BasaltGully: Provoking volcanic activity below the sea GemAdjustment: Sensibly shuffling gem depth DungeonArchive: Entombing occult literature +Planetoids: Enriching low Terraria orbit SulphurSea: Polluting one of the oceans BrimstoneCrags: Incinerating Azafure HiddenShrines: Hiding forbidden shrines diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson index 9edc92b12c..40f7b60eda 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson @@ -1,18 +1,9 @@ -BatWings: Improved vision -BeeWings: Permanently gives the Honey buff +BeeWings: Decreases fall speed while not pressing {$Key.DOWN} BoneWings: Halves flight time when taking a hit -ButterflyWings: Increases mana regeneration rate -FestiveWings: Homing ornaments rain down as you fly -FinWings: - ''' - Gills effect and you can move freely through liquids - You fall faster while submerged in liquid - ''' -FlameWings: Multiplies all heat debuff damage by 1.25x -FrozenWings: Multiplies all cold debuff damage by 1.25x -HarpyWings: 10% increased movement speed -LeafWings: +10 defense and permanent Dryad's Blessing -TatteredFairyWings: You leave a trail of fairy dust as you fly +DemonWings: Increases fall speed +FestiveWings: Spawns ornaments which restore flight time +FinWings: Allows quick travel in water +TatteredFairyWings: Leaves a trail of flight draining fairy dust WingsNebula: Increases the pickup range of Nebula armor's nebula boosters WingsSolar: Allows Solar Flare armor's dash to be used without any charges WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 77afe9d29b..b037db0068 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -7,6 +7,7 @@ DodgeInfo: ''' AddedTooltip: { + EyeoftheGolem: 20% increased critical strike damage TruffleWorm: ''' Summons Duke Fishron if used as bait in the Ocean @@ -29,7 +30,8 @@ AddedTooltip: { WarmthPotion: Greatly reduces the duration of Chilled, Frozen, and Glacial State HandWarmer: Provides a regeneration boost while wearing the Snow armor GoldenFishingRod: Its fishing line will never break - Stepstool: Standing on the stool grants 5% increased critical strike chance + // Step Stool + PortableStool: Standing on the stool grants 5% increased critical strike chance Tombstones: ''' 13 of any tombstone turns the surrounding area into a graveyard @@ -149,6 +151,8 @@ EditedTooltip: { Throws a mixture of slime and sparkling crystals Slimed enemies take more damage from fire-based debuffs ''' + // Ancient Manipulator + LunarCraftingStation: Used to craft items from Lunar Fragments, Luminite, and Astral Bars AnkhShield1: Grants immunity to knockback AnkhShield2: Grants immunity to most debuffs, including Mighty Wind Campfires: Life regen is increased by 0.5 HP/s when near a campfire @@ -196,7 +200,7 @@ EditedTooltip: { EmpressFlightBooster2: Increases movement and jump speed by 10% and acceleration by 1.25x RifleScope1: Increase view range for guns (Right click to zoom out) RifleScope2: The scope effect can be toggled with visibility - SniperScope: 7% increased ranged damage and critical strike chance + SniperScope: 12% increased ranged critical strike chance MagicQuiver: Increases arrow damage by 5% and greatly increases arrow speed MoltenQuiver1: Increases arrow damage by 7% and greatly increases arrow speed MoltenQuiver2: Lights wooden arrows ablaze and all arrows inflict Hellfire diff --git a/MainMenu/CalamityMainMenu.cs b/MainMenu/CalamityMainMenu.cs index 3d92738200..deb0852e84 100644 --- a/MainMenu/CalamityMainMenu.cs +++ b/MainMenu/CalamityMainMenu.cs @@ -41,7 +41,7 @@ namespace CalamityMod.MainMenu } = new(); public float remixLogoRotation = 0f; - public override string DisplayName => "Calamity Style"; + public override string DisplayName => CalamityUtils.GetTextValue("UI.MainMenu"); public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/Logo"); public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); diff --git a/MainMenu/CalamityMainMenu_Classic.cs b/MainMenu/CalamityMainMenu_Classic.cs index c887934987..b589df95dc 100644 --- a/MainMenu/CalamityMainMenu_Classic.cs +++ b/MainMenu/CalamityMainMenu_Classic.cs @@ -40,7 +40,7 @@ namespace CalamityMod.MainMenu } = new(); public float remixLogoRotation = 0f; - public override string DisplayName => "Calamity Style - Classic"; + public override string DisplayName => CalamityUtils.GetTextValue("UI.MainMenuClassic"); public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/Logo"); public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 3852e1e332..fb20344f3a 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -224,7 +224,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemID.JellyfishNecklace, 100); + npcLoot.Add(ItemID.JellyfishNecklace, 25); var postSkeletron = npcLoot.DefineConditionalDropSet(() => NPC.downedBoss3); postSkeletron.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 50, 40)); } diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 536cbf9a7e..ce1ea981bd 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -326,7 +326,7 @@ namespace CalamityMod.NPCs.Abyss { npcLoot.Add(ItemID.Bomb); npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Bezoar, 100, 50)); - npcLoot.Add(ItemID.JellyfishNecklace, 100); + npcLoot.Add(ItemID.JellyfishNecklace, 25); } } } diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index fc5bd14403..69c7dc7c72 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemID.Flipper, 20); + npcLoot.Add(ItemID.Flipper, 8); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 2c95fabde1..a1cf912c4f 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -3,12 +3,10 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -181,8 +179,6 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2, 1, 3); - LeadingConditionRule postAS = npcLoot.DefineConditionalDropSet(DropHelper.PostAS()); - postAS.Add(ModContent.ItemType(), 20); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 77c122d094..ab27b1d31a 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -1,4 +1,5 @@ -using System.IO; +using System.Collections.Generic; +using System.IO; using System.Threading; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; @@ -413,11 +414,11 @@ namespace CalamityMod.NPCs.AstrumAureus // Relic npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); - // GFB Crab Banner and Asteroid Staff drop + // GFB troll drops: Crab Banners and a random item which uses Luminite Bars + // Luminite Bar item drop is handled in a separate mod system var GFBOnly = npcLoot.DefineConditionalDropSet(DropHelper.GFB); { GFBOnly.Add(DropHelper.PerPlayer(ItemID.CrabBanner, 1, 1, 9999), true); - GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); } // Lore @@ -585,4 +586,25 @@ namespace CalamityMod.NPCs.AstrumAureus target.AddBuff(ModContent.BuffType(), 360); } } + + // This ModSystem is used to allow Aureus to drop a random item which uses Luminite Bars in its recipe in Get fixed boi. + // This cannot be placed in ModifyNPCLoot, because ModifyNPCLoot is run before modded recipes are initialized. Thus, placing it there would only drop vanilla items. + // As a funny side effect, this also allows for dropping items from other mods which use Luminite Bars in their recipes. + public class AddAureusGFBDrop : ModSystem + { + public override void PostSetupRecipes() + { + // Iterate through all recipes, and list the items which use Luminite Bars in their recipes. + List luminiteStuff = []; + for (int i = 0; i < Main.recipe.Length; i++) + { + if (Main.recipe[i].ContainsIngredient(ItemID.LunarBar) && !luminiteStuff.Contains(Main.recipe[i].createItem.type)) + luminiteStuff.Add(Main.recipe[i].createItem.type); + } + // Define the conditional for GFB. + LeadingConditionRule GFBOnly = new LeadingConditionRule(DropHelper.GFB); + GFBOnly.OnSuccess(ItemDropRule.OneFromOptionsNotScalingWithLuck(1, luminiteStuff.ToArray())); + Main.ItemDropsDB.RegisterToNPCNetId(ModContent.NPCType(), GFBOnly); + } + } } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs index cac49fe66f..7fc43d201c 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs @@ -130,6 +130,10 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Increase projectile fire rate based on number of nearby active tiles float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); + // Decides whether Ceaseless moves closer to its target or not + float distanceRequiredToMove = (Main.getGoodWorld || !anyDarkEnergies) ? 320f : bossRush ? 600f : death ? 520f : revenge ? 480f : expertMode ? 440f : 400f; + bool move = Vector2.Distance(npc.Center, player.Center) > distanceRequiredToMove || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); + // Succ attack if (!anyDarkEnergies) { @@ -142,7 +146,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Avoid cheap bullshit npc.damage = 0; - if (Vector2.Distance(npc.Center, player.Center) > 320f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + if (move) Movement(true); else npc.ai[3] = 1f; @@ -171,7 +175,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.velocity = Vector2.Zero; // Move towards target again if they get outside the succ radius - float moveCloserGateValue = suckDistance * 0.75f; + float moveCloserGateValue = suckDistance * 0.8f; if (Vector2.Distance(npc.Center, player.Center) > moveCloserGateValue) npc.ai[3] = 0f; @@ -377,7 +381,18 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Avoid cheap bullshit npc.damage = 0; - Movement(false); + if (move) + { + Movement(false); + } + else + { + // Slow down + if (npc.velocity.Length() > 0.5f) + npc.velocity *= 0.8f; + else + npc.velocity = Vector2.Zero; + } // Count up all Dark Energy HP values int totalDarkEnergyHP = 0; @@ -469,8 +484,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Move between 8 different positions around the player, in order float maxDistance = 320f; - Vector2 moveToOffset = succ ? Vector2.Zero : new Vector2(0f, -maxDistance); - if (!succ) + Vector2 moveToOffset = succ ? Vector2.Zero : Main.getGoodWorld ? new Vector2(0f, -maxDistance) : Vector2.Zero; + if (!succ && Main.getGoodWorld) { // Move to a new location every few seconds calamityGlobalNPC.newAI[2] += 1f; @@ -522,18 +537,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Vector2 distanceFromDestination = destination - npc.Center; // Movement - if (npc.Distance(destination) > maxDistance || succ) - { + if (npc.Distance(destination) > maxDistance || succ || !Main.getGoodWorld) CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); - } - else - { - // Slow down - if (npc.velocity.Length() > 0.5f) - npc.velocity *= 0.8f; - else - npc.velocity = Vector2.Zero; - } } // Spawn more Dark Energies as the fight progresses diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index abd55657ee..281d6b94ab 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -17,9 +17,11 @@ using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.Sounds; +using CalamityMod.Systems; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -54,10 +56,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs float numberOfAttacksBeforeExhaustion = 12f; float exhaustionIncreasePerAttack = exhaustionGateValue * (1f / numberOfAttacksBeforeExhaustion); bool exhausted = calamityGlobalNPC.newAI[1] == 1f; - bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); - bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; + bool phase2 = lifeRatio <= (death ? OldDuke.OldDuke.LifePercentagePhase2_Death : revenge ? OldDuke.OldDuke.LifePercentagePhase2_Revenge : OldDuke.OldDuke.LifePercentagePhase2_Normal); + bool phase3 = lifeRatio <= (death ? OldDuke.OldDuke.LifePercentagePhase3_Death : (revenge ? OldDuke.OldDuke.LifePercentagePhase3_Revenge : OldDuke.OldDuke.LifePercentagePhase3_Expert)) && expertMode; bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; + + int phase = (npc.ModNPC as OldDuke.OldDuke).Phase; + bool charging = npc.ai[3] < 10f; float pie = (float)Math.PI; @@ -306,8 +311,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Set variables for spawn effects if (npc.localAI[0] == 0f) { - npc.localAI[0] = 1f; npc.alpha = 255; + + npc.velocity.Y = -12f; + npc.velocity.X = Main.rand.NextFloat(-2f, 2f); + + npc.localAI[0] = 1f; npc.rotation = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -411,6 +420,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Spawn effects if (npc.ai[0] == -1f) { + npc.alpha = (int)MathHelper.Lerp(npc.alpha, 0, 0.2f); + // Avoid cheap bullshit npc.damage = 0; @@ -429,8 +440,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Alpha if (npc.ai[2] > 20f) { - if (npc.Calamity().newAI[3] == 0f) - npc.velocity.Y = -2f; + npc.velocity *= 0.9f; npc.alpha -= 5; if (Collision.SolidCollision(npc.position, npc.width, npc.height)) @@ -441,25 +451,36 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.alpha = 150; } - // Spawn dust and play sound - if (npc.ai[2] == attackTimer - 30) + if (npc.ai[2] == 75) { - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) - { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt) + npc.Center; - Vector2 vector2 = dust - npc.Center; - int toxicDust = Dust.NewDust(dust + vector2, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); - Main.dust[toxicDust].noGravity = true; - Main.dust[toxicDust].noLight = true; - Main.dust[toxicDust].velocity = Vector2.Normalize(vector2) * 3f; - } - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + + CalamityUtils.AddScreenshakeAt(npc.Center, 14); + SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath.WithPitchOffset(-0.5f), npc.Center); + SoundEngine.PlaySound(OldDuke.OldDuke.DashSoundP3, npc.Center); + } + + if (npc.ai[2] >= 75f) + { + float sd = player.Center.X > npc.Center.X ? -1f : 1f; + + (npc.ModNPC as OldDuke.OldDuke).shake = 2f; + npc.rotation = MathHelper.Lerp(MathHelper.WrapAngle(npc.rotation), MathHelper.ToRadians(sd == 1f ? 75f : -75f), 0.2f); + + if (npc.ai[2] % 5f == 1f) + { + Vector2 mouthCenter = npc.Center + new Vector2(-80 * sd, 0).RotatedBy(npc.rotation); + + float factor = (npc.ai[2] - 75f) / 50f; + + float a = MathHelper.Lerp(1f, 0f, factor); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(mouthCenter, Vector2.Zero, new Color(55, 55, 55).MultiplyRGBA(new Color(a, a, a, a)), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.08f + (0.15f * factor), 10)); + } } npc.ai[2] += 1f; - if (npc.ai[2] >= 75) + if (npc.ai[2] >= 125f) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -538,6 +559,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + DoChargeBurst(npc, 0); + // Direction if (dukeLookAt != 0) { @@ -625,17 +648,14 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } // Spawn dust - int chargeDustAmt = 7; - for (int j = 0; j < chargeDustAmt; j++) - { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * pie / chargeDustAmt) + npc.Center; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int chargeDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); - Main.dust[chargeDust].noGravity = true; - Main.dust[chargeDust].noLight = true; - Main.dust[chargeDust].velocity /= 4f; - Main.dust[chargeDust].velocity -= npc.velocity; - } + Vector2 vel = npc.velocity; + vel.Normalize(); + vel *= 55f; + + DoChargeVisual(npc, phase); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(-90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) @@ -910,6 +930,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.spriteDirection = -npc.direction; } + + DoChargeBurst(npc, 1); } // Set velocity for spin @@ -1000,18 +1022,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.velocity *= 1.01f; } - // Spawn dust - int phase2ChargeDustAmt = 7; - for (int k = 0; k < phase2ChargeDustAmt; k++) - { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * pie / phase2ChargeDustAmt) + npc.Center; - Vector2 vector9 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); - Main.dust[phase2ChargeDust].noGravity = true; - Main.dust[phase2ChargeDust].noLight = true; - Main.dust[phase2ChargeDust].velocity /= 4f; - Main.dust[phase2ChargeDust].velocity -= npc.velocity; - } + DoChargeVisual(npc, phase); npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) @@ -1037,6 +1048,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + SoundEngine.PlaySound(OldDuke.OldDuke.VortexSpawnSound, npc.Center); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; @@ -1313,6 +1325,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.spriteDirection = -npc.direction; } + + DoChargeBurst(npc, 2); } // Pause @@ -1403,18 +1417,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.velocity *= 1.01f; } - // Spawn dust - int phase3ChargeDustAmt = 7; - for (int m = 0; m < phase3ChargeDustAmt; m++) - { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * pie / phase3ChargeDustAmt) + npc.Center; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int phase3ChargeDust = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); - Main.dust[phase3ChargeDust].noGravity = true; - Main.dust[phase3ChargeDust].noLight = true; - Main.dust[phase3ChargeDust].velocity /= 4f; - Main.dust[phase3ChargeDust].velocity -= npc.velocity; - } + DoChargeVisual(npc, phase); npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) @@ -1451,7 +1454,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.ai[2] == teleportPauseTimer / 2) modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer / 2) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer - 1f) { // Teleport location if (npc.ai[1] == 0f) @@ -1576,6 +1579,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); + SoundEngine.PlaySound(OldDuke.OldDuke.VortexSpawnSound, npc.Center); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; @@ -1649,9 +1653,50 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } if (SoundEngine.TryGetActiveSound(modNPC.RoarSoundSlot, out var roarSound) && roarSound.IsPlaying) - { roarSound.Position = npc.Center; + } + + static Color FireGreen = new Color(155, 255, 55); + + static void DoChargeBurst(NPC npc, int phase) + { + SoundEngine.PlaySound(phase > 1 ? OldDuke.OldDuke.DashSoundP3 : OldDuke.OldDuke.DashSound, npc.Center); + + if (phase > 1) + { + for (int i = 0; i < 30; i++) + { + float fl = Main.rand.NextFloat(-60f, 60f); + GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + (Vector2.Zero.DirectionTo(npc.velocity) * 20f) + new Vector2(0f, fl).RotatedBy(Vector2.Zero.AngleTo(npc.velocity)), (-npc.velocity * Main.rand.NextFloat(2f)).RotatedBy(MathHelper.ToRadians(fl)), false, 25, Main.rand.NextFloat(0.3f, 1.2f), FireGreen)); + } + + CalamityUtils.AddScreenshakeAt(npc.Center, 10f, 3000f); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3f, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2f, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20)); } } + + static void DoChargeVisual(NPC npc, int phase) + { + float progress = npc.ai[2]; + + int chargeTime = 36; + + Color col = Color.Lerp(phase > 0 ? FireGreen : new Color(100, 100, 100, 55), new Color(55, 55, 55, 55), progress / chargeTime); + + if (phase > 1) + { + if (Math.Floor(VisualTimerSystem.GlobalVisualTimer % 6f) < 1f) + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, npc.velocity / 3f, col, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.04f, 0.1f, 20)); + + (npc.ModNPC as OldDuke.OldDuke).NuclearOverlayVisual = 1f; + } + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new CustomSpark(npc.Center - (npc.velocity * 2f), npc.velocity / 2f, "CalamityMod/Particles/ForwardSmear", false, 10, Main.rand.NextFloat(0.3f, 0.5f), col, new Vector2(1f, Main.rand.NextFloat(1.45f, 1.6f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f))); + } } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 86c30b1902..06fc1fcea3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -155,7 +155,6 @@ namespace CalamityMod.NPCs // Cold debuff effects public bool IncreasedColdEffects_EskimoSet = false; - public bool IncreasedColdEffects_FrozenWings = false; public bool IncreasedColdEffects_CryoStone = false; // Electric effects @@ -165,7 +164,6 @@ namespace CalamityMod.NPCs public bool IncreasedHeatEffects_Fireball = false; public bool IncreasedHeatEffects_CinnamonRoll = false; public int IncreasedHeatEffects_FireBoots = 0; - public bool IncreasedHeatEffects_FlameWings = false; // Toxic Heart effect public bool IncreasedSicknessEffects_ToxicHeart = false; @@ -544,13 +542,11 @@ namespace CalamityMod.NPCs myClone.VulnerableToWater = VulnerableToWater; myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet; - myClone.IncreasedColdEffects_FrozenWings = IncreasedColdEffects_FrozenWings; myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone; myClone.IncreasedElectricityEffects_Unused = IncreasedElectricityEffects_Unused; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; myClone.IncreasedHeatEffects_CinnamonRoll = IncreasedHeatEffects_CinnamonRoll; myClone.IncreasedHeatEffects_FireBoots = IncreasedHeatEffects_FireBoots; - myClone.IncreasedHeatEffects_FlameWings = IncreasedHeatEffects_FlameWings; myClone.IncreasedSicknessEffects_ToxicHeart = IncreasedSicknessEffects_ToxicHeart; myClone.IncreasedWaterEffects_Amulet1 = IncreasedWaterEffects_Amulet1; myClone.IncreasedWaterEffects_Amulet2 = IncreasedWaterEffects_Amulet2; @@ -974,8 +970,6 @@ namespace CalamityMod.NPCs if (IncreasedColdEffects_EskimoSet) coldDamageMult += 0.25; - if (IncreasedColdEffects_FrozenWings) - coldDamageMult += 0.25; if (IncreasedColdEffects_CryoStone) coldDamageMult += 0.5; @@ -988,8 +982,6 @@ namespace CalamityMod.NPCs heatDamageMult += 0.25 * IncreasedHeatEffects_FireBoots; if (IncreasedHeatEffects_CinnamonRoll) heatDamageMult += CinnamonRoll.HeatDebuffBoost; - if (IncreasedHeatEffects_FlameWings) - heatDamageMult += 0.25; if (IncreasedSicknessEffects_ToxicHeart) sicknessDamageMult += 0.5; @@ -6476,7 +6468,7 @@ namespace CalamityMod.NPCs { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.camper && !player.StandingStill()) - modifiers.SourceDamage *= 0.1f; + modifiers.SourceDamage *= 0.5f; if (IsArmored()) //Hide combat text so we can draw our own for armored NPCs { @@ -6487,9 +6479,9 @@ namespace CalamityMod.NPCs if (EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc.type) || AquaticScourgeIDList.Includes(npc.type) || DestroyerIDList.Includes(npc.type) || AstrumDeusIDList.Includes(npc.type) || StormWeaverIDList.Includes(npc.type) || ThanatosIDList.Includes(npc.type) || npc.type == NPCType() || - npc.type == NPCType() || npc.type == NPCType()) + npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { - float damageMult = ThanatosIDList.Includes(npc.type) ? 0.35f : 0.5f; + float damageMult = ThanatosIDList.Includes(npc.type) ? 0.35f : npc.type == NPCType() ? 0.8f : 0.5f; if (item.CountsAsClass() && item.type != ItemType()) modifiers.SourceDamage *= damageMult; } @@ -6672,7 +6664,7 @@ namespace CalamityMod.NPCs } if (modPlayer.camper && !player.StandingStill()) - modifiers.SourceDamage *= 0.1f; + modifiers.SourceDamage *= 0.5f; if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ProjectileType()] > 0 || player.ownedProjectileCounts[ProjectileType()] > 0 || (player.Calamity().rOfResilienceCooldown == 0 && player.HeldItem.type == ItemType()))) modifiers.SourceDamage *= 0.1f; @@ -7408,8 +7400,8 @@ namespace CalamityMod.NPCs DeerclopsAI.hasTargetBeenInRange = false; DeerclopsAI.borderDelay = 7f * 60f; DeerclopsAI.borderScalar = 0f; - DeerclopsAI.innerBorder = DeerclopsAI.maxDRIncreaseDistance * 5f; - DeerclopsAI.outerBorder = DeerclopsAI.maxDRIncreaseDistance * 5f; + DeerclopsAI.innerBorder = DeerclopsAI.MaxDRIncreaseDistance * 5f; + DeerclopsAI.outerBorder = DeerclopsAI.MaxDRIncreaseDistance * 5f; } // Despawn Blazing Wheels and Spike Balls when a boss spawns so they're not annoying and stay in the arena diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index e4a82001c1..159d4cd730 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -109,9 +109,11 @@ namespace CalamityMod.NPCs #region Sky / Space // Harpy // Sky Glaze @ 3.33% IF Eye of Cthulhu dead + // Giant Harpy Feather @ 1.25% (0.67% in Vanilla) // Essence of Sunlight @ 50% IF Hardmode and not statue spawned case NPCID.Harpy: postEoC.Add(ModContent.ItemType(), 30); + npcLoot.ChangeDropRate(ItemID.GiantHarpyFeather, 1, 80); hardmode.AddIf(() => !npc.SpawnedFromStatue, ModContent.ItemType(), 2); break; @@ -133,18 +135,24 @@ namespace CalamityMod.NPCs #region Underground // Giant Shelly + // Giant Shell @ 100% IF Hardmode + // OTHERWISE, // Giant Shell @ 14.29% Normal, 25% Expert+ case NPCID.GiantShelly: case NPCID.GiantShelly2: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + hardmode.Add(ModContent.ItemType()); + hardmode.OnFailedConditions(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); break; // Crawdad + // Craw Carapace @ 100% IF Hardmode + // OTHERWISE, // Craw Carapace @ 14.29% Normal, 25% Expert+ // Armor Polish @ 1% Normal, 2% Expert+ case NPCID.Crawdad: case NPCID.Crawdad2: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + hardmode.Add(ModContent.ItemType()); + hardmode.OnFailedConditions(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.ArmorPolish, 100, 50)); break; @@ -176,6 +184,27 @@ namespace CalamityMod.NPCs npcLoot.Add(ModContent.ItemType()); break; + // Skeleton Archer + // Magic Quiver @ 5% (2.5% in Vanilla) + // Marrow @ 2.5% (0.5% in Vanilla) + case NPCID.SkeletonArcher: + npcLoot.ChangeDropRate(ItemID.MagicQuiver, 1, 20); + npcLoot.ChangeDropRate(ItemID.Marrow, 1, 40); + break; + + // Armored Skeleton + // Beam Sword @ 5% (0.67% in Vanilla) + case NPCID.ArmoredSkeleton: + npcLoot.ChangeDropRate(ItemID.BeamSword, 1, 20); + break; + + // Black Recluse + // Poison Staff @ 5% (2.5% in Vanilla) + case NPCID.BlackRecluse: + case NPCID.BlackRecluseWall: + npcLoot.ChangeDropRate(ItemID.PoisonStaff, 1, 20); + break; + // Mimic // Drops all of its items Calamity Style @ 25% each // This requires erasing its vanilla behavior. @@ -373,18 +402,21 @@ namespace CalamityMod.NPCs // Life Jelly @ 10% Normal, 14.29% Expert+ case NPCID.PinkJellyfish: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 7)); + npcLoot.ChangeDropRate(ItemID.JellyfishNecklace, 1, 25); break; // Blue Jellyfish // Cleansing Jelly @ 10% Normal, 14.29% Expert+ case NPCID.BlueJellyfish: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 7)); + npcLoot.ChangeDropRate(ItemID.JellyfishNecklace, 1, 25); break; // Green Jellyfish // Vital Jelly @ 12.5% Normal, 20% Expert+ case NPCID.GreenJellyfish: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 8, 5)); + npcLoot.ChangeDropRate(ItemID.JellyfishNecklace, 1, 25); break; // Piranha, Arapaima, Blood Feeder @@ -409,7 +441,7 @@ namespace CalamityMod.NPCs // Jellyfish Necklace @ 1% case NPCID.BloodJelly: case NPCID.FungoFish: - npcLoot.Add(ItemID.JellyfishNecklace, 100); + npcLoot.Add(ItemID.JellyfishNecklace, 25); break; #endregion @@ -551,7 +583,7 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 15, 10)); break; - //The ectoplasm extra drops got moved to the list section; just like moss hornets + // The ectoplasm extra drops got moved to the list section; just like moss hornets // Hardmode Dungeon Melee Skeletons // Wisp in a Bottle @ 0.5% INSTEAD OF 0.25% @@ -602,10 +634,18 @@ namespace CalamityMod.NPCs #region Hell - // Hellbat. + // Hellbat // Flarebat Staff @ 4% + // Magma Stone @ 1.33% (0.67% in Vanilla) case NPCID.Hellbat: npcLoot.Add(ModContent.ItemType(), 25); + npcLoot.ChangeDropRate(ItemID.MagmaStone, 1, 75); + break; + + // Lava Bat + // Magma Stone @ 3.33% (2% in Vanilla) + case NPCID.Lavabat: + npcLoot.ChangeDropRate(ItemID.MagmaStone, 1, 30); break; // Fire Imp @@ -617,10 +657,12 @@ namespace CalamityMod.NPCs // Demon, Voodoo Demon // Bladecrest Oathsword @ 2%, 6.67% after defeating EoW/BoC + // Demon Scythe @ 5% (2.86% in Vanilla) case NPCID.Demon: case NPCID.VoodooDemon: npcLoot.AddIf((info) => !NPC.downedBoss2, ModContent.ItemType(), 50); npcLoot.AddIf((info) => NPC.downedBoss2, ModContent.ItemType(), 15); + npcLoot.ChangeDropRate(ItemID.DemonScythe, 1, 20); break; // Bone Serpent diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 2058a665ac..c50caa0208 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -216,6 +216,7 @@ namespace CalamityMod.NPCs "Faith", // <@!509050283871961123> (toasty1007) "Xsiana", // <@!625780237489143839> (lokistic) "Lain", // <@!655201622863118337> (literallyadeerfr) + "Hamis", // <@!608455754093035521> (haefer) }; private static readonly string[] TavernkeepNames = { diff --git a/NPCs/CalamityTileCollisionHarmNPC.cs b/NPCs/CalamityTileCollisionHarmNPC.cs index 0e1c4d420a..adf32e32a1 100644 --- a/NPCs/CalamityTileCollisionHarmNPC.cs +++ b/NPCs/CalamityTileCollisionHarmNPC.cs @@ -122,13 +122,17 @@ namespace CalamityMod.NPCs { float oldVelocity = OldVelocity.Length(); + npc.Center += ForcedVel; + ForcedVel *= 0.995f; + if (Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40)) { if (!ForceVelocityOnly) { - int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); + int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, (ForcedVel.Length() > 0 ? 1f : 0f), 1f)); Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI); wallImpact.DamageType = DamageClass.Melee; + wallImpact.CritChance = (int)attacker.GetCritChance(DamageClass.Melee) + attacker.HeldItem.crit; } PotentialEnergyDamage = 0; @@ -136,8 +140,6 @@ namespace CalamityMod.NPCs hitVoid = false; } - npc.Center += ForcedVel; - ForcedVel *= 0.995f; if (packetTimer % 30 == 0) npc.SyncMotionToServer(); if (!WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40) && !hitVoid) diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index fbb606fc63..b12922cb56 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.DesertScourge if (!shouldFly) { - NPC.velocity.Y += 0.15f; + NPC.velocity.Y += (death ? 0.125f : 0.1f); if (NPC.velocity.Y > 0f && Math.Abs(NPC.Center.Y - Main.player[NPC.target].Center.Y) > 180f) NPC.velocity.Y += 0.05f; diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 814c36893e..69bd6158db 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -363,7 +363,7 @@ namespace CalamityMod.NPCs.DesertScourge if (!shouldFly) { - NPC.velocity.Y += 0.15f; + NPC.velocity.Y += 0.1f; if (NPC.velocity.Y > maxChaseSpeed) NPC.velocity.Y = maxChaseSpeed; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 09e689fb5f..3659112078 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -662,7 +662,7 @@ namespace CalamityMod.NPCs.DesertScourge } else if (!shouldFly) { - NPC.velocity.Y += 0.15f; + NPC.velocity.Y += (death ? 0.125f : 0.1f); if (NPC.Center.Y - player.Center.Y < -180f) { NPC.velocity.Y += 0.05f; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 3c7fa5266d..d4eb16b82b 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -33,6 +33,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/ExoMechs/THanosLaser"); + public static readonly SoundStyle GFBeam = new("CalamityMod/Sounds/Custom/ExoMechs/THanosGFBeam"); + + public static readonly SoundStyle ThanatosHitSoundOpen = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen", 2) { Volume = 0.5f }; public static readonly SoundStyle ThanatosHitSoundClosed = new("CalamityMod/Sounds/NPCHit/ThanatosHitClosed", 3) { Volume = 0.4f }; @@ -903,7 +906,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { //Commented out in case we decide its better for it to simply play from anywhere in range //if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) - LaserSoundSlot = SoundEngine.PlaySound(LaserSound, NPC.Center); + LaserSoundSlot = SoundEngine.PlaySound((Main.zenithWorld ? GFBeam : LaserSound), NPC.Center); // Create a bunch of lightning bolts in the sky ExoMechsSky.CreateLightningBolt(12); diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 191cabdc62..8e18fc78ad 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -385,17 +385,19 @@ namespace CalamityMod.NPCs.HiveMind switch (choice) { case 0: + type = !NPC.AnyNPCs(NPCID.EaterofSouls) ? NPCID.EaterofSouls : 0; + break; + case 1: - type = NPC.CountNPCS(NPCID.EaterofSouls) < 2 ? NPCID.EaterofSouls : 0; + type = !NPC.AnyNPCs(NPCID.DevourerHead) ? NPCID.DevourerHead : 0; break; case 2: - type = NPC.CountNPCS(NPCID.DevourerHead) < 2 ? NPCID.DevourerHead : 0; + type = !NPC.AnyNPCs(ModContent.NPCType()) ? ModContent.NPCType() : 0; break; case 3: - case 4: - type = NPC.CountNPCS(ModContent.NPCType()) < 2 ? ModContent.NPCType() : 0; + type = (!NPC.AnyNPCs(NPCID.Corruptor) && death) ? NPCID.Corruptor : 0; break; default: @@ -629,7 +631,7 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { - int maxSpawns = bossRush ? 10 : death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); + int maxSpawns = bossRush ? 16 : death ? 8 : revenge ? 6 : expertMode ? Main.rand.Next(4, 6) : Main.rand.Next(3, 5); int maxDankSpawns = bossRush ? 4 : death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; for (int i = 0; i < maxSpawns; i++) @@ -1115,13 +1117,6 @@ namespace CalamityMod.NPCs.HiveMind { phase2timer = 0; NPC.ai[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height)) - { - int maxEaters = revenge ? 3 : 2; - if (NPC.CountNPCS(NPCID.EaterofSouls) < maxEaters && NPC.Distance(Main.player[NPC.target].Center) > 80f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); - } - if (NPC.ai[0] == 6f) { NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / arcTime * -rotationDirection); @@ -1362,19 +1357,20 @@ namespace CalamityMod.NPCs.HiveMind { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.rand.NextBool(30)) + if (Main.rand.NextBool(15)) { - if (NPC.CountNPCS(NPCID.EaterofSouls) < 3) + int hiveBlobCount = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); + if (hiveBlobCount < 3) NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()); } - if (Main.rand.NextBool(60)) + if (Main.rand.NextBool(30)) { if (NPC.CountNPCS(NPCID.EaterofSouls) < 2) NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); } - if (Main.rand.NextBool(150)) + if (Main.rand.NextBool(45)) { if (!NPC.AnyNPCs(NPCID.DevourerHead)) NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.DevourerHead); diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index fe9bf61205..7fde916b9d 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -316,15 +316,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - // waffles% stipulation: eidolists are accessible by beating cal clone, even without beating WoF - bool hardmodeOrCalClone = Main.hardMode || DownedBossSystem.downedCalamitasClone; - if (!hardmodeOrCalClone || !spawnInfo.Player.InAbyss()) + if (!spawnInfo.Player.InAbyss()) return 0f; // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. if (NPC.AnyNPCs(NPC.type)) return 0f; - + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) return Main.remixWorld ? 2.25f : 0.25f; diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 6788da55c2..23da274c57 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -109,7 +109,6 @@ namespace CalamityMod.NPCs.NormalNPCs { var weapons = new int[] { - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), }; diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index d2e311d506..88e48e8dbe 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -20,6 +20,8 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; +using CalamityMod.Systems; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -38,14 +40,32 @@ namespace CalamityMod.NPCs.OldDuke [AutoloadBossHead] public class OldDuke : ModNPC { + public static Color GlowColor = new Color(55, 255, 25, 0); + + // Old Duke doesn't have a phase 3 in normal mode + public const float LifePercentagePhase2_Normal = 0.5f; + public const float LifePercentagePhase2_Revenge = 0.7f; + public const float LifePercentagePhase2_Death = 0.8f; + public const float LifePercentagePhase3_Expert = 0.2f; + public const float LifePercentagePhase3_Revenge = 0.35f; + public const float LifePercentagePhase3_Death = 0.5f; + + public int Phase = 0; + public float NuclearOverlayVisual = 0f; + public static readonly SoundStyle HuffSound = new("CalamityMod/Sounds/Custom/OldDukeHuff"); public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/OldDukeRoar"); public static readonly SoundStyle VomitSound = new("CalamityMod/Sounds/Custom/OldDukeVomit"); + public static readonly SoundStyle VortexSpawnSound = new("CalamityMod/Sounds/Custom/OldDukeVortexSpawn"); + public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/OldDukeDash"); + public static readonly SoundStyle DashSoundP3 = new("CalamityMod/Sounds/Custom/OldDukeDashP3"); public SlotId RoarSoundSlot; public static Asset GlowTexture; + public float shake = 0f; + public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 7; @@ -66,6 +86,7 @@ namespace CalamityMod.NPCs.OldDuke public override void SetDefaults() { + NPC.alpha = 255; NPC.width = 150; NPC.height = 100; NPC.aiStyle = -1; @@ -124,6 +145,21 @@ namespace CalamityMod.NPCs.OldDuke public override void AI() { + shake = MathHelper.Lerp(shake, 0f, 0.1f); + + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool phase2 = lifeRatio <= (death ? LifePercentagePhase2_Death : revenge ? LifePercentagePhase2_Revenge : LifePercentagePhase2_Normal); + bool phase3 = lifeRatio <= (death ? LifePercentagePhase3_Death : (revenge ? LifePercentagePhase3_Revenge : LifePercentagePhase3_Expert)) && expertMode; + + Phase = phase3 ? 2 : phase2 ? 1 : 0; + NuclearOverlayVisual = (Phase == 2 && NPC.Calamity().newAI[1] != 1) ? MathHelper.Lerp(NuclearOverlayVisual, 0.2f, 0.2f) : MathHelper.Lerp(NuclearOverlayVisual, 0f, 0.1f); + OldDukeAI.VanillaOldDukeAI(NPC, Mod); } @@ -207,10 +243,23 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y = frameHeight * 6; } } + + if (NPC.ai[0] == -1f) + { + if (NPC.ai[2] >= 75f) + NPC.frame.Y = frameHeight * 6; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + Color finalDrawColor = Color.Lerp(drawColor, Color.White, NuclearOverlayVisual); + Color overlayDrawColor = Color.Lerp(Color.Transparent, Color.LimeGreen.MultiplyRGBA(new Color(255, 255, 255, 0)), NuclearOverlayVisual); + finalDrawColor = Color.Lerp(finalDrawColor, Color.LimeGreen.MultiplyRGBA(new Color(255, 255, 255, 0)), NuclearOverlayVisual); + + finalDrawColor = Color.Lerp(finalDrawColor, Color.Transparent, (float)NPC.alpha / 255f); + overlayDrawColor = Color.Lerp(overlayDrawColor, Color.Transparent, (float)NPC.alpha / 255f); + SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) { @@ -266,6 +315,7 @@ namespace CalamityMod.NPCs.OldDuke { Color afterimageColor = color; afterimageColor = Color.Lerp(afterimageColor, drawLerpColor, drawLerpValue); + afterimageColor = Color.Lerp(afterimageColor, overlayDrawColor, NuclearOverlayVisual); afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; @@ -280,9 +330,7 @@ namespace CalamityMod.NPCs.OldDuke float afterimageScale = 0f; if (NPC.ai[0] == -1f) - { secondAfterimageAmt = 0; - } if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f) { @@ -315,10 +363,7 @@ namespace CalamityMod.NPCs.OldDuke { for (int j = 0; j < secondAfterimageAmt; j++) { - Color secondAfterimageColor = drawColor; - secondAfterimageColor = Color.Lerp(secondAfterimageColor, drawLerpColor, drawLerpValue); - secondAfterimageColor = NPC.GetAlpha(secondAfterimageColor); - secondAfterimageColor *= 1f - afterimageOpacity; + Color secondAfterimageColor = Color.Lerp(finalDrawColor, Color.Transparent, (float)j / (float)secondAfterimageAmt); Vector2 secondAfterimagePos = NPC.Center + (j / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos; secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); @@ -326,13 +371,18 @@ namespace CalamityMod.NPCs.OldDuke } } - Color finalDrawColor = drawColor; - finalDrawColor = Color.Lerp(finalDrawColor, drawLerpColor, drawLerpValue); - finalDrawColor = NPC.GetAlpha(finalDrawColor); Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (NPC.ai[0] > 9f ? finalDrawColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + drawLocation += new Vector2(Main.rand.NextFloat(-shake, shake), Main.rand.NextFloat(-shake, shake)); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(finalDrawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(overlayDrawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + float auraOutset = 6f + (float)(Math.Sin(VisualTimerSystem.GlobalVisualTimer / 10f) * 10f); + for (float i = 0f; i < 360f; i += 90f) + spriteBatch.Draw(texture2D15, drawLocation + new Vector2(auraOutset, 0).RotatedBy(MathHelper.ToRadians(i)), NPC.frame, NPC.GetAlpha(overlayDrawColor.MultiplyRGBA(new Color(0.4f, 0.4f, 0.4f, 0.4f))), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f) { @@ -486,12 +536,6 @@ namespace CalamityMod.NPCs.OldDuke { if (NPC.life > 0) { - int onHitDust = 0; - while (onHitDust < hit.Damage / NPC.lifeMax * 100.0) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); - onHitDust++; - } } else { diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index be2fa69fef..8d259c4bd9 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -2,9 +2,12 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -167,6 +170,15 @@ namespace CalamityMod.NPCs.OldDuke public override void OnKill() { + for (int i = 0; i < 15; i++) + { + float sc = Main.rand.NextFloat(1f, 3f); + Vector2 vel = new Vector2(Main.rand.NextFloat(10, 25), 0).RotatedByRandom(MathHelper.TwoPi); + + GeneralParticleHandler.SpawnParticle(new CustomSpark(NPC.Center, vel, "CalamityMod/Projectiles/Boss/OldDukeToothBallSpike", true, 40, sc + 0.5f, OldDuke.GlowColor, Vector2.One)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(NPC.Center, vel, "CalamityMod/Projectiles/Boss/OldDukeToothBallSpike", true, 40, sc, Color.White, Vector2.One, false, affectedByLight: true)); + } + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); @@ -220,6 +232,33 @@ namespace CalamityMod.NPCs.OldDuke return true; } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + float velDist = NPC.velocity.Length(); + + Vector2 vel = NPC.velocity; + vel.Normalize(); + + if (velDist > 5) + { + float sc = velDist - 5; + if (Main.rand.NextBool(3)) + GeneralParticleHandler.SpawnParticle(new SparkParticle(NPC.Center + new Vector2(Main.rand.NextFloat(5, 30), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)), NPC.velocity, false, 20, Main.rand.NextFloat(0.5f, 1.5f), OldDuke.GlowColor, true)); + } + + if (Main.rand.NextBool(3)) + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(NPC.Center, -(vel * 4f).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)), OldDuke.GlowColor, Color.DarkSlateGray, Main.rand.NextFloat(0.5f, 1.5f), 150f)); + + Asset tex = ModContent.Request(Texture); + for (int i = 0; i < 360; i += 90) + { + Main.EntitySpriteDraw(tex.Value, NPC.Center + new Vector2(0, 4) - Main.screenPosition + new Vector2(4, 0).RotatedBy(MathHelper.ToRadians(i)), tex.Frame(), OldDuke.GlowColor, NPC.rotation, tex.Frame().Center(), NPC.scale, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, NPC.Center + new Vector2(0, 4) - Main.screenPosition + new Vector2(8, 0).RotatedBy(MathHelper.ToRadians(i)), tex.Frame(), OldDuke.GlowColor, NPC.rotation, tex.Frame().Center(), NPC.scale, SpriteEffects.None); + } + + return base.PreDraw(spriteBatch, screenPos, drawColor); + } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index fd999977ae..e2b4fdfe64 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -251,6 +251,7 @@ namespace CalamityMod.NPCs.OldDuke afterimageColor = Color.Lerp(afterimageColor, Color.Lime, 0.5f); afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (afterimageAmt - i) / 15f; + afterimageColor.A = 0; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index d829991d28..600cdb43e7 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -171,31 +171,39 @@ namespace CalamityMod.NPCs.Perforator // Spit attack in Rev // Spit ichor blobs in Death - float spitDistance = 800f; - float tooCloseToSpitDistance = 160f; - bool canSpit = (NPC.Distance(player.Center) <= spitDistance && NPC.Distance(player.Center) > tooCloseToSpitDistance && - (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation() && - Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) || NPC.Calamity().newAI[1] == 1f; + float spitDistance = 960f; + float tooCloseToSpitDistance = 320f; + bool isInRangeToSpit = NPC.Distance(player.Center) <= spitDistance && NPC.Distance(player.Center) > tooCloseToSpitDistance; + bool headIsTurnedTowardsTarget = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation(); + bool canHitTarget = Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + bool alwaysAbleToSpit = NPC.Calamity().newAI[1] == 1f; + bool canSpit = (isInRangeToSpit && headIsTurnedTowardsTarget && canHitTarget) || alwaysAbleToSpit; if (canSpit) { - NPC.Calamity().newAI[0] += 1f; - float spitGateValue = 180f; - bool spit = NPC.Calamity().newAI[0] >= spitGateValue; + float spitGateValue = 120f; + if (NPC.Calamity().newAI[0] < spitGateValue) + NPC.Calamity().newAI[0] += 1f; + + // Only spit if all the conditions are met, in order to make the attack actually dangerous + bool spit = NPC.Calamity().newAI[0] >= spitGateValue && isInRangeToSpit && headIsTurnedTowardsTarget && canHitTarget; + + // Telegraph for half a second, or for however long it takes for the spit conditions to be met float telegraphSpitGateValue = spitGateValue - 30f; bool telegraphSpit = NPC.Calamity().newAI[0] >= telegraphSpitGateValue; + + // Spit from the mouth hole thing...yeah Vector2 spitLocation = NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 20f; if (telegraphSpit) { NPC.Calamity().newAI[1] = 1f; - Vector2 dustVelocity = spitLocation - spitLocation; int dustType = Main.rand.NextBool() ? DustID.Ichor : DustID.Blood; for (int k = 0; k < 10; k++) { - int dust = Dust.NewDust(spitLocation, 0, 0, dustType); + int dust = Dust.NewDust(spitLocation, 1, 1, dustType); Main.dust[dust].position = spitLocation + Main.rand.NextVector2CircularEdge(25f, 25f); - Main.dust[dust].velocity = spitLocation - Main.dust[dust].position; - Main.dust[dust].scale = dustType == DustID.Ichor ? 1f : 3f; + Main.dust[dust].velocity = (spitLocation - Main.dust[dust].position).SafeNormalize(Vector2.UnitY) * 2f; + Main.dust[dust].scale = dustType == DustID.Ichor ? 1f : 2f; Main.dust[dust].noGravity = true; } } @@ -210,7 +218,7 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int spitProjectileAmount = 8; - float spitProjectileBaseVelocity = 12f; + float spitProjectileBaseVelocity = 16f; float spitProjectileRandomVelocityLimit = 3f; for (int i = 0; i < spitProjectileAmount; i++) { diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 2b77994911..b0120e825c 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -141,14 +141,14 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - float speed = 0.15f; - float turnSpeed = 0.1f; + float speed = revenge ? 0.2f : 0.15f; + float turnSpeed = revenge ? 0.15f : 0.1f; if (expertMode) { - float velocityScale = (death ? 0.15f : 0.1f) * enrageScale; + float velocityScale = (death ? 0.2f : 0.14f) * enrageScale; speed += velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.1f : 0.07f) * enrageScale; + float accelerationScale = (death ? 0.15f : 0.1f) * enrageScale; turnSpeed += accelerationScale * (1f - lifeRatio); } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 54525678bc..144a0ed936 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -114,6 +114,7 @@ namespace CalamityMod.NPCs.Perforator writer.Write(small); writer.Write(medium); writer.Write(large); + writer.Write(NPC.localAI[2]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -123,6 +124,7 @@ namespace CalamityMod.NPCs.Perforator small = reader.ReadBoolean(); medium = reader.ReadBoolean(); large = reader.ReadBoolean(); + NPC.localAI[2] = reader.ReadSingle(); } public override void AI() @@ -153,7 +155,7 @@ namespace CalamityMod.NPCs.Perforator // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; - bool phase3 = lifeRatio < 0.4f && revenge; + bool phase3 = medium && revenge; // Enrage if ((!player.ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) @@ -201,17 +203,17 @@ namespace CalamityMod.NPCs.Perforator else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - //GFB seed shenanigans: Behavior during the suck + // GFB seed shenanigans: Behavior during the suck if (NPC.localAI[1] >= 6f) { - //Leak projectiles everywhere and start healing + // Leak projectiles everywhere and start healing int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); int spread = Main.rand.Next(-45, 46); Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread)), type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); - //Heals 10 times per second for 0.1% of its health each = 1% per second + // Heals 10 times per second for 0.1% of its health each = 1% per second if (Main.netMode != NetmodeID.MultiplayerClient) { int healAmt = (int)(NPC.lifeMax / 1000); @@ -240,6 +242,11 @@ namespace CalamityMod.NPCs.Perforator else wormsAlive = 0; + // Do not spit from side mouth while the large worm is alive + // Death Mode ignores this + if (largeWormAlive && !death) + phase3 = false; + NPC.Calamity().DR = wormsAlive * 0.3f; if (NPC.ai[3] == 0f && NPC.life > 0) @@ -401,21 +408,66 @@ namespace CalamityMod.NPCs.Perforator return; } - if (Main.netMode != NetmodeID.MultiplayerClient) + // Side mouth starts spitting when it opens + if (phase3) { - // Side mouth starts spitting when it opens (WIP) - if (phase3) + NPC.localAI[2] += 1f; + if (NPC.frame.Y / (TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]) == 5 && NPC.localAI[2] >= 0f) { - NPC.localAI[2] += 1f; - if (NPC.frame.Y / (TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]) == 5 && NPC.localAI[2] >= 0f) - { - // Ensure it only spits once - NPC.localAI[2] = -10f; + // Ensure it only spits once + // Spits half as much while the medium worm is alive + NPC.localAI[2] = mediumWormAlive ? -70f : -10f; - //SoundEngine.PlaySound(SoundID.Item17, ); + Vector2 centerOffset = new Vector2(NPC.direction == 1 ? 52f : -52f, -4f); + Vector2 mouthLocation = NPC.Center + centerOffset; + Vector2 spitVelocity = (mouthLocation + (Vector2.UnitX * 100f * NPC.direction) - mouthLocation).SafeNormalize(Vector2.UnitY) * 6f; + + SoundEngine.PlaySound(SoundID.Item17, mouthLocation); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxProjectiles = 3; + Vector2 dustSpawnBox = new Vector2(12f, 12f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; + for (int i = 0; i < maxProjectiles; i++) + { + bool ichor = Main.rand.NextBool(); + int type = ichor ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 randomizedProjectileSpawnLocation = mouthLocation + Main.rand.NextVector2CircularEdge(4f, 4f); + Vector2 randomizedProjectileVelocity = spitVelocity + Main.rand.NextVector2CircularEdge(1.5f, 1.5f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), randomizedProjectileSpawnLocation, randomizedProjectileVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + + float dustSpeed = Main.rand.NextFloat(3.0f, 9.0f); + float angleRandom = 0.05f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0.0f).RotatedBy(randomizedProjectileVelocity.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2.0f * angleRandom); + + if (ichor) + { + for (int j = 0; j < 4; j++) + { + int ichorDust = Dust.NewDust(randomizedProjectileSpawnLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, DustID.Ichor); + Main.dust[ichorDust].velocity = dustVelocity; + } + } + else + { + for (int j = 0; j < 4; j++) + { + int bloodDust = Dust.NewDust(randomizedProjectileSpawnLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, DustID.Blood); + Main.dust[bloodDust].velocity = dustVelocity; + Main.dust[bloodDust].scale = 2f; + } + } + } } } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { NPC.localAI[0] += 1f; if (NPC.localAI[0] >= (revenge ? 200f : 250f) + wormsAlive * 150f && NPC.position.Y + NPC.height < player.position.Y && Vector2.Distance(player.Center, NPC.Center) > 80f) { @@ -436,6 +488,8 @@ namespace CalamityMod.NPCs.Perforator Vector2 destination = wormsAlive > 0 ? player.Center : NPC.Center - Vector2.UnitY * 100f; Vector2 projectileVelocity = new Vector2(Vector2.Normalize(destination - NPC.Center).X * velocity, -velocity); float rotation = MathHelper.ToRadians(spread); + Vector2 dustSpawnBox = new Vector2(12f, 12f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); @@ -443,23 +497,27 @@ namespace CalamityMod.NPCs.Perforator Vector2 projectileSpawnLocation = NPC.Center + Vector2.Normalize(perturbedSpeed) * 50f; Vector2 projectileVelocityRandomized = perturbedSpeed + randomVelocity; + float dustSpeed = Main.rand.NextFloat(3.0f, 9.0f); + float angleRandom = 0.05f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0.0f).RotatedBy(projectileVelocityRandomized.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2.0f * angleRandom); + if (ichor) { for (int j = 0; j < 4; j++) { - int ichorDust = Dust.NewDust(NPC.position, 12, 12, DustID.Ichor); - Main.dust[ichorDust].position = projectileSpawnLocation; - Main.dust[ichorDust].velocity = projectileVelocityRandomized; + int ichorDust = Dust.NewDust(projectileSpawnLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, DustID.Ichor); + Main.dust[ichorDust].velocity = dustVelocity; } } else { for (int j = 0; j < 4; j++) { - int bloodDust = Dust.NewDust(NPC.position, 12, 12, DustID.Blood); - Main.dust[bloodDust].position = projectileSpawnLocation; - Main.dust[bloodDust].velocity = projectileVelocityRandomized; - Main.dust[bloodDust].scale = 3f; + int bloodDust = Dust.NewDust(projectileSpawnLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, DustID.Blood); + Main.dust[bloodDust].velocity = dustVelocity; + Main.dust[bloodDust].scale = 2f; } } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index eb320135a4..7b264b2ddc 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -165,7 +165,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); + Vector2 halfSizeTexture = NPC.frame.Size() / 2f; int afterimageAmt = 5; Vector2 drawLocation = NPC.Center - screenPos; diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index a12db2106d..6146ad8433 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -124,10 +124,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); + Vector2 halfSizeTexture = NPC.frame.Size() / 2f; Vector2 drawLocation = NPC.Center - screenPos; drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + drawLocation += halfSizeTexture * NPC.scale + Vector2.UnitY * NPC.gfxOffY; Color backAfterimageColor = PlaguebringerGoliath.BackglowColor * NPC.Opacity; for (int i = 0; i < 10; i++) diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs index b09d815870..abbf84aaa3 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs @@ -9,6 +9,7 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.NPCs.PrimordialWyrm; namespace CalamityMod.NPCs.PrimordialWyrm { @@ -176,8 +177,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + // this math is so incredibly scuffed. please someone fix it i dont even know what any of this actually does + float brightness = 1f; + float nameWasTooLong = Main.GameUpdateCount * 0.01f; + float saneVelocity = MathHelper.Clamp((int)PrimordialWyrmHead.PWHeadVelocity, 6f, 8f); + brightness = MathF.Sin(nameWasTooLong * (6f + saneVelocity) - NPC.whoAmI); + brightness = MathHelper.Clamp(brightness, 0.25f, 1f); texture = GlowTexture.Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * (NPC.Opacity * brightness), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs index 07d140904b..c89ee5b210 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs @@ -175,8 +175,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + // this math is so incredibly scuffed. please someone fix it i dont even know what any of this actually does + float brightness = 1f; + float nameWasTooLong = Main.GameUpdateCount * 0.01f; + float saneVelocity = MathHelper.Clamp((int)PrimordialWyrmHead.PWHeadVelocity, 6f, 8f); + brightness = MathF.Sin(nameWasTooLong * (6f + saneVelocity) - NPC.whoAmI); + brightness = MathHelper.Clamp(brightness, 0.25f, 1f); texture = GlowTexture.Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * (NPC.Opacity * brightness), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 183ba8cdad..3e312cbf39 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -53,6 +53,9 @@ namespace CalamityMod.NPCs.PrimordialWyrm set => NPC.Calamity().newAI[0] = value; } + // Store velocity for use with other segments + public static float PWHeadVelocity; + // Base distance from the target for most attacks private const float baseDistance = 1000f; @@ -1457,8 +1460,19 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + // this math is so incredibly scuffed. please someone fix it i dont even know what any of this actually does + float brightness = 1f; + float nameWasTooLong = Main.GameUpdateCount * 0.01f; + float saneVelocity = MathHelper.Clamp((int)NPC.velocity.Length(), 6f, 8f); + PWHeadVelocity = saneVelocity; + brightness = MathF.Sin(nameWasTooLong * (6f + saneVelocity) - NPC.whoAmI); + brightness = MathHelper.Clamp(brightness, 0.25f, 1f); texture = GlowTexture.Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * (NPC.Opacity * brightness), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + // if anyone needs to debug this piece of shit code, i leave this to you + //Main.NewText("vec length: " + NPC.velocity.Length()); + //Main.NewText("sane vel: " + saneVelocity); + //Main.NewText("brightness: " + brightness, new Color(255, 0, brightness * 128)); // this line doesnt even work LMAO return false; } @@ -1468,6 +1482,13 @@ namespace CalamityMod.NPCs.PrimordialWyrm potionType = ModContent.ItemType(); } + public override void OnKill() + { + // Mark Primordial Wyrm as dead + DownedBossSystem.downedPrimordialWyrm = true; + CalamityNetcode.SyncWorld(); + } + public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType()); diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs index 83b94b364b..cb7c3ff52e 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs @@ -137,8 +137,14 @@ namespace CalamityMod.NPCs.PrimordialWyrm center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + // this math is so incredibly scuffed. please someone fix it i dont even know what any of this actually does + float brightness = 1f; + float nameWasTooLong = Main.GameUpdateCount * 0.01f; + float saneVelocity = MathHelper.Clamp((int)PrimordialWyrmHead.PWHeadVelocity, 6f, 8f); + brightness = MathF.Sin(nameWasTooLong * (6f + saneVelocity) - NPC.whoAmI); + brightness = MathHelper.Clamp(brightness, 0.25f, 1f); texture = GlowTexture.Value; - spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, center, NPC.frame, Color.White * (NPC.Opacity * brightness), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index e677e317fd..9d19bc6ba6 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -32,8 +32,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.defense = 6; NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 360 : 180; NPC.knockBackResist = 0.7f; - AnimationType = 121; - NPC.Opacity = 0.8f; + AnimationType = NPCID.Slimer; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -60,6 +59,12 @@ namespace CalamityMod.NPCs.SlimeGod }); } + public override void AI() + { + Vector3 light = new Vector3(0.5f, 0.1f, 0.5f); + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + } + public override void HitEffect(NPC.HitInfo hit) { if (Main.netMode != NetmodeID.MultiplayerClient && NPC.life <= 0) @@ -70,10 +75,9 @@ namespace CalamityMod.NPCs.SlimeGod Color dustColor = Color.Lavender; dustColor.A = 150; + for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); } public override void OnKill() { diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index ff4ec21caf..e8df94c69d 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 90; NPC.knockBackResist = 0.9f; AnimationType = NPCID.CorruptSlime; - NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -49,6 +48,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + Vector3 light = new Vector3(0.5f, 0.1f, 0.5f); + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; } @@ -56,16 +58,14 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Lavender; dustColor.A = 150; + for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index b037980269..4cb9744c71 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 220 : 110; NPC.knockBackResist = 0.8f; AnimationType = NPCID.CorruptSlime; - NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -61,6 +60,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + Vector3 light = new Vector3(0.5f, 0.1f, 0.1f); + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + NPC.damage = (NPC.velocity.Y == 0f || NPC.velocity.Length() < 3f) ? 0 : NPC.defDamage; } @@ -68,16 +70,14 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Crimson; dustColor.A = 150; + for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 10079952a5..9f321b1817 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -17,7 +17,9 @@ namespace CalamityMod.NPCs.SlimeGod public class CrimsonSlimeSpawn2 : ModNPC { public float spikeTimer = 60f; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CrimsonSlimeSpawn.DisplayName"); + public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 5; @@ -36,7 +38,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.defense = 6; NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 260 : 130; NPC.knockBackResist = 0.7f; - NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -61,13 +62,18 @@ namespace CalamityMod.NPCs.SlimeGod public override void FindFrame(int frameHeight) { + Vector3 light = new Vector3(0.5f, 0.1f, 0.1f); + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + int frameY = 1; if (!Main.dedServ) { if (TextureAssets.Npc[Type].Value is null) return; + frameY = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; } + int aiState = 0; if (NPC.aiAction == 0) aiState = NPC.velocity.Y >= 0f ? (NPC.velocity.Y <= 0f ? (NPC.velocity.X == 0f ? 0 : 1) : 3) : 2; @@ -79,6 +85,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.frameCounter++; if (aiState == 4) NPC.frameCounter++; + if (NPC.frameCounter >= 8f) { NPC.frame.Y += frameY; @@ -96,9 +103,8 @@ namespace CalamityMod.NPCs.SlimeGod int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); if (Main.zenithWorld) - { type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - } + if (!NPC.wet) { Vector2 faceDirection = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); @@ -109,9 +115,8 @@ namespace CalamityMod.NPCs.SlimeGod { NPC.ai[0] = -40f; if (NPC.velocity.Y == 0f) - { NPC.velocity.X = NPC.velocity.X * 0.9f; - } + if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { int projcount = Main.zenithWorld ? 12 : 5; @@ -131,9 +136,8 @@ namespace CalamityMod.NPCs.SlimeGod { NPC.ai[0] = -40f; if (NPC.velocity.Y == 0f) - { NPC.velocity.X = NPC.velocity.X * 0.9f; - } + if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { targetY = Main.player[NPC.target].position.Y - faceDirection.Y - (float)Main.rand.Next(0, 200); @@ -152,16 +156,14 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Crimson; dustColor.A = 150; + for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); } } diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 672195c5f0..b4947f9b8a 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -20,6 +20,8 @@ namespace CalamityMod.NPCs.SlimeGod private float bossLife; private float addedStretch = 0f; private float landingRecoil = 0f; + private const int Width = 206; + private const int Height = 156; public override void SetStaticDefaults() { @@ -30,9 +32,8 @@ namespace CalamityMod.NPCs.SlimeGod { NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); - NPC.width = 206; - NPC.height = 156; - NPC.scale = 1.1f; + NPC.width = Width; + NPC.height = Height; NPC.defense = 12; NPC.LifeMaxNERB(7500, 9000, 160000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; @@ -75,6 +76,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + Vector3 light = new Vector3(1f, 0.2f, 0.2f) * NPC.scale; + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; @@ -85,8 +89,11 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = NPC.life / (float)NPC.lifeMax; + // Reset defense and damage NPC.defense = NPC.defDefense; int setDamage = NPC.defDamage; + + // Boost defense and damage while buffed by the Slime God if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 24; @@ -104,8 +111,13 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; + // Used for teleporting float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + + // Used for how fast the slime animates NPC.aiAction = 0; + + // Reset tile collide and gravity NPC.noTileCollide = false; NPC.noGravity = false; @@ -115,6 +127,7 @@ namespace CalamityMod.NPCs.SlimeGod Player player = Main.player[NPC.target]; + // Despawn if (NPC.ai[0] != 3f) { if (player.dead || !player.active) @@ -135,8 +148,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.timeLeft = 1800; } + // Split into smaller slimes and fire spikes at half HP if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { + // Spread of random globs in meme mode if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) { int type = ModContent.ProjectileType(); @@ -144,18 +159,21 @@ namespace CalamityMod.NPCs.SlimeGod Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, (float)Main.rand.Next(-1499, 1500) * 0.01f, (float)Main.rand.Next(-1499, 1500) * 0.01f, type, 35, 0f); } + // Spawn split slimes SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X - 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 0f); NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X + 80, (int)spawnAt.Y, ModContent.NPCType(), 0, 0f, 0f, 45f); - if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) // Split into 3 slimes if the other large slime hasn't split yet. + + // Split into 3 additional slimes if the other large slime hasn't split yet + if (Main.zenithWorld && NPC.CountNPCS(ModContent.NPCType()) < 3) NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnAt.X, (int)spawnAt.Y - 80, ModContent.NPCType(), 0, 0f, 0f, 90f); - // Calculate stretch here so that the spike spread looks more natural. + // Calculate stretch here so that the spike spread looks more natural float stretch = NPC.velocity.Y * 0.03f; stretch = Math.Abs(stretch) + addedStretch; - // Stretch rapidly if about to jump or teleport, stretch normally while idle. + // Stretch rapidly if about to jump or teleport, stretch normally while idle if (NPC.velocity.Y == 0f) stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); @@ -164,25 +182,48 @@ namespace CalamityMod.NPCs.SlimeGod Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; - // Spread of spikes. + // Spread of spikes float projectileVelocity = 2f; int type2 = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type2); - Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; - destination.Normalize(); + Vector2 spawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y + 50f * NPC.scale); + Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; int numProj = 9; float rotation = MathHelper.ToRadians(100); float maxVelocity = death ? 18f : revenge ? 16f : 14f; float acceleration = death ? 1.03f : revenge ? 1.025f : 1.02f; int spikeType = 0; + int dustType = DustID.TintableDust; + Color dustColor = Color.Crimson; + dustColor.A = 150; + Vector2 dustSpawnBox = new Vector2(40f, 40f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { spikeType = numProj - 1 - i; + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 20f * scaleStretch, perturbedSpeed, type2, damage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); + Vector2 projectileLocation = spawnLocation + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 70f * scaleStretch; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 32; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, damage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); } + // Die NPC.life = 0; NPC.HitEffect(); NPC.active = false; @@ -273,7 +314,8 @@ namespace CalamityMod.NPCs.SlimeGod // Get ready to teleport by increasing ai[3] if (calamityGlobalNPC.newAI[0] < teleportGateValue) { - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) calamityGlobalNPC.newAI[0] += death ? 3f : 2f; else calamityGlobalNPC.newAI[0] += 1f; @@ -283,7 +325,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[0] == 0f) { - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + // Catch up to the target if too far away + float catchUpDistance = 1600f; + bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { // Set damage @@ -436,12 +480,9 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noTileCollide = true; NPC.noGravity = true; - if (NPC.velocity.X < 0f) - NPC.direction = -1; - else - NPC.direction = 1; - + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); Vector2 targetCenter = player.Center; targetCenter.Y -= 350f; @@ -450,8 +491,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = player.Center - NPC.Center; - targetDist.Normalize(); + targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; @@ -472,7 +512,7 @@ namespace CalamityMod.NPCs.SlimeGod return; } - targetDist.Normalize(); + targetDist = targetDist.SafeNormalize(Vector2.UnitY); targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } @@ -500,38 +540,58 @@ namespace CalamityMod.NPCs.SlimeGod SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - // Eruption of slime balls that fall down - float projectileVelocity = 8f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; - destination.Normalize(); + // Calculate stretch here so that the spike spread looks more natural + float stretch = NPC.velocity.Y * 0.03f; + stretch = Math.Abs(stretch) + addedStretch; + + // Stretch rapidly if about to jump or teleport, stretch normally while idle + if (NPC.velocity.Y == 0f) + stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f); + + if (stretch > 0.5f) + stretch = 0.5f; + + Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale; + + // Spread of spikes + float projectileVelocity = 2f; + int type2 = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type2); + Vector2 spawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y + 50f * NPC.scale); + Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; - int numProj = 5; - float rotation = MathHelper.ToRadians(45); + int numProj = 9; + float rotation = MathHelper.ToRadians(100); + float maxVelocity = death ? 18f : revenge ? 16f : 14f; + float acceleration = death ? 1.03f : revenge ? 1.025f : 1.02f; + int spikeType = 0; + int dustType = DustID.TintableDust; + Color dustColor = Color.Crimson; + dustColor.A = 150; + Vector2 dustSpawnBox = new Vector2(40f, 40f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { + spikeType = numProj - 1 - i; + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed * 1.5f, type, damage, 0f, Main.myPlayer, 1f, 0f); - } + Vector2 projectileLocation = spawnLocation + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 70f * scaleStretch; - // Fire slime balls directly at players with a max of 2 - if (enraged && expertMode) - { - List targets = new List(); - foreach (Player plr in Main.ActivePlayers) - { - if (!plr.dead) - targets.Add(plr.whoAmI); + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); - if (targets.Count > 1) - break; - } - foreach (int t in targets) + for (int j = 0; j < 32; j++) { - Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, damage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); } } @@ -555,6 +615,8 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y > velocityLimit) NPC.velocity.Y = velocityLimit; } + + // Jump in quick succession else if (NPC.ai[0] == 2f) { if (NPC.velocity.Y == 0f) @@ -646,20 +708,19 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } + // Catch up to the target if too far away else if (NPC.ai[0] == 4f) { // Avoid cheap bullshit NPC.damage = setDamage; - if (NPC.velocity.X > 0f) - NPC.direction = 1; - else - NPC.direction = -1; - + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; NPC.noGravity = true; NPC.knockBackResist = 0f; + Vector2 distanceFromTarget = player.Center - NPC.Center; distanceFromTarget.Y -= 16f; if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && @@ -675,14 +736,18 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } - if (distanceFromTarget.Length() > 12f) + float movementSpeed = 16f; + if (distanceFromTarget.Length() > movementSpeed) { - distanceFromTarget.Normalize(); - distanceFromTarget *= 12f; + distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); + distanceFromTarget *= movementSpeed; } - NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; + float inertia = 25f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; } + + // Teleport shit else if (NPC.ai[0] == 5f) { // Avoid cheap bullshit @@ -712,7 +777,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -746,7 +811,7 @@ namespace CalamityMod.NPCs.SlimeGod dustColor.A = 150; for (int i = 0; i < 10; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -756,6 +821,7 @@ namespace CalamityMod.NPCs.SlimeGod if (landingRecoil > 0.36f) landingRecoil = 0.36f; + // Slime spawning and scale logic if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -767,11 +833,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.X = NPC.Center.X; NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio; - NPC.width = (int)(206f * NPC.scale); - NPC.height = (int)(156f * NPC.scale); + NPC.width = (int)(Width * NPC.scale); + NPC.height = (int)(Height * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -782,12 +848,11 @@ namespace CalamityMod.NPCs.SlimeGod if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; - int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); - int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); - int slimeType = ModContent.NPCType(); - if (Main.rand.NextBool(3)) - slimeType = ModContent.NPCType(); + int offset = 32; + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); + int slimeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; @@ -795,7 +860,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; if (Main.dedServ && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); } } } @@ -854,17 +919,43 @@ namespace CalamityMod.NPCs.SlimeGod return false; } - public static float SlimeRotationFactor(NPC npc) - { - return MathHelper.ToRadians(npc.velocity.X * (-npc.velocity.Y / 10)); - } + public static float SlimeRotationFactor(NPC npc) => MathHelper.ToRadians(npc.velocity.X * (-npc.velocity.Y * 0.1f)); public override void HitEffect(NPC.HitInfo hit) { Color dustColor = Color.Crimson; dustColor.A = 150; + for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hit.HitDirection, -1f, 0, dustColor, 1f); + + if (NPC.life <= 0) + { + NPC.position = NPC.Center; + NPC.width = NPC.height = (int)(160f * NPC.scale); + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); + + for (int i = 0; i < 40; i++) + { + int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + Main.dust[crimDust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[crimDust].scale = 0.5f; + Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + + for (int j = 0; j < 80; j++) + { + int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); + Main.dust[crimDust2].noGravity = true; + Main.dust[crimDust2].velocity *= 5f; + crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + Main.dust[crimDust2].velocity *= 2f; + } + } } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index b93f13907b..4aa40da436 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -22,6 +22,8 @@ namespace CalamityMod.NPCs.SlimeGod private float addedStretch = 0f; private int wingFrameDrawn = 0; private const int TotalWingFrames = 8; + private const int Width = 134; + private const int Height = 150; public static Asset WingTexture; @@ -37,9 +39,8 @@ namespace CalamityMod.NPCs.SlimeGod { NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); - NPC.width = 134; - NPC.height = 150; - NPC.scale = 1.1f; + NPC.width = Width; + NPC.height = Height; NPC.defense = 10; NPC.LifeMaxNERB(8000, 9600, 220000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; @@ -79,6 +80,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + Vector3 light = new Vector3(1f, 0.2f, 1f) * NPC.scale; + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; @@ -231,13 +235,69 @@ namespace CalamityMod.NPCs.SlimeGod Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; float rotation = MathHelper.ToRadians(80); + int dustType = DustID.TintableDust; + Color dustColor = Color.Lavender; + dustColor.A = 150; + Vector2 dustSpawnBox = new Vector2(30f, 30f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProjectiles; i++) { if (CalamityWorld.LegendaryMode) destination *= Main.rand.NextFloat() + 0.5f; Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProjectiles - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Vector2 projectileLocation = NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 24; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + + // Fire slime balls directly at players with a max of 2 + if (enraged && expertMode) + { + List targets = new List(); + foreach (Player plr in Main.ActivePlayers) + { + if (!plr.dead) + targets.Add(plr.whoAmI); + + if (targets.Count > 1) + break; + } + foreach (int t in targets) + { + Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; + Vector2 projectileLocation = NPC.Center + projFireDirection.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(projFireDirection.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 24; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, damage, 0f, Main.myPlayer); + } } } @@ -295,7 +355,28 @@ namespace CalamityMod.NPCs.SlimeGod int damage = NPC.GetProjectileDamage(type); Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + destination.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, destination, type, damage, 0f, Main.myPlayer, 1f); + int dustType = DustID.TintableDust; + Color dustColor = Color.Lavender; + dustColor.A = 150; + Vector2 dustSpawnBox = new Vector2(30f, 30f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; + Vector2 projectileLocation = NPC.Center + destination.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(destination.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 24; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, destination, type, damage, 0f, Main.myPlayer, 1f); } SoundEngine.PlaySound(SlimeGodCore.ShotSound, NPC.Center); @@ -319,11 +400,11 @@ namespace CalamityMod.NPCs.SlimeGod else if (NPC.ai[0] == 3f) { // Distance required to charge - float minChargeSafeDistance = 550f; + float minChargeSafeDistance = 650f; // Charge variables float chargeVelocityMult = 0.1f; - float maxChargeVelocity = (bossRush || enraged) ? 21f : death ? 18f : revenge ? 16.5f : expertMode ? 15f : 12f; + float maxChargeVelocity = (bossRush || enraged) ? 12f : death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; if (Main.getGoodWorld) maxChargeVelocity *= 1.15f; if (CalamityWorld.LegendaryMode && revenge) @@ -376,7 +457,7 @@ namespace CalamityMod.NPCs.SlimeGod float slowDownDurationAfterCharge = revenge ? 90f : 120f; NPC.ai[2] = slowDownDurationAfterCharge; NPC.localAI[2] = 0f; - NPC.velocity /= 2f; + NPC.velocity *= 0.5f; NPC.netUpdate = true; } else @@ -470,11 +551,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.X = NPC.Center.X; NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio; - NPC.width = (int)(134f * NPC.scale); - NPC.height = (int)(150f * NPC.scale); + NPC.width = (int)(Width * NPC.scale); + NPC.height = (int)(Height * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -488,8 +569,9 @@ namespace CalamityMod.NPCs.SlimeGod int randSlimeAmt = Main.rand.Next(1, 3); for (int j = 0; j < randSlimeAmt; j++) { - int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); - int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); + int offset = 16; + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); int slimeType = ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); @@ -703,8 +785,37 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Lavender; dustColor.A = 150; + for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + + if (NPC.life <= 0) + { + NPC.position = NPC.Center; + NPC.width = NPC.height = (int)(160f * NPC.scale); + NPC.position.X = NPC.position.X - (float)(NPC.width / 2); + NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); + + for (int i = 0; i < 40; i++) + { + int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + Main.dust[crimDust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[crimDust].scale = 0.5f; + Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + + for (int j = 0; j < 80; j++) + { + int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); + Main.dust[crimDust2].noGravity = true; + Main.dust[crimDust2].velocity *= 5f; + crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + Main.dust[crimDust2].velocity *= 2f; + } + } } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index dacc2f1f2a..8e702a3dd7 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -36,6 +36,13 @@ namespace CalamityMod.NPCs.SlimeGod [AutoloadBossHead] public class SlimeGodCore : ModNPC { + private enum PaladinSlimeTypes + { + None, + Ebonian, + Crimulan + } + private bool slimesSpawned = false; private int buffedSlime = 0; @@ -132,7 +139,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.npc[CalamityGlobalNPC.slimeGodPurple].active) { - if ((npc.ModNPC as SlimeGodCore).buffedSlime == 1) + if ((npc.ModNPC as SlimeGodCore).buffedSlime == (int)PaladinSlimeTypes.Ebonian) Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 1f; else Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 0f; @@ -155,7 +162,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.npc[CalamityGlobalNPC.slimeGodRed].active) { - if ((npc.ModNPC as SlimeGodCore).buffedSlime == 2) + if ((npc.ModNPC as SlimeGodCore).buffedSlime == (int)PaladinSlimeTypes.Crimulan) Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 1f; else Main.npc[CalamityGlobalNPC.slimeGodRed].localAI[1] = 0f; @@ -192,6 +199,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + Vector3 light = new Vector3(0.5f, 0.5f, 0.5f) * NPC.Opacity; + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); CalamityGlobalNPC.slimeGod = NPC.whoAmI; @@ -410,27 +420,27 @@ namespace CalamityMod.NPCs.SlimeGod NPC.rotation += NPC.direction * 0.3f; - if (buffedSlime == 0) + if (buffedSlime == (int)PaladinSlimeTypes.None) { SoundEngine.PlaySound(PossessionSound, NPC.Center); if (purpleSlimeAlive && redSlimeAlive) buffedSlime = Main.rand.Next(2) + 1; else if (purpleSlimeAlive) - buffedSlime = 1; + buffedSlime = (int)PaladinSlimeTypes.Ebonian; else if (redSlimeAlive) - buffedSlime = 2; + buffedSlime = (int)PaladinSlimeTypes.Crimulan; } Vector2 purpleSlimeVector = new Vector2(calamityGlobalNPC.newAI[0], calamityGlobalNPC.newAI[1]); Vector2 redSlimeVector = new Vector2(NPC.ai[1], NPC.ai[2]); - Vector2 goToVector = buffedSlime == 1 ? purpleSlimeVector : redSlimeVector; + Vector2 goToVector = buffedSlime == (int)PaladinSlimeTypes.Ebonian ? purpleSlimeVector : redSlimeVector; Vector2 goToPosition = goToVector - NPC.Center; - NPC.velocity = Vector2.Normalize(goToPosition) * 24f; + NPC.velocity = goToPosition.SafeNormalize(Vector2.UnitY) * 24f; // Reduce velocity to 0 to avoid spastic movement when inside big slime. - float stickPositionAdjustment = buffedSlime == 1 ? 16f : 32f; + float stickPositionAdjustment = buffedSlime == (int)PaladinSlimeTypes.Ebonian ? 16f : 32f; if (Vector2.Distance(NPC.Center, goToVector) < 80f + stickPositionAdjustment) { NPC.velocity = Vector2.Zero; @@ -500,7 +510,7 @@ namespace CalamityMod.NPCs.SlimeGod float projectileVelocity = 4f + (aggressionLevel - 1) * 2f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } else @@ -508,7 +518,7 @@ namespace CalamityMod.NPCs.SlimeGod float projectileVelocity = 8f + (aggressionLevel - 1) * 2f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 velocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); } } @@ -519,7 +529,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.Opacity > 0.8f) NPC.Opacity = 0.8f; - buffedSlime = 0; + buffedSlime = (int)PaladinSlimeTypes.None; float flySpeed = death ? 15f : revenge ? 13.5f : expertMode ? 12f : 9f; flySpeed += aggressionLevel; @@ -649,7 +659,7 @@ namespace CalamityMod.NPCs.SlimeGod float sc = 1f; if (!ShouldDespawn(NPC)) { - if (buffedSlime != 0f) + if (buffedSlime != (int)PaladinSlimeTypes.None) { NPC.scale = MathHelper.Lerp(NPC.scale, 0f, 0.2f); NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 0.7f, 0.4f); @@ -662,7 +672,7 @@ namespace CalamityMod.NPCs.SlimeGod } SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Color drawColorAlpha = (buffedSlime != 0f && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); + Color drawColorAlpha = (buffedSlime != (int)PaladinSlimeTypes.None && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); Vector2 origin = NPC.frame.Size() * 0.5f; Vector2 halfSize = NPC.Size * 0.5f; @@ -725,7 +735,7 @@ namespace CalamityMod.NPCs.SlimeGod } // Reset the color - drawColorAlpha = (buffedSlime != 0f && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); + drawColorAlpha = (buffedSlime != (int)PaladinSlimeTypes.None && !ShouldDespawn(NPC)) ? new Color(200, 150, Main.DiscoB, NPC.alpha) * NPC.Opacity : NPC.GetAlpha(drawColor); // Draw the base texture spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index 3a7fe26a17..cbf6b5c86c 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -21,6 +21,8 @@ namespace CalamityMod.NPCs.SlimeGod private float bossLife; private float addedStretch = 0f; private float landingRecoil = 0f; + private const int Width = 166; + private const int Height = 114; public override void SetStaticDefaults() { @@ -41,9 +43,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.LifeMaxNERB(1875, 2250, 80000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.GetNPCDamage(); - NPC.width = 166; - NPC.height = 114; - NPC.scale = 0.8f; + NPC.width = Width; + NPC.height = Height; NPC.defense = 10; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 1, 0, 0); @@ -90,6 +91,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + Vector3 light = new Vector3(0.75f, 0.15f, 0.15f) * NPC.scale; + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + if (CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active) CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; @@ -100,8 +104,11 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = NPC.life / (float)NPC.lifeMax; + // Reset defense and damage NPC.defense = NPC.defDefense; int setDamage = NPC.defDamage; + + // Boost defense and damage while buffed by the Slime God if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 20; @@ -119,8 +126,13 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; + // Used for teleporting float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + + // Used for how fast the slime animates NPC.aiAction = 0; + + // Reset tile collide and gravity NPC.noTileCollide = false; NPC.noGravity = false; @@ -130,6 +142,7 @@ namespace CalamityMod.NPCs.SlimeGod Player player = Main.player[NPC.target]; + // Despawn if (NPC.ai[0] != 3f) { if (player.dead || !player.active) @@ -233,7 +246,8 @@ namespace CalamityMod.NPCs.SlimeGod // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) NPC.ai[3] += death ? 3f : 2f; else NPC.ai[3] += 1f; @@ -243,7 +257,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[0] == 0f) { - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + // Catch up to the target if too far away + float catchUpDistance = 1600f; + bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { // Set damage @@ -388,12 +404,9 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noTileCollide = true; NPC.noGravity = true; - if (NPC.velocity.X < 0f) - NPC.direction = -1; - else - NPC.direction = 1; - + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); Vector2 targetCenter = player.Center; targetCenter.Y -= 350f; @@ -402,8 +415,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = player.Center - NPC.Center; - targetDist.Normalize(); + targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); targetDist *= death ? 11f : revenge ? 10f : expertMode ? 9f : 8f; NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; @@ -424,7 +436,7 @@ namespace CalamityMod.NPCs.SlimeGod return; } - targetDist.Normalize(); + targetDist = targetDist.SafeNormalize(Vector2.UnitY); targetDist *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } @@ -456,15 +468,35 @@ namespace CalamityMod.NPCs.SlimeGod float projectileVelocity = 8f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; - destination.Normalize(); + Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; int numProj = 3; float rotation = MathHelper.ToRadians(45); + int dustType = DustID.TintableDust; + Color dustColor = Color.Crimson; + dustColor.A = 150; + Vector2 dustSpawnBox = new Vector2(30f, 30f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed * 1.5f, type, damage, 0f, Main.myPlayer, 1f, 0f); + Vector2 projectileLocation = NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 24; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed * 1.5f, type, damage, 0f, Main.myPlayer, 1f, 0f); } // Fire slime balls directly at players with a max of 2 @@ -481,8 +513,24 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); + Vector2 projFireDirection = (Main.player[t].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; + Vector2 projectileLocation = NPC.Center + projFireDirection.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(projFireDirection.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 24; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -506,6 +554,8 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.velocity.Y > velocityLimit) NPC.velocity.Y = velocityLimit; } + + // Jump in quick succession else if (NPC.ai[0] == 2f) { if (NPC.velocity.Y == 0f) @@ -596,20 +646,19 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } + // Catch up to the target if too far away else if (NPC.ai[0] == 4f) { // Set damage NPC.damage = setDamage; - if (NPC.velocity.X > 0f) - NPC.direction = 1; - else - NPC.direction = -1; - + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; NPC.noGravity = true; NPC.knockBackResist = 0f; + Vector2 distanceFromTarget = player.Center - NPC.Center; distanceFromTarget.Y -= 16f; if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && @@ -624,14 +673,18 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } - if (distanceFromTarget.Length() > 12f) + float movementSpeed = 16f; + if (distanceFromTarget.Length() > movementSpeed) { - distanceFromTarget.Normalize(); - distanceFromTarget *= 12f; + distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); + distanceFromTarget *= movementSpeed; } - NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; + float inertia = 20f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; } + + // Teleport shit else if (NPC.ai[0] == 5f) { // Avoid cheap bullshit @@ -659,9 +712,9 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int i = 0; i < 10; i++) + for (int i = 0; i < 5; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -693,9 +746,9 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Crimson; dustColor.A = 150; - for (int i = 0; i < 10; i++) + for (int i = 0; i < 5; i++) { - int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int crimsonDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); Main.dust[crimsonDust].noGravity = true; Main.dust[crimsonDust].velocity *= 0.5f; } @@ -705,6 +758,7 @@ namespace CalamityMod.NPCs.SlimeGod if (landingRecoil > 0.36f) landingRecoil = 0.36f; + // Slime spawning and scale logic if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -716,11 +770,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.X = NPC.Center.X; NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio * 0.75f; - NPC.width = (int)(166f * NPC.scale); - NPC.height = (int)(114f * NPC.scale); + NPC.width = (int)(Width * NPC.scale); + NPC.height = (int)(Height * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -731,12 +785,11 @@ namespace CalamityMod.NPCs.SlimeGod if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; - int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); - int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); - int slimeType = ModContent.NPCType(); - if (Main.rand.NextBool(3)) - slimeType = ModContent.NPCType(); + int offset = 16; + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); + int slimeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); Main.npc[slimeSpawn].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; @@ -744,7 +797,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; if (Main.dedServ && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); } } } @@ -820,21 +873,20 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Crimson; dustColor.A = 150; + for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + if (NPC.life <= 0) { - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.width = 50; - NPC.height = 50; + NPC.position = NPC.Center; + NPC.width = NPC.height = (int)(80f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int i = 0; i < 40; i++) + + for (int i = 0; i < 20; i++) { - int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); + int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); Main.dust[crimDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -842,12 +894,13 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int j = 0; j < 70; j++) + + for (int j = 0; j < 40; j++) { - int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 3f); + int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); Main.dust[crimDust2].noGravity = true; Main.dust[crimDust2].velocity *= 5f; - crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); + crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); Main.dust[crimDust2].velocity *= 2f; } } diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index eea5d83c45..9a0213d635 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -21,6 +21,8 @@ namespace CalamityMod.NPCs.SlimeGod private float bossLife; private float addedStretch = 0f; private float landingRecoil = 0f; + private const int Width = 166; + private const int Height = 114; public override void SetStaticDefaults() { @@ -41,9 +43,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.LifeMaxNERB(2000, 2400, 110000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.GetNPCDamage(); - NPC.width = 166; - NPC.height = 114; - NPC.scale = 0.8f; + NPC.width = Width; + NPC.height = Height; NPC.defense = 8; NPC.aiStyle = -1; AIType = -1; @@ -90,6 +91,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + Vector3 light = new Vector3(0.75f, 0.15f, 0.75f) * NPC.scale; + Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); + if (CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active) CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; @@ -231,7 +235,8 @@ namespace CalamityMod.NPCs.SlimeGod // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > 320f) + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) NPC.ai[3] += death ? 3f : 2f; else NPC.ai[3] += 1f; @@ -241,7 +246,9 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[0] == 0f) { - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > 2400f || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); + // Catch up to the target if too far away + float catchUpDistance = 1600f; + bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) { // Set damage @@ -431,12 +438,9 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noTileCollide = true; NPC.noGravity = true; - if (NPC.velocity.X < 0f) - NPC.direction = -1; - else - NPC.direction = 1; - + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); Vector2 targetCenter = player.Center; targetCenter.Y -= 350f; @@ -445,8 +449,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = player.Center - NPC.Center; - targetDist.Normalize(); + targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; @@ -467,7 +470,7 @@ namespace CalamityMod.NPCs.SlimeGod return; } - targetDist.Normalize(); + targetDist = targetDist.SafeNormalize(Vector2.UnitY); targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; } @@ -499,18 +502,38 @@ namespace CalamityMod.NPCs.SlimeGod float projectileVelocity = 4f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; - destination.Normalize(); + Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; int numProj = 9; float rotation = MathHelper.ToRadians(90); + int dustType = DustID.TintableDust; + Color dustColor = Color.Lavender; + dustColor.A = 150; + Vector2 dustSpawnBox = new Vector2(30f, 30f); + Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { // Spawn projectiles 0, 1, 2, 6, 7 and 8 if (i < 3 || i > 5) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f * NPC.scale + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Vector2 projectileLocation = NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(perturbedSpeed.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 24; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } @@ -528,8 +551,24 @@ namespace CalamityMod.NPCs.SlimeGod } foreach (int t in targets) { - Vector2 projFireDirection = Vector2.Normalize(Main.player[t].Center - NPC.Center) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projFireDirection) * 30f * NPC.scale, projFireDirection, type, damage, 0f, Main.myPlayer); + Vector2 projFireDirection = (Main.player[t].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; + Vector2 projectileLocation = NPC.Center + projFireDirection.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale; + + float dustSpeed = Main.rand.NextFloat(2f, 4f); + float angleRandom = 0.1f; + Vector2 dustVelocity = new Vector2(dustSpeed, 0f).RotatedBy(projFireDirection.ToRotation()); + dustVelocity = dustVelocity.RotatedBy(-angleRandom); + dustVelocity = dustVelocity.RotatedByRandom(2f * angleRandom); + + for (int j = 0; j < 24; j++) + { + int slimeDust = Dust.NewDust(projectileLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, dustType); + Main.dust[slimeDust].velocity = dustVelocity; + Main.dust[slimeDust].color = dustColor; + Main.dust[slimeDust].noGravity = true; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, damage, 0f, Main.myPlayer); } } } @@ -648,15 +687,13 @@ namespace CalamityMod.NPCs.SlimeGod // Set damage NPC.damage = setDamage; - if (NPC.velocity.X > 0f) - NPC.direction = 1; - else - NPC.direction = -1; - + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; NPC.spriteDirection = NPC.direction; + NPC.noTileCollide = true; NPC.noGravity = true; NPC.knockBackResist = 0f; + Vector2 distanceFromTarget = player.Center - NPC.Center; distanceFromTarget.Y -= 16f; if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && @@ -671,13 +708,15 @@ namespace CalamityMod.NPCs.SlimeGod NPC.netUpdate = true; } - if (distanceFromTarget.Length() > 12f) + float movementSpeed = 16f; + if (distanceFromTarget.Length() > movementSpeed) { - distanceFromTarget.Normalize(); - distanceFromTarget *= 12f; + distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); + distanceFromTarget *= movementSpeed; } - NPC.velocity = (NPC.velocity * 4f + distanceFromTarget) / 5f; + float inertia = 25f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; } else if (NPC.ai[0] == 6f) { @@ -706,9 +745,9 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int i = 0; i < 10; i++) + for (int i = 0; i < 5; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } @@ -740,9 +779,9 @@ namespace CalamityMod.NPCs.SlimeGod // Emit teleport dust Color dustColor = Color.Lavender; dustColor.A = 150; - for (int i = 0; i < 10; i++) + for (int i = 0; i < 5; i++) { - int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, NPC.alpha, dustColor, 2f); + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); Main.dust[corruptDust].noGravity = true; Main.dust[corruptDust].velocity *= 0.5f; } @@ -763,11 +802,11 @@ namespace CalamityMod.NPCs.SlimeGod if (scaleRatio != NPC.scale) { - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); + NPC.position.X = NPC.Center.X; NPC.position.Y = NPC.position.Y + (float)NPC.height; NPC.scale = scaleRatio * 0.75f; - NPC.width = (int)(166f * NPC.scale); - NPC.height = (int)(114f * NPC.scale); + NPC.width = (int)(Width * NPC.scale); + NPC.height = (int)(Height * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)NPC.height; } @@ -778,8 +817,10 @@ namespace CalamityMod.NPCs.SlimeGod if ((float)(NPC.life + slimeSpawnThreshold) < bossLife) { bossLife = (float)NPC.life; - int x = (int)(NPC.position.X + (float)Main.rand.Next(NPC.width - 32)); - int y = (int)(NPC.position.Y + (float)Main.rand.Next(NPC.height - 32)); + + int offset = 16; + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); int slimeType = ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); @@ -788,7 +829,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; if (Main.dedServ && slimeSpawn < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); } } } @@ -864,35 +905,35 @@ namespace CalamityMod.NPCs.SlimeGod { Color dustColor = Color.Lavender; dustColor.A = 150; + for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, NPC.alpha, dustColor, 1f); - } + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f); + if (NPC.life <= 0) { - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.width = 50; - NPC.height = 50; + NPC.position = NPC.Center; + NPC.width = NPC.height = (int)(80f * NPC.scale); NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int i = 0; i < 40; i++) + + for (int i = 0; i < 20; i++) { - int corruptionDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); - Main.dust[corruptionDust].velocity *= 3f; + int crimDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + Main.dust[crimDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[corruptionDust].scale = 0.5f; - Main.dust[corruptionDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[crimDust].scale = 0.5f; + Main.dust[crimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int j = 0; j < 70; j++) + + for (int j = 0; j < 40; j++) { - int corruptionDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 3f); - Main.dust[corruptionDust2].noGravity = true; - Main.dust[corruptionDust2].velocity *= 5f; - corruptionDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, NPC.alpha, dustColor, 2f); - Main.dust[corruptionDust2].velocity *= 2f; + int crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 3f); + Main.dust[crimDust2].noGravity = true; + Main.dust[crimDust2].velocity *= 5f; + crimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, 0f, 0f, 0, dustColor, 2f); + Main.dust[crimDust2].velocity *= 2f; } } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 7dd6078c43..e2488b3a43 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -555,6 +555,11 @@ namespace CalamityMod.NPCs.StormWeaver // Charge if (!phase4) { + if (calamityGlobalNPC.newAI[0] == chargePhaseGateValue - 70) + { + Vector2 soundCenter = Main.player[NPC.target].Center; + SoundEngine.PlaySound(CommonCalamitySounds.LightningTelegraph, soundCenter); + } if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue) { NPC.localAI[3] = 60f; diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 5b3a9d6f6c..8f2eebf5f8 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -41,6 +41,14 @@ namespace CalamityMod.NPCs.SunkenSea Gold = 5 } + /// + /// The squish of this NPC while drawing. + /// + private Vector2 ScaleSquish = Vector2.One; + + // keeps track of the number of hops between a flip + public int flipCounter; + protected override List PreyIDs => new List(); protected override List PredatorIDs => new List(); @@ -182,19 +190,58 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[dust].scale *= 0.5f; } } - // Quick lil hops in random directions for movement + + // Reset any squish that is done to the Ghost Bells, and clamps its upper limit to prevent it from becoming too tall + if (ScaleSquish.Y > 1f) + ScaleSquish.Y = MathHelper.Clamp(ScaleSquish.Y, 1f, 1.5f); + ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); + + // Quick lil hops in semi-random directions for movement. its thursday if (NPC.wet) { NPC.height = (int)(36 * NPC.scale); - if (NPC.velocity.Length() < 1f) + if (NPC.velocity.Length() < 0.5f) { - NPC.velocity = Main.rand.NextVector2CircularEdge(8, 8); + // stretch a bit for ~ effect ~ + ScaleSquish.Y += 0.4f; + + // get a semi-random float that is equivalent to +- X (normalised) degrees around the current rotation + float semiRandomAngle = Main.rand.NextFloat(-0.7f, 0.7f); + // multiply velocity by a random amount to break up cycles and appear more natural + NPC.velocity *= Main.rand.NextFloat(12f, 15f); + // check if the velocity lands itself into a tile + bool bonk = CalamityUtils.DistanceToTileCollisionHit(NPC.position, NPC.velocity, 9) != null; + + // random chance if the last direction flip was 3+ hops ago OR if the ghost bell is about to bonk a tile + if ((flipCounter >= 3 && Main.rand.NextBool(6)) || bonk) + { + // send it in the opposite direction + NPC.velocity *= -1; + NPC.velocity = NPC.velocity.RotatedBy(semiRandomAngle); + flipCounter = 0; // reset the counter + //Main.NewText("flip! " + flipCounter + " " + NPC.velocity + " " + NPC.rotation); + } + else + { + // send it in a random direction + NPC.velocity = NPC.velocity.RotatedBy(semiRandomAngle); + ++flipCounter; // add to the counter + //Main.NewText("swim, " + flipCounter + " " + NPC.velocity + " " + NPC.rotation); + } } NPC.velocity *= 0.95f; NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.ToRotation() + MathHelper.PiOver2, 0.5f); + + if (NPC.velocity == Vector2.Zero) + { + // failsafe. turns out they love getting themselves stuck in walls, so this is necessary to prevent that + NPC.velocity = Main.rand.NextVector2CircularEdge(8, 8); + } } else { + // wouldnt want it flipping back into the air immediately, would we? + flipCounter = 0; // Height is changed so that the jelly looks like it's actually laying on the ground when rotated NPC.height = (int)(24 * NPC.scale); // Gravy @@ -340,7 +387,7 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 npcOffset = NPC.Center - screenPos; npcOffset -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, ScaleSquish, spriteEffects, 0f); return false; } diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index ce98ff3c77..e7eccea2f6 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -308,7 +308,7 @@ namespace CalamityMod.NPCs.SunkenSea if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType(), NPC.damage, 1); + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType(), NPC.damage / 2, 1); } for (int i = 0; i < 9; i++) { diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index d7a66fa4bc..640c48a995 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -195,7 +195,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemID.JellyfishNecklace, 100); + npcLoot.Add(ItemID.JellyfishNecklace, 25); LeadingConditionRule postDS = npcLoot.DefineConditionalDropSet(DropHelper.PostDS()); postDS.Add(ModContent.ItemType(), 5); } diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs index d86b9f83e4..52a24f4be8 100644 --- a/NPCs/SunkenSea/Jellyghoul.cs +++ b/NPCs/SunkenSea/Jellyghoul.cs @@ -1,12 +1,14 @@ using CalamityMod.BiomeManagers; +using CalamityMod.DataStructures; using CalamityMod.Items.Placeables; using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles.SunkenSea; using CalamityMod.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using System; +using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -32,6 +34,13 @@ namespace CalamityMod.NPCs.SunkenSea public static SoundStyle JellyGhoulScream = SoundID.NPCDeath51 with { Pitch = -1, Volume = 0.2f, MaxInstances = 0 }; + public static Asset tentacleTexture; + + public override void Load() + { + tentacleTexture = ModContent.Request(Texture + "Tentacle"); + } + public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 1; @@ -207,9 +216,6 @@ namespace CalamityMod.NPCs.SunkenSea public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - if (NPC.IsABestiaryIconDummy) - return true; - SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -221,13 +227,16 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 afterimageOffset = new Vector2((float)Math.Cos(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1], (float)Math.Sin(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1]) * afterimageDistance; // Spooky glowey aura effect - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + if (!NPC.IsABestiaryIconDummy) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - spriteBatch.Draw(bloom, NPC.Center - Main.screenPosition + afterimageOffset, null, FinalColor * 0.45f, 0f, bloom.Size() / 2f, 0.6f, SpriteEffects.None, 0); - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.Draw(bloom, NPC.Center - screenPos + afterimageOffset, null, FinalColor * 0.45f, 0f, bloom.Size() / 2f, 0.6f, SpriteEffects.None, 0); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } Texture2D texture = TextureAssets.Npc[Type].Value; Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); @@ -239,6 +248,55 @@ namespace CalamityMod.NPCs.SunkenSea npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + // Tentacles + Texture2D tentacle = tentacleTexture.Value; + for (int i = 0; i < 4; i++) + { + // Is the tentacle on the outside? + bool outerTentacle = i == 0 || i == 3; + // Is the tentacle one of the left ones? + int leftTentacle = i < 2 ? -1 : 1; + // Start position x offset + int xOffset = outerTentacle ? 4 : 2; + // How much the end position is rotated by + int endDeg = outerTentacle ? 20 : 5; + // Length of each tentacle + int tentacleLength = outerTentacle ? 60 : 50; + // A psuedo randomness value between tentacles and the NPC's index used to desync tentacles from each other + int randomness = i % 2 + NPC.whoAmI; + // Start position of the tentacle + Vector2 anchor = npcOffset + afterimageOffset + new Vector2(leftTentacle * xOffset, 10); + // End position of the tentacle + Vector2 end = npcOffset + afterimageOffset + Vector2.UnitY.RotatedBy(MathHelper.ToRadians(endDeg * -leftTentacle)).RotatedBy(MathHelper.ToRadians(MathF.Sin(Main.GlobalTimeWrappedHourly * 4) * 5 * -leftTentacle)) * tentacleLength; + + // Store the previous tentacle's location + Vector2 prevTentacle = npcOffset + afterimageOffset; + int segmentCount = 10; + Vector2 direction = anchor.DirectionTo(end).RotatedBy(MathHelper.PiOver2); + BezierCurve curve = new BezierCurve(anchor, anchor + (end - anchor) * 0.33f + direction * MathF.Sin(Main.GlobalTimeWrappedHourly * 4 + randomness) * 8, anchor + (end - anchor) * 0.66f + direction * MathF.Cos(Main.GlobalTimeWrappedHourly * 4 + randomness) * 16, end); + List points = curve.GetPoints(segmentCount); + for (int j = 0; j < segmentCount; j++) + { + // Which texture variant the tentacle uses is based on the horizontal position on its sheet + int texX = i == 0 ? 0 : i == (segmentCount - 1) ? 16 : 8; + // Which segment type. + // The first segment (0 is invisible) uses the first frame + // The final segment uses the last frame + // The rest alternate between frames 2 and 3 + int texY = j % 2 == 0 ? 16 : 8; + if (j == 1) + texY = 0; + else if (j == segmentCount - 1) + texY = 24; + + int segHeight = (j == segmentCount - 1) ? 8 : 6; + + if (j != 0) + spriteBatch.Draw(tentacle, points[j], new Rectangle(texX, texY, 6, segHeight), FinalColor * NPC.Opacity, points[j].DirectionTo(prevTentacle).ToRotation() + MathHelper.PiOver2, new Vector2(2), NPC.scale, spriteEffects, 0); + prevTentacle = points[j]; + } + } + // Draws transparent clones around itself to look woozy int cloneAmt = 4; for (int i = 0; i < cloneAmt; i++) diff --git a/NPCs/SunkenSea/Jellyghoul.png b/NPCs/SunkenSea/Jellyghoul.png index 26bfb3154d..4ca9f182b3 100644 Binary files a/NPCs/SunkenSea/Jellyghoul.png and b/NPCs/SunkenSea/Jellyghoul.png differ diff --git a/NPCs/SunkenSea/JellyghoulTentacle.png b/NPCs/SunkenSea/JellyghoulTentacle.png new file mode 100644 index 0000000000..573995d970 Binary files /dev/null and b/NPCs/SunkenSea/JellyghoulTentacle.png differ diff --git a/NPCs/SunkenSea/PrismaticGuppy.cs b/NPCs/SunkenSea/PrismaticGuppy.cs index 2834b8ab07..8858bb6811 100644 --- a/NPCs/SunkenSea/PrismaticGuppy.cs +++ b/NPCs/SunkenSea/PrismaticGuppy.cs @@ -440,7 +440,31 @@ namespace CalamityMod.NPCs.SunkenSea NPC.velocity.Y += 1; } - if (CurrentColor == (int)FishColor.Gold) + if (Main.rand.NextBool(50)) + { + int dustid = DustID.WhiteTorch; + switch (CurrentColor) + { + case 0: + dustid = DustID.IceTorch; + break; + case 1: + dustid = DustID.CoralTorch; + break; + case 2: + dustid = DustID.PinkTorch; + break; + case 4: + dustid = DustID.BoneTorch; + break; + } + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, dustid, Scale: 1.5f); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.color *= 0.5f; + } + + if (CurrentColor == (int)FishColor.Gold) { NPC.rarity = 3; NPC.value = 100000; diff --git a/NPCs/SunkenSea/Scavenger.cs b/NPCs/SunkenSea/Scavenger.cs new file mode 100644 index 0000000000..882329c24e --- /dev/null +++ b/NPCs/SunkenSea/Scavenger.cs @@ -0,0 +1,895 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Enums; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.Utilities; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class Scavenger : SunkenSeaNPC + { + public record ScavengerItem(int itemID, int minimum, int maximum, Func condition); + + public static Asset walkTexture; + + public static Asset inspectTexture; + + public static Asset giveTexture; + + public static Dictionary> ScavengerLoot = new Dictionary>() + { + { ItemID.WhitePearl, new WeightedRandom() }, + { ItemID.BlackPearl, new WeightedRandom() }, + { ItemID.PinkPearl, new WeightedRandom() }, + { ItemID.GalaxyPearl, new WeightedRandom() }, + { ModContent.ItemType(), new WeightedRandom() }, + }; + + public enum PhaseType + { + Idle = 0, + FoundItem = 1, + Bartering = 2 + } + + // The in world index of the item the crab is going after + public int HeldItemIndex + { + get => (int)NPC.ai[1] - 1; + set => NPC.ai[1] = value + 1; + } + + // The type of currency the crab is currently holding + public int HeldItemType + { + get => (int)NPC.ai[2]; + set => NPC.ai[2] = value; + } + + // The crab's current behaviour + public ref float Phase => ref NPC.ai[0]; + + // Used during trading and as a cooldown + public ref float TradeTimer => ref NPC.ai[3]; + + public ref float WalkTimer => ref NPC.Calamity().newAI[0]; + + public ref float TurnTimer => ref NPC.Calamity().newAI[1]; + + public ref float WalkOrStand => ref NPC.Calamity().newAI[2]; + + public ref float StackMin => ref NPC.localAI[0]; + + public ref float StackMax => ref NPC.localAI[1]; + + public ref float OldItemType => ref NPC.localAI[2]; + + public bool ShouldUseWalkingFrames => NPC.velocity.X != 0 && ((WalkOrStand == 1 && Phase == (int)PhaseType.Idle) || (Phase == (int)PhaseType.FoundItem)); + + public bool ShouldUseInspectionFrames => Phase == (int)PhaseType.Bartering && TradeTimer < 80; + + public bool ShouldUseGivingFrames => Phase == (int)PhaseType.Bartering && TradeTimer >= 80; + + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.TimelessShores; + + protected override List PreyIDs => new List + { + + }; + + protected override List PredatorIDs => new List + { + ModContent.NPCType(), + ModContent.NPCType() + }; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + Main.npcFrameCount[NPC.type] = 1; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + Main.npcFrameCount[Type] = 7; + + InitializeScavengerLoot(); + + if (!Main.dedServ) + { + walkTexture = ModContent.Request(Texture + "Walking"); + inspectTexture = ModContent.Request(Texture + "Inspecting"); + giveTexture = ModContent.Request(Texture + "Giving"); + } + } + + #region Trades + + public static void InitializeScavengerLoot() + { + int white = ItemID.WhitePearl; + int black = ItemID.BlackPearl; + int pink = ItemID.PinkPearl; + int minBlock = 6; + int maxBlock = 17; + float coralBlockChance = 0.1f; + + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); + AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); + AddScavengerItem(white, ItemID.WoodenCrate, 1, () => !Main.hardMode, 0.1f); + AddScavengerItem(white, ItemID.WoodenCrateHard, 1, () => Main.hardMode, 0.1f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.1f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.1f); + AddScavengerItem(white, ItemID.ScarabBomb, 3, 10, 0.1f); + AddScavengerItem(white, ItemID.Coral, 3, 10, 0.2f); + AddScavengerItem(white, ItemID.Starfish, 3, 10, 0.2f); + AddScavengerItem(white, ItemID.Seashell, 3, 10, 0.2f); + // Critters. Golds, Radiants, Pearlpods and any Basalt Gully/Timeless Shore critters are to be excluded + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + + AddScavengerItem(black, ModContent.ItemType(), 1, () => !Main.hardMode, 0.1f); + AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); + AddScavengerItem(black, ItemID.PirateMap, 1, () => Main.hardMode, 0.05f); + AddScavengerItem(black, ItemID.IronCrate, 1, () => !Main.hardMode, 0.1f); + AddScavengerItem(black, ItemID.IronCrateHard, 1, () => Main.hardMode, 0.1f); + AddScavengerItem(black, ItemID.GoldenCrate, 1, () => !Main.hardMode, 0.02f); + AddScavengerItem(black, ItemID.GoldenCrateHard, 1, () => Main.hardMode, 0.02f); + AddScavengerItem(black, ItemID.WaterWalkingBoots, 1, 0.05f); + AddScavengerItem(black, ItemID.JellyfishNecklace, 1, 0.05f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); + //AddScavengerItem(black, ItemID.Nachos, 1, 0.05f); insert food item + AddScavengerItem(black, ModContent.ItemType(), 1, () => DownedBossSystem.downedDesertScourge, 0.3f); + AddScavengerItem(black, ModContent.ItemType(), 1, () => DownedBossSystem.downedDesertScourge, 0.3f); + AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); + AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); + AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); + AddScavengerItem(black, ItemID.FinWings, 1, () => Main.hardMode, 0.1f); + + AddScavengerItem(pink, ModContent.ItemType(), 1); + //AddScavengerItem(pink, ModContent.ItemType(), 1); + //AddScavengerItem(pink, ModContent.ItemType(), 1); + //AddScavengerItem(pink, ModContent.ItemType(), 1); + //AddScavengerItem(pink, ModContent.ItemType(), 1); + AddScavengerItem(pink, ModContent.ItemType(), 1); + AddScavengerItem(pink, ModContent.ItemType(), 1); + //AddScavengerItem(pink, ModContent.ItemType(), 1); + //AddScavengerItem(pink, ModContent.ItemType(), 1); + //AddScavengerItem(pink, ModContent.ItemType(), 1); + AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); + AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); + + ScavengerLoot[ItemID.GalaxyPearl] = ScavengerLoot[white]; // Gives 1-2x the amount of white items + ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; // Gives 2 pink items + + } + + #region Loot adding methods + /// + /// Adds an item to the Scavenger's loot pool + /// + /// The item type required to be traded + /// The loot item + /// The minimum amount to drop + /// The maximum amount to drop + /// The weight of the item drop. Lower numbers means lower chances + public static void AddScavengerItem(int currency, int itemID, int min, int max, float weight = 1) + { + AddScavengerItem(currency, itemID, min, max, () => true, weight); + } + + /// + /// Adds an item to the Scavenger's loot pool + /// + /// The item type required to be traded + /// The loot item + /// How much should drop + /// The weight of the item drop. Lower numbers means lower chances + public static void AddScavengerItem(int currency, int itemID, int amount, float weight = 1) + { + AddScavengerItem(currency, itemID, amount, amount, () => true, weight); + } + + /// + /// Adds an item to the Scavenger's loot pool + /// + /// The item type required to be traded + /// The loot item + /// How much should drop + /// A condition + /// The weight of the item drop. Lower numbers means lower chances + public static void AddScavengerItem(int currency, int itemID, int amount, Func condition, float weight = 1) + { + AddScavengerItem(currency, itemID, amount, amount, condition, weight); + } + + /// + /// Adds an item to the Scavenger's loot pool + /// + /// The item type required to be traded + /// The loot item + /// The minimum amount to drop + /// The maximum amount to drop + /// A condition + /// The weight of the item drop. Lower numbers means lower chances + public static void AddScavengerItem(int currency, int itemID, int min, int max, Func condition, float weight = 1) + { + if (ScavengerLoot.ContainsKey(currency)) + { + ScavengerLoot[currency].Add(new ScavengerItem(itemID, min, max, condition), weight); + } + else + { + ScavengerLoot.Add(currency, new WeightedRandom()); + ScavengerLoot[currency].Add(new ScavengerItem(itemID, min, max, condition), weight); + } + } + #endregion + #endregion + + public override void SetDefaults() + { + base.SetDefaults(); + NPC.damage = 20; + NPC.width = 48; + NPC.height = 48; + NPC.defense = 5; + NPC.lifeMax = 350; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit38; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.15f; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Scavenger") + }); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.Calamity().newAI[0] = reader.ReadSingle(); + NPC.Calamity().newAI[1] = reader.ReadSingle(); + NPC.Calamity().newAI[2] = reader.ReadSingle(); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.Calamity().newAI[0]); + writer.Write(NPC.Calamity().newAI[1]); + writer.Write(NPC.Calamity().newAI[2]); + } + + public override void AI() + { + // Check to make sure the target item still exists + if (HeldItemIndex > 0) + { + Item targetItem = Main.item[HeldItemIndex]; + // If the item doesn't exist, reset its held item + if (targetItem == null || !targetItem.active) + { + HeldItemIndex = -1; + } + } + + // Initialize its direction + if (NPC.direction == 0) + NPC.direction = Main.rand.NextBool() ? -1 : 1; + + switch (Phase) + { + // Do idle stuff, actual behavior not determined rn + case (int)PhaseType.Idle: + { + // Decide if it should walk or sit + float movementSpeed = CurrentPrey != null || CurrentPredator != null ? 2 : 1; + bool startMovement = false; + if (WalkTimer <= 0) + { + WalkTimer = Main.rand.Next(180, 340); + WalkOrStand = WalkOrStand <= 0 ? 1 : -1; + if (WalkOrStand == 1 && Main.rand.NextBool() && CurrentPrey == null) + { + NPC.direction *= -1; + } + if (CurrentPrey != null) + { + NPC.direction = (int)(CurrentPrey.Center.X - NPC.Center.X); + } + startMovement = true; + } + bool lookingAtPredator = CurrentPredator != null && NPC.direction == Math.Sign(CurrentPredator.Center.X - NPC.Center.X); + bool waterCheck = WaterCheck(16); + // If it bumps into something, jump or turn around + if ((!startMovement && TurnTimer <= 0 && (NPC.velocity.X == 0 || waterCheck) && WalkOrStand == 1) || lookingAtPredator) + { + // Jump if there are a couple tiles and a space above + if (!waterCheck && JumpCheck() && NPC.velocity.Y == 0 && !lookingAtPredator) + { + NPC.velocity.Y -= 7; + NPC.velocity.X = movementSpeed * NPC.direction; + WalkOrStand = 1; + TurnTimer = 10; + } + // Turn around if it can't jump up or a pit/water is in the way + else + { + NPC.direction *= -1; + TurnTimer = 30; + } + } + // Move + if (!NPC.justHit) + { + if (WalkOrStand == 1) + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); + else if (NPC.velocity.Y == 0) + NPC.velocity.X *= 0.95f; + } + else if (WalkOrStand == -1) + { + WalkTimer = 0; + if (CurrentPredator != null) + { + WalkOrStand = 1; + WalkTimer = Main.rand.Next(180, 340); + } + } + CalamityUtils.StepUpBlocks(NPC); + + // If the trade timer is 0 and the crab isn't looking ofr an item, look for an item + if (TradeTimer >= 0 && HeldItemIndex <= -1 && CurrentPredator == null) + { + float curDist = 0; + bool superRare = false; + foreach (Item i in Main.ActiveItems) + { + if (!i.active) + continue; + if (i.beingGrabbed) + continue; + float distance = i.Distance(NPC.Center); + if (distance > 460) + continue; + if (!NPC.HasSight(i.Center)) + continue; + if (Math.Abs(NPC.Center.Y - i.Center.Y) > 100) + continue; + + // Check if the item is a valid currency and is the closest possible currency + if (ScavengerLoot.ContainsKey(i.type)) + { + if (distance < curDist || curDist == 0) + { + HeldItemIndex = i.whoAmI; + superRare = i.type > ItemID.PinkPearl ? true : false; + } + curDist = distance; + } + } + // If an item was found, go after it + if (curDist != 0) + { + NPC.netUpdate = true; + Phase = (int)PhaseType.FoundItem; + TurnTimer = 0; + WalkTimer = 0; + if (NPC.velocity.Y == 0) + NPC.velocity.Y = -5; + NPC.direction = NPC.DirectionTo(Main.item[HeldItemIndex].Center).X.DirectionalSign(); + + SoundEngine.PlaySound(SoundID.NPCHit51 with { Pitch = -0.4f }, NPC.Center); + + EmoteExpressionParticle.EmoteType eType = superRare ? EmoteExpressionParticle.EmoteType.DoubleExclamation : EmoteExpressionParticle.EmoteType.Exclamation; + + var emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(2f, 3f); + Particle emote = new EmoteExpressionParticle( + NPC.Center + emoteDirection * 2f, + emoteDirection, + 2.2f, + Color.YellowGreen, + Main.rand.Next(30, 46), + eType); + GeneralParticleHandler.SpawnParticle(emote); + } + } + // Increment the trade timer back to zero if it is below zero + if (TradeTimer < 0) + TradeTimer++; + } + break; + // Go to the item + case (int)PhaseType.FoundItem: + { + // If the item is no longer valid, go back to idle behaviour + if (HeldItemIndex <= -1 || CurrentPredator != null) + { + NPC.netUpdate = true; + Phase = (int)PhaseType.Idle; + HeldItemIndex = -1; + TurnTimer = 0; + WalkTimer = 0; + return; + } + + // If the item is suddenly no longer valid for some reason, go back to idle behaviur + Item targetItem = Main.item[HeldItemIndex]; + if (!targetItem.active || !ScavengerLoot.ContainsKey(targetItem.type)) + { + NPC.netUpdate = true; + targetItem.noGrabDelay = 0; + HeldItemIndex = -1; + NPC.velocity = Vector2.Zero; + Phase = (int)PhaseType.Idle; + TurnTimer = 0; + WalkTimer = 0; + break; + } + + // Once the jump anim is done, go to the pearl + if (WalkTimer > 0) + { + float movementSpeed = 3; + bool waterCheck = WaterCheck(16); + // If it bumps into something, jump or turn around + if (TurnTimer <= 0 && (NPC.velocity.X == 0 || waterCheck) && NPC.velocity.Y == 0) + { + // Jump if there are a couple tiles and a space above + if (!waterCheck && JumpCheck()) + { + NPC.velocity.Y -= 8; + NPC.velocity.X = movementSpeed * NPC.direction; + TurnTimer = 10; + } + // Turn around if it can't jump up or a pit/water is in the way + else + { + NPC.direction *= -1; + TurnTimer = 30; + NPC.netUpdate = true; + targetItem.noGrabDelay = 0; + HeldItemIndex = -1; + Phase = (int)PhaseType.Idle; + TurnTimer = 0; + WalkTimer = 0; + } + } + // Change direction if the item position changed + bool itemOnRight = targetItem.Center.X > NPC.Center.X; + if (itemOnRight && NPC.direction == -1) + { + NPC.direction *= -1; + } + else if (!itemOnRight && NPC.direction == 0) + { + NPC.direction *= -1; + } + TurnTimer--; + + NPC.velocity.X = NPC.direction * movementSpeed; + CalamityUtils.StepUpBlocks(NPC); + } + // While the jump animation is occurring, slow down horizontally + else + { + NPC.velocity.X *= 0.95f; + } + // Marks if the jump animation is finished + if (NPC.velocity.Y == 0) + { + WalkTimer++; + } + + // Pull the item if close enough + if (targetItem.Distance(NPC.Center) < 120) + { + targetItem.noGrabDelay = 10000; + targetItem.velocity = targetItem.DirectionTo(NPC.Center) * 5; + } + // Grab the item if close enough + if (targetItem.Distance(NPC.Center) < 10) + { + NPC.netUpdate = true; + Phase = (int)PhaseType.Bartering; + // If the item's stack is 1, despawn the item. Otherwise decrement its stack by 1. + if (targetItem.stack == 1) + targetItem.active = false; + else + targetItem.stack--; + // Set the crab's held item type + HeldItemType = targetItem.type; + TurnTimer = 0; + WalkTimer = 0; + } + } + break; + // Ponder the held item then give a reward back + case (int)PhaseType.Bartering: + { + if (CurrentPredator != null) + { + Item.NewItem(NPC.GetSource_FromThis(), NPC.getRect(), HeldItemType); + + NPC.netUpdate = true; + HeldItemIndex = -1; + Phase = (int)PhaseType.Idle; + TurnTimer = 0; + WalkTimer = 0; + OldItemType = 0; + StackMin = 0; + StackMax = 0; + + SoundEngine.PlaySound(SoundID.NPCHit51 with { Pitch = -0.3f }, NPC.Center); + + EmoteExpressionParticle.EmoteType eType = EmoteExpressionParticle.EmoteType.Exclamation; + + var emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(2f, 3f); + Particle emote = new EmoteExpressionParticle( + NPC.Center + emoteDirection * 2f, + emoteDirection, + 2.2f, + Color.Red, + Main.rand.Next(30, 46), + eType); + GeneralParticleHandler.SpawnParticle(emote); + return; + } + NPC.velocity.X *= NPC.velocity.Y != 0 ? 0.96f : 0.9f; + TradeTimer++; + // Calculate the reward + if (TradeTimer == 132) + { + NPC.netUpdate = true; + OldItemType = HeldItemType; + HeldItemType = CalculateReward(out int min, out int max); + StackMin = min; + StackMax = max; + } + + // After some time, spit out a reward and go back to idle with a cooldown + if (TradeTimer > 160) + { + NPC.netUpdate = true; + HeldItemIndex = -1; + Phase = (int)PhaseType.Idle; + // This timer increments during its idle phase so it's set to a negative value + // Once the value hits zero, the crab will be able to trade again + TradeTimer = -CalamityUtils.SecondsToFrames(8); + + // Spawn the reward + if (HeldItemType > 0) + { + float stackMult = 1; + int dropAmt = 1; + if (ContentSamples.ItemsByType[HeldItemType].maxStack > 1) + { + if (OldItemType == ModContent.ItemType()) + stackMult *= 2; + if (OldItemType == ItemID.GalaxyPearl) + stackMult *= Main.rand.NextFloat(1.2f, 2f); + } + else + { + if (OldItemType == ModContent.ItemType()) + dropAmt *= 2; + if (OldItemType == ItemID.GalaxyPearl) + dropAmt *= 2; + } + for (int i = 0; i < dropAmt; i++) + { + SpawnItem(HeldItemType, stackMult); + } + } + HeldItemType = 0; + OldItemType = 0; + StackMin = 0; + StackMax = 0; + } + } + break; + } + + if (Phase != (int)PhaseType.FoundItem && WalkTimer > 0) + WalkTimer--; + + if (TurnTimer > 0) + TurnTimer--; + + NPC.spriteDirection = NPC.direction; + } + + public void SpawnItem(int ID, float stackMult = 1f) + { + int stack = 1; + if (NPC.localAI[0] != NPC.localAI[1]) + { + stack = Main.rand.Next((int)NPC.localAI[0], (int)NPC.localAI[1] + 1); + } + stack = (int)(stack * stackMult); + int i = Item.NewItem(NPC.GetSource_FromThis(), new Rectangle((int)NPC.Center.X + NPC.direction * 20, (int)NPC.Center.Y - 20, NPC.width, NPC.height), ID, Stack: stack); + Main.item[i].velocity = new Vector2(NPC.direction * Main.rand.NextFloat(3.7f, 4.3f), -Main.rand.NextFloat(-1.2f, 0.8f)); + } + + // Checks if the horizontal position in front of it has water or is a pit so that the crab can avoid it + public bool WaterCheck(int height) + { + Point startPos = NPC.direction == 1 ? NPC.Right.ToTileCoordinates() : NPC.Left.ToTileCoordinates(); + for (int i = 1; i < height; i++) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i); + Tile above = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i - 1); + // If there's a tile, wegud + if (t.HasTile) + return false; + // If there's liquid or a pit, we not gud + if (t.LiquidAmount > 0 && !above.HasTile) + return true; + + } + return true; + } + + // Checks if the horizontal position in front of the crab can be jumped up + public bool JumpCheck() + { + Point startPos = NPC.direction == 1 ? NPC.BottomRight.ToTileCoordinates() : NPC.BottomLeft.ToTileCoordinates(); + bool canJump = false; + int add = NPC.direction == 1 ? 0 : -1; + int jumpHeight = 6; + for (int i = jumpHeight; i > 0; i--) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + add, startPos.Y - i); + // If there are tiles obfuscating the jump position, return false + if (i > (jumpHeight - 2) && t.HasTile) + return false; + // If there is a tile to jump on, return true + if (t.HasTile) + { + canJump = true; + break; + } + } + return canJump; + } + + public int CalculateReward(out int min, out int max) + { + min = 0; + max = 0; + // Make sure the held item type is valid + if (ScavengerLoot.TryGetValue(HeldItemType, out WeightedRandom value)) + { + // If the held item has no roll value, immediately return + if (value == null) + return 0; + + int tries = 100; + for (int i = 0; i < tries; i++) + { + var v = value.Get(); + if (v.condition.Invoke()) + { + min = v.minimum; + max = v.maximum; + return v.itemID; + } + } + + return 0; + } + else + { + return 0; + } + } + + public static bool IsPassableTile(int x, int y) + { + return (!Main.tile[x, y].HasUnactuatedTile || + !Main.tileSolid[(int)Main.tile[x, y].TileType] || Main.tileSolidTop[(int)Main.tile[x, y].TileType]); + } + + public void StepUp() + { + Vector2 position = NPC.position; + position.X += NPC.velocity.X; + int x = (int)((position.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1)) * NPC.direction) / 16f); + int y = (int)((position.Y + (float)NPC.height - 1f) / 16f); + + if ((float)(x * 16) >= position.X + (float)NPC.width || (float)(x * 16 + 16) <= position.X) + return; + + bool nextTileValid = Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]; + bool aboveTileHalfBlock = Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile; + bool aboveTileHasRoom = Main.tile[x, y - 1].IsHalfBlock && IsPassableTile(x, y - 4); + bool aboveTileEmpty = !Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || aboveTileHasRoom; + bool tile3AbovePassable = !Main.tile[x - NPC.direction, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - NPC.direction, y - 3].TileType]; + + if ((nextTileValid || aboveTileHalfBlock) && aboveTileEmpty && IsPassableTile(x, y - 2) && IsPassableTile(x, y - 3) && tile3AbovePassable) + { + float npcBottom = (float)(y * 16); + if (Main.tile[x, y].IsHalfBlock) + { + npcBottom += 8f; + } + if (Main.tile[x, y - 1].IsHalfBlock) + { + npcBottom -= 8f; + } + if (npcBottom < position.Y + (float)NPC.height) + { + float percentageTileRisen = position.Y + (float)NPC.height - npcBottom; + if (percentageTileRisen <= 16.1f) + { + NPC.gfxOffY += NPC.position.Y + (float)NPC.height - npcBottom; + NPC.position.Y = npcBottom - (float)NPC.height; + if (percentageTileRisen < 9f) + { + NPC.stepSpeed = 1f; + } + else + { + NPC.stepSpeed = 2f; + } + } + } + } + } + + public override void FindFrame(int frameHeight) + { + float frameCount = Main.npcFrameCount[Type] - 1; + + if (ShouldUseWalkingFrames) + frameCount = 5; + else if (ShouldUseInspectionFrames) + frameCount = 23; + else if (ShouldUseGivingFrames) + frameCount = 12; + + NPC.frameCounter++; + if (NPC.frameCounter > 6) + { + NPC.frame.Y++; + NPC.frameCounter = 0; + } + + // Reset frame when transitioning to giving animation + if (NPC.frame.Y >= frameCount || (Phase == (int)PhaseType.Bartering && TradeTimer == 80)) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0; + } + } + + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.Cavern.Chance * 0.4f; + } + return 0f; + + //fuck this + //if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType()) + //{ + // return 0.05f; + //} + //return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + int frameCount = Main.npcFrameCount[Type]; + float extraPosOffset = 0; + if (ShouldUseWalkingFrames) + { + texture = walkTexture.Value; + frameCount = 6; + } + else if (ShouldUseInspectionFrames) + { + texture = inspectTexture.Value; + frameCount = 24; + extraPosOffset = 6; + } + else if (ShouldUseGivingFrames) + { + texture = giveTexture.Value; + frameCount = 13; + } + Vector2 origin = new Vector2(texture.Width / 2, texture.Height / frameCount / 2); + Vector2 npcOffset = NPC.Center - screenPos + Vector2.UnitY * extraPosOffset; + npcOffset -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, npcOffset, texture.Frame(1, frameCount, 0, NPC.frame.Y), NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + // my dreams devoured + // legacy code for visually holding an item + /*Texture2D item = TextureAssets.Item[HeldItemType].Value; + Vector2 itemOffset = new Vector2(NPC.direction == 1 ? 8 : -8, 20); + if (TradeTimer < 80) + spriteBatch.Draw(item, npcOffset + itemOffset, null, drawColor, 0, new Vector2(item.Width / 2, item.Height), 1f, spriteEffects, 0); + */ + return false; + } + } +} diff --git a/NPCs/SunkenSea/Scavenger.png b/NPCs/SunkenSea/Scavenger.png new file mode 100644 index 0000000000..7e3f646f0d Binary files /dev/null and b/NPCs/SunkenSea/Scavenger.png differ diff --git a/NPCs/SunkenSea/ScavengerGiving.png b/NPCs/SunkenSea/ScavengerGiving.png new file mode 100644 index 0000000000..cd08777d65 Binary files /dev/null and b/NPCs/SunkenSea/ScavengerGiving.png differ diff --git a/NPCs/SunkenSea/ScavengerInspecting.png b/NPCs/SunkenSea/ScavengerInspecting.png new file mode 100644 index 0000000000..7db93e9712 Binary files /dev/null and b/NPCs/SunkenSea/ScavengerInspecting.png differ diff --git a/NPCs/SunkenSea/ScavengerWalking.png b/NPCs/SunkenSea/ScavengerWalking.png new file mode 100644 index 0000000000..229cc451c6 Binary files /dev/null and b/NPCs/SunkenSea/ScavengerWalking.png differ diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index 04acfe9d7f..6746073626 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -172,6 +172,8 @@ namespace CalamityMod.NPCs.SunkenSea return NPC.HasSight(p.Center) && Vector2.DistanceSquared(NPC.Center, p.Center) < 360f * 360f; } + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); + public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.3f : 0.15f; diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs index 2645577fd6..c4857a199b 100644 --- a/NPCs/SunkenSea/Sharkoon.cs +++ b/NPCs/SunkenSea/Sharkoon.cs @@ -249,11 +249,13 @@ namespace CalamityMod.NPCs.SunkenSea } // When it gets outside of water, it'll try to gravitate downards towards the water. - if (!NPC.wet && !IsExploding) + if (!NPC.wet && !IsExploding && CurrentBehavior != OutsideWaterBehavior) CurrentBehavior = OutsideWaterBehavior; - // Reset any squish that is done to the Sharkoon. + + // Reset any squish that is done to the Sharkoon, and clamps its upper limit to prevent it from becoming too tall if (ScaleSquish.Y > 1f) + ScaleSquish.Y = MathHelper.Clamp(ScaleSquish.Y, 1f, 1.5f); ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 2ab010ca66..6849d231a9 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2267,7 +2267,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(spark2); } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; @@ -2286,7 +2286,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(spark2); } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; @@ -2308,7 +2308,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(orb); } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { float projectileVelocityToPass = projectileVelocity.Length() * 1.3f; Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); @@ -3556,7 +3556,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas float _ = 0f; bool collidingWithShield = Collision.CheckAABBvLineCollision(target.TopLeft, target.Size, shieldTop, shieldBottom, 64f, ref _) && shieldOpacity > 0.55f; - return collidingWithShield || NPC.Hitbox.Intersects(target.Hitbox); + // CIT 16MAY2025: SCal must have contact damage set on the first frame to preserve difficulty mode stat scaling, sometimes leading to people getting hit if on top of her. + // Thus, also check if the arena has spawned, since that will not be true on the first frame. + return (collidingWithShield || NPC.Hitbox.Intersects(target.Hitbox)) && spawnArena; } public override void FindFrame(int frameHeight) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index e458db81c1..be01b55807 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -527,7 +527,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!despawn) npc.localAI[1] += 1f; - if (npc.localAI[1] >= 210f) + float teleportGateValue = npc.ai[0] == -6f ? 300f : 210f; + if (npc.localAI[1] >= teleportGateValue) { npc.localAI[1] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs index e981b3ac3c..ddaa634383 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs @@ -16,8 +16,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static bool shouldDrawEnrageBorder = true; public static bool hasTargetBeenInRange = true; - public const float increaseDRTriggerDistance = 750f; - public const float maxDRIncreaseDistance = 1200f; + public const float IncreaseDRTriggerDistance = 750f; + public const float MaxDRIncreaseDistance = 1200f; public static float borderDelay = 10f * 60f; public static float innerBorder = 750f; public static float outerBorder = 1200f; @@ -60,8 +60,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Damage resistance based on distance from target float distanceFromTarget = npc.Distance(targetData.Center); - bool triggerDRIncrease = distanceFromTarget >= increaseDRTriggerDistance; - float resistDamageAmount = MathHelper.Clamp((distanceFromTarget - increaseDRTriggerDistance) / (maxDRIncreaseDistance - increaseDRTriggerDistance), 0f, 1f); + bool triggerDRIncrease = distanceFromTarget >= IncreaseDRTriggerDistance; + float resistDamageAmount = MathHelper.Clamp((distanceFromTarget - IncreaseDRTriggerDistance) / (MaxDRIncreaseDistance - IncreaseDRTriggerDistance), 0f, 1f); npc.localAI[3] = MathHelper.Lerp(0f, 30f, resistDamageAmount); float dustAndDRScalar = Utils.Remap(npc.localAI[3], 0f, 30f, 0f, 1f); calamityGlobalNPC.DR = MathHelper.Lerp(0.05f, 0.9f, dustAndDRScalar); @@ -85,14 +85,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (borderDelay > 120f) borderDelay = 120f; } - if (innerBorder != increaseDRTriggerDistance || maxDRIncreaseDistance != outerBorder) + if (innerBorder != IncreaseDRTriggerDistance || MaxDRIncreaseDistance != outerBorder) { // Adjust the border IF the new value is lower (helps prevent jumping if you enter the border early while it's on screen but not finished zooming in) var LerpValue = Utils.GetLerpValue(hasTargetBeenInRange ? 120f : 180f, 0f, borderDelay, true); - var newInner = MathHelper.Lerp(maxDRIncreaseDistance * 5f, increaseDRTriggerDistance, LerpValue); + var newInner = MathHelper.Lerp(MaxDRIncreaseDistance * 5f, IncreaseDRTriggerDistance, LerpValue); if (newInner < innerBorder) innerBorder = newInner; - var newOuter = MathHelper.Lerp(maxDRIncreaseDistance * 5f, maxDRIncreaseDistance, LerpValue); + var newOuter = MathHelper.Lerp(MaxDRIncreaseDistance * 5f, MaxDRIncreaseDistance, LerpValue); if (newOuter < outerBorder) outerBorder = newOuter; } @@ -127,9 +127,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.homeTileX = (int)npc.ai[2]; npc.homeTileY = (int)npc.ai[3]; - // Spawn Shadow Hands - if (Main.netMode != NetmodeID.MultiplayerClient) - SpawnPassiveShadowHands(npc, lifeRatio, shadowHand, shadowHandDamage, death); + // Spawn Shadow Hands if the player enters the shadows + if (Main.netMode != NetmodeID.MultiplayerClient && hasTargetBeenInRange) + SpawnBorderShadowHands(npc, lifeRatio, shadowHand, shadowHandDamage, death); // AI states switch ((int)npc.ai[0]) @@ -167,46 +167,69 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 distanceFromTarget2 = closestTargetPoint - relativeCenter; (closestTargetPoint - npc.Center).Length(); float distanceCheckMultiplier = 0.6f; + bool useFrontIceSpikeAttack = Math.Abs(distanceFromTarget2.X) >= Math.Abs(distanceFromTarget2.Y) * distanceCheckMultiplier || distanceFromTarget2.Length() < 48f; bool useEitherIceSpikeAttack = distanceFromTarget2.Y <= (float)(100 + targetData.Height) && distanceFromTarget2.Y >= -200f; - if (Math.Abs(distanceFromTarget2.X) < 120f && useEitherIceSpikeAttack && npc.velocity.Y == 0f && npc.localAI[1] >= 2f) + + // Can only use ice spikes a maximum of twice in a row before doing something else + float iceSpikeAttackLimit = 2f; + bool doNotUseIceSpikes = calamityGlobalNPC.newAI[1] >= iceSpikeAttackLimit; + if (!doNotUseIceSpikes) { - npc.velocity.X = 0f; - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] -= 1f; - npc.SyncExtraAI(); - npc.netUpdate = true; - break; + // Deerclops must be this close to its target on the X axis to do the ice spike attack + // This distance increases at lower HP because the ice spikes get bigger + float iceSpikesDistanceGateValue = 120f + MathHelper.Lerp(0f, 120f, 1f - lifeRatio); + if (Math.Abs(distanceFromTarget2.X) < iceSpikesDistanceGateValue && useEitherIceSpikeAttack && npc.velocity.Y == 0f && npc.localAI[1] >= 2f) + { + npc.velocity.X = 0f; + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] -= 1f; + calamityGlobalNPC.newAI[1] += 1f; + npc.SyncExtraAI(); + npc.netUpdate = true; + break; + } + + if (Math.Abs(distanceFromTarget2.X) < iceSpikesDistanceGateValue && useEitherIceSpikeAttack && npc.velocity.Y == 0f && useFrontIceSpikeAttack) + { + npc.velocity.X = 0f; + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.localAI[1] += 1f; + calamityGlobalNPC.newAI[0] -= 1f; + calamityGlobalNPC.newAI[1] += 1f; + npc.SyncExtraAI(); + npc.netUpdate = true; + break; + } } - if (Math.Abs(distanceFromTarget2.X) < 120f && useEitherIceSpikeAttack && npc.velocity.Y == 0f && useFrontIceSpikeAttack) + // Can only use rubble a maximum of thrice in a row before doing something else + // This also takes into account the ice spike limit + float rubbleAttackLimit = 3f; + bool doNotUseRubble = calamityGlobalNPC.newAI[1] >= rubbleAttackLimit; + float rubbleGateValue = death ? 160f : 200f; + if (!doNotUseRubble) { - npc.velocity.X = 0f; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.localAI[1] += 1f; - calamityGlobalNPC.newAI[0] -= 1f; - npc.SyncExtraAI(); - npc.netUpdate = true; - break; + bool useRubbleAttack = npc.ai[1] >= rubbleGateValue; + if (npc.velocity.Y == 0f && npc.velocity.X != 0f && useRubbleAttack) + { + npc.velocity.X = 0f; + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] -= 1f; + calamityGlobalNPC.newAI[1] += 1f; + npc.SyncExtraAI(); + npc.netUpdate = true; + break; + } } - bool useRubbleAttack = npc.ai[1] >= 240f; - if (npc.velocity.Y == 0f && npc.velocity.X != 0f && useRubbleAttack) - { - npc.velocity.X = 0f; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] -= 1f; - npc.SyncExtraAI(); - npc.netUpdate = true; - break; - } - - bool useShadowHandAttack = npc.ai[1] >= 90f; + float shadowHandGateValue = death ? 60f : 75f; + bool useShadowHandAttack = npc.ai[1] >= shadowHandGateValue; if (npc.velocity.Y == 0f && npc.velocity.X == 0f && useShadowHandAttack) { npc.velocity.X = 0f; @@ -214,24 +237,34 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = 0f; npc.localAI[1] = 0f; calamityGlobalNPC.newAI[0] -= 1f; + calamityGlobalNPC.newAI[1] = 0f; npc.SyncExtraAI(); npc.netUpdate = true; break; } // This replaced the slow debuff infliction - bool useSecondShadowHandAttack = npc.ai[1] >= 120f; + // Must use 4 different attacks before being able to use this attack again + float secondShadowHandAttackCooldown = 4f; + float secondShadowHandGateValue = death ? 80f : 100f; + bool useSecondShadowHandAttack = npc.ai[1] >= secondShadowHandGateValue; if (npc.velocity.Y == 0f && useSecondShadowHandAttack && Math.Abs(distanceFromTarget2.X) > 100f && calamityGlobalNPC.newAI[0] <= 0f) { npc.velocity.X = 0f; npc.ai[0] = 3f; npc.ai[1] = 0f; npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 5f; + calamityGlobalNPC.newAI[0] = secondShadowHandAttackCooldown; + calamityGlobalNPC.newAI[1] = 0f; npc.SyncExtraAI(); npc.netUpdate = true; } + // If Deerclops has been taking a while to attack, stop moving on the X axis to force a shadow hand attack + float haltMovementGateValue = doNotUseRubble ? (secondShadowHandGateValue + 20f) : doNotUseIceSpikes ? (rubbleGateValue + 20f) : 240f; + if (distanceFromTarget2.Length() < IncreaseDRTriggerDistance) + haltMovement = npc.ai[1] >= haltMovementGateValue; + break; // Create spikes in front of Deerclops @@ -314,7 +347,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = (death ? 7 : 5) + (int)MathHelper.Lerp(0f, 11f, 1f - lifeRatio); + int totalProjectiles = (death ? 11 : 9) + (int)MathHelper.Lerp(0f, 7f, 1f - lifeRatio); float velocityMultIncrement = ((totalProjectiles + 1) / (float)totalProjectiles) - 1f; float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, death ? 270f : 180f, 1f - lifeRatio)); float radians = MathHelper.TwoPi / totalProjectiles + randomRadialOffset; @@ -324,7 +357,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 actualVelocity = spinningPoint.RotatedBy(radians * k); float velocityMultiplier = 1f - k * velocityMultIncrement; - Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 450f, actualVelocity * velocityMultiplier * -1f, shadowHand, shadowHandDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 550f, actualVelocity * velocityMultiplier * -1f, shadowHand, shadowHandDamage, 0f, Main.myPlayer); } } } @@ -356,7 +389,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; - // Spawn shadow hands around the target with randomized AI + // Spawn shadow hands around the target (literally just a different variant of the other shadow hand attack with more spread and more velocity) case 5: if (npc.ai[1] == 30f) @@ -375,11 +408,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int handAmount = (int)MathHelper.Lerp(death ? 5f : 3f, death ? 12f : 10f, 1f - lifeRatio); - for (int i = 0; i < handAmount; i++) + int totalProjectiles = (death ? 11 : 9) + (int)MathHelper.Lerp(0f, 7f, 1f - lifeRatio); + float velocityMultIncrement = ((totalProjectiles + 1) / (float)totalProjectiles) - 1f; + float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, death ? 360f : 270f, 1f - lifeRatio)); + float radians = MathHelper.TwoPi / totalProjectiles + randomRadialOffset; + float velocity = (death ? 10.5f : 8f) + MathHelper.Lerp(0f, 4f, 1f - lifeRatio); + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - RandomizeInsanityShadowFor(Main.player[npc.target], death, isHostile: true, out var spawnposition, out var spawnvelocity, out var ai, out var ai2); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnposition, spawnvelocity, shadowHand, shadowHandDamage, 0f, Main.myPlayer, ai, ai2); + Vector2 actualVelocity = spinningPoint.RotatedBy(radians * k); + float velocityMultiplier = 1f - k * velocityMultIncrement; + Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 550f, actualVelocity * velocityMultiplier * -1f, shadowHand, shadowHandDamage, 0f, Main.myPlayer); } } } @@ -541,9 +580,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - private static void SpawnPassiveShadowHands(NPC npc, float lifeRatio, int shadowHand, int shadowHandDamage, bool death) + private static void SpawnBorderShadowHands(NPC npc, float lifeRatio, int shadowHand, int shadowHandDamage, bool death) { - int shadowHandSpawnRate = (int)Utils.Remap(lifeRatio, 1f, 0f, death ? 60f : 80f, death ? 30f : 40f); + int shadowHandSpawnRate = death ? 15 : 20; npc.localAI[2] += 1f; int shadowHandTimer = (int)npc.localAI[2]; if (shadowHandTimer % shadowHandSpawnRate != 0) @@ -555,85 +594,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses foreach (Player player in Main.ActivePlayers) { - if (npc.Boss_CanShootExtraAt(player.whoAmI, rotation % 3, 3, 1200f, alwaysSkipMainTarget: false)) + // Spawn hands to cut the player off and force them back towards Deerclops + // This only happens if the player is triggering Deerclops' increased DR + float minShadowHandSpawnDistanceFromPlayer = 360f; + float playerDistanceFromDeerclops = Vector2.Distance(npc.Center, player.Center); + if (playerDistanceFromDeerclops >= IncreaseDRTriggerDistance && playerDistanceFromDeerclops <= MaxDRIncreaseDistance) { - // Normal shadow hand spawn behavior - // Modified to make the shadow hand spawns fair - RandomizeInsanityShadowFor(player, death, isHostile: true, out var spawnPosition, out var spawnVelocity, out var ai, out var ai2); - - // Spawn hands to cut the player off and force them back towards Deerclops - // This only happens if the player is triggering Deerclops' increased DR - float minShadowHandSpawnDistanceFromPlayer = 450f; - float playerDistanceFromDeerclops = Vector2.Distance(npc.Center, player.Center); - if (playerDistanceFromDeerclops >= 450f) - { - spawnPosition = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (playerDistanceFromDeerclops + minShadowHandSpawnDistanceFromPlayer); - spawnVelocity = (player.Center - spawnPosition).SafeNormalize(Vector2.UnitY) * spawnVelocity.Length(); - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition, spawnVelocity, shadowHand, shadowHandDamage, 0f, Main.myPlayer, ai, ai2); + Vector2 spawnPosition = npc.Center + (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (playerDistanceFromDeerclops + minShadowHandSpawnDistanceFromPlayer); + float shadowHandVelocity = death ? 6f : 5f; + Vector2 spawnVelocity = (player.Center - spawnPosition).SafeNormalize(Vector2.UnitY) * shadowHandVelocity; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition, spawnVelocity, shadowHand, shadowHandDamage, 0f, Main.myPlayer); } } } - private static void RandomizeInsanityShadowFor(Entity targetEntity, bool death, bool isHostile, out Vector2 spawnPosition, out Vector2 spawnVelocity, out float ai0, out float ai1) - { - int spawnDirection = Main.rand.NextBool() ? 1 : -1; - int shadowHandType = Main.rand.Next(4); - float spawnDistance = (isHostile ? 450f : 225f); - float velocityDivisor = (isHostile ? 30 : 20); - float velocityOffset = (isHostile ? 30 : 0); - float randomRotation = Main.rand.NextFloatDirection() * (float)Math.PI * 0.125f; - if (isHostile && targetEntity.velocity.X * (float)spawnDirection > 0f) - spawnDirection *= -1; - - if (shadowHandType == 0 && isHostile) - velocityDivisor += 10f; - - spawnPosition = targetEntity.Center + targetEntity.velocity * velocityOffset + new Vector2((float)spawnDirection * (0f - spawnDistance), 0f).RotatedBy(randomRotation); - spawnVelocity = new Vector2((float)spawnDirection * spawnDistance / velocityDivisor, 0f).RotatedBy(randomRotation); - ai0 = 0f; - ai1 = 0f; - - int velocityAdd = death ? 2 : 0; - if (shadowHandType == 1) - { - float rotation = (float)Math.PI * 2f * Main.rand.NextFloat(); - spawnPosition = targetEntity.Center - rotation.ToRotationVector2() * spawnDistance; - ai0 = 180f; - ai1 = rotation - (float)Math.PI / 2f; - spawnVelocity = rotation.ToRotationVector2() * (isHostile ? (4 + velocityAdd) : 2); - } - else if (shadowHandType == 2) - { - float rotation = (float)Math.PI * 2f * Main.rand.NextFloat(); - spawnPosition = targetEntity.Center - rotation.ToRotationVector2() * spawnDistance; - ai0 = 300f; - ai1 = rotation; - spawnVelocity = rotation.ToRotationVector2() * (isHostile ? (4 + velocityAdd) : 2); - } - else if (shadowHandType == 3) - { - float rotation = (float)Math.PI * 2f * Main.rand.NextFloat(); - float distance = (isHostile ? 150 : 75); - float spawnVelocityRotation = (float)Math.PI / 2f / distance * Main.rand.NextFloatDirection(); - spawnPosition = targetEntity.Center + targetEntity.velocity * distance; - if (Vector2.Distance(spawnPosition, targetEntity.Center) < spawnDistance) - spawnPosition = (spawnPosition - targetEntity.Center).SafeNormalize(Vector2.UnitY) * spawnDistance; - - Vector2 vector = rotation.ToRotationVector2() * (isHostile ? (8 + velocityAdd) : 3); - for (int i = 0; (float)i < distance; i++) - { - spawnPosition -= vector; - vector = vector.RotatedBy(0f - spawnVelocityRotation); - } - - spawnVelocity = vector; - ai0 = 390f; - ai1 = spawnVelocityRotation; - } - } - private static void ShootRubbleUp(NPC npc, ref Point sourceTileCoords, int howMany, int distancedByThisManyTiles, int whichOne, int rubble, int rubbleDamage, float lifeRatio, bool death) { // Loop to spawn rubble @@ -657,9 +631,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 rubbleVelocity = new Vector2(0f, -1f).RotatedBy((float)(whichOne * npc.direction) * 0.7f * ((float)Math.PI / 4f / (float)howMany)); int ai1_FrameToUse = Main.rand.Next(Main.projFrames[rubble] * 4); ai1_FrameToUse = 6 + Main.rand.Next(6); - float delay = (int)MathHelper.Lerp(death ? 8f : 10f, death ? 16f : 20f, lifeRatio); - float ai2_DelayBeforeGoingUp = whichOne * delay; - Projectile.NewProjectile(npc.GetSource_FromAI(), new Vector2(posX * 16 + 8, posY * 16 - 8), rubbleVelocity * 0.01f, rubble, rubbleDamage, 0f, Main.myPlayer, 0f, ai1_FrameToUse, ai2_DelayBeforeGoingUp); + float delay = death ? 24f : 30f; + float ai2_DelayBeforeGoingUp = (whichOne + 1) * delay; + float velocityMultiplier = MathHelper.Lerp(0.01f, 0.015f, 1f - lifeRatio); + Projectile.NewProjectile(npc.GetSource_FromAI(), new Vector2(posX * 16 + 8, posY * 16 - 8), rubbleVelocity * velocityMultiplier, rubble, rubbleDamage, 0f, Main.myPlayer, 0f, ai1_FrameToUse, ai2_DelayBeforeGoingUp); } private static void MakeSpikesForward(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int iceSpikeDamage, float lifeRatio, bool death) @@ -671,7 +646,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!(npc.ai[AISLOT_PhaseCounter] < (float)iceSpikeGateValue)) { Point sourceTileCoords = npc.Bottom.ToTileCoordinates(); - int numIceSpikes = lifeRatio < 0.5f ? 15 : 20; + int numIceSpikes = 20; int xOffsetMult = 1; sourceTileCoords.X += npc.direction * 3; int screenShakeGateValue = (int)npc.ai[AISLOT_PhaseCounter] - iceSpikeGateValue; @@ -686,12 +661,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (screenShakeGateValue % 4 != 0) iceSpikeLimit = iceSpikeStart; + // Ice spikes get fucking gigantic later on in the fight + float iceSpikeScaleIncrease = MathHelper.Lerp(1f, 2f, 1f - lifeRatio); for (int i = iceSpikeStart; i < iceSpikeLimit && i < numIceSpikes; i++) { - int xOffset = i * xOffsetMult; + int xOffset = (int)Math.Round(i * xOffsetMult * iceSpikeScaleIncrease); TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, i, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); - if (lifeRatio < 0.5f) - TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, i, xOffset * 2, iceSpike, iceSpikeDamage, lifeRatio, death); } } } @@ -705,7 +680,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!(npc.ai[AISLOT_PhaseCounter] < (float)iceSpikeGateValue)) { Point sourceTileCoords = npc.Bottom.ToTileCoordinates(); - int numIceSpikes = lifeRatio < 0.5f ? 12 : 15; + int numIceSpikes = 15; int xOffsetMult = 1; int screenShakeGateValue = (int)npc.ai[AISLOT_PhaseCounter] - iceSpikeGateValue; if (screenShakeGateValue == 0) @@ -719,16 +694,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (screenShakeGateValue % 2 != 0) iceSpikeLimit = iceSpikeStart; + // Ice spikes get fucking gigantic later on in the fight + float iceSpikeScaleIncrease = MathHelper.Lerp(1f, 2f, 1f - lifeRatio); for (int iceSpikeIndex = iceSpikeStart; iceSpikeIndex >= 0 && iceSpikeIndex < iceSpikeLimit && iceSpikeIndex < numIceSpikes; iceSpikeIndex++) { - int xOffset = iceSpikeIndex * xOffsetMult; + int xOffset = (int)Math.Round(iceSpikeIndex * xOffsetMult * iceSpikeScaleIncrease); TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); TryMakingSpike(npc, ref sourceTileCoords, -npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); - if (lifeRatio < 0.5f) - { - TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, -iceSpikeIndex, xOffset * 2, iceSpike, iceSpikeDamage, lifeRatio, death); - TryMakingSpike(npc, ref sourceTileCoords, -npc.direction, numIceSpikes, -iceSpikeIndex, xOffset * 2, iceSpike, iceSpikeDamage, lifeRatio, death); - } } } } @@ -741,8 +713,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 iceSpikeSpawnPos = new Vector2(posX * 16 + 8, posY * 16 - 8); Vector2 iceSpikeVelocity = new Vector2(0f, -1f).RotatedBy((float)(whichOne * dir) * 0.7f * ((float)Math.PI / 4f / (float)howMany)); - float scaleIncrease = MathHelper.Lerp(0f, 0.55f, 1f - lifeRatio); - Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, iceSpikeDamage, 0f, Main.myPlayer, 0f, 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * (1.1f + scaleIncrease) / (float)howMany); + float iceSpikeScale = 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * 1.1f / (float)howMany; + Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, iceSpikeDamage, 0f, Main.myPlayer, 0f, iceSpikeScale); } } @@ -833,7 +805,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (stopMoving) { - npc.velocity.X *= 0.9f; + npc.velocity.X *= 0.8f; if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index 79474e1803..eb52a49218 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -207,13 +207,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (death && phase6 && phase == 3)); bool charging = phase == 0; + bool stingerArcs = phase == 4; + bool beenadeVomit = phase == 5; // 5 is stinger arc and charge - if (phase == 4) + if (stingerArcs) phase = 5; // 6 is beenade vomit - if (phase == 5) + if (beenadeVomit) phase = 6; CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); @@ -317,15 +319,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 0f; float chargeVelocityX = (phase4 ? 24f : phase2 ? 20f : 16f) + 8f * enrageScale; float chargeVelocityY = (phase4 ? 18f : phase2 ? 15f : 12f) + 6f * enrageScale; - float chargeAccelerationX = (phase4 ? 0.9f : phase2 ? 0.7f : 0.5f) + 0.25f * enrageScale; - float chargeAccelerationY = (phase4 ? 0.45f : phase2 ? 0.35f : 0.25f) + 0.125f * enrageScale; + float chargeAccelerationX = (phase4 ? 0.7f : phase2 ? 0.6f : 0.5f) + 0.25f * enrageScale; + float chargeAccelerationY = (phase4 ? 0.35f : phase2 ? 0.3f : 0.25f) + 0.125f * enrageScale; if (death) { chargeVelocityX += 2f; chargeVelocityY += 4f; - chargeAccelerationX += 0.15f; - chargeAccelerationY += 0.3f; + chargeAccelerationX += 0.1f; + chargeAccelerationY += 0.2f; } // Velocity calculations @@ -925,11 +927,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - float beenadeAttackSpeed = 20f + 4f * enrageScale; - float beenadeAttackAccel = 0.75f; - Vector2 targetVector = Main.player[npc.target].Center + Vector2.UnitY * 240f; + float beenadeAttackSpeed = 16f + 4f * enrageScale; + float beenadeAttackAccel = 0.5f; + Vector2 targetVector = Main.player[npc.target].Center - Vector2.UnitY * 240f; - if (npc.Distance(targetVector) > 80f) + if (npc.Distance(targetVector) > 160f) npc.SimpleFlyMovement(npc.SafeDirectionTo(targetVector) * beenadeAttackSpeed, beenadeAttackAccel); else npc.velocity *= 0.8f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index d182231f38..7634c94155 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -410,9 +410,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; calamityGlobalNPC.newAI[1] += 1f; - float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 14f) : phase4 ? (death ? 8f : 6f) : ((death ? 6f : 4f) * ((1f - lifeRatio) / (1f - phase4LifeRatio))); + float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 8f) : phase4 ? (death ? 6f : 4f) : ((death ? 4.5f : 3f) * ((1f - lifeRatio) / (1f - phase4LifeRatio))); if (!handsDead) - chargePhaseChangeRateBoost *= 0.5f; + chargePhaseChangeRateBoost *= 0.25f; float chargePhaseChangeRate = chargePhaseChangeRateBoost + 1f; npc.ai[2] += chargePhaseChangeRate; @@ -494,6 +494,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = npc.velocity.X / 15f; + // Force net updates every frame during this movement to avoid despawning in multiplayer + // I'm doing this because npc.ai[2] changes every frame and that's used to calculate Skeletron's velocity here + npc.ForceNetUpdate(); + return false; } diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index cebbf59dee..31fd7a91dc 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Particles private bool FadeOut; private Vector2 Squish; private Color BaseColor; + private float MakeLight; - public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true, float baseOpacity = 1f, bool fade = true) + public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true, float baseOpacity = 1f, bool fade = true, float makeLight = 1) { Position = position; Velocity = velocity; @@ -39,6 +40,7 @@ namespace CalamityMod.Particles Squish = squish; Rotation = rotation; UseAltVisual = UseAdditiveBlend; + MakeLight = makeLight; } public override void Update() @@ -49,7 +51,8 @@ namespace CalamityMod.Particles opacity = (FadeOut ? (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) : 1f) * BaseOpacity; Color = BaseColor * opacity; - Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + if (MakeLight > 0) + Lighting.AddLight(Position, (Color.R / 255f) * MakeLight, (Color.G / 255f) * MakeLight, (Color.B / 255f) * MakeLight); Velocity *= 0.95f; } @@ -64,7 +67,6 @@ namespace CalamityMod.Particles { Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; scaleMult = (MathHelper.Lerp(tex.Size().X / joke.Size().X, tex.Size().Y / joke.Size().Y, 0.5f)); - Main.NewText(scaleMult); tex = joke; UseAltVisual = true; } diff --git a/Particles/ForwardSmear.png b/Particles/ForwardSmear.png new file mode 100644 index 0000000000..b577cc9891 Binary files /dev/null and b/Particles/ForwardSmear.png differ diff --git a/Particles/GlowTriangle.png b/Particles/GlowTriangle.png new file mode 100644 index 0000000000..cdc9e2e98e Binary files /dev/null and b/Particles/GlowTriangle.png differ diff --git a/Particles/MediumMistParticle.cs b/Particles/MediumMistParticle.cs index d35f5330ca..358ccdbcbc 100644 --- a/Particles/MediumMistParticle.cs +++ b/Particles/MediumMistParticle.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; diff --git a/Particles/ShineExplosion1.png b/Particles/ShineExplosion1.png new file mode 100644 index 0000000000..0c288e7f05 Binary files /dev/null and b/Particles/ShineExplosion1.png differ diff --git a/Particles/ShineExplosion2.png b/Particles/ShineExplosion2.png new file mode 100644 index 0000000000..44fb3e36a6 Binary files /dev/null and b/Particles/ShineExplosion2.png differ diff --git a/Particles/XykWing1.png b/Particles/XykWing1.png new file mode 100644 index 0000000000..6779fd4ee6 Binary files /dev/null and b/Particles/XykWing1.png differ diff --git a/Particles/XykWing2.png b/Particles/XykWing2.png new file mode 100644 index 0000000000..8ace823d53 Binary files /dev/null and b/Particles/XykWing2.png differ diff --git a/Particles/XykWing3.png b/Particles/XykWing3.png new file mode 100644 index 0000000000..5db97a482d Binary files /dev/null and b/Particles/XykWing3.png differ diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs index d9834046f1..b9cfaa5def 100644 --- a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -110,12 +110,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// /// Calculates the laser length while taking tiles into account. /// - /// The amount of samples the ray uses. The higher this is, the more precision, but also more calculations done. - public float DetermineLaserLength_CollideWithTiles(int samplePointCount) + public float DetermineLaserLength_CollideWithTiles() { - float[] laserLengthSamplePoints = new float[samplePointCount]; - Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.scale, MaxLaserLength, laserLengthSamplePoints); - return laserLengthSamplePoints.Average(); + return CalamityUtils.PreciseDistanceToTileCollisionHit(Projectile.Center, Projectile.velocity.ToRotation(), MaxLaserLength); } protected internal void DrawBeamWithColor(Color beamColor, float scale, int startFrame = 0, int middleFrame = 0, int endFrame = 0) diff --git a/Projectiles/Boss/CrimulanSpike.cs b/Projectiles/Boss/CrimulanSpike.cs index 17e7b62fd7..233db11b4a 100644 --- a/Projectiles/Boss/CrimulanSpike.cs +++ b/Projectiles/Boss/CrimulanSpike.cs @@ -52,9 +52,11 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Crimson; dustColor.A = 150; - int redSpiky = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, DustID.SparksMech, 0f, 0f, 50, dustColor, 1.2f); + int redSpiky = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, DustID.TintableDust); Main.dust[redSpiky].velocity *= 0.3f; Main.dust[redSpiky].velocity += Projectile.velocity * 0.3f; + Main.dust[redSpiky].color = dustColor; + Main.dust[redSpiky].scale = 1.4f; Main.dust[redSpiky].noGravity = true; } } @@ -72,9 +74,6 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = Projectile.ai[2] > 0f ? ModContent.Request("CalamityMod/Projectiles/Boss/CrimulanSpike" + ((int)Projectile.ai[2] + 1)).Value : TextureAssets.Projectile[Projectile.type].Value; - lightColor.R = (byte)(255 * Projectile.Opacity); - lightColor.G = (byte)(255 * Projectile.Opacity); - lightColor.B = (byte)(255 * Projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index 382dc902b0..b1fcb344fb 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -1,8 +1,11 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -48,39 +51,32 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation += Projectile.velocity.X * 0.1f; + MediumMistParticle mist2 = new MediumMistParticle(Projectile.Center, Projectile.velocity, OldDuke.GlowColor, Color.DarkSlateBlue, Main.rand.NextFloat(1f), 200f); + mist2.AffectedByLight = true; + + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, (Projectile.velocity / 2) + new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)), Color.DarkRed, 20, Main.rand.NextFloat(0.2f, 1f), 0.2f, MathHelper.ToRadians(Main.rand.NextFloat(-2f, 2f)), affectedByLight: true)); + GeneralParticleHandler.SpawnParticle(mist2); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[blood].noGravity = true; Main.dust[blood].velocity *= 0f; + } - int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); - Main.dust[acid].noGravity = true; - Main.dust[acid].velocity *= 0f; + public override void OnSpawn(IEntitySource source) + { + for (int i = 0; i < 3; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center + (Projectile.velocity * 2f), Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-20, 20))) * Main.rand.NextFloat(3f), true, 8, Main.rand.NextFloat(1f, 2f), Color.DarkRed.MultiplyRGBA(new Color(0.3f, 0.3f, 0.3f, 0.3f)), false, true)); + } } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.Center); - int dustAmt = 8; - for (int i = 0; i < dustAmt; i++) + for (int i = 0; i < 15; i++) { - Vector2 dustRotation = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - dustRotation = dustRotation.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 dustVel = dustRotation - Projectile.Center; - int blood = Dust.NewDust(dustRotation + dustVel, 0, 0, DustID.Blood, dustVel.X, dustVel.Y, 100, default, 1.2f); - Main.dust[blood].noGravity = true; - Main.dust[blood].noLight = true; - Main.dust[blood].velocity = dustVel; - } - - for (int d = 0; d < 6; d++) - { - int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default(Color), 3f); - Main.dust[acid].noGravity = true; - Main.dust[acid].velocity *= 5f; - acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default(Color), 2f); - Main.dust[acid].velocity *= 2f; - Main.dust[acid].noGravity = true; + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), true, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.DarkRed, false, true)); } } diff --git a/Projectiles/Boss/OldDukeSummonDrop.cs b/Projectiles/Boss/OldDukeSummonDrop.cs index abb9efda0c..7962f218e6 100644 --- a/Projectiles/Boss/OldDukeSummonDrop.cs +++ b/Projectiles/Boss/OldDukeSummonDrop.cs @@ -1,6 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,6 +38,9 @@ namespace CalamityMod.Projectiles.Boss { Projectile.velocity.Y += 0.15f; } + + if (Main.rand.NextBool(3)) + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, -(Projectile.velocity / 4f).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)), OldDuke.GlowColor, Color.DarkSlateGray, Main.rand.NextFloat(0.5f, 1.5f), 150f)); } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -75,7 +82,9 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], new Color(255, 255, 255, 127), 2); + Asset tex = ModContent.Request(Texture); + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.White, Projectile.rotation, tex.Frame().Bottom(), new Vector2(1f, 1f / tex.Height() * (Projectile.velocity.Length() * 3 + 6)), SpriteEffects.None); return false; } } diff --git a/Projectiles/Boss/OldDukeToothBallSpike.cs b/Projectiles/Boss/OldDukeToothBallSpike.cs index c165b6e4c4..6640ed68aa 100644 --- a/Projectiles/Boss/OldDukeToothBallSpike.cs +++ b/Projectiles/Boss/OldDukeToothBallSpike.cs @@ -1,6 +1,9 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.NPCs.OldDuke; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,6 +41,23 @@ namespace CalamityMod.Projectiles.Boss } } + public override bool PreDraw(ref Color lightColor) + { + // There are two of each draw call because it makes the additive glow a bit brighter + Asset tex = ModContent.Request(Texture); + for (int i = 0; i < 5; i++) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - (Projectile.velocity * i) - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), MathHelper.Lerp(1.5f, 0.2f, (float)i / 5f), SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - (Projectile.velocity * i) - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), MathHelper.Lerp(1.5f, 0.2f, (float)i / 5f), SpriteEffects.None); + } + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), 1.5f, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), 1.5f, SpriteEffects.None); + + Projectile.DrawBackglow(OldDuke.GlowColor, 4f); + + return base.PreDraw(ref lightColor); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0) diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index 264a595984..893d3dc3a7 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -1,8 +1,13 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,23 +17,29 @@ namespace CalamityMod.Projectiles.Boss { public class OldDukeVortex : ModProjectile, ILocalizedModType { + Vector2 cen = Vector2.Zero; + public new string LocalizationCategory => "Projectiles.Boss"; - public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/OldDukeVortex"); + public static SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/OldDukeVortex"); + public SlotId SoundId; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; + SpawnSound.MaxInstances = 50; + + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { + SoundId = SoundEngine.PlaySound(SpawnSound with { IsLooped = true, MaxInstances = 20 }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 408; Projectile.height = 408; Projectile.scale = 0.004f; Projectile.hostile = true; - Projectile.alpha = 255; + Projectile.alpha = 0; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; @@ -38,6 +49,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (Projectile.localAI[1] == 0) + { + cen = Projectile.Center; + Projectile.localAI[1] = 1; + } + Projectile.position = cen - (new Vector2(Projectile.width / 2) * Projectile.scale); + if (Main.zenithWorld) { if (Projectile.scale < 2f) @@ -56,7 +74,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.alpha < 255) Projectile.alpha += 3; - Projectile.scale += 0.012f; + Projectile.scale -= 0.012f; } } } @@ -80,7 +98,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.alpha < 255) Projectile.alpha += 3; - Projectile.scale += 0.012f; + Projectile.scale -= 0.012f; Projectile.width = Projectile.height = (int)(408f * Projectile.scale); } else @@ -88,69 +106,81 @@ namespace CalamityMod.Projectiles.Boss } } - Projectile.velocity = Vector2.Normalize(new Vector2(Projectile.ai[0], Projectile.ai[1]) - Projectile.Center) * 1.5f; + float distanceRequired = 800f * Projectile.scale; + float succPower = Main.zenithWorld ? 1f : 0.5f; + foreach (Player player in Main.ActivePlayers) + { + float distance = Vector2.Distance(player.Center, cen); + if (distance < distanceRequired && player.grappling[0] == -1) + { + if (Collision.CanHit(cen, 1, 1, player.Center, 1, 1)) + { + float distanceRatio = distance / distanceRequired; + + float wingTimeSet = (float)Math.Ceiling((float)player.wingTimeMax * 0.5f * distanceRatio); + if (player.wingTime > wingTimeSet) + player.wingTime = wingTimeSet; + + float multiplier = 1f - distanceRatio; + if (player.Center.X < cen.X) + player.velocity.X += succPower * multiplier; + else + player.velocity.X -= succPower * multiplier; + } + } + } + + Projectile.ai[0]++; + + if (Projectile.ai[0] % 10 == 1) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(cen, Vector2.Zero, new Color(55, 195, 0, 20), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), Projectile.scale * 0.9f, Projectile.scale * 0.4f, 40)); + } + + if (Projectile.timeLeft <= 85) + { + Projectile.localAI[2] += 1f / 85f; + } + Projectile.velocity = Vector2.Zero; Projectile.rotation -= 0.1f * (float)(1D - (Projectile.alpha / 255D)); float lightAmt = 2f * Projectile.scale; - Lighting.AddLight(Projectile.Center, lightAmt, lightAmt * 2f, lightAmt); + Lighting.AddLight(cen, lightAmt, lightAmt * 2f, lightAmt); - if (Projectile.soundDelay == 0) + float maxdist = 1200; + + if (SoundEngine.TryGetActiveSound(SoundId, out var Sound) && Sound.IsPlaying) { - Projectile.soundDelay = 174; - SoundEngine.PlaySound(SpawnSound, Projectile.Center); + Sound.Position = cen; + Sound.Volume = Projectile.scale; + Sound.Pitch = MathHelper.Lerp(0f, -1f, (MathHelper.Clamp((Projectile.Distance(Main.LocalPlayer.Center) - 800) / maxdist, 0f, 1f) + (-Projectile.scale + 1))); } if (Projectile.timeLeft > 85) { - int numDust = (int)(0.2f * MathHelper.TwoPi * 408f * Projectile.scale); - float angleIncrement = MathHelper.TwoPi / (float)numDust; - Vector2 dustOffset = new Vector2(408f * Projectile.scale, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + Vector2 vec2 = cen + new Vector2(Main.rand.NextFloat(320, 540) * Projectile.scale, 0).RotatedByRandom(MathHelper.TwoPi); - int var = (int)(408f * Projectile.scale); - for (int i = 0; i < numDust; i++) - { - if (Main.rand.NextBool(var)) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulphurousSeaAcid); - Main.dust[dust].position = Projectile.Center + dustOffset; - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity = Vector2.Normalize(Projectile.Center - Main.dust[dust].position) * 24f; - Main.dust[dust].scale = Projectile.scale * 3f; - } - } - - float distanceRequired = 800f * Projectile.scale; - float succPower = Main.zenithWorld ? 1f : 0.5f; - foreach (Player player in Main.ActivePlayers) - { - float distance = Vector2.Distance(player.Center, Projectile.Center); - if (distance < distanceRequired && player.grappling[0] == -1) - { - if (Collision.CanHit(Projectile.Center, 1, 1, player.Center, 1, 1)) - { - float distanceRatio = distance / distanceRequired; - - float wingTimeSet = (float)Math.Ceiling((float)player.wingTimeMax * 0.5f * distanceRatio); - if (player.wingTime > wingTimeSet) - player.wingTime = wingTimeSet; - - float multiplier = 1f - distanceRatio; - if (player.Center.X < Projectile.Center.X) - player.velocity.X += succPower * multiplier; - else - player.velocity.X -= succPower * multiplier; - } - } - } + GeneralParticleHandler.SpawnParticle(new SparkParticle(vec2, (cen - vec2) / 20, false, 10, Main.rand.NextFloat(0.5f, 1f), Color.LimeGreen, true)); } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Asset Tex = ModContent.Request(Texture); + + float sc = MathHelper.Lerp(1, 0, Projectile.localAI[2]); + + float alphaLerp = MathHelper.Lerp(1f, 0f, (float)Projectile.alpha / 255f); + + Main.EntitySpriteDraw(Tex.Value, cen - Main.screenPosition, Tex.Frame(), new Color(0f, 0f, 0f, 0.4f).MultiplyRGBA(new Color(alphaLerp, alphaLerp, alphaLerp, alphaLerp)), -Projectile.rotation / 2 * (4 + 1), Tex.Frame().Center(), 1.61f * Projectile.scale * sc, SpriteEffects.None); + + for (int i = 2; i >= 0; i--) + { + float lerp = (float)i / 3f; + + Main.EntitySpriteDraw(Tex.Value, cen - Main.screenPosition, Tex.Frame(), Color.Lerp(new Color(5, 155, 95, 100), new Color(255, 255, 255, 55), lerp).MultiplyRGBA(new Color(alphaLerp, alphaLerp, alphaLerp, alphaLerp)), -Projectile.rotation / 2 * (i + 1), Tex.Frame().Center(), MathHelper.Lerp(1f, 1.7f, lerp) * Projectile.scale * sc, SpriteEffects.None); + } return false; } diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index 57c685ea48..a7be93ef6e 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -1,10 +1,15 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs.OldDuke; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; +using Terraria.Audio; using Terraria.Chat; using Terraria.ID; using Terraria.Localization; @@ -14,6 +19,10 @@ namespace CalamityMod.Projectiles.Boss { public class OverlyDramaticDukeSummoner : ModProjectile, ILocalizedModType { + Vector2 cen; + + public SlotId SoundId; + public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/Boss/OldDukeVortex"; @@ -26,7 +35,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.width = Projectile.height = 1; + SoundId = SoundEngine.PlaySound(OldDukeVortex.SpawnSound with { IsLooped = true, MaxInstances = 20 }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame()); + Projectile.width = Projectile.height = 408; Projectile.scale = 0.004f; Projectile.hostile = true; Projectile.alpha = 255; @@ -63,49 +73,68 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Projectile.rotation -= 0.15f * (float)(1D - (Projectile.alpha / 255D)); + if (Projectile.ai[0] == 0) + cen = Projectile.Center; + + Projectile.rotation -= 0.15f * (float)(1D - (Projectile.alpha / 255D)) * (Projectile.ai[0] / 660f); Projectile.ai[0]++; + Projectile.ai[1]++; + + Vector2 vec = new Vector2(408, 408) * Projectile.scale; + + Projectile.position = cen - new Vector2((float)Math.Sqrt(vec.X), (float)Math.Sqrt(vec.Y)); + float totalTilesToExpand = 1600f * Projectile.scale / 16; Point centerAsTileCoords = Projectile.Center.ToTileCoordinates(); - ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out int topY, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2)); - topY++; - bottomY--; - Vector2 topVector = new Vector2(centerAsTileCoords.X, topY) * 16f + new Vector2(8f); - Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f); + Vector2 topVector = Projectile.Top; + Vector2 bottomVector = Projectile.Bottom; Vector2 centerVector = Vector2.Lerp(topVector, bottomVector, 0.5f); Projectile.width = (int)(208 * Projectile.scale); - Projectile.height = (int)(bottomVector.Y - topVector.Y); - Projectile.Center = centerVector; + + Vector2 ProjectileSpawnPosition = cen; if (Projectile.ai[0] < 90f) { Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 90f); - Projectile.scale = MathHelper.Lerp(0.004f, 1f, Projectile.ai[0] / 90f); } + if (Projectile.ai[0] < 600f) + { + Projectile.scale = MathHelper.Lerp(0.004f, 1.6f, Projectile.ai[0] / 660f); + + Vector2 vec2 = Projectile.Center + new Vector2(Main.rand.NextFloat(320, 540) * Projectile.scale, 0).RotatedByRandom(MathHelper.TwoPi); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(vec2, (Projectile.Center - vec2) / 20, false, 10, Main.rand.NextFloat(0.5f, 1f), Color.LimeGreen, true)); + } + + if (Projectile.ai[0] % 10 == 1 && Projectile.ai[0] < 600f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(cen, Vector2.Zero, new Color(55, 195, 0, 20), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), Projectile.scale * 0.9f, Projectile.scale * 0.4f, 40)); + } + + float maxdist = 1200; + // Spray gore and acid everywhere - else if (Projectile.ai[0] < 480f) + if (Projectile.ai[0] < 480f && Projectile.ai[0] > 90f) { if (Projectile.ai[0] % 10f == 9f) { Vector2 velocity = new Vector2(0f, -18f).RotatedByRandom(0.7f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top + new Vector2(Main.rand.NextFloat(-80f, 80f), 100f), velocity, - ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), ProjectileSpawnPosition, velocity, + ModContent.ProjectileType(), 65, 2f); } if (Projectile.ai[0] % 35f == 34f) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), -7f - Main.rand.NextFloat(4f, 12f)).RotatedByRandom(0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top + new Vector2(Main.rand.NextFloat(-30f, 30f), 100f), velocity, - ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), ProjectileSpawnPosition, velocity, + ModContent.ProjectileType(), 65, 2f); } } // Fade out and die if (Projectile.ai[0] >= 600f) { - Projectile.alpha = (int)MathHelper.Lerp(0f, 255f, (Projectile.ai[0] - 600f) / 120f); - bool canSpawnBoomer = false; foreach (Player player in Main.ActivePlayers) { @@ -117,20 +146,26 @@ namespace CalamityMod.Projectiles.Boss } // Summon the boomer duke - if (Projectile.ai[0] == 660f) + if (Projectile.ai[0] == 600f) { if (canSpawnBoomer) { - for (int i = 0; i < 160; i++) + SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath.WithPitchOffset(0.5f), cen); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(-0.5f), cen); + + for (float i = 0; i <= 5; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Top + Vector2.UnitY * 100f, (int)CalamityDusts.SulphurousSeaAcid); - dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5f, 23f); - dust.noGravity = true; - dust.scale = 3f; + if (i == 5) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(cen, Vector2.Zero, new Color(55, 255, 0), "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, i * 0.1f, 40)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(cen, Vector2.Zero, new Color(55, 255, 0), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, i * 0.1f, 40)); } + if (Main.netMode != NetmodeID.MultiplayerClient) { - int boomer = NPC.NewNPC(Projectile.GetSource_FromThis(), (int)Projectile.Top.X, (int)Projectile.Top.Y + 100, ModContent.NPCType()); + int boomer = NPC.NewNPC(Projectile.GetSource_FromThis(), (int)ProjectileSpawnPosition.X, (int)ProjectileSpawnPosition.Y, ModContent.NPCType()); string boomerName = Main.npc[boomer].TypeName; if (Main.netMode == NetmodeID.SinglePlayer) @@ -166,37 +201,41 @@ namespace CalamityMod.Projectiles.Boss AcidRainEvent.UpdateInvasion(false); } } + + if (Projectile.ai[0] >= 600f) + { + Projectile.alpha = (int)MathHelper.Lerp(0f, 255f, MathHelper.Clamp((Projectile.ai[0] - 600f) / 30, 0f, 1f)); + Projectile.scale = MathHelper.Lerp(Projectile.scale, 0f, MathHelper.Clamp((Projectile.ai[0] - 600f) / 30, 0f, 1f)); + } } if (Projectile.ai[0] >= 720f) { Projectile.Kill(); } + + if (SoundEngine.TryGetActiveSound(SoundId, out var Sound) && Sound.IsPlaying) + { + Sound.Position = Projectile.Center; + Sound.Volume = Projectile.scale * 2f; + Sound.Pitch = MathHelper.Lerp(0f, -1f, (MathHelper.Clamp((Projectile.Distance(Main.LocalPlayer.Center) - 800) / maxdist, 0f, 1f) + (-Projectile.scale + 1))); + } } public override bool PreDraw(ref Color lightColor) { - float totalTilesToExpand = 1600f * Projectile.scale / 16; - Point centerAsTileCoords = Projectile.Center.ToTileCoordinates(); - ExpandVertically(centerAsTileCoords.X, centerAsTileCoords.Y, out _, out int bottomY, (int)(totalTilesToExpand / 2), (int)(totalTilesToExpand / 2)); - bottomY--; - Vector2 bottomVector = new Vector2(centerAsTileCoords.X, bottomY) * 16f + new Vector2(8f); + Asset Tex = ModContent.Request(Texture); - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - float yMax = 1600f * Projectile.scale; - for (int y = 0; y < yMax; y += 30) + float sc = MathHelper.Lerp(1, 0, Projectile.localAI[2]); + + float alphaLerp = MathHelper.Lerp(1f, 0f, (float)Projectile.alpha / 255f); + + Main.EntitySpriteDraw(Tex.Value, cen - Main.screenPosition, Tex.Frame(), new Color(0f, 0f, 0f, 0.4f).MultiplyRGBA(new Color(alphaLerp, alphaLerp, alphaLerp, alphaLerp)), -Projectile.rotation / 2 * (4 + 1), Tex.Frame().Center(), 1.61f * Projectile.scale * sc, SpriteEffects.None); + + for (int i = 2; i >= 0; i--) { - float thetaDelta = MathHelper.Pi * y / yMax; - float scale = Projectile.scale * MathHelper.Lerp(0.3f, 1.4f, y / yMax); - float alphaMultiplier = MathHelper.Lerp(1f, 0.6f, y / yMax); - Main.EntitySpriteDraw(texture, - bottomVector - Main.screenPosition - Vector2.UnitY * y, - null, - Color.White * Projectile.Opacity * 0.3f * alphaMultiplier, - Projectile.rotation + thetaDelta, - texture.Size() * 0.5f, - scale, - SpriteEffects.None, - 0); + float lerp = (float)i / 3f; + + Main.EntitySpriteDraw(Tex.Value, cen - Main.screenPosition, Tex.Frame(), Color.Lerp(new Color(5, 155, 95, 100), new Color(255, 255, 255, 55), lerp).MultiplyRGBA(new Color(alphaLerp, alphaLerp, alphaLerp, alphaLerp)), -Projectile.rotation / 2 * (i + 1), Tex.Frame().Center(), MathHelper.Lerp(1f, 1.7f, lerp) * Projectile.scale * sc, SpriteEffects.None); } return false; } diff --git a/Projectiles/Boss/QueenBeenade.cs b/Projectiles/Boss/QueenBeenade.cs index 904fc5a5eb..4a2ff25994 100644 --- a/Projectiles/Boss/QueenBeenade.cs +++ b/Projectiles/Boss/QueenBeenade.cs @@ -10,8 +10,11 @@ namespace CalamityMod.Projectiles.Boss public class QueenBeenade : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => $"Terraria/Images/Projectile_{ProjectileID.Beenade}"; + private const int TimeLeft = 180; + public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; @@ -19,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 22; Projectile.hostile = true; Projectile.penetrate = -1; - Projectile.timeLeft = 180; + Projectile.timeLeft = TimeLeft; } public override void AI() @@ -47,7 +50,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.Y = 16f; } - public override bool? CanDamage() => Projectile.timeLeft <= 0; + // Using 1 just in case + public override bool? CanDamage() => Projectile.timeLeft <= 1; public override bool OnTileCollide(Vector2 oldVelocity) { @@ -60,6 +64,25 @@ namespace CalamityMod.Projectiles.Boss return false; } + public override Color? GetAlpha(Color lightColor) + { + int timer = TimeLeft - Projectile.timeLeft; + float startWarningColorGateValue = 60f; + float timeToReachFullIntensity = 120f; + float timeToReachExplosion = startWarningColorGateValue + timeToReachFullIntensity; + Color initialColor = lightColor; + Color finalColor = Color.Lerp(new Color(125, 0, 0), Color.Red, (float)Math.Abs(Math.Sin((timer - startWarningColorGateValue) * (MathHelper.Pi / 45f)))); + finalColor.A = (byte)(255 - Projectile.alpha); + if (timer > startWarningColorGateValue) + { + float colorTransitionRatio = (timer - startWarningColorGateValue) / timeToReachFullIntensity; + Color explodeColor = Color.Lerp(initialColor, finalColor, colorTransitionRatio); + return explodeColor; + } + else + return initialColor; + } + public override void OnKill(int timeLeft) { int newSize = 40; diff --git a/Projectiles/Boss/QueenBeenadeBee.cs b/Projectiles/Boss/QueenBeenadeBee.cs index b4eb7d0644..489609310c 100644 --- a/Projectiles/Boss/QueenBeenadeBee.cs +++ b/Projectiles/Boss/QueenBeenadeBee.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Projectiles.Boss { // Animation Projectile.frameCounter++; - if (Projectile.frameCounter > 4) + if (Projectile.frameCounter >= 3) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 4) + if (Projectile.frame >= 3) Projectile.frame = 0; // Direction and rotation @@ -60,6 +60,8 @@ namespace CalamityMod.Projectiles.Boss { Projectile.ai[0] = 1f; + Projectile.tileCollide = true; + if (Projectile.velocity.Length() < Projectile.ai[2]) Projectile.velocity *= 1.05f; diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index 30db17a25a..aba5827d69 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -1,5 +1,7 @@ using System; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -32,6 +34,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Projectile.spriteDirection = 1; + if (Projectile.Center.X < Main.LocalPlayer.Center.X) Projectile.spriteDirection = -1; + Lighting.AddLight(Projectile.Center, 0.1f, 0.7f, 0f); Projectile.ai[0] += 1f; @@ -43,6 +48,8 @@ namespace CalamityMod.Projectiles.Boss } if (Projectile.ai[0] < 1620f) { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Top + new Vector2(Main.rand.NextFloat(-12, 12), 6f), new Vector2(0, -Main.rand.NextFloat(2)), false, 20, Main.rand.NextFloat(0.5f, 1.2f), new Color(100, 255, 0))); + if (Projectile.frame >= 4) { Projectile.frame = 0; @@ -67,11 +74,12 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - lightColor.R = (byte)(255 * Projectile.Opacity); - lightColor.G = (byte)(255 * Projectile.Opacity); - lightColor.B = (byte)(255 * Projectile.Opacity); - CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(66, 236, 113), lightColor, 3.75f); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + lightColor.R = (byte)(100 * Projectile.Opacity); + lightColor.G = (byte)(155 * Projectile.Opacity); + lightColor.B = (byte)(55 * Projectile.Opacity); + lightColor.A = 0; + CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(20, 60, 26, 0), Color.White, 2f); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index 5c2a01564d..71ac79c0a2 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Boss public class UnstableCrimulanGlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; @@ -28,6 +29,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Vector3 light = new Vector3(0.5f, 0.1f, 0.1f) * Projectile.Opacity; + Lighting.AddLight(Projectile.Center, light.X, light.Y, light.Z); + // Fly up and then fall down if (Projectile.ai[0] == 1f) { @@ -59,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Crimson; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, 0, dustColor); Main.dust[dust].noGravity = true; } @@ -80,9 +84,6 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - lightColor.R = (byte)(255 * Projectile.Opacity); - lightColor.G = (byte)(255 * Projectile.Opacity); - lightColor.B = (byte)(255 * Projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index 2860149285..89b77b7a77 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -29,6 +29,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Vector3 light = new Vector3(0.5f, 0.1f, 0.5f) * Projectile.Opacity; + Lighting.AddLight(Projectile.Center, light.X, light.Y, light.Z); + if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive || Projectile.ai[0] == 1f)) { float velocityMult = BossRushEvent.BossRushActive ? 1.025f : CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; @@ -46,7 +49,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Lavender; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, 0, dustColor); Main.dust[dust].noGravity = true; } @@ -67,9 +70,6 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - lightColor.R = (byte)(255 * Projectile.Opacity); - lightColor.G = (byte)(255 * Projectile.Opacity); - lightColor.B = (byte)(255 * Projectile.Opacity); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 02c5a9f444..a26faea61e 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -224,6 +224,9 @@ namespace CalamityMod.Projectiles /// A temporary multiplicative amount of damage reduction when hitting the player. Resets to 0 if drops to 0. public float multiplicativeDR = 0; + /// If true, this projectile is a hook which has spawned a flower on it from Bloom Stone. Used to prevent spawning multiple flowers. + public bool hookCanSpawnFlower = false; + /// If true, allows hostile projectiles to deal defense damage to the player. Used mostly for hard-hitting bosses. public bool DealsDefenseDamage = false; @@ -2094,9 +2097,9 @@ namespace CalamityMod.Projectiles float dustVelocityMultiplier = 0.75f; int numDust = 5; int numDust2 = 5; - int fadeInTime = 10; - int fadeOutGateValue = masterMode ? 80 : death ? 50 : 25; - float killGateValue = masterMode ? 90f : death ? 60f : 35f; + int fadeInTime = 50; + int fadeOutGateValue = masterMode ? 120 : death ? 90 : 65; + float killGateValue = masterMode ? 130f : death ? 100f : 75f; int maxFrames = 5; bool fadeIn = projectile.ai[0] < (float)fadeInTime; @@ -2129,7 +2132,7 @@ namespace CalamityMod.Projectiles if (fadeIn) { - projectile.Opacity += 0.1f; + projectile.Opacity += 0.02f; if (projectile.Opacity > 1f) projectile.Opacity = 1f; @@ -4022,6 +4025,17 @@ namespace CalamityMod.Projectiles TransformerTimer--; } + // Spawn Bloom Stone flower on landed hooks + // Should only spawn if: Projectile is a hook, hook is grappled to a tile, the player is wearing Bloom Stone, no flower has been spawned from this hook, no pollen exists + if (projectile.aiStyle == ProjAIStyleID.Hook && projectile.ai[0] == 2f && + Main.player[projectile.owner].Calamity().bloomStone && !hookCanSpawnFlower && + !CalamityUtils.AnyOwnedProjectiles(ProjectileType(), projectile.owner)) + { + hookCanSpawnFlower = true; + if (Main.myPlayer == projectile.owner) + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, projectile.whoAmI); + } + // CIT 29JUN2024: Moved from PreAI to PostAI so that it is called every update instead of every frame. // This makes the distance traveled increment more accurately for projectiles with extra updates, as previously projectiles with extra updates // would add the distance traveled for the whole frame on the first update, making the distance checking much choppier. @@ -4104,16 +4118,38 @@ namespace CalamityMod.Projectiles #endregion #region Grappling Hooks + public override void UseGrapple(Player player, ref int type) + { + if (player.Calamity().bloomStoneHookVisuals) + { + // Insert vine effect when spawning a hook + } + } public override void GrapplePullSpeed(Projectile projectile, Player player, ref float speed) { + float mult = 1f; if (player.Calamity().reaverSpeed) - speed *= 1.1f; - } + mult += 0.5f; + if (player.Calamity().bloomStone) + mult += 0.5f; + speed *= mult; + // Visual flowers while being pulled + if (player.Calamity().bloomStoneHookVisuals && player.miscCounter % 5 == 0 && player.velocity.Length() > 2f) + { + Vector2 spawnPos = player.Center + Main.rand.NextVector2Circular(20f, 20f); + CustomSprite flowey = new(spawnPos, Vector2.Zero, 12, "CalamityMod/Projectiles/Magic/GleamingBolt", 0.425f, Color.White * 0.75f, 0f, false); + GeneralParticleHandler.SpawnParticle(flowey); + } + } public override void GrappleRetreatSpeed(Projectile projectile, Player player, ref float speed) { + float mult = 1f; if (player.Calamity().reaverSpeed) - speed *= 1.1f; + mult += 0.5f; + if (player.Calamity().bloomStone) + mult += 0.5f; + speed *= mult; } #endregion @@ -4129,14 +4165,14 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) { - // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. + // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula float vanillaVelocityDamageMultiplier = 0.1f + player.velocity.Length() / 7f * 0.9f; float baseVelocityDamageMultiplier = 0.01f + player.velocity.Length() * 0.002f; float calamityVelocityDamageMultiplier = 100f * (1f - (1f / (1f + baseVelocityDamageMultiplier))); modifiers.SourceDamage *= calamityVelocityDamageMultiplier / vanillaVelocityDamageMultiplier; } - // Adamantite Throwing Axe's lightning has damage falloff. + // Adamantite Throwing Axe's lightning has damage falloff if (projectile.type == ProjectileID.CultistBossLightningOrbArc && projectile.ai[2] == 1f) { if (projectile.numHits > 0) @@ -4145,15 +4181,23 @@ namespace CalamityMod.Projectiles projectile.damage = 1; } - // Stardust Wings buff the Stardust Guardian's damage. + // Heat Ray damage falloff + if (projectile.type == ProjectileID.HeatRay && projectile.numHits > 0) + { + projectile.damage = (int)(projectile.damage * 0.9f); + if (projectile.damage < 1) + projectile.damage = 1; + } + + // Stardust Wings buff the Stardust Guardian's damage if (player.wingsLogic == (int)VanillaWingID.WingsStardust && projectile.type == ProjectileID.StardustGuardian) modifiers.SourceDamage *= 2f; - // If applicable, use ricoshot bonus damage. + // If applicable, use ricoshot bonus damage if (totalRicoshotDamageBonus > 0f) modifiers.ScalingBonusDamage += totalRicoshotDamageBonus; - // If this projectile is forced to crit, simply set the crit bool. + // If this projectile is forced to crit, simply set the crit bool if (forcedCrit) modifiers.SetCrit(); @@ -4238,9 +4282,8 @@ namespace CalamityMod.Projectiles public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { if (BloodstoneOrbValue > 0) - { - Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), BloodstoneOrbValue, 0f, Main.player[projectile.owner].whoAmI); - } + Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), BloodstoneOrbValue, 0f, Main.player[projectile.owner].whoAmI); + // Hyperius Overflow if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) { @@ -4249,6 +4292,7 @@ namespace CalamityMod.Projectiles damage = damageDone - target.Calamity().hyperiusDamage; else damage = damageDone; + target.Calamity().hyperiusDamage -= damage; // Spawn overflow hit @@ -4267,7 +4311,7 @@ namespace CalamityMod.Projectiles // If this projectile does not use static iframes, or is not registered to share them, then do nothing. if (!projectile.usesIDStaticNPCImmunity || !SharedStaticIFrames.Includes(projectile.type)) return; - + // Get the set of shared static iframe projectile types. // If it's empty, then do nothing. IList sharedWithProjectiles = SharedStaticIFrames.GetSharedStaticIFrames(projectile.type); @@ -4295,8 +4339,8 @@ namespace CalamityMod.Projectiles case ProjectileID.DeerclopsIceSpike: if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - float fadeInTime = 10f; - float fadeOutGateValue = masterMode ? 80f : death ? 50f : 25f; + float fadeInTime = 50f; + float fadeOutGateValue = masterMode ? 120f : death ? 90f : 65f; return (projectile.ai[0] >= fadeInTime && projectile.ai[0] < fadeOutGateValue); } break; @@ -4379,7 +4423,8 @@ namespace CalamityMod.Projectiles float homingTime = ((Main.masterMode || BossRushEvent.BossRushActive) ? 120f : CalamityWorld.death ? 105f : 90f); if (projectile.ai[0] == -3f) homingTime += 60f; - return projectile.ai[1] >= homingTime ? new Color(184, 140, 255, projectile.alpha) : lightColor; + + return projectile.ai[1] >= homingTime ? new Color(184, 140, 255, projectile.alpha) : new Color(255, 255, 255, (int)Utils.WrappedLerp(0f, 255f, (float)(projectile.timeLeft % 40) / 40f)); } if (projectile.type == ProjectileID.BloodNautilusShot) @@ -4477,9 +4522,9 @@ namespace CalamityMod.Projectiles Vector2 origin12 = new Vector2(16f, value26.Height / 2); Color alpha5 = projectile.GetAlpha(lightColor); Vector2 vector39 = new Vector2(projectile.scale); - float fadeOutGateValue = masterMode ? 80f : death ? 50f : 25f; - float killGateValue = masterMode ? 90f : death ? 60f : 35f; - float lerpValue5 = Utils.GetLerpValue(killGateValue, killGateValue - 10f, projectile.ai[0], clamped: true); + float fadeOutGateValue = masterMode ? 120f : death ? 90f : 65f; + float killGateValue = masterMode ? 130f : death ? 100f : 75f; + float lerpValue5 = Utils.GetLerpValue(killGateValue, killGateValue - 50f, projectile.ai[0], clamped: true); vector39.Y *= lerpValue5; Vector4 vector40 = lightColor.ToVector4(); Vector4 vector41 = new Color(67, 17, 17).ToVector4(); @@ -4694,8 +4739,8 @@ namespace CalamityMod.Projectiles new Vector2(position.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)TextureAssets.Projectile[projectile.type].Width() * projectile.scale / 2f + halfSize.X * projectile.scale, position.Y - Main.screenPosition.Y + (float)projectile.height - (float)TextureAssets.Projectile[projectile.type].Height() * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + halfSize.Y * projectile.scale + projectile.gfxOffY), frame, alphaColor, projectile.rotation, halfSize, projectile.scale, spriteEffects, 0f); - } } + } #endregion #region Pre Kill diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index dcab273bc2..76a983fc1c 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -35,8 +35,6 @@ namespace CalamityMod.Projectiles YoyoTopSpeed(topSpeed / (extraUpdates + 1)), }; - // TODO -- Very few vanilla yoyos have range and speed tweaks. Looks like an unfinished job. - // SORTING NOTES: // 1. Sort tweaks by categories first, then sort by the internal name in alphabetical order. Navigate through categories and names using the search function. // 2. Higher categories hold priority over lower ones (ie. Balancing with PB tweaks belong in balancing, rather than PB) @@ -142,6 +140,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ClusterFragmentsII, Do(IDStaticIFrames(15)) }, { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, { ProjectileID.ClusterSnowmanRocketII, Do(LocalIFrames(15)) }, + { ProjectileID.DangerousSpider, Do( ExtraUpdatesExact(2), LocalIFrames(45)) }, //Spider Staff spiders. It has Venom, Dangerous, and Jumping spiders. { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3), DefaultIDStaticIFrames) }, // Flying Dragon { ProjectileID.EmeraldBolt, Do(NoPiercing) }, { ProjectileID.EmpressBlade, Do(LocalIFrames(30)) }, // Terraprisma @@ -163,12 +162,14 @@ namespace CalamityMod.Projectiles { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, { ProjectileID.Hamdrax, standardDrillTweaks }, // Drax (never internally renamed since 1.1) + { ProjectileID.HeatRay, Do(InfinitePiercing, IDStaticIFrames(6)) }, // Due to the weapon's fast use speed, the lasers need to give less than 10 iframes { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.IceSickle, Do(ExtraUpdatesExact(1)) }, { ProjectileID.IchorBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.InfluxWaver, Do(ExtraUpdatesExact(1)) }, { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, + { ProjectileID.JumperSpider, Do( ExtraUpdatesExact(2), LocalIFrames(45)) }, //Spider Staff spiders. It has Venom, Dangerous, and Jumping spiders. { ProjectileID.LaserDrill, Do(ArmorPenetrationDelta(+25), LocalIFrames(5)) }, { ProjectileID.LightDisc, Do(MaxUpdatesExact(3), DefaultIDStaticIFrames) }, { ProjectileID.LostSoulHostile, Do(TileCollide) }, // Ragged Caster @@ -215,6 +216,7 @@ namespace CalamityMod.Projectiles { ProjectileID.TrueNightsEdge, Do(PiercingExact(4)) }, { ProjectileID.VenomBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, + { ProjectileID.VenomSpider, Do( ExtraUpdatesExact(2), LocalIFrames(45)) }, //Spider Staff spiders. It has Venom, Dangerous, and Jumping spiders. { ProjectileID.VortexDrill, standardDrillTweaks }, { ProjectileID.Wasp, Do(PiercingExact(2)) }, { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(3), TimeLeftExact(1920)) }, @@ -432,7 +434,6 @@ namespace CalamityMod.Projectiles {ProjectileID.Grenade, Do(DefaultIDStaticIFrames)}, {ProjectileID.HallowSpray, Do(DefaultIDStaticIFrames)}, {ProjectileID.HallowStar, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HeatRay, Do(DefaultIDStaticIFrames)}, {ProjectileID.HolyWater, Do(DefaultIDStaticIFrames)}, {ProjectileID.HoneyBomb, Do(DefaultIDStaticIFrames)}, {ProjectileID.HoneyGrenade, Do(DefaultIDStaticIFrames)}, @@ -841,7 +842,7 @@ namespace CalamityMod.Projectiles public void ApplyTweak(Projectile proj) { proj.penetrate = newPenetrate; - if (proj.penetrate < 1) + if (proj.penetrate == 0) proj.penetrate = 1; proj.maxPenetrate = proj.penetrate; } diff --git a/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs b/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs index 6c281e0cd0..f0d082c746 100644 --- a/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs +++ b/Projectiles/DraedonsArsenal/AerialTrackerLaser.cs @@ -85,7 +85,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal modNPC.laserBurnStacks++; - Projectile.damage = 1; + modifiers.SourceDamage *= 0; + modifiers.FinalDamage.Flat = 0.1f; modifiers.HideCombatText(); } diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs index a1b875a79d..0157be22c3 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Projectile.timeLeft == 12) { Vector2 beamVector = Projectile.velocity; - float beamLength = DetermineLaserLength_CollideWithTiles(12); + float beamLength = DetermineLaserLength_CollideWithTiles(); //Rapid dust int dustCount = Main.rand.Next(10, 30); @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void DetermineScale() => Projectile.scale = 1f; - public override float DetermineLaserLength() => DetermineLaserLength_CollideWithTiles(5); + public override float DetermineLaserLength() => DetermineLaserLength_CollideWithTiles(); public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs index 0c3fcb4a86..f65465d78c 100644 --- a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -258,7 +259,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override bool OnTileCollide(Vector2 oldVelocity) { - SoundStyle sound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3); + SoundStyle sound = CommonCalamitySounds.VoidstoneMine with { Volume = 1 }; SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = -0.25f - 0.1f * tileHits, MaxInstances = 6 }, Projectile.Center); if (Projectile.velocity.X != oldVelocity.X) diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs deleted file mode 100644 index f481a41547..0000000000 --- a/Projectiles/Magic/Asteroid.cs +++ /dev/null @@ -1,126 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class Asteroid : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 24; - Projectile.height = 24; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 2; - } - - public override void AI() - { - if (Projectile.position.Y > Main.player[Projectile.owner].position.Y - 300f) - { - Projectile.tileCollide = true; - } - if ((double)Projectile.position.Y < Main.worldSurface * 16.0) - { - Projectile.tileCollide = true; - } - Projectile.scale = Projectile.ai[1]; - Projectile.rotation += Projectile.velocity.X * 2f; - Vector2 position = Projectile.Center + Vector2.Normalize(Projectile.velocity) * 10f; - Dust greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f)]; - greenDust.position = position; - greenDust.velocity = Projectile.velocity.RotatedBy(1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; - greenDust.position += Projectile.velocity.RotatedBy(1.5707963705062866, default); - greenDust.fadeIn = 0.5f; - greenDust.noGravity = true; - greenDust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f)]; - greenDust.position = position; - greenDust.velocity = Projectile.velocity.RotatedBy(-1.5707963705062866, default) * 0.33f + Projectile.velocity / 4f; - greenDust.position += Projectile.velocity.RotatedBy(-1.5707963705062866, default); - greenDust.fadeIn = 0.5f; - greenDust.noGravity = true; - - int moreGreen = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f); - Main.dust[moreGreen].velocity *= 0.5f; - Main.dust[moreGreen].scale *= 1.3f; - Main.dust[moreGreen].fadeIn = 1f; - Main.dust[moreGreen].noGravity = true; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item89, Projectile.Center); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = (int)(128f * Projectile.scale); - Projectile.height = (int)(128f * Projectile.scale); - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 4; i++) - { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); - } - for (int j = 0; j < 16; j++) - { - int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 2.5f); - Main.dust[killDust].noGravity = true; - Main.dust[killDust].velocity *= 3f; - killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, default, 1.5f); - Main.dust[killDust].velocity *= 2f; - Main.dust[killDust].noGravity = true; - } - if (!Main.dedServ) - { - for (int k = 0; k < 2; k++) - { - int gored = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position + new Vector2((float)(Projectile.width * Main.rand.Next(100)) / 100f, (float)(Projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[gored]; - gore.velocity *= 0.3f; - gore.velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f; - gore.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f; - } - } - if (Projectile.owner == Main.myPlayer) - { - Projectile.localAI[1] = -1f; - Projectile.maxPenetrate = 0; - Projectile.Damage(); - } - for (int l = 0; l < 5; l++) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 107, - 259, - 158 - }); - int exploding = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 2.5f * (float)Projectile.direction, -2.5f, 0, default, 1f); - Main.dust[exploding].alpha = 200; - Main.dust[exploding].velocity *= 2.4f; - Main.dust[exploding].scale += Main.rand.NextFloat(); - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Magic/Asteroid.png b/Projectiles/Magic/Asteroid.png deleted file mode 100644 index 85ede611fc..0000000000 Binary files a/Projectiles/Magic/Asteroid.png and /dev/null differ diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index bb111a2960..c78db03e4c 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Magic; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Magic/IncineratingFireball.cs b/Projectiles/Magic/IncineratingFireball.cs index c945d0333f..888af08d49 100644 --- a/Projectiles/Magic/IncineratingFireball.cs +++ b/Projectiles/Magic/IncineratingFireball.cs @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/WeaponEnchant"), Owner.Center); CombatText.NewText(Owner.Hitbox, new Color(192, 0, 0), CalamityUtils.GetTextValue("Misc.BurningSeaBurn"), true); - Owner.AddBuff(ModContent.BuffType(), (int)BurningSea.FizzleOutTime); + Owner.AddBuff(ModContent.BuffType(), 120); TriggeredBurnOut = true; } } diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index f6908e97fb..c8047588a5 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -64,8 +64,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 1; launched = true; } - - targeted = Projectile.Center.ClosestNPCAt(950); + if (targeted == null || targeted.life <= 0) + targeted = Projectile.Center.ClosestNPCAt(950); CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.15f, 6, 0.98f, accelerate: true); if (time < 550 && targeted == null) @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= (launched ? 1f : 0.4f); + modifiers.SourceDamage *= (launched ? 1f : 0.3f); Player Owner = Main.player[Projectile.owner]; diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 423f549cdd..5234818c25 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -71,8 +71,8 @@ namespace CalamityMod.Projectiles.Magic { time = 600; } - - targeted = Projectile.Center.ClosestNPCAt(950); + if (targeted == null || targeted.life <= 0) + targeted = Projectile.Center.ClosestNPCAt(950); CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.15f, 6, 0.98f, accelerate: true); if (time < 550 && targeted == null) @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= (launched ? 1f : 0.4f); + modifiers.SourceDamage *= (launched ? 1f : 0.3f); Player Owner = Main.player[Projectile.owner]; diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 4228af9676..b05ce18c1f 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -1,21 +1,35 @@ using System; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class SHPB : ModProjectile, ILocalizedModType + public class SHPB : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { + public PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles; + + public ref float ExplodeTimer => ref Projectile.ai[2]; + + public bool CanExplodeFromProximity + { + get => Projectile.ai[1] == 1f; + set => Projectile.ai[1] = value.ToInt(); + } + public new string LocalizationCategory => "Projectiles.Magic"; - public int explosionTimer = 120; public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -23,8 +37,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 24; Projectile.height = 24; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.scale = 0.4f; + Projectile.alpha = 0; + Projectile.scale = 0f; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Magic; } @@ -92,7 +106,6 @@ namespace CalamityMod.Projectiles.Magic float lights = (float)Main.rand.Next(90, 111) * 0.01f; lights *= Main.essScale; Lighting.AddLight(Projectile.Center, 1f * lights, 0.2f * lights, 0.75f * lights); - Projectile.alpha -= 2; // Animation Projectile.frameCounter++; @@ -104,23 +117,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame = 0; } - // Size pulsing - bool lightSoul = GetSoulEffects((int)Projectile.ai[0]) == SoulType.Light; - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale += 0.05f; - if (Projectile.scale > 1.9f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f)) - Projectile.localAI[0] = 1f; - } - else - { - Projectile.scale -= 0.05f; - if (Projectile.scale < 1.5f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f)) - Projectile.localAI[0] = 0f; - } - Projectile.ExpandHitboxBy((int)(24 * Projectile.scale)); - // Sight has weak homing if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Sight) { @@ -140,15 +136,15 @@ namespace CalamityMod.Projectiles.Magic } if (index != -1) - Projectile.velocity = (Projectile.velocity * 18f + Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * 20f) / 19f; + Projectile.velocity = (Projectile.velocity * 17f + Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * 20f) / 18f; else Projectile.velocity *= 0.9875f; // Slow down over time if not homing } - else if (!(GetSoulEffects((int)Projectile.ai[0]) == SoulType.Flight)) // Always slow down if not Flight + else if (GetSoulEffects((int)Projectile.ai[0]) != SoulType.Flight) // Always slow down if not Flight Projectile.velocity *= 0.9875f; + // As soon as a plasma orb is in range of an enemy, it will explode in 1 second. float explodeRange = 250f; - bool canExplode = false; foreach (NPC n in Main.ActiveNPCs) { if (n.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1)) @@ -159,15 +155,99 @@ namespace CalamityMod.Projectiles.Magic if (npcDist < explodeRange) { explodeRange = npcDist; - canExplode = true; + CanExplodeFromProximity = true; } } } - if (canExplode) + + if (CanExplodeFromProximity) { - explosionTimer--; - if (explosionTimer <= 0) + ExplodeTimer++; + if (ExplodeTimer >= 60f) Projectile.Kill(); + + // Quickly scale down before exploding. + bool lightSoul = GetSoulEffects((int)Projectile.ai[0]) == SoulType.Light; + float minScale = 0.5f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f); + float maxScale = 1.9f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f); + Projectile.scale = MathHelper.Clamp(Projectile.scale - 0.075f, minScale, maxScale); + } + else + { + // Size control. + // Scale up to the minimum scale at the start. + if (Projectile.timeLeft >= 285) + { + bool lightSoul = GetSoulEffects((int)Projectile.ai[0]) == SoulType.Light; + float minScale = 1.5f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f); + Projectile.scale += 0.125f; + if (Projectile.scale > minScale) + Projectile.scale = minScale; + } + // Pulse occasionally afterwards. + else if (Projectile.timeLeft <= 285 && Projectile.timeLeft >= 45) + { + bool lightSoul = GetSoulEffects((int)Projectile.ai[0]) == SoulType.Light; + float minScale = 1.5f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f); + float maxScale = 1.9f * (lightSoul ? SHPC.LightExplosionSizeMult : 1f); + + Projectile.localAI[0]++; + Projectile.scale = MathHelper.Lerp(minScale, maxScale, CalamityUtils.SineBumpEasing(Projectile.localAI[0] / 75f, 1)); + } + // Scale down once the projectile is about to die. + else + { + // Save the last scale value of the projectile so that we can seamlessly shrink the projectile. + if (Projectile.localAI[1] == 0f) + Projectile.localAI[1] = Projectile.scale; + + Projectile.scale = Utils.Remap(Projectile.timeLeft, 45, 0, Projectile.localAI[1], 0.35f, true); + } + } + + Projectile.ExpandHitboxBy((int)(24 * Projectile.scale)); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + // Miscellaneous visual additions. + float deathInterpolant = ExplodeTimer > 0 ? Utils.GetLerpValue(0, 50, ExplodeTimer, true) : Utils.GetLerpValue(60, 10, Projectile.timeLeft, true); + if (Main.rand.NextBool(3) && deathInterpolant <= 0f) + { + for (int i = 0; i < 4; i++) + { + Vector2 dustSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(Projectile.width * 0.75f, Projectile.height * 0.75f); + Vector2 dustVelocity = Projectile.velocity * -1.2f; + Dust dust = Dust.NewDustDirect(dustSpawnPosition, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y); + dust.scale = Main.rand.NextFloat(0.8f, 1.2f); + dust.noGravity = true; + dust.noLight = false; + dust.color = FindColorForSoul((int)Projectile.ai[0]); + dust.velocity *= 0.9f; + } + } + + // Start emitting particles on death. + if (deathInterpolant > 0f) + { + float speedMultiplier = MathHelper.Lerp(1f, 3f, deathInterpolant); + float scaleMultiplier = MathHelper.Lerp(1f, 1.65f, deathInterpolant); + for (int i = 0; i < 3; i++) + { + Vector2 dustVelocity = Main.rand.NextVector2Circular(1f, 1f) * 2.5f * speedMultiplier; + Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y); + dust.scale = Main.rand.NextFloat(1.4f, 1.8f) * scaleMultiplier; + dust.color = FindColorForSoul((int)Projectile.ai[0]); + dust.noGravity = true; + dust.noLight = false; + } + + Vector2 plasmaVelocity = Main.rand.NextVector2Circular(1f, 1f) * 1.35f * speedMultiplier; + Color plasmaColor = Color.Lerp(FindColorForSoul((int)Projectile.ai[0]), Color.White, deathInterpolant); + + float plasmaScale = Main.rand.NextFloat(0.2f, 0.4f) * scaleMultiplier; + int plasmaLifetime = Main.rand.Next(30, 45); + + SquishyLightParticle plasma = new(Projectile.Center, plasmaVelocity, plasmaScale, plasmaColor, plasmaLifetime); + GeneralParticleHandler.SpawnParticle(plasma); } } @@ -209,27 +289,99 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); for (int i = 0; i < 8; i++) { bool pickup = i >= 5; - Vector2 soulVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (pickup ? 3f : Main.rand.NextFloat(6f, 9f)); + Vector2 soulVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (pickup ? 2.75f : Main.rand.NextFloat(6f, 9f)); int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, soulVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.33f), 0f, Projectile.owner, Main.rand.Next(6), 0f, pickup ? 1f : 0f); if (pickup) Main.projectile[p].timeLeft *= 3; } } - } - public override Color? GetAlpha(Color lightColor) => FindColorForSoul((int)Projectile.ai[0]); + // Explosion visuals. + for (int i = 0; i < 25; i++) + { + Vector2 plasmaVelocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(6f, 11f); + Color plasmaColor = Color.Lerp(FindColorForSoul((int)Projectile.ai[0]), Color.White, Main.rand.NextFloat()); + + float plasmaScale = Main.rand.NextFloat(0.8f, 1.4f); + int plasmaLifetime = Main.rand.Next(30, 45); + + SquishyLightParticle plasma = new(Projectile.Center, plasmaVelocity, plasmaScale, plasmaColor, plasmaLifetime); + GeneralParticleHandler.SpawnParticle(plasma); + } + + for (int i = 0; i < 15; i++) + { + Vector2 dustVelocity = Main.rand.NextVector2Circular(1f, 1f) * 6f; + float dustScale = Main.rand.NextFloat(1.8f, 2.4f); + Color dustColor = Color.Lerp(FindColorForSoul((int)Projectile.ai[0]), Color.White, Main.rand.NextFloat()); + + Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y, 0, dustColor, dustScale); + dust.noGravity = true; + dust.noLight = false; + dust.noLightEmittence = false; + } + } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; - Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + Texture2D mainTexture = ModContent.Request(Texture).Value; + Texture2D bloomCircleTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Rectangle frame = mainTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + + // Start to shake before exploding. + float deathInterpolant = ExplodeTimer > 0 ? Utils.GetLerpValue(0, 50, ExplodeTimer, true) : Utils.GetLerpValue(60, 10, Projectile.timeLeft, true); + float shakeStrength = MathHelper.Lerp(0f, 6f, deathInterpolant); + Vector2 drawPosition = Projectile.Center + Main.rand.NextVector2Circular(shakeStrength, shakeStrength) - Main.screenPosition; + + // Turn the entire projectile white while exploding. + Color drawColor = Color.Lerp(FindColorForSoul((int)Projectile.ai[0]), Color.White, deathInterpolant); + Color bloomColor = Color.Lerp(drawColor, Color.White, 0.25f); + + Main.spriteBatch.SetBlendState(BlendState.Additive); + + Main.EntitySpriteDraw(bloomCircleTexture, drawPosition, null, Projectile.GetAlpha(bloomColor) * 0.85f, Projectile.rotation, bloomCircleTexture.Size() / 2f, Projectile.scale * 0.65f, SpriteEffects.None); + Main.EntitySpriteDraw(mainTexture, drawPosition, frame, Projectile.GetAlpha(drawColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(mainTexture, drawPosition, frame, Projectile.GetAlpha(Color.White), Projectile.rotation, frame.Size() / 2f, Projectile.scale * 0.8f, SpriteEffects.None); + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); return false; } + + public float PlasmaBallWidthFunction(float completion) + { + float deathInterpolant = ExplodeTimer > 0 ? Utils.GetLerpValue(0, 50, ExplodeTimer, true) : Utils.GetLerpValue(60, 10, Projectile.timeLeft, true); + + float width; + float maxBodyWidth = Projectile.scale * 58f; + float curveRatio = 0.15f; + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + return width * MathHelper.Lerp(1f, 0f, deathInterpolant); + } + + public Color PlasmaBallColorFunction(float completion) + { + Color bodyColor = Color.Lerp(Color.Transparent, FindColorForSoul((int)Projectile.ai[0]), Utils.GetLerpValue(0f, 0.35f, completion)); + Color endColor = Color.Lerp(bodyColor, FindColorForSoul((int)Projectile.ai[0]), Utils.GetLerpValue(0.35f, 1f, completion)); + + // Change to white when the ball is about to explode. + float deathInterpolant = ExplodeTimer > 0 ? Utils.GetLerpValue(0, 50, ExplodeTimer, true) : Utils.GetLerpValue(60, 10, Projectile.timeLeft, true); + return Color.Lerp(endColor, Color.White, deathInterpolant); + } + + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + { + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PlasmaBallWidthFunction, PlasmaBallColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); + } } } diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index 1fe19bc6c0..c667a63398 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -1,28 +1,84 @@ -using CalamityMod.Particles; +using System; +using System.Linq; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class SHPL : ModProjectile, ILocalizedModType + public class SHPL : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/LaserProj"; + + public bool ShouldStopAndDie + { + get => Projectile.ai[1] == 1f; + set => Projectile.ai[1] = value.ToInt(); + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 14; + ProjectileID.Sets.TrailingMode[Type] = 2; + } public override void SetDefaults() { Projectile.width = 5; Projectile.height = 5; - Projectile.scale = 3f; + Projectile.scale = 1.85f; Projectile.friendly = true; Projectile.extraUpdates = 3; Projectile.timeLeft = 600; + Projectile.penetrate = -1; Projectile.DamageType = DamageClass.Magic; } + public override bool? CanDamage() => !ShouldStopAndDie; + public override void AI() { + // 12MAY2025: fryzahh: + // This is made so that when hitting targets or tiles, the oldPos array can properly update so the laser appears to + // naturally dissipate entirely before despawning. Of course, it's also coded so that the laser stops dealing damage + // entirely once this is done to avoid hitting targets multiple times, so functionally the projectile remains the same + // and this change should have little to no effect on gameplay. If it does, ping me about it. + if (ShouldStopAndDie) + { + Projectile.velocity *= 0f; + if (Projectile.oldPos.Last() == Projectile.position) + { + Projectile.scale -= 0.15f; + if (Projectile.scale <= 0f) + { + Projectile.Kill(); + return; + } + } + + // Spawn a bunch of dusts at the dissipation point. + for (int i = 0; i < 2; i++) + { + Vector2 dustVelocity = Main.rand.NextVector2Circular(1f, 1f) * 6f; + float dustScale = Main.rand.NextFloat(1.8f, 2.4f); + Color dustColor = Color.Lerp(SHPB.FindColorForSoul((int)Projectile.ai[0]), Color.White, Main.rand.NextFloat()); + + Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y, 0, dustColor, dustScale); + dust.noGravity = true; + dust.noLight = false; + dust.noLightEmittence = false; + } + } + + Projectile.rotation += MathHelper.TwoPi / 60f; Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.5f, 0.2f, 0.5f); float timerIncr = 3f; Projectile.localAI[0] += timerIncr; @@ -30,14 +86,65 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] = 100f; } - public override Color? GetAlpha(Color lightColor) => SHPB.FindColorForSoul((int)Projectile.ai[0]); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => ShouldStopAndDie = true; - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); + public override bool OnTileCollide(Vector2 oldVelocity) + { + ShouldStopAndDie = true; + return false; + } public override void OnKill(int timeLeft) { AltLineParticle line = new(Projectile.Center, -Projectile.velocity.RotatedByRandom(MathHelper.Pi / 6f), false, 20, 1f, SHPB.FindColorForSoul((int)Projectile.ai[0])); GeneralParticleHandler.SpawnParticle(line); } + + public override bool PreDraw(ref Color lightColor) => false; + + public override void PostDraw(Color lightColor) + { + if (!ShouldStopAndDie) + return; + + // Draw a star over the collision point while dissipting. + Texture2D starTexture = ModContent.Request("CalamityMod/Particles/FullStar").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + + Main.spriteBatch.SetBlendState(BlendState.Additive); + Main.EntitySpriteDraw(starTexture, drawPosition, null, Color.White, Projectile.rotation, starTexture.Size() * 0.5f, Projectile.scale, 0); + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + } + + public float LaserWidthFunction(float completion) + { + float maxBodyWidth = Projectile.scale * Projectile.width; + float scaleInterpolant = Utils.GetLerpValue(0.05f, 0.2f, completion, true) * Utils.GetLerpValue(0.95f, 0.8f, completion, true); + return maxBodyWidth * scaleInterpolant * Projectile.scale; + } + + public float LaserCoreEnergyFunction(float completion) + { + float maxBodyWidth = (Projectile.scale * Projectile.width) * 0.25f; + float scaleInterpolant = Utils.GetLerpValue(0.05f, 0.2f, completion, true) * Utils.GetLerpValue(0.95f, 0.8f, completion, true); + return maxBodyWidth * scaleInterpolant * Projectile.scale; + } + + public Color LaserColorFunction(float completion) + { + Color startColor = Color.Lerp(Color.White, SHPB.FindColorForSoul((int)Projectile.ai[0]), Utils.GetLerpValue(0f, 0.125f, completion, true)); + Color bodyColor = Color.Lerp(startColor, SHPB.FindColorForSoul((int)Projectile.ai[0]), Utils.GetLerpValue(0.125f, 1f, completion, true)); + return Color.Lerp(startColor, bodyColor, completion); + } + + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + { + // Render the main trail for the body for the laser. + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(LaserWidthFunction, LaserColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); + + // Render a smaller, pure white trail in the same position to represent condensed energy in the core of the laser. + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(LaserCoreEnergyFunction, (_) => Color.White, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); + } } } diff --git a/Projectiles/Magic/SHPS.cs b/Projectiles/Magic/SHPS.cs index 4b75bb5e05..9ce66fce0c 100644 --- a/Projectiles/Magic/SHPS.cs +++ b/Projectiles/Magic/SHPS.cs @@ -1,18 +1,31 @@ -using CalamityMod.Particles; +using System; +using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class SHPS : ModProjectile, ILocalizedModType + public class SHPS : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref float Timer => ref Projectile.ai[1]; - public ref float Pickup => ref Projectile.ai[2]; // 0 if attacking soul, 1 if pickup soul + + // Whether or not this soul can be collected by the SHPC or not. + public bool IsAPickupSoul + { + get => Projectile.ai[2] == 1f; + set => Projectile.ai[2] = value.ToInt(); + } + private float AIState = 0f; // 0 = Idle, 1 = Homing to enemy, 2 = Getting sucked to player private const float HomingRange = 560f; @@ -20,10 +33,16 @@ namespace CalamityMod.Projectiles.Magic private Projectile ToSuckTowards; public float RandomAnglingStrength = 0f; - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 14; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() { - Projectile.width = Projectile.height = 10; + Projectile.width = Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; @@ -32,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic } // Can only deal damage after it starts homing - public override bool? CanDamage() => Timer >= 25f && Pickup == 0f ? null : false; + public override bool? CanDamage() => Timer >= 25f && !IsAPickupSoul; public override void AI() { @@ -41,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic // Determine behavior if (Timer >= 25) // Always remains idle for a short delay { - if (Pickup == 0f) // Only run homing code if not a pickup + if (!IsAPickupSoul) // Only run homing code if not a pickup { float npcDistCheck = HomingRange; int index = -1; @@ -72,7 +91,11 @@ namespace CalamityMod.Projectiles.Magic { if (p.type == ModContent.ProjectileType() && p.Colliding(p.Hitbox, Projectile.Hitbox)) { - AIState = 2f; + if (AIState != 2f) + { + AIState = 2f; + Projectile.ExpandHitboxBy(70); + } ToSuckTowards = p; break; } @@ -91,17 +114,22 @@ namespace CalamityMod.Projectiles.Magic if (Timer % 30 == 1f) RandomAnglingStrength = Main.rand.NextFloat(-0.16f, 0.16f); Projectile.velocity = Projectile.velocity.RotatedBy(RandomAnglingStrength); - if (Projectile.velocity.Length() > 3f && Pickup == 1f) - Projectile.velocity *= 0.985f; + if (Projectile.velocity.Length() > 2.75f && IsAPickupSoul) + Projectile.velocity *= 0.96f; break; + case 1f: Projectile.extraUpdates = 1; float speed = Projectile.velocity.Length(); Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Target.Center).ToRotation(), 0.15f).ToRotationVector2() * speed; break; + case 2f: - Projectile.velocity = (Projectile.velocity * 15f + Utils.DirectionTo(Projectile.Center, ToSuckTowards.ModProjectile().TipPosition) * 15f) / 16f; - if (Vector2.Distance(Projectile.Center, ToSuckTowards.ModProjectile().TipPosition) < 40f) + // Attempt to smoothly fly towards SHPC's barrel. + Vector2 idealVelocity = Projectile.SafeDirectionTo(ToSuckTowards.ModProjectile().TipPosition + Main.player[Projectile.owner].velocity) * 30f; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.1f); + + if (Vector2.Distance(Projectile.Center, ToSuckTowards.ModProjectile().TipPosition) < 70f) { ToSuckTowards.ModProjectile().SoulColors.Add(Projectile.ai[0]); Projectile.Kill(); @@ -109,14 +137,113 @@ namespace CalamityMod.Projectiles.Magic break; } - // Appearance - if (Timer % 1 == 0f) + if (Main.rand.NextBool(12)) { - SquareParticle trail = new(Projectile.Center, Vector2.Zero, false, 25, 3f, SHPB.FindColorForSoul((int)Projectile.ai[0]), Pickup == 1f ? MathHelper.PiOver4 : 0f); - GeneralParticleHandler.SpawnParticle(trail); + for (int i = 0; i < 2; i++) + { + Vector2 dustSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(6f, 6f); + Vector2 dustVelocity = Projectile.velocity * -1.2f; + float dustScale = Main.rand.NextFloat(0.6f, 0.8f); + Dust dust = Dust.NewDustDirect(dustSpawnPosition, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y, 0, SHPB.FindColorForSoul((int)Projectile.ai[0]), dustScale); + dust.noGravity = true; + dust.noLight = false; + dust.noLightEmittence = false; + } } - SquareParticle mainSpot = new(Projectile.Center, Vector2.Zero, false, 2, 1.4f, Color.White, Pickup == 1f ? MathHelper.PiOver4 : 0f); - GeneralParticleHandler.SpawnParticle(mainSpot); + + // Pickup souls give off separate particles to differentiate them from Attack souls. + if (Main.rand.NextBool(6) && IsAPickupSoul) + { + for (int i = 0; i < 3; i++) + { + Vector2 smokeVelocity = Main.rand.NextVector2Circular(1f, 1f) * 0.65f; + int smokeLifetime = Main.rand.Next(30, 45); + float smokeScale = Main.rand.NextFloat(0.15f, 0.3f); + float smokeOpacity = Main.rand.NextFloat(0.75f, 0.9f); + + HeavySmokeParticle ghastlySmoke = new(Projectile.Center, smokeVelocity, SHPB.FindColorForSoul((int)Projectile.ai[0]), smokeLifetime, smokeScale, smokeOpacity, 0.02f, true); + GeneralParticleHandler.SpawnParticle(ghastlySmoke); + } + } + } + + public override void OnKill(int timeLeft) + { + // Spawn a bunch of dust along the length of the trail a soul is killed. + BezierCurve curve = new(Projectile.oldPos); + for (int i = 0; i < 35; i++) + { + Vector2 dustSpawnPosition = curve.Evaluate(Main.rand.NextFloat()); + Vector2 dustVelocity = Main.rand.NextVector2Circular(1f, 1f) * 3f; + float dustScale = Main.rand.NextFloat(1.2f, 1.8f); + Dust dust = Dust.NewDustDirect(dustSpawnPosition, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y, 0, SHPB.FindColorForSoul((int)Projectile.ai[0]), dustScale); + dust.noGravity = true; + dust.noLight = false; + dust.noLightEmittence = false; + } + + // Spawn a burst of dust at the center. + for (int i = 0; i < 12; i++) + { + Vector2 dustVelocity = Main.rand.NextVector2Circular(1f, 1f) * 6f; + float dustScale = Main.rand.NextFloat(1.8f, 2.4f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y, 0, SHPB.FindColorForSoul((int)Projectile.ai[0]), dustScale); + dust.noGravity = true; + dust.noLight = false; + dust.noLightEmittence = false; + } + } + + public override bool PreDraw(ref Color lightColor) => false; + + public float SoulWidthFunction(float completion) + { + float width; + float maxBodyWidth = Projectile.scale * 24f; + float curveRatio = 0.15f; + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width; + } + + public Color SoulColorFunction(float completion) + { + Color tipColor = Color.Lerp(SHPB.FindColorForSoul((int)Projectile.ai[0]), Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(SHPB.FindColorForSoul((int)Projectile.ai[0]), tipColor, completion); + } + + public float SoulCoreWidthFunction(float completion) + { + float width; + float maxBodyWidth = Projectile.scale * 14f; + float curveRatio = 0.15f; + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width; + } + + public Color SoulCoreColorFunction(float completion) + { + Color tipColor = Color.Lerp(Color.White, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(Color.White, tipColor, completion); + } + + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + { + // Render the main trail for the body for the soul. + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(SoulWidthFunction, SoulColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); + + // Render a smaller, pure white trail in the same position to represent the glowing white core of the soul. + Vector2[] soulCoreLength = Projectile.oldPos.Take(8).ToArray(); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(soulCoreLength, new(SoulCoreWidthFunction, SoulCoreColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), soulCoreLength.Length * 2); } } } diff --git a/Projectiles/Magic/SHPV.cs b/Projectiles/Magic/SHPV.cs index ad11cffbc3..bb9a52caa4 100644 --- a/Projectiles/Magic/SHPV.cs +++ b/Projectiles/Magic/SHPV.cs @@ -1,15 +1,15 @@ using System; using System.Collections.Generic; -using System.Threading; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Particles; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.GameContent; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -18,14 +18,22 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private static Asset Smoke = ModContent.Request("CalamityMod/Particles/MediumMist"); + private static Asset SoulSquare = ModContent.Request("CalamityMod/Particles/Square"); private Player Owner => Main.player[Projectile.owner]; + private SlotId VacuumSound; + private const int VacuumStartFrames = 78; + private const int VacuumLoopFrames = 132; + private bool PlayedEndSound = false; public ref float Timer => ref Projectile.ai[0]; // The maximum distance in pixels out from the tip of the gun in which souls can be sucked in. - private const float Size = 480f; - // The spread of the suction on each side. 25 degrees on each side, 50 degrees total. - private const float Spread = MathHelper.Pi / 7.2f; + private const float Size = 576f; + // The spread of the suction on each side. 27 degrees on each side, 54 degrees total. + private const float Spread = MathHelper.Pi / 6.66f; + // Maximum number of souls per visual ring drawn on the gun. Additional souls get moved into additional rings. + private const int MaxSoulsRing = 10; // Manual offset used for drawing the gun. private static Vector2 Offset => new Vector2(27f, -10f); // The position of the tip of the gun. Used for most projectile logic. @@ -34,6 +42,8 @@ namespace CalamityMod.Projectiles.Magic public List SoulColors = []; // Tracks whether or not the gun should be doing the laser attack. private bool FiringLasers = false; + // Allows for current soul color to be "consumed" every other laser shot. + private bool ConsumeSoul = false; public override void SetDefaults() { @@ -51,6 +61,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); return; } + // Start sound + if (Timer == 0f) + VacuumSound = SoundEngine.PlaySound(SHPC.VacuumStart, Owner.Center); + // Move the vacuum sound on top of the player constantly + if (SoundEngine.TryGetActiveSound(VacuumSound, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Owner.Center; Timer++; // If you release right click, use the laser attack @@ -58,17 +74,32 @@ namespace CalamityMod.Projectiles.Magic FiringLasers = true; if (FiringLasers) { + // Vacuum end sound + if (!PlayedEndSound) + { + if (SoundEngine.TryGetActiveSound(VacuumSound, out var Vacuum)) + Vacuum?.Stop(); + VacuumSound = SoundEngine.PlaySound(SHPC.VacuumEnd, Owner.Center); + PlayedEndSound = true; + } + if (SoulColors.Count > 0) { - if (Timer % 10 == 0f) + if (Timer % 5 == 0f) { if (Owner.HeldItem.ModItem is SHPC shpc && shpc.storedSoulpower > 0) { - shpc.storedSoulpower -= Math.Min(shpc.storedSoulpower, 2); SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, Owner.Center); + Vector2 laserPos = TipPosition + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-7f, 7f); Vector2 laserVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 20f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), TipPosition, laserVel, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, SoulColors[0]); - SoulColors.RemoveAt(0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserPos, laserVel, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25f), 3f, Projectile.owner, SoulColors[0]); + + if (ConsumeSoul) + { + SoulColors.RemoveAt(0); + shpc.storedSoulpower--; + } + ConsumeSoul = !ConsumeSoul; } else SoulColors.Clear(); @@ -78,8 +109,8 @@ namespace CalamityMod.Projectiles.Magic else { // Debug code used for assessing the visual and functional area of the vacuum - /*BloomLineVFX l = new(Owner.Center, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).RotatedBy(Spread) * Size, 0.4f, Color.Gray, 2, true); - BloomLineVFX l2 = new(Owner.Center, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).RotatedBy(-Spread) * Size, 0.4f, Color.Gray, 2, true); + /*BloomLineVFX l = new(TipPosition, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).RotatedBy(Spread) * Size, 0.4f, Color.Gray, 2, true); + BloomLineVFX l2 = new(TipPosition, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).RotatedBy(-Spread) * Size, 0.4f, Color.Gray, 2, true); GeneralParticleHandler.SpawnParticle(l); GeneralParticleHandler.SpawnParticle(l2);*/ @@ -90,6 +121,10 @@ namespace CalamityMod.Projectiles.Magic MediumMistParticle smoky = new(spawn, Utils.DirectionTo(spawn, TipPosition) * 4.5f, Color.Gray, Color.DarkGray, 1.25f, 96f); GeneralParticleHandler.SpawnParticle(smoky); } + + // Vacuum loop sound + if ((Timer - VacuumStartFrames) % VacuumLoopFrames == 0) + VacuumSound = SoundEngine.PlaySound(SHPC.VacuumLoop, Owner.Center); } // Typical held projectile shit @@ -99,19 +134,29 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); Projectile.velocity = Vector2.Zero; Projectile.Center = Owner.Center; - // This is used to make the projectile naturally despawn after running out of souls + // This is used to make the projectile naturally despawn with a delay after running out of souls or if you stop firing with no souls if (!FiringLasers || SoulColors.Count > 0) - Projectile.timeLeft = 30; + Projectile.timeLeft = 48; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(VacuumSound, out var ChargeSound)) + ChargeSound?.Stop(); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { + // You shouldn't be sucking in souls while firing + if (FiringLasers) + return false; + bool withinAngle = Math.Abs(Utils.DirectionTo(TipPosition, Owner.Calamity().mouseWorld).ToRotation() - Utils.DirectionTo(TipPosition, targetHitbox.Center.ToVector2()).ToRotation()) <= Spread; // This extra safety hitbox is a square around the gun tip used so that the soul doesn't need to perfectly travel down the narrow end of the vacuum to get sucked in Rectangle extraSafetyHitbox = new Rectangle((int)TipPosition.X - (Projectile.width / 2), (int)TipPosition.Y - (Projectile.height / 2), Projectile.width, Projectile.height); return (CalamityUtils.CircularHitboxCollision(TipPosition, Size, targetHitbox) && withinAngle) || targetHitbox.Intersects(extraSafetyHitbox); } - + public override bool? CanDamage() => false; public override bool PreDraw(ref Color lightColor) { // Draw spiraling smoke particles representing the suction radius @@ -119,7 +164,7 @@ namespace CalamityMod.Projectiles.Magic float rotation = Utils.DirectionTo(TipPosition, farthestPos).ToRotation(); if (!FiringLasers) { - Texture2D tex = ModContent.Request("CalamityMod/Particles/MediumMist").Value; + Texture2D tex = Smoke.Value; Rectangle frame = tex.Frame(1, 3, 0, Main.rand.Next(3)); Main.spriteBatch.SetBlendState(BlendState.Additive); @@ -129,7 +174,7 @@ namespace CalamityMod.Projectiles.Magic for (int j = 0; j < 3; j++) { float distRatio = 1f - (Main.GameUpdateCount + j * 10) % 30 / 30f; - Vector2 posOffset = new Vector2(MathF.Sin(MathHelper.TwoPi / 6f * i) * 25f * distRatio, MathF.Cos(Main.GameUpdateCount * MathHelper.Pi / 30f + MathHelper.TwoPi / 6f * i) * 160f * distRatio).RotatedBy(rotation); + Vector2 posOffset = new Vector2(MathF.Sin(MathHelper.TwoPi / 6f * i) * 25f * distRatio, MathF.Cos(Main.GameUpdateCount * MathHelper.Pi / 30f + MathHelper.TwoPi / 6f * i) * 240f * distRatio).RotatedBy(rotation); float colorMult = 0.5f * Utils.GetLerpValue(1f, 0.8f, distRatio, true); Main.EntitySpriteDraw(tex, Vector2.Lerp(TipPosition, farthestPos, distRatio) + posOffset - Main.screenPosition, frame, Color.Gray * colorMult, rotation + MathHelper.Pi, frame.Size() / 2f, 1.5f * distRatio, SpriteEffects.None); } @@ -142,6 +187,28 @@ namespace CalamityMod.Projectiles.Magic Vector2 position = Owner.Center - Main.screenPosition + Vector2.UnitX.RotatedBy(rotation) * Offset.X + Vector2.UnitY * Offset.Y; SpriteEffects sp = Owner.Calamity().mouseWorld.X < Owner.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; Main.EntitySpriteDraw(shpc, position, null, lightColor, rotation, shpc.Size() / 2f, 1f, sp); + + // Draw souls around the gun as a sort of indicator of how many you have sucked in + if (SoulColors.Count > 0) + { + Texture2D orbitingSoulTexture = SoulSquare.Value; + for (int i = 0; i < SoulColors.Count; i++) + { + int soulsInRing = SoulColors.Count > MaxSoulsRing ? (SoulColors.Count - i > SoulColors.Count % MaxSoulsRing ? MaxSoulsRing : SoulColors.Count % MaxSoulsRing) : SoulColors.Count; + // Souls past 10 get moved into additional rings + int ringsBack = i / MaxSoulsRing; + Vector2 soulPosition = Projectile.Center + Vector2.UnitX.RotatedBy(rotation) * (68f - (ringsBack * 9f)) + Vector2.UnitY * -12.5f; + Vector2 posOffset = new Vector2(MathF.Sin(Main.GameUpdateCount * MathHelper.Pi / 30f + MathHelper.TwoPi / soulsInRing * (i % MaxSoulsRing)) * 3f, MathF.Cos(Main.GameUpdateCount * MathHelper.Pi / 30f + MathHelper.TwoPi / soulsInRing * (i % MaxSoulsRing)) * 25f).RotatedBy(rotation); + + // Makes the souls disappear when they go "behind" the gun + bool shouldDraw = posOffset.RotatedBy(-rotation).X <= 2.7f; + if (shouldDraw) + { + Main.EntitySpriteDraw(orbitingSoulTexture, soulPosition + posOffset - Main.screenPosition, null, SHPB.FindColorForSoul((int)SoulColors[i]), 0f, orbitingSoulTexture.Size() * 0.5f, 1f, SpriteEffects.None); + Main.EntitySpriteDraw(orbitingSoulTexture, soulPosition + posOffset - Main.screenPosition, null, Color.White, 0f, orbitingSoulTexture.Size() * 0.5f, 0.5f, SpriteEffects.None); + } + } + } return false; } } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 2f9ddfab3f..7cdb951703 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Magic float orbCount = MathHelper.Lerp(0, 20, (dmgMult-1) / 4f); for (var i = 0; i < orbCount; i++) { - Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, Projectile.velocity.RotatedByRandom(1) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 20, 0f, player.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), Projectile.Center, Projectile.velocity.RotatedByRandom(1) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 18, 0f, player.whoAmI); } if (dmgMult > 1) { diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index adb118628d..1207adf6cd 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -195,15 +195,13 @@ namespace CalamityMod.Projectiles.Magic float minMult = 0.25f; int hitsToMinMult = 7; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (hasReboundOffPlat ? 2.5f : 1) * damageMult; + modifiers.SourceDamage *= (hasReboundOffPlat ? 2.5f : 0.8f) * damageMult; if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn) { spawnPlat = true; hasSetPlatSpawn = true; } - //if (!hasReboundOffPlat) - //Projectile.extraUpdates = 10; } public override bool? CanDamage() => reflecting ? false : null; public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index f231dfd265..60f9c2608a 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.tileCollide = false; } public override void AI() @@ -92,6 +93,7 @@ namespace CalamityMod.Projectiles.Magic } else if (Projectile.ai[0] <= 0f) { + Projectile.Calamity().conditionalHomingRange = 750f; Projectile.netUpdate = true; float speed = 12f; Vector2 projCenter = Projectile.Center; @@ -103,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic } Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); float mouseDist = mouseVec.Length(); - if (mouseDist == 0f || Projectile.ai[0] < 0f) + if (mouseDist <= 2f || Projectile.ai[0] < 0f) { projCenter = player.Center; mouseVec = Projectile.Center - projCenter; diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index 277a9241a8..ec63dd9a4e 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.timeLeft = 540; Projectile.DamageType = DamageClass.Magic; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/AftershockRock.cs b/Projectiles/Melee/AftershockRock.cs deleted file mode 100644 index 8686851e54..0000000000 --- a/Projectiles/Melee/AftershockRock.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class AftershockRock : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - public override void SetDefaults() - { - Projectile.width = 38; - Projectile.height = 38; - Projectile.aiStyle = ProjAIStyleID.GroundProjectile; - Projectile.friendly = true; - Projectile.penetrate = 3; - Projectile.MaxUpdates = 3; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 300 * Projectile.MaxUpdates; - Projectile.ignoreWater = true; - AIType = ProjectileID.BoulderStaffOfEarth; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; - Projectile.tileCollide = false; - } - - public override void AI() - { - if (Projectile.Center.Y > Projectile.ai[2]) - Projectile.tileCollide = true; - else - Projectile.tileCollide = false; - } - } -} diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 449613f3d8..41d56171c8 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Projectiles.Melee public class Cyclone : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public int dustvortex = 0; + public int dustVortex = 0; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 6; @@ -36,33 +37,31 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.ai[0]++; - Projectile.ai[1]++; - - //Code so it doesnt collide on tiles instantly - if (Projectile.ai[0] >= 12) - Projectile.tileCollide = true; + // Only begin colliding with tiles when the projectile is not inside tiles + CalamityUtils.PreventTileCollisionUntilHitboxIsOutsideOfTiles(Projectile); Projectile.rotation += 2.5f; + Projectile.alpha -= 5; + Projectile.ai[1] += 1f; if (Projectile.alpha < 50) { Projectile.alpha = 50; - if (Projectile.ai[1] >= 15) + if (Projectile.ai[1] >= 15f) { - for (int i = 1; i <= 6; i++) { - Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(dustvortex)); + Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(dustVortex)); int d = Dust.NewDust(Projectile.Center, Projectile.width / 2, Projectile.height / 2, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); Main.dust[d].noGravity = true; Main.dust[d].velocity = dustspeed; - dustvortex += 60; + dustVortex += 60; } - dustvortex -= 355; - Projectile.ai[1] = 0; + dustVortex -= 355; + Projectile.ai[1] = 0f; } } + float num472 = Projectile.Center.X; float num473 = Projectile.Center.Y; float num474 = 600f; @@ -77,30 +76,20 @@ namespace CalamityMod.Projectiles.Melee if (num478 < num474) { if (npc.position.X < num472) - { npc.velocity.X += 0.05f; - } else - { npc.velocity.X -= 0.05f; - } + if (npc.position.Y < num473) - { npc.velocity.Y += 0.05f; - } else - { npc.velocity.Y -= 0.05f; - } } } } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(204, 255, 255, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(204, 255, 255, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 62e7694000..8406697e38 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Projectiles.Melee public bool playSwingSound = true; public bool allowSecondHit = true; public float bladeFade = 0; + public int armoredHits = 0; public override void SetDefaults() { base.SetDefaults(); @@ -135,6 +136,7 @@ namespace CalamityMod.Projectiles.Melee doSwing = true; finalFlip = false; + armoredHits = 0; } else { @@ -255,8 +257,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 600); - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + if ((target.life <= 0 && target.realLife == -1) && Projectile.numHits > 0) Projectile.numHits -= 1; + if (damageDone <= 2) + armoredHits++; Vector2 launchVel = (Projectile.ai[1] != 1 ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Utils.DirectionTo(Owner.Center, target.Center)); target.MoveNPC(launchVel, 37, true); @@ -341,7 +345,7 @@ namespace CalamityMod.Projectiles.Melee { float minMult = 1f; int hitsToMinMult = 1; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float damageMult = Utils.Remap(Projectile.numHits - armoredHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs deleted file mode 100644 index e48ffa2e5b..0000000000 --- a/Projectiles/Melee/EssenceFlame2.cs +++ /dev/null @@ -1,80 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class EssenceFlame2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Healing/EssenceFlame"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 180; - Projectile.alpha = 255; - Projectile.extraUpdates = 3; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - Projectile.alpha -= 5; - - Projectile.frameCounter++; - if (Projectile.frameCounter > 16) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - Projectile.frame = 0; - - if (Projectile.timeLeft < 150) - CalamityUtils.HomeInOnNPC(Projectile, true, 760f, 10f, 20f); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 5; i++) - { - int essenceDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); - Main.dust[essenceDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[essenceDust].scale = 0.5f; - Main.dust[essenceDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 8; j++) - { - int essenceDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f); - Main.dust[essenceDust2].noGravity = true; - Main.dust[essenceDust2].velocity *= 5f; - essenceDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f); - Main.dust[essenceDust2].velocity *= 2f; - } - } - } -} diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 12efa56e57..a1cf5ba28d 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Projectiles.Melee public int swingCount; public bool finalFlip = false; public bool swingSound = true; + public int armoredHits = 0; private NPC target => Main.npc[(int)Projectile.ai[0]]; @@ -104,6 +105,7 @@ namespace CalamityMod.Projectiles.Melee swingCount++; finalFlip = false; swingSound = true; + armoredHits = 0; } else { @@ -210,8 +212,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + if ((target.life <= 0 && target.realLife == -1) && Projectile.numHits > 0) Projectile.numHits -= 1; + if (damageDone <= 2) + armoredHits++; if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType() && Main.rand.NextBool(5)) { @@ -256,7 +260,9 @@ namespace CalamityMod.Projectiles.Melee target.knockBackResist = 1; // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) - target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true); + float damageMults = ((DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) ? 5 : 1) * (Main.zenithWorld ? 77 : 1) * (rightClicked ? 3 : 1); + int damage = (int)(Projectile.damage * damageMults); + target.FlungNPC().ApplyCollisionDamage(target, Owner, damage, launchVel * launchPower, 5f, true); } if (Projectile.numHits < 3) @@ -278,12 +284,15 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Owner.Calamity().mouseRight) - modifiers.SourceDamage *= 0.0025f; + { + modifiers.SourceDamage *= 0; + modifiers.FinalDamage.Flat = 0.1f; + } else { float minMult = 0.5f; int hitsToMinMult = 15; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float damageMult = Utils.Remap(Projectile.numHits - armoredHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; } } diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 2dc1197cbc..d184324240 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Melee public bool spawnBoom = true; public bool finalFlip = false; public bool playSwingSound = true; + public int armoredHits = 0; public override void SetDefaults() { base.SetDefaults(); @@ -100,6 +101,7 @@ namespace CalamityMod.Projectiles.Melee doSwing = true; finalFlip = false; + armoredHits = 0; } else { @@ -191,8 +193,10 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + if ((target.life <= 0 && target.realLife == -1) && Projectile.numHits > 0) Projectile.numHits -= 1; + if (damageDone <= 2) + armoredHits++; Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); target.MoveNPC(launchVel, 8, true); @@ -237,7 +241,7 @@ namespace CalamityMod.Projectiles.Melee { float minMult = 0.3f; int hitsToMinMult = 5; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float damageMult = Utils.Remap(Projectile.numHits - armoredHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index b480b723bc..b336a0b32d 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Projectiles.Melee public int swingCount; public bool finalFlip = false; public bool playSwingSound = true; + public int armoredHits = 0; public override void SetDefaults() { base.SetDefaults(); @@ -94,6 +95,7 @@ namespace CalamityMod.Projectiles.Melee doSwing = true; finalFlip = false; + armoredHits = 0; } else { @@ -179,8 +181,10 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + if ((target.life <= 0 && target.realLife == -1) && Projectile.numHits > 0) Projectile.numHits -= 1; + if (damageDone <= 2) + armoredHits++; SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow"); SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = 0.8f }, Projectile.Center); @@ -211,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee { float minMult = 0.3f; int hitsToMinMult = 5; - float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float damageMult = Utils.Remap(Projectile.numHits - armoredHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index 0917e7db63..a3dcbd83e6 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee public override float DetermineLaserLength() { - return DetermineLaserLength_CollideWithTiles(5); + return DetermineLaserLength_CollideWithTiles(); } public override bool PreAI() diff --git a/Projectiles/Melee/SaharaSlicersBolt.cs b/Projectiles/Melee/SaharaSlicersBolt.cs index 3304c67806..6628ec23f1 100644 --- a/Projectiles/Melee/SaharaSlicersBolt.cs +++ b/Projectiles/Melee/SaharaSlicersBolt.cs @@ -1,8 +1,9 @@ -using System; -using CalamityMod.Particles; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -35,6 +36,7 @@ namespace CalamityMod.Projectiles.Melee { Player Owner = Main.player[Projectile.owner]; float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + Projectile.ai[2]++; // Shot Mode if (Projectile.ai[0] == 1) @@ -102,7 +104,28 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.ai[0] == 1) CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return true; + Vector2 scale = new Vector2(Projectile.scale); + // Squishy fade in. This does not occur if the slicer is instantly thrown + if (Projectile.ai[0] == 0) + { + int endStretch = 4; + int endSquash = 8; + Vector2 stretch = new Vector2(0.8f, 1.6f); + if (Projectile.ai[2] < endStretch) + { + float completion = Utils.GetLerpValue(0, endStretch, Projectile.ai[2], true); + scale.X = MathHelper.Lerp(1.8f, stretch.X, completion); + scale.Y = MathHelper.Lerp(0.3f, stretch.Y, completion); + } + else + { + float completion = Utils.GetLerpValue(0, endSquash, Projectile.ai[2], true); + scale.X = MathHelper.Lerp(stretch.X, 1f, completion); + scale.Y = MathHelper.Lerp(stretch.Y, 1f, completion); + } + } + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, TextureAssets.Projectile[Type].Size() / 2, scale, SpriteEffects.None); + return false; } public override bool? CanDamage() => Projectile.ai[0] == 1 ? true : false; } diff --git a/Projectiles/Melee/SeekingScorcherProj.cs b/Projectiles/Melee/SeekingScorcherProj.cs index 3ade299e4f..8b7f83e462 100644 --- a/Projectiles/Melee/SeekingScorcherProj.cs +++ b/Projectiles/Melee/SeekingScorcherProj.cs @@ -230,6 +230,13 @@ namespace CalamityMod.Projectiles.Melee } } } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs index 4a86c09dd1..a562a8cc32 100644 --- a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Melee float spreadAmount = MathHelper.ToRadians(360); for (var i = 0; i < orbAmount; i++) { - Projectile.NewProjectile(Projectile.GetSource_OnHit(target), target.Center, -angle.RotatedByRandom(spreadAmount) * 3.5f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 22, 0f, player.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), target.Center, -angle.RotatedByRandom(spreadAmount) * 3.5f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 20, 0f, player.whoAmI); } Particle bloodsplosion2 = new CustomPulse(target.Center, Vector2.Zero, new Color(255, 32, 32) * 0.75f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-15f, 15f), 0.03f, 0.155f, 40); diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 0bd714b8fa..db26da3a46 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; @@ -11,23 +12,266 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.Projectiles.Melee; +using ReLogic.Content; +using System.Linq; +using Terraria.DataStructures; namespace CalamityMod.Projectiles.Melee { [PierceResistException] public class ViolenceThrownProjectile : ModProjectile { + private int hitstop = 0; public override LocalizedText DisplayName => CalamityUtils.GetItemName(); internal Player Owner => Main.player[Projectile.owner]; internal ref float Time => ref Projectile.ai[0]; public override string Texture => "CalamityMod/Items/Weapons/Melee/Violence"; - public override void SetStaticDefaults() + + public bool isJavelin { - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = 36; + get + { + if (Projectile.ai[2] == 0) + return true; + else + return false; + } } + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 60; + } + + private Vector2 NormalVelocity = Vector2.Zero; + private NPC target; + private Vector2 targetoffset = Vector2.Zero; + private int[] offsetadjust = new int[] + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + }; + + public override void OnSpawn(IEntitySource source) + { + if (isJavelin) + JavelinSetDefaults(); + else + YoyoSetDefaults(); + } + + //These methods adjusts to which AI type is in use + #region Variable Methods + public override void SetDefaults() + { + Projectile.timeLeft = 60; + //The rest of this runs in OnSpawn instead due to variable AI stuff + } + public override void AI() + { + if (isJavelin) + JavelinAI(); + else + YoyoAI(); + } + + public override bool PreDraw(ref Color lightColor) + { + if (isJavelin && Projectile.timeLeft > 2) + return JavelinPreDraw(ref lightColor); + else + return YoyoPreDraw(ref lightColor); + } + + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + if (isJavelin) + JavelinModifyDamageHitbox(ref hitbox); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (isJavelin) + JavelinOnHitNPC(target, hit, damageDone); + else + YoyoOnHitNPC(target, hit, damageDone); + } + #endregion + + //Methods for controlling the Javelin throw + #region Javelin Methods + public void JavelinAI() + { + + var player = Main.player[Projectile.owner]; + float adust = MathHelper.ToRadians(45 + 180); + if (hitstop > 0) + { + hitstop--; + Projectile.timeLeft++; + Projectile.velocity = NormalVelocity * 0.01f + (offsetadjust.Contains(target.type) ? target.position - targetoffset : Vector2.Zero); + targetoffset = target.position; + + Vector2 impactPoint = Vector2.Lerp(Projectile.Center, target.Center, 0.5f);//Projectile.Center + new Vector2(0,-100).RotatedBy(Projectile.rotation + MathHelper.Pi/4f); + Vector2 bloodSpawnPosition = impactPoint + Main.rand.NextVector2Circular(target.width, target.height) * 0.04f; + Vector2 splatterDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * -1; + + // Emit blood if the target is organic. + if (target.Organic()) + { + if (Projectile.FinalExtraUpdate()) + SoundEngine.PlaySound(SoundID.NPCHit18 with { Volume = 0.2f }, Projectile.Center); + for (int i = 0; i < 1; i++) + { + int bloodLifetime = Main.rand.Next(22, 36); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + Vector2 bloodVelocity = splatterDirection.RotatedByRandom(0.81f) * Main.rand.NextFloat(11f, 23f); + bloodVelocity.Y -= 12f; + BloodParticle blood = new BloodParticle(bloodSpawnPosition, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i < 1; i++) + { + float bloodScale = Main.rand.NextFloat(0.2f, 0.33f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat(0.5f, 1f)); + Vector2 bloodVelocity = splatterDirection.RotatedByRandom(0.9f) * Main.rand.NextFloat(9f, 14.5f); + BloodParticle2 blood = new BloodParticle2(bloodSpawnPosition, bloodVelocity, 20, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + } + + // Emit sparks if the target is not organic. + else + { + + if (Projectile.FinalExtraUpdate()) + { + for (int i = 0; i < 2; i++) + { + int sparkLifetime = Main.rand.Next(22, 36); + float sparkScale = Main.rand.NextFloat(0.8f, 1f) + 1 * 0.85f; + Color sparkColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.7f)); + sparkColor = Color.Lerp(sparkColor, Color.Orange, Main.rand.NextFloat()); + + if (Main.rand.NextBool(10)) + sparkScale *= 2f; + + Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f); + sparkVelocity.Y -= 6f; + SparkParticle spark = new SparkParticle(impactPoint, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundEngine.PlaySound(SoundID.NPCHit18 with { Volume = 0.2f }, Projectile.Center); + } + } + + + } + else + { + Projectile.velocity = NormalVelocity; + } + if (Projectile.timeLeft == 1) + { + Projectile.timeLeft++; + + ReturnToOwner(); + Projectile.rotation += 0.45f; + Projectile.extraUpdates = 3; + Projectile.damage = 0; + Time = 60; + } + Lighting.AddLight(Projectile.Center + (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.45f, Color.Red.ToVector3() * 0.4f); + } + public bool JavelinPreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + + // Not cloning the points causes the below operations to be applied to the original oldPos value by reference + // and thus causes it to be consistently added over and over, which is not intended behavior. + Vector2[] drawPoints = (Vector2[])Projectile.oldPos.Clone(); + Vector2 aimAheadDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + PrimitiveRenderer.RenderTrail(Projectile.oldPos.Take(60).ToArray(), new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"], smoothen: true), 25); + return true; + } + public void JavelinSetDefaults() + { + Projectile.timeLeft = 60; + Projectile.width = Projectile.height = 142; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.extraUpdates = 4; + Projectile.aiStyle = -2; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.Center = Main.player[Projectile.owner].Center; + NormalVelocity = Projectile.velocity; + Projectile.rotation = Projectile.velocity.ToRotation() + MathF.PI / 4; + } + public void JavelinModifyDamageHitbox(ref Rectangle hitbox) + { + var center = hitbox.Center.ToVector2(); + hitbox.Height = (int)(45 * Projectile.scale); + hitbox.Width = (int)(45 * Projectile.scale); + hitbox.Location = (center + NormalVelocity.SafeNormalize(Vector2.Zero) * 70 - new Vector2(hitbox.Width / 2, hitbox.Height / 2)).ToPoint(); + + } + public void JavelinOnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + var player = Main.player[Projectile.owner]; + this.target = target; + targetoffset = target.position; + float x = Utils.GetLerpValue(1000f, 6000f, damageDone, true); + int x1 = (int)(20 * (x) * (Projectile.extraUpdates + 1)); + if (damageDone > 5) + { + hitstop = x1; + Projectile.damage = (int)(Projectile.damage * 0.9f); + } + target.AddBuff(ModContent.BuffType(), 240); + + + if (Main.netMode != NetmodeID.Server) + { + // Play a splatter and impact sound. + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); + + float damageInterpolant = Utils.GetLerpValue(950f, 2000f, hit.Damage, true); + float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant); + float impactParticleScale = MathHelper.Lerp(0.6f, 1f, damageInterpolant); + impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f); + + Color impactColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.5f)); + Vector2 impactPoint = Vector2.Lerp(Projectile.Center, target.Center, 0.65f); + + + // And create an impact point particle. + ImpactParticle impactParticle = new ImpactParticle(impactPoint, impactAngularVelocity, 20, impactParticleScale, impactColor); + GeneralParticleHandler.SpawnParticle(impactParticle); + } + + } + #endregion + + //These methods are the original Violence "Yoyo" functionality + #region Yoyo Methods + public void YoyoSetDefaults() { Projectile.width = Projectile.height = 142; Projectile.aiStyle = -1; @@ -42,7 +286,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; } - public override void AI() + public void YoyoAI() { // Fade in. Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true); @@ -55,7 +299,6 @@ namespace CalamityMod.Projectiles.Melee else { ReturnToOwner(); - float idealAngle = Projectile.AngleTo(Owner.Center) - MathHelper.PiOver4; Projectile.rotation = Projectile.rotation.AngleLerp(idealAngle, 0.1f); Projectile.rotation = Projectile.rotation.AngleTowards(idealAngle, 0.25f); @@ -103,7 +346,7 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public void YoyoOnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (!Main.dedServ) { @@ -174,6 +417,44 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(impactParticle); } } + public bool YoyoPreDraw(ref Color lightColor) + { + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + + Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + + // Not cloning the points causes the below operations to be applied to the original oldPos value by reference + // and thus causes it to be consistently added over and over, which is not intended behavior. + Vector2[] drawPoints = (Vector2[])Projectile.oldPos.Clone(); + Vector2 aimAheadDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + + if (Owner.channel || isJavelin) + { + drawPoints[0] += aimAheadDirection * -12f; + drawPoints[1] = drawPoints[0] - (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * Vector2.Distance(drawPoints[0], drawPoints[1]); + } + for (int i = 0; i < drawPoints.Length; i++) + drawPoints[i] -= (Projectile.oldRot[i] + MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.5f; + + int numPointsRendered = (int)Math.Min(24, Time); + PrimitiveRenderer.RenderTrail(drawPoints.Take((int)Math.Min(Time, 36)).ToArray(), new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"], smoothen: true), 24); + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + for (int i = 0; i < 6; i++) + { + float rotation = Projectile.oldRot[i] - MathHelper.PiOver2; + if (Owner.channel) + rotation += 0.2f; + + Color afterimageColor = Color.Lerp(lightColor, Color.Transparent, 1f - (float)Math.Pow(Utils.GetLerpValue(0, 6, i), 1.4D)) * Projectile.Opacity; + Main.EntitySpriteDraw(spearProjectile, drawPosition, null, afterimageColor, rotation, spearProjectile.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + } + + return false; + } + #endregion + + #region Shared Methods internal float PrimitiveWidthFunction(float completionRatio) { @@ -196,46 +477,6 @@ namespace CalamityMod.Projectiles.Melee return Color.Lerp(frontFade, backFade, (float)Math.Pow(completionRatio, 1.2D)) * (float)Math.Pow(1f - completionRatio, 1.1D) * Projectile.Opacity; } - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - - Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - - // Not cloning the points causes the below operations to be applied to the original oldPos value by reference - // and thus causes it to be consistently added over and over, which is not intended behavior. - Vector2[] drawPoints = (Vector2[])Projectile.oldPos.Clone(); - Vector2 aimAheadDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - - if (Owner.channel) - { - drawPoints[0] += aimAheadDirection * -12f; - drawPoints[1] = drawPoints[0] - (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * Vector2.Distance(drawPoints[0], drawPoints[1]); - } - for (int i = 0; i < drawPoints.Length; i++) - drawPoints[i] -= (Projectile.oldRot[i] + MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.5f; - - if (Time > Projectile.oldPos.Length) - { - // Violence trakcs 36 positions in oldPos. - // Provide all 36 points for smoothing, but only render 24. - int numPointsRendered = 24; - PrimitiveRenderer.RenderTrail(drawPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"], smoothen: true), numPointsRendered); - } - - Vector2 drawPosition = Projectile.Center - Main.screenPosition; - for (int i = 0; i < 6; i++) - { - float rotation = Projectile.oldRot[i] - MathHelper.PiOver2; - if (Owner.channel) - rotation += 0.2f; - - Color afterimageColor = Color.Lerp(lightColor, Color.Transparent, 1f - (float)Math.Pow(Utils.GetLerpValue(0, 6, i), 1.4D)) * Projectile.Opacity; - Main.EntitySpriteDraw(spearProjectile, drawPosition, null, afterimageColor, rotation, spearProjectile.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); - } - - return false; - } + #endregion } } diff --git a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs index 0f165f509e..83942f5fa5 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile spore = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.15f, 0.35f) + Vector2.UnitX.RotatedByRandom(MathHelper.Pi), ProjectileID.SporeGas + Main.rand.Next(3), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); spore.DamageType = DamageClass.MeleeNoSpeed; spore.usesLocalNPCImmunity = true; + spore.usesIDStaticNPCImmunity = false; spore.localNPCHitCooldown = 30; } } diff --git a/Projectiles/Ranged/BouncingShotgunPellet.cs b/Projectiles/Ranged/BouncingShotgunPellet.cs index eb59268856..926212c0fa 100644 --- a/Projectiles/Ranged/BouncingShotgunPellet.cs +++ b/Projectiles/Ranged/BouncingShotgunPellet.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Ranged/RealmRavagerBullet"; - private int bounce = 2; + private int bounce = 3; public override void SetDefaults() { Projectile.width = 4; @@ -29,14 +29,42 @@ namespace CalamityMod.Projectiles.Ranged bounce--; if (bounce <= 0) Projectile.Kill(); - else + + Player owner = Main.player[Projectile.owner]; + + if (bounce == 1) + { + float npcDistCheck = 640f; // 40 tiles + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, owner.ClampedMouseWorld()); + if (currentNPCDist < npcDistCheck) + { + npcDistCheck = currentNPCDist; + index = n.whoAmI; + } + } + // If the index is not default, smart bounce in the direction of that enemy. + if (index != -1) + { + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], owner.ActiveItem().shootSpeed, 3); + } + return false; + } + else // Otherwise, use standard bouncing behavior. { if (Projectile.velocity.X != oldVelocity.X) + { Projectile.velocity.X = -oldVelocity.X; + } if (Projectile.velocity.Y != oldVelocity.Y) + { Projectile.velocity.Y = -oldVelocity.Y; - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - Projectile.damage /= 2; + } } return false; } diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 18d29ded2c..36e947c47b 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -58,12 +58,12 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f); } - if (Main.rand.NextBool(17)) + if (Main.rand.NextBool(19)) { bool LowVel = Main.rand.NextBool() ? false : true; - FlameParticle fire = new FlameParticle(Projectile.Center, 20, MathHelper.Clamp(Time * 0.05f, 0.15f, 1.75f), 0.05f, Color.BlueViolet * (LowVel ? 1.2f : 0.5f), Color.DarkBlue * (LowVel ? 1.2f : 0.5f)); - fire.Velocity = new Vector2(Projectile.velocity.X * 0.8f, -10).RotatedByRandom(0.005f) * (LowVel ? Main.rand.NextFloat(0.4f, 0.65f) : Main.rand.NextFloat(0.8f, 1f)); - GeneralParticleHandler.SpawnParticle(fire); + float size = Utils.Remap(Utils.GetLerpValue(0f, Lifetime, Time), 0.2f, 0.5f, 0.25f, 1f); + Particle trail = new CustomSpark(Projectile.Center, Projectile.velocity + Vector2.UnitY * Main.rand.NextFloat(-10, -24) * size, "CalamityMod/Particles/BloomCircle", false, 14, 0.9f * size, (Main.rand.NextBool() ? Color.DarkBlue : Color.BlueViolet) * 0.5f, new Vector2(Main.rand.NextFloat(2, 3), 1f), true, true, shrinkSpeed: 0.3f, glowOpacity: 0.5f); + GeneralParticleHandler.SpawnParticle(trail); } } else if (Time == 5f) diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index 1ba053ff56..097af310b5 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -109,12 +109,11 @@ namespace CalamityMod.Projectiles.Ranged dust.scale = Main.rand.NextFloat(0.75f, 1.1f); dust.noGravity = true; } - //SoundEngine.PlaySound(SoundID.Shatter with { Volume = 0.4f, Pitch = 0.1f + 0.1f * bounces }, Projectile.Center); SoundEngine.PlaySound(SoundID.Item50 with { Volume = 0.3f, Pitch = -0.2f + 0.4f * bounces, MaxInstances = 15 }, Projectile.Center); } for (int i = 0; i < 2; i++) { - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f * (i), 0.45f * (i), 9, true); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f * (i), 0.45f * (i), 9, true, makeLight: 0); GeneralParticleHandler.SpawnParticle(blastRing); } float rot = Main.rand.NextFloat(-5, 5); @@ -126,6 +125,7 @@ namespace CalamityMod.Projectiles.Ranged dust.fadeIn = 1.5f; dust.noGravity = true; dust.color = Color.White; + dust.noLightEmittence = true; } // Doesn't actually do damage, just an aoe for confustion infliction and knockback Projectile flash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 5, 0f, Projectile.owner); @@ -166,6 +166,11 @@ namespace CalamityMod.Projectiles.Ranged bounces--; return false; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float damageMult = (Projectile.numHits == 0 ? 1 : 0.3f); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { } diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 084f5a7ab9..777dee25c5 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -134,7 +134,8 @@ namespace CalamityMod.Projectiles.Ranged modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); modifiers.DisableCrit(); - Projectile.damage = 1; + modifiers.SourceDamage *= 0; + modifiers.FinalDamage.Flat = 0.1f; modifiers.HideCombatText(); OnHitEffects(target); diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 97dd241aa7..eb1a31f9ba 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -115,7 +115,8 @@ namespace CalamityMod.Projectiles.Ranged modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); modifiers.DisableCrit(); - Projectile.damage = 1; + modifiers.SourceDamage *= 0; + modifiers.FinalDamage.Flat = 0.1f; modifiers.HideCombatText(); } } diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index c67551d894..85a3f2a673 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -118,9 +118,6 @@ namespace CalamityMod.Projectiles.Ranged } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (falling) - modifiers.SourceDamage *= 1.1f; - if (Projectile.numHits > 1 && falling) Projectile.damage = (int)(Projectile.damage * 0.5f); if (Projectile.damage < 1) diff --git a/Projectiles/Ranged/LeviatitanMeteor.cs b/Projectiles/Ranged/LeviatitanMeteor.cs index 76d7062dc8..6f60474fee 100644 --- a/Projectiles/Ranged/LeviatitanMeteor.cs +++ b/Projectiles/Ranged/LeviatitanMeteor.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged public class LeviatitanMeteor : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Melee/AftershockRock"; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 5; diff --git a/Projectiles/Melee/AftershockRock.png b/Projectiles/Ranged/LeviatitanMeteor.png similarity index 100% rename from Projectiles/Melee/AftershockRock.png rename to Projectiles/Ranged/LeviatitanMeteor.png diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index bdb58ffa4f..8decdde947 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; @@ -167,7 +168,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(orb2); } } - SoundStyle fire = new("CalamityMod/Sounds/Item/NullHit"); + SoundStyle fire = NullificationPistol.HitSound; SoundEngine.PlaySound(fire with { Volume = (Projectile.ai[1] == 5 ? 1 : 0.7f), Pitch = Main.rand.NextFloat(0, 0.1f) * (Projectile.ai[1] == 5 ? 3 : 1) }, Projectile.Center); if (Main.zenithWorld) { diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.cs b/Projectiles/Ranged/PrismaticEnergyBlast.cs index 2d51675e1c..a30ef78454 100644 --- a/Projectiles/Ranged/PrismaticEnergyBlast.cs +++ b/Projectiles/Ranged/PrismaticEnergyBlast.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged public override float DetermineLaserLength() { if (Projectile.penetrate == 100) - return DetermineLaserLength_CollideWithTiles(8); + return DetermineLaserLength_CollideWithTiles(); return LaserLength; } diff --git a/Projectiles/Ranged/SmallCoral.cs b/Projectiles/Ranged/SmallCoral.cs deleted file mode 100644 index 40f6c0292c..0000000000 --- a/Projectiles/Ranged/SmallCoral.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class SmallCoral : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.velocity.X *= 0.9995f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.01f; - Projectile.rotation = Projectile.velocity.ToRotation(); - if (Projectile.direction == -1) - Projectile.rotation += MathHelper.Pi; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 16; - Projectile.height = 16; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SnowBlock, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 2f; - } - } - } -} diff --git a/Projectiles/Ranged/SmallCoral.png b/Projectiles/Ranged/SmallCoral.png deleted file mode 100644 index 10aba07451..0000000000 Binary files a/Projectiles/Ranged/SmallCoral.png and /dev/null differ diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index 8dce1067ed..c1b5d6dde9 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -90,6 +90,7 @@ namespace CalamityMod.Projectiles.Ranged { Main.projectile[proj].DamageType = DamageClass.Ranged; Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].usesIDStaticNPCImmunity = false; Main.projectile[proj].localNPCHitCooldown = 30; } } diff --git a/Projectiles/Ranged/TitaniumRailgunShot.cs b/Projectiles/Ranged/TitaniumRailgunShot.cs index d36d0017ea..6dda452c41 100644 --- a/Projectiles/Ranged/TitaniumRailgunShot.cs +++ b/Projectiles/Ranged/TitaniumRailgunShot.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged { Vector2 beamVector = Projectile.velocity; - float beamLength = DetermineLaserLength_CollideWithTiles(12); + float beamLength = DetermineLaserLength_CollideWithTiles(); //Rapid dust int dustCount = Main.rand.Next(10, 30); @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged public override void DetermineScale() => Projectile.scale = Projectile.timeLeft / Lifetime * MaxScale; - public override float DetermineLaserLength() => DetermineLaserLength_CollideWithTiles(5); + public override float DetermineLaserLength() => DetermineLaserLength_CollideWithTiles(); public override bool ShouldUpdatePosition() => false; diff --git a/Projectiles/Rogue/AcidShrapnel.cs b/Projectiles/Rogue/AcidShrapnel.cs deleted file mode 100644 index 8797e58c73..0000000000 --- a/Projectiles/Rogue/AcidShrapnel.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class AcidShrapnel : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Rogue/BarrelShrapnel"; - - public bool HitTile = false; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 3; - } - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 160; - Projectile.tileCollide = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.ignoreWater = true; - } - public override void AI() - { - Projectile.ai[0] += 1f; - if (HitTile) - { - Projectile.velocity.X = 0f; - Projectile.rotation = MathHelper.Pi; - } - else - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - - Projectile.velocity.Y += 0.2f; - } - public override bool OnTileCollide(Vector2 oldVelocity) - { - HitTile = true; - return false; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - Projectile.Kill(); - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - Projectile.Kill(); - } - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 15; i++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid); - dust.velocity = Vector2.UnitY.RotatedBy(i / 15f * MathHelper.TwoPi) * 3f * (float)Math.Cos(i / 15f * MathHelper.TwoPi); - dust.scale = 2.5f; - dust.noGravity = true; - } - } - } -} diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index d845c88fe8..6788a60063 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using CalamityMod.Dusts; using CalamityMod.NPCs; +using CalamityMod.NPCs.Ravager; using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -397,9 +399,9 @@ namespace CalamityMod.Projectiles.Rogue hasReachedFullCharge = false; if (tileHits == 0) { - SoundStyle sound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3); + SoundStyle sound = CommonCalamitySounds.VoidstoneMine with { Volume = 1 }; SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = -0.55f, MaxInstances = 6 }, Projectile.Center); - SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundStyle sound2 = RockPillar.HitSound; SoundEngine.PlaySound(sound2 with { Volume = 0.4f, Pitch = -0.2f, MaxInstances = 6 }, Projectile.Center); } tileHits++; diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.cs b/Projectiles/Rogue/GreenDonkeyKongReference.cs deleted file mode 100644 index fce9c945f1..0000000000 --- a/Projectiles/Rogue/GreenDonkeyKongReference.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class GreenDonkeyKongReference : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/AcidicRainBarrel"; - - public float cooldown = 0f; - public float oldVelocityX = 0f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 5; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 48; - Projectile.height = 48; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 480; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public bool CollideX => Projectile.oldPosition.X == Projectile.position.X; - - public override void AI() - { - bool stealthS = Projectile.Calamity().stealthStrike; - if (Projectile.localAI[0] == 0f) - { - Projectile.ai[1] = stealthS.ToInt() == 0 ? 1 : 3; - Projectile.localAI[0] = 1f; - } - Projectile.rotation += Math.Sign(Projectile.velocity.X) * MathHelper.ToRadians(8f); - if (Projectile.velocity.Y < 15f) - { - Projectile.velocity.Y += 0.3f; - } - if (CollideX && cooldown == 0) - { - BounceEffects(); - Projectile.velocity.X = -oldVelocityX; - } - else if (cooldown > 0) - { - cooldown -= 1f; - } - if (Projectile.velocity.X != 0f) - { - oldVelocityX = Math.Sign(Projectile.velocity.X) * 12f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - - public void BounceEffects() - { - bool stealthS = Projectile.Calamity().stealthStrike; - int projectileCount = 8; - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - if (stealthS) - { - projectileCount += 5; //more shit the closer we are to death - } - for (int i = 0; i < projectileCount; i++) - { - if (Main.rand.NextBool(3)) - { - Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(30f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity + shrapnelVelocity, - ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner); - } - else - { - Vector2 acidVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int acidIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity + acidVelocity, - ModContent.ProjectileType(), - (int)(Projectile.damage * 0.75f), 1f, Projectile.owner); - if (acidIndex.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[acidIndex].DamageType = RogueDamageClass.Instance; - Main.projectile[acidIndex].timeLeft = 300; - Main.projectile[acidIndex].usesLocalNPCImmunity = true; - Main.projectile[acidIndex].localNPCHitCooldown = -1; - } - } - } - - if (stealthS) - { - for (int i = 0; i < 6; i++) - { - Vector2 acidVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int acidIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity + acidVelocity, - ModContent.ProjectileType(), - (int)(Projectile.damage * 0.667f), 1f, Projectile.owner); - if (acidIndex.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[acidIndex].DamageType = RogueDamageClass.Instance; - Main.projectile[acidIndex].timeLeft = 420; - } - } - } - - Projectile.ai[1]--; - cooldown = 15; - if (Projectile.ai[1] <= 0) - { - Projectile.Kill(); - } - } - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); - return false; - } - } -} diff --git a/Projectiles/Rogue/SandDollarFrag.cs b/Projectiles/Rogue/SandDollarFrag.cs new file mode 100644 index 0000000000..7d0df79ccf --- /dev/null +++ b/Projectiles/Rogue/SandDollarFrag.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class SandDollarFrag : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; // Gets overridden in PreDraw anyways + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + } + + public override void AI() + { + Projectile.velocity.Y += 0.11f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + Projectile.rotation += Projectile.velocity.X * 0.025f; + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 5; i++) + { + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X / 4, Projectile.oldVelocity.Y / 4, 0, new Color(234, 183, 100), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 2f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Projectiles/Rogue/SandDollarFrag" + Projectile.ai[0].ToString()).Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, 1f, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/Rogue/SandDollarFrag1.png b/Projectiles/Rogue/SandDollarFrag1.png new file mode 100644 index 0000000000..caffaafff7 Binary files /dev/null and b/Projectiles/Rogue/SandDollarFrag1.png differ diff --git a/Projectiles/Rogue/SandDollarFrag2.png b/Projectiles/Rogue/SandDollarFrag2.png new file mode 100644 index 0000000000..1e318bc1f0 Binary files /dev/null and b/Projectiles/Rogue/SandDollarFrag2.png differ diff --git a/Projectiles/Rogue/SandDollarFrag3.png b/Projectiles/Rogue/SandDollarFrag3.png new file mode 100644 index 0000000000..33c162ee37 Binary files /dev/null and b/Projectiles/Rogue/SandDollarFrag3.png differ diff --git a/Projectiles/Rogue/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index 85e86a89df..0b370a56a6 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -8,31 +13,98 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; + public ref float Timer => ref Projectile.ai[0]; + public ref float BounceCheck => ref Projectile.ai[1]; + private const int Pierce = 2; public override void SetDefaults() { Projectile.width = 30; Projectile.height = 28; Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.aiStyle = ProjAIStyleID.Boomerang; - Projectile.timeLeft = 300; - AIType = ProjectileID.Bananarang; + Projectile.penetrate = Pierce; + Projectile.timeLeft = 600; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 25; } + public override void AI() + { + Timer++; + Projectile.rotation += BounceCheck > 0f ? 0.35f : 0.2f; + // Bouncing resets the timer for use in fading in its glow + if (Timer >= 30f || BounceCheck > 0f) + { + if (BounceCheck > 0f && Projectile.Calamity().stealthStrike) + Projectile.velocity *= 0.975f; + else + { + Projectile.velocity.X *= BounceCheck > 0f ? 0.985f : 0.998f; + Projectile.velocity.Y += 0.0375f; + } + } + if (Projectile.velocity.Y > 8f) + Projectile.velocity.Y = 8f; + + // Random dust after bouncing + if (BounceCheck > 0f || Projectile.Calamity().stealthStrike) + { + Vector2 dustPos = Projectile.Center + Main.rand.NextVector2CircularEdge(20f, 15f); + Vector2 dustVel = Utils.DirectionTo(Projectile.Center, dustPos).RotatedBy(MathHelper.PiOver2) * 2f; + Dust dust = Dust.NewDustPerfect(dustPos, DustID.Sand, dustVel, Scale: 0.75f); + dust.noGravity = true; + } + } + public override bool? CanDamage() => BounceCheck > 0f && Projectile.Calamity().stealthStrike ? false : null; + public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.ai[0] += 0.1f; - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) + // Should only bounce if it hasn't bounced before, hasn't pierced an enemy, and is hitting a floor (moving downwards) + if (BounceCheck == 0f && (Projectile.penetrate == Pierce || Projectile.Calamity().stealthStrike) && Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 0f) { + BounceCheck = 1f; + Timer = 0f; + Projectile.penetrate = 1; Projectile.velocity.Y = -oldVelocity.Y; + if (Projectile.velocity.Y < -4f) + Projectile.velocity.Y = -4f; + + // Summon a duststorm on stealth strikes + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, 1f, Projectile.owner, Projectile.whoAmI); + } + return false; } + return true; + } + + public override void OnKill(int timeLeft) + { + for (int s = 0; s < 8; s++) + { + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Scale: 0.9f); + dust.noGravity = true; + } + + if (BounceCheck > 0f && Main.myPlayer == Projectile.owner) + { + for (int i = 1; i <= 3; i++) + { + Vector2 velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3f, 4.5f); + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner, i); + Main.projectile[p].rotation = Main.rand.NextFloat(MathHelper.TwoPi); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Vector2 stretch = new Vector2(MathHelper.Lerp(1.2f, 0.8f, (float)Math.Abs(Math.Sin(Projectile.rotation))), MathHelper.Lerp(0.85f, 1.15f, (float)Math.Abs(Math.Sin(Projectile.rotation)))); + Color drawColor = BounceCheck > 0f ? Color.Lerp(lightColor, Color.White, MathHelper.Clamp(Timer / 60f, 0f, 0.5f)) : lightColor; + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, tex.Size() / 2f, stretch, SpriteEffects.None); return false; } } diff --git a/Projectiles/Rogue/SandDollarStealth.cs b/Projectiles/Rogue/SandDollarStealth.cs index 5eed13c7f0..1a7b49c931 100644 --- a/Projectiles/Rogue/SandDollarStealth.cs +++ b/Projectiles/Rogue/SandDollarStealth.cs @@ -1,58 +1,74 @@ -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class SandDollarStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; + public override string Texture => "CalamityMod/Projectiles/Typeless/SandCloakVeil"; + private const float Radius = 96f; + private const int StartTime = 180; + private bool shouldDie = false; public override void SetDefaults() { Projectile.width = 30; Projectile.height = 28; Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.aiStyle = ProjAIStyleID.Boomerang; - Projectile.timeLeft = 300; - AIType = ProjectileID.Bananarang; + Projectile.timeLeft = StartTime; + Projectile.Opacity = 0f; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(); - - private void OnHitEffects() + public override void AI() { - int coralAmt = Main.rand.Next(1, 4); - if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) + Projectile disk = Main.projectile[(int)Projectile.ai[0]]; + Projectile.rotation += 0.025f; + + if (disk.active) { - for (int coralCount = 0; coralCount < coralAmt; coralCount++) + if (!shouldDie) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int coral = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); - if (coral.WithinBounds(Main.maxProjectiles)) - Main.projectile[coral].DamageType = RogueDamageClass.Instance; + Projectile.Center = disk.Center + disk.velocity; + Projectile.timeLeft = 20; } - } - } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.ai[0] += 0.1f; - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; } - if (Projectile.velocity.Y != oldVelocity.Y) + else + shouldDie = true; + + if (Projectile.timeLeft >= 20) + Projectile.Opacity += 0.05f; + else + Projectile.Opacity -= 0.05f; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + float scaleStep = 0.05f; + Color drawCol = Projectile.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)); + float drawTransparency = 0.2f; + + if (Projectile.timeLeft > StartTime - 20) + drawTransparency *= Utils.GetLerpValue(StartTime - 20, StartTime, Projectile.timeLeft, true); + else if (Projectile.timeLeft < 20) + drawTransparency *= Utils.GetLerpValue(0, 20, Projectile.timeLeft, true); + + for (int i = 0; i < 20; i++) { - Projectile.velocity.Y = -oldVelocity.Y; + float rotation = (Projectile.rotation + scaleStep * i) * (i % 2 == 0).ToDirectionInt(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, rotation, tex.Size() / 2f, (Radius * 0.0044f) - (i * scaleStep), SpriteEffects.None); } return false; } diff --git a/Projectiles/Rogue/SkyStabberProj.cs b/Projectiles/Rogue/SkyStabberProj.cs deleted file mode 100644 index c9cab426cb..0000000000 --- a/Projectiles/Rogue/SkyStabberProj.cs +++ /dev/null @@ -1,84 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SkyStabberProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/SkyStabber"; - - public override void SetDefaults() - { - Projectile.width = 15; - Projectile.height = 15; - Projectile.friendly = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.tileCollide = true; - Projectile.penetrate = 10; - Projectile.timeLeft = 1000; - - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - - if (Projectile.ai[0] >= 90f) - { - Projectile.velocity.X *= 0.98f; - Projectile.velocity.Y *= 0.98f; - } - else - { - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.killSpikyBalls) - { - Projectile.active = false; - Projectile.netUpdate = true; - } - } - - // Makes the projectile bounce infinitely, as it stops mid-air anyway. - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X * 0.6f; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y * 0.6f; - } - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(target.Center); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(target.Center); - - private void OnHitEffects(Vector2 targetPos) - { - if (Projectile.Calamity().stealthStrike) - { - var source = Projectile.GetSource_FromThis(); - for (int n = 0; n < 4; n++) - { - Projectile feather = CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); - if (feather.whoAmI.WithinBounds(Main.maxProjectiles)) - feather.DamageType = RogueDamageClass.Instance; - } - } - } - } -} diff --git a/Projectiles/Summon/PerditionBeacon.cs b/Projectiles/Summon/PerditionBeacon.cs index 505e9616ee..1f68488cbe 100644 --- a/Projectiles/Summon/PerditionBeacon.cs +++ b/Projectiles/Summon/PerditionBeacon.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; @@ -15,16 +16,14 @@ namespace CalamityMod.Projectiles.Summon public override int AssociatedProjectileTypeID => ModContent.ProjectileType(); public override int AssociatedBuffTypeID => ModContent.BuffType(); public override ref bool AssociatedMinionBool => ref ModdedOwner.perditionBeacon; - public override float MinionSlots => 5f; - public ref float AttackTime => ref Projectile.ai[0]; public ref float AttackTimer => ref Projectile.ai[1]; public ref float DownwardCrossFade => ref Projectile.localAI[1]; public override void SetStaticDefaults() { - base.SetStaticDefaults(); Main.projFrames[Type] = 16; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -32,6 +31,10 @@ namespace CalamityMod.Projectiles.Summon base.SetDefaults(); Projectile.width = 48; Projectile.height = 90; + Projectile.minion = false; + Projectile.sentry = true; + Projectile.minionSlots = 0; + Projectile.timeLeft = Projectile.SentryLifeTime; } public override void SetOwnerTarget() @@ -111,6 +114,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnSpawn(IEntitySource source) { + Main.player[Projectile.owner].UpdateMaxTurrets(); // Release a burst of fire dust on spawn. if (Main.dedServ) return; diff --git a/Projectiles/Turret/LaserShot.cs b/Projectiles/Turret/LaserShot.cs index ae852dfc63..d0aae0660c 100644 --- a/Projectiles/Turret/LaserShot.cs +++ b/Projectiles/Turret/LaserShot.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Turret public override float DetermineLaserLength() { - return DetermineLaserLength_CollideWithTiles(8); + return DetermineLaserLength_CollideWithTiles(); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Typeless/BabyCannonballProjectile.cs b/Projectiles/Typeless/BabyCannonballProjectile.cs index 15f00571b0..2dcca5f59d 100644 --- a/Projectiles/Typeless/BabyCannonballProjectile.cs +++ b/Projectiles/Typeless/BabyCannonballProjectile.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.alpha = 255; Projectile.MaxUpdates = 3; - Projectile.timeLeft = 600; + Projectile.timeLeft = 150 * Projectile.MaxUpdates;; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 11; } diff --git a/Projectiles/Typeless/BatholithBangleProjectile.cs b/Projectiles/Typeless/BatholithBangleProjectile.cs new file mode 100644 index 0000000000..8cb026e4c2 --- /dev/null +++ b/Projectiles/Typeless/BatholithBangleProjectile.cs @@ -0,0 +1,203 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BatholithBangleProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public int damageTime = 120; + public int Soundtime1 = 84; + public int Soundtime2 = 90; + public int Soundtime3 = 96; + public int Soundtime4 = 107; + public SlotId SoundSlot; + public Color clr1 = new Color(59, 28, 136); // Light Granite + public Color clr2 = new Color(16, 14, 36); // Dark Granite + public Color clr3 = new Color(23, 186, 218); // Granite energy + public int spinDir = 1; + public bool invalidTarget => (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f || !Main.npc[(int)Projectile.ai[0]].active || Main.npc[(int)Projectile.ai[0]].life <= 0); + public Player Owner => Main.player[Projectile.owner]; + public bool visual => Owner.Calamity().batholithBangleVisual; + public override void SetDefaults() + { + Projectile.width = 120; + Projectile.height = 120; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = damageTime + 2; + Projectile.ArmorPenetration = 35; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.scale = 0.8f; + } + public override void AI() + { + if (time == 0 && visual) + { + spinDir = Main.rand.NextBool() ? 1 : -1; + SoundStyle sound = new("CalamityMod/Sounds/Item/BatholithBangleSound"); + SoundSlot = SoundEngine.PlaySound(sound with { Volume = 1f, MaxInstances = -1 }, Projectile.Center); + } + if (!invalidTarget) + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; + else if (time < Soundtime2) + { + NPC target = Projectile.Center.ClosestNPCAt(400, true, true); + Projectile.ai[0] = (target == null ? -1 : target.whoAmI); + } + + if (time > Soundtime1) + { + Projectile.rotation += 0.23f * spinDir * (float)Math.Pow(Utils.GetLerpValue(damageTime, Soundtime2, time, true), 1); + } + + float stabLerp = (float)Math.Pow(Utils.GetLerpValue(Soundtime4, damageTime, time, true), 8); + Vector2 triPlace = (Vector2.UnitY * (230 - 150 * stabLerp)) * Projectile.scale; + if (time == Soundtime2) + MakePusle(Projectile.Center + triPlace.RotatedBy(Projectile.rotation)); + if (time == Soundtime3) + MakePusle(Projectile.Center + triPlace.RotatedBy(Projectile.rotation + MathHelper.TwoPi / 3)); + if (time == Soundtime4) + MakePusle(Projectile.Center + triPlace.RotatedBy(Projectile.rotation - MathHelper.TwoPi / 3)); + if (time == damageTime) + { + float visMult = (visual ? 1 : 0.6f); + if (visual) + { + Owner.Calamity().GeneralScreenShakePower = 5f; + + Particle spark = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 12, 1.35f, clr3, Projectile.scale * new Vector2(2.5f, 1.3f), true, true, shrinkSpeed: 1.25f, extraRotation: MathHelper.PiOver2); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 10, 1.05f, clr3, Projectile.scale * new Vector2(2f, 1.3f), true, true, shrinkSpeed: 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, clr1, "CalamityMod/Particles/BloomRing", Projectile.scale * new Vector2(0.6f, 1.4f), 0, 0.3f, 1.35f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, clr1, "CalamityMod/Particles/BloomRing", Projectile.scale * new Vector2(1.3f, 0.7f), 0, 0.25f, 1f, 15); + GeneralParticleHandler.SpawnParticle(pulse2); + + } + + for (int i = 0; i < 12; i++) + { + Vector2 vel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5, 10); + Particle granite = new CustomSpark(Projectile.Center, vel, "CalamityMod/Particles/GlowTriangle", true, Main.rand.Next(30, 55 + 1), Projectile.scale * Main.rand.NextFloat(0.12f, 0.18f), (Main.rand.NextBool() ? clr1 : clr3) * visMult, Vector2.One, true, false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.5f, 0.5f)); + GeneralParticleHandler.SpawnParticle(granite); + } + } + + if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying) + Sound.Position = Projectile.Center; + time++; + } + public void MakePusle(Vector2 position) + { + if (!visual) + return; + for (int i = 0; i < 8; i++) + { + Vector2 outerVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1, 5); + Particle marble = new CustomSpark(position + outerVel * 5, outerVel, "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(18, 25 + 1), Projectile.scale * Main.rand.NextFloat(0.3f, 0.4f), Main.rand.NextBool() ? clr1 : clr3, Vector2.One, true, true, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.3f, 0.3f), glowOpacity: 0.8f); + GeneralParticleHandler.SpawnParticle(marble); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + float critDamage = Math.Min(Owner.GetTotalCritChance(AverageDamageClass.Instance) * 0.01f, 1f); + modifiers.SourceDamage *= 1 + critDamage; + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center) - Vector2.UnitY; + float launchPower = 9; + target.MoveNPC(launchVel, launchPower, true); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + bool hasCD = Owner.Calamity().cooldowns.TryGetValue(GenericBandCooldown.ID, out CooldownInstance bandCD); + + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().generalBandCooldown > BatholithBangle.cooldown / 2) + { + Owner.Calamity().generalBandCooldown -= BatholithBangle.cooldown / 2; + if (hasCD) + bandCD.timeLeft -= BatholithBangle.cooldown / 2; + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + public override bool? CanDamage() + { + if (time >= damageTime && Projectile.numHits <= 0) + return null; + else + return false; + } + public override bool? CanHitNPC(NPC target) + { + if ((invalidTarget || Projectile.ai[0] == target.whoAmI) && Projectile.numHits <= 0) + return null; + return false; + } + public override bool PreDraw(ref Color lightColor) + { + if (!visual) + return false; + Asset tri = ModContent.Request("CalamityMod/Particles/GlowTriangle"); + Asset shine = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + float stabLerp = (float)Math.Pow(Utils.GetLerpValue(Soundtime4, damageTime, time, true), 8); + Vector2 triPlace = Vector2.UnitY * (230 - 150 * stabLerp) * Projectile.scale; + + for (int i = 0; i < 6; i++) + { + float scale = Projectile.scale * (0.3f - 0.015f * i); + float rotation = Projectile.rotation; + float spawnScaleBonus = 0.3f; + float squashPower = 0.4f; + Color triColor = Color.Lerp(clr1, clr3, i * 0.14f); + if (time >= Soundtime2) + { + float lerp = (float)Math.Pow(Utils.GetLerpValue(Soundtime2 + 13, Soundtime2, time, true), 2); + Main.EntitySpriteDraw(tri.Value, Projectile.Center + triPlace.RotatedBy(rotation) - Main.screenPosition, null, triColor with { A = 0 }, rotation + MathHelper.Pi * lerp, tri.Size() * 0.5f, Projectile.scale * new Vector2(0.05f * i + 1 - squashPower * (1 - lerp), -0.05f * i + 1 + squashPower * (1 - lerp)) * (scale + spawnScaleBonus * lerp), SpriteEffects.None); + } + if (time >= Soundtime3) + { + rotation += MathHelper.TwoPi / 3; + float lerp = (float)Math.Pow(Utils.GetLerpValue(Soundtime3 + 13, Soundtime3, time, true), 2); + Main.EntitySpriteDraw(tri.Value, Projectile.Center + triPlace.RotatedBy(rotation) - Main.screenPosition, null, triColor with { A = 0 }, rotation + MathHelper.Pi * lerp, tri.Size() * 0.5f, Projectile.scale * new Vector2(0.05f * i + 1 - squashPower * (1 - lerp), -0.05f * i + 1 + squashPower * (1 - lerp)) * (scale + spawnScaleBonus * lerp), SpriteEffects.None); + } + if (time >= Soundtime4) + { + rotation += MathHelper.TwoPi / 3; + float lerp = (float)Math.Pow(Utils.GetLerpValue(Soundtime4 + 13, Soundtime4, time, true), 2); + Main.EntitySpriteDraw(tri.Value, Projectile.Center + triPlace.RotatedBy(rotation) - Main.screenPosition, null, triColor with { A = 0 }, rotation + MathHelper.Pi * lerp, tri.Size() * 0.5f, Projectile.scale * new Vector2(0.05f * i + 1 - squashPower * (1 - lerp), -0.05f * i + 1 + squashPower * (1 - lerp)) * (scale + spawnScaleBonus * lerp), SpriteEffects.None); + } + + } + for (int i = 0; i < 4; i++) + { + float shineLerp = (float)Math.Pow(Utils.GetLerpValue(0, Soundtime4, time, true), 3); + Color clrLerp = Color.Lerp(clr1, clr3, i * 0.3f); + Color shineColor = Color.Lerp(clrLerp, Color.White, i * 0.2f) * shineLerp; + float shineScale = Projectile.scale * 0.4f + 0.3f * shineLerp; + Main.EntitySpriteDraw(shine.Value, Projectile.Center - Main.screenPosition, null, shineColor with { A = 0 }, MathHelper.PiOver2, shine.Size() * 0.5f, new Vector2(0.5f - i * 0.15f, 1 + i * 0.2f) * (1 - i * 0.2f) * shineScale, SpriteEffects.None); + Main.EntitySpriteDraw(shine.Value, Projectile.Center - Main.screenPosition, null, shineColor with { A = 0 }, 0, shine.Size() * 0.5f, new Vector2(0.5f - i * 0.15f, 1 + i * 0.2f) * (1 - i * 0.1f) * shineScale, SpriteEffects.None); + } + return false; + } + } +} diff --git a/Projectiles/Typeless/BlackGlassBandProjectile.cs b/Projectiles/Typeless/BlackGlassBandProjectile.cs index 62e17f4eb4..b48eb8ccb2 100644 --- a/Projectiles/Typeless/BlackGlassBandProjectile.cs +++ b/Projectiles/Typeless/BlackGlassBandProjectile.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +13,8 @@ namespace CalamityMod.Projectiles.Typeless { public new string LocalizationCategory => "Projectiles.Typeless"; public int time = 0; + public Player Owner => Main.player[Projectile.owner]; + public bool visual => Owner.Calamity().bGlassBandVisual; public override void SetDefaults() { Projectile.width = 2; @@ -28,27 +32,29 @@ namespace CalamityMod.Projectiles.Typeless { if (time == 0) { - SoundStyle sound = new("CalamityMod/Sounds/Custom/AuricMine", 3); - SoundEngine.PlaySound(sound with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.15f, 0.25f), MaxInstances = -1 }, Projectile.Center); - SoundStyle sound2 = new("CalamityMod/Sounds/Item/NullHit"); - SoundEngine.PlaySound(sound2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.3f, 0.45f), MaxInstances = -1 }, Projectile.Center); + float visMult = (visual ? 1 : 0.3f); + SoundStyle sound = new("CalamityMod/Sounds/Item/BlackGlassBandSound"); + if (visual) + { + SoundEngine.PlaySound(sound with { Volume = 1f, MaxInstances = -1 }, Projectile.Center); + float randRot = Main.rand.NextFloat(0, MathHelper.Pi); + for (int i = -1; i <= 1; i += 2) + { + Vector2 position = Projectile.Center + (Vector2.UnitX * 20 * i).RotatedBy(randRot); + Particle spark = new CustomSpark(position, Vector2.UnitY.RotatedBy(randRot) * 0.001f, "CalamityMod/Particles/GlowSpark", false, 15, 0.03f, Color.DarkSlateBlue, new Vector2(7f, 0.2f), true, shrinkSpeed: 0.55f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = -1; i <= 1; i += 2) + { + Vector2 position = Projectile.Center + (Vector2.UnitY * 20 * i).RotatedBy(randRot); + Particle spark = new CustomSpark(position, Vector2.UnitX.RotatedBy(randRot) * 0.001f, "CalamityMod/Particles/GlowSpark", false, 15, 0.03f, Color.DarkSlateBlue, new Vector2(7f, 0.2f), true, shrinkSpeed: 0.55f); + GeneralParticleHandler.SpawnParticle(spark); + } + } for (int i = 0; i < 18; i++) { - Particle spark = new CustomSpark(Projectile.Center, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), "CalamityMod/Particles/GlowOrbParticle", true, 35, Main.rand.NextFloat(0.6f, 0.8f), Main.rand.NextBool() ? Color.DarkSlateBlue : Color.MediumPurple, new Vector2(0.8f, 1.2f), false); - GeneralParticleHandler.SpawnParticle(spark); - } - float randRot = Main.rand.NextFloat(0, MathHelper.Pi); - for (int i = -1; i <= 1; i += 2) - { - Vector2 position = Projectile.Center + (Vector2.UnitX * 20 * i).RotatedBy(randRot); - Particle spark = new CustomSpark(position, Vector2.UnitY.RotatedBy(randRot) * 0.001f, "CalamityMod/Particles/GlowSpark", false, 15, 0.03f, Color.DarkSlateBlue, new Vector2(7f, 0.2f), true, shrinkSpeed: 0.55f); - GeneralParticleHandler.SpawnParticle(spark); - } - for (int i = -1; i <= 1; i += 2) - { - Vector2 position = Projectile.Center + (Vector2.UnitY * 20 * i).RotatedBy(randRot); - Particle spark = new CustomSpark(position, Vector2.UnitX.RotatedBy(randRot) * 0.001f, "CalamityMod/Particles/GlowSpark", false, 15, 0.03f, Color.DarkSlateBlue, new Vector2(7f, 0.2f), true, shrinkSpeed: 0.55f); + Particle spark = new CustomSpark(Projectile.Center, new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), "CalamityMod/Particles/GlowOrbParticle", true, 35, Main.rand.NextFloat(0.6f, 0.8f), (Main.rand.NextBool() ? Color.DarkSlateBlue : Color.MediumPurple) * visMult, new Vector2(0.8f, 1.2f), false); GeneralParticleHandler.SpawnParticle(spark); } } @@ -57,12 +63,23 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { modifiers.SetCrit(); + float critDamage = Math.Min(Owner.GetTotalCritChance(AverageDamageClass.Instance) * 0.01f, 1f); + modifiers.SourceDamage *= (1 + critDamage); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player Owner = Main.player[Projectile.owner]; - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().bGlassbandCooldown > BlackGlassBand.cooldown / 2) - Owner.Calamity().bGlassbandCooldown = BlackGlassBand.cooldown / 2; + bool hasCD = Owner.Calamity().cooldowns.TryGetValue(GenericBandCooldown.ID, out CooldownInstance bandCD); + + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().generalBandCooldown > BlackGlassBand.cooldown / 2) + { + Owner.Calamity().generalBandCooldown -= BlackGlassBand.cooldown / 2; + if (hasCD) + bandCD.timeLeft -= BlackGlassBand.cooldown / 2; + } + } + public override bool? CanDamage() + { + return null; } } } diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index a1b97fc5f4..c0252c1c57 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 600; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 180 * Projectile.MaxUpdates; } public override void AI() diff --git a/Projectiles/Typeless/BloomStoneFlower.cs b/Projectiles/Typeless/BloomStoneFlower.cs new file mode 100644 index 0000000000..596a08d25f --- /dev/null +++ b/Projectiles/Typeless/BloomStoneFlower.cs @@ -0,0 +1,86 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BloomStoneFlower : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Magic/BeamingBolt"; + + public ref float HookIndex => ref Projectile.ai[0]; + public ref float FlowerPart => ref Projectile.ai[1]; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 30; + Projectile.scale = 1.2f; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + } + + public override void AI() + { + switch (FlowerPart) + { + case 0: + Projectile hook = Main.projectile[(int)HookIndex]; + if (!(hook.active && hook.aiStyle == ProjAIStyleID.Hook && hook.ai[0] == 2f)) + { + Projectile.Kill(); + return; + } + + Projectile.timeLeft = 5; + if (Vector2.DistanceSquared(Projectile.Center, Main.player[Projectile.owner].Center) < 1024f) + { + SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + for (int i = 0; i < 5; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Type, 0, 0f, Projectile.owner, 0f, 1f); + } + Projectile.Kill(); + } + break; + case 1: + if (Projectile.width < 90) + Projectile.ExpandHitboxBy(90); + Projectile.velocity *= 0.98f; + + // Visual effect + if (Projectile.timeLeft % 10 == 0) + { + MediumMistParticle pollenCloud = new(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f), Color.Yellow, Color.Gold, 3f, 100f); + GeneralParticleHandler.SpawnParticle(pollenCloud); + } + if (Projectile.timeLeft % 4 == 0) + { + Dust pollenDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), newColor: Color.Gold, Scale: 0.6f); + pollenDust.noLightEmittence = true; + pollenDust.noGravity = true; + } + + // Check for buffing + Player owner = Main.player[Projectile.owner]; + foreach (Player p in Main.ActivePlayers) + { + if (!(p == owner || (p.team == owner.team && owner.team != 0))) + continue; + + if (Projectile.Hitbox.Intersects(p.Hitbox)) + p.Calamity().bloomStoneDR = 360; + } + break; + } + } + + public override bool PreDraw(ref Color lightColor) => FlowerPart == 0f; + } +} diff --git a/Projectiles/Typeless/ClaretCannonProj.cs b/Projectiles/Typeless/ClaretCannonProj.cs index 9866a37afc..000e23c08e 100644 --- a/Projectiles/Typeless/ClaretCannonProj.cs +++ b/Projectiles/Typeless/ClaretCannonProj.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.alpha = 0; Projectile.penetrate = 1; - Projectile.timeLeft = 600; Projectile.DamageType = AverageDamageClass.Instance; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; Projectile.aiStyle = 0; } @@ -53,8 +53,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), ClaretCannon.ClaretCooldownMax); - target.AddBuff(BuffID.BetsysCurse, ClaretCannon.ClaretCooldownMax*2); + target.AddBuff(ModContent.BuffType(), ClaretCannon.ClaretCooldownMax / 2); + target.AddBuff(BuffID.BetsysCurse, ClaretCannon.ClaretCooldownMax); if (Projectile.penetrate == -1) return; var player = Main.player[Projectile.owner]; diff --git a/Projectiles/Typeless/DiamondOfTheDeepProjectile.cs b/Projectiles/Typeless/DiamondOfTheDeepProjectile.cs index 902165ffad..c8339673f9 100644 --- a/Projectiles/Typeless/DiamondOfTheDeepProjectile.cs +++ b/Projectiles/Typeless/DiamondOfTheDeepProjectile.cs @@ -2,12 +2,19 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.NPCs.AstrumDeus; using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -277,9 +284,9 @@ namespace CalamityMod.Projectiles.Typeless { if (visuals) { - SoundStyle fire = new("CalamityMod/Sounds/Custom/AstrumDeus/AstrumDeusGodRay"); + SoundStyle fire = AstrumDeusHead.GodRaySound; SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = (Main.rand.NextFloat(-0.6f, -0.5f) + projType * 0.1f) }, Projectile.Center); - SoundStyle fire2 = new("CalamityMod/Sounds/Item/VoidDash"); + SoundStyle fire2 = StatisVoidSash.VoidDash; SoundEngine.PlaySound(fire2 with { Volume = 0.3f, Pitch = (Main.rand.NextFloat(0.2f, 0.4f) + projType * 0.1f) }, Projectile.Center); } @@ -400,9 +407,9 @@ namespace CalamityMod.Projectiles.Typeless { if (visuals) { - SoundStyle s = new("CalamityMod/Sounds/Custom/AstrumDeus/DeusMineExplode"); + SoundStyle s = DeusMine.ExplodeSound; SoundEngine.PlaySound(s with { Volume = 0.7f, Pitch = (Main.rand.NextFloat(0.3f, 0.4f)) }, Projectile.Center); - SoundStyle fire2 = new("CalamityMod/Sounds/Item/VoidDash"); + SoundStyle fire2 = StatisVoidSash.VoidDash; SoundEngine.PlaySound(fire2 with { Volume = 0.4f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); for (int i = 0; i < 15; i++) @@ -462,7 +469,7 @@ namespace CalamityMod.Projectiles.Typeless { if (visuals) { - SoundStyle s = new("CalamityMod/Sounds/Custom/AuricMine", 3); + SoundStyle s = AuricOre.MineSound; SoundEngine.PlaySound(s with { Volume = 0.5f, Pitch = (-0.3f + Projectile.numHits * 0.1f), MaxInstances = 6 }, Projectile.Center); } @@ -476,8 +483,8 @@ namespace CalamityMod.Projectiles.Typeless { modifiers.SourceDamage *= 0.33f; // Deals less damage but hits multiple times if (visuals) - { - SoundStyle s = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3); + { + SoundStyle s = CommonCalamitySounds.VoidstoneMine with { Volume = 1 }; SoundEngine.PlaySound(s with { Volume = 0.6f, Pitch = (-0.3f + Projectile.numHits * 0.1f) }, Projectile.Center); } @@ -516,22 +523,22 @@ namespace CalamityMod.Projectiles.Typeless float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 10) / MathHelper.Pi); Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 1, 5, 1, 0.6f), Utils.Remap(Projectile.velocity.Length(), 1, 5, 1, 2f)); - Asset block = ModContent.Request("CalamityMod/Items/Placeables/Abyss/AbyssGravel"); + Asset block = TextureAssets.Item[ModContent.ItemType()]; switch (projType) // 0 = gravel/vines, 1 = hadal/hydrothermic, 2 = void/lumenyl { case 0: { - block = ModContent.Request("CalamityMod/Items/Placeables/Abyss/AbyssGravel"); + block = TextureAssets.Item[ModContent.ItemType()]; break; } case 1: { - block = ModContent.Request("CalamityMod/Items/Placeables/Abyss/PyreMantle"); + block = TextureAssets.Item[ModContent.ItemType()]; break; } case 2: { - block = ModContent.Request("CalamityMod/Items/Placeables/Abyss/Voidstone"); + block = TextureAssets.Item[ModContent.ItemType()]; break; } } diff --git a/Projectiles/Typeless/FestiveWingsOrnament.cs b/Projectiles/Typeless/FestiveWingsOrnament.cs new file mode 100644 index 0000000000..4fc2c6a7fb --- /dev/null +++ b/Projectiles/Typeless/FestiveWingsOrnament.cs @@ -0,0 +1,107 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class FestiveWingsOrnament : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.OrnamentFriendly; + + internal static readonly SoundStyle JingleSound = new("CalamityMod/Sounds/Item/FestiveJingle") { PitchVariance = 0.5f }; + + public override void SetStaticDefaults() => Main.projFrames[Type] = Main.projFrames[ProjectileID.OrnamentFriendly]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 22; + Projectile.friendly = true; + Projectile.timeLeft = 420; + } + + public override void OnSpawn(IEntitySource source) + { + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); + + // Vanilla's sprite sheet is slightly messed up so the "center" is the bottom + SoundEngine.PlaySound(JingleSound, Projectile.Bottom); + + Player owner = Main.player[Projectile.owner]; + if (owner == null || !owner.active) + return; + + Vector2 direction = owner.SafeDirectionTo(Projectile.Bottom); + Projectile.rotation = direction.ToRotation() + MathHelper.PiOver2; + + int totalPoints = (int)Utils.Remap(Vector2.Distance(Projectile.Bottom, owner.Center), 320f, 512f, 8f, 13f); + Vector2[] trailPoints = new Vector2[totalPoints + 1]; + trailPoints[0] = owner.Center; + trailPoints[totalPoints] = Projectile.Bottom; + for (int i = 1; i < totalPoints; i++) + { + trailPoints[i] = Vector2.Lerp(owner.Center, Projectile.Bottom, i / (float)totalPoints) + Main.rand.NextVector2Circular(12f, 12f) + direction.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-48f, 48f); + } + + int dustType = DustID.GemRuby - Projectile.frame; + for (int i = 0; i < totalPoints; i++) + { + for (int d = 0; d < 8; d++) + { + Dust trail = Dust.NewDustPerfect(Vector2.Lerp(trailPoints[i], trailPoints[i + 1], d / 8f), dustType); + trail.noGravity = true; + trail.noLight = true; + } + } + } + + public override void AI() + { + Lighting.AddLight(Projectile.Bottom, 0.5f, 0.5f, 0.5f); + + if (Projectile.timeLeft <= 120) + { + Projectile.velocity.Y += 0.75f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (Vector2.Distance(player.Center, Projectile.Bottom) < 32f && player.wingTimeMax > 0f) + { + player.wingTime = MathHelper.Clamp(player.wingTime + 75f, 0f, player.wingTimeMax); + SoundEngine.PlaySound(SoundID.Item29, player.Center); + Projectile.Kill(); + + int dustType = DustID.GemRuby - Projectile.frame; + for (int d = 0; d < 36; d++) + { + Dust ring = Dust.NewDustPerfect(Projectile.Bottom, dustType); + ring.velocity = (MathHelper.TwoPi * d / 36f).ToRotationVector2() * 6f; + ring.noGravity = true; + ring.noLight = true; + } + break; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.Bottom); + int dustType = DustID.GemRuby - Projectile.frame; + for (int i = 0; i < 20; i++) + { + Dust shatter = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType); + shatter.noLight = true; + shatter.scale = 0.8f; + } + return true; + } + } +} diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index ceb42cf336..cddc5fef7a 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -18,10 +18,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; - Projectile.timeLeft = 900; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 180 * Projectile.MaxUpdates; Projectile.ignoreWater = true; Projectile.tileCollide = false; } diff --git a/Projectiles/Typeless/ProtolithBangleProjectile.cs b/Projectiles/Typeless/ProtolithBangleProjectile.cs new file mode 100644 index 0000000000..ca833e6d43 --- /dev/null +++ b/Projectiles/Typeless/ProtolithBangleProjectile.cs @@ -0,0 +1,138 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ProtolithBangleProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public int damageTime = 24; + public int Soundtime1 = 2; + public int Soundtime2 = 8; + public int Soundtime3 = 15; + public int explosionSize = 230; + public SlotId SoundSlot; + public Player Owner => Main.player[Projectile.owner]; + public bool visual => Owner.Calamity().protolithBangleVisual; + public override void SetDefaults() + { + Projectile.width = explosionSize; + Projectile.height = explosionSize; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = damageTime + 20; + Projectile.ArmorPenetration = 25; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.scale = 0.8f; + } + public override void AI() + { + if (!(Projectile.ai[0] < 0f || Projectile.ai[0] > 199f) && time <= damageTime && Main.npc[(int)Projectile.ai[0]].active && Main.npc[(int)Projectile.ai[0]].life > 0) + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; + + Vector2 particlePlace = Vector2.UnitY * 40; + if (time == Soundtime1) + { + MakePusle(Projectile.Center + particlePlace); + } + if (time == Soundtime2) + { + MakePusle(Projectile.Center + particlePlace.RotatedBy(MathHelper.TwoPi / 3)); + } + if (time == Soundtime3) + { + MakePusle(Projectile.Center + particlePlace.RotatedBy(-MathHelper.TwoPi / 3)); + } + if (time == damageTime) + { + float visMult = (visual ? 1 : 0.3f); + Projectile.ai[0] = -1; + + if (visual) + { + Particle spark = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 15, 1.2f, Color.Gold, Projectile.scale * new Vector2(1f, 1.3f), true, true, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(spark); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Projectile.scale * new Vector2(1.4f, 0.6f), 0, 0.3f, 1.35f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + } + + for (int i = 0; i < 28; i++) + { + Particle marble = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(8, 13)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/Square", true, Main.rand.Next(40, 70 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 15, Color.Lerp(Color.White, Color.Khaki, Main.rand.NextFloat()) * visMult, new Vector2(1f, Main.rand.NextFloat(1, 2)), false, false, extraRotation: Main.rand.NextFloat(-4, 4)); + GeneralParticleHandler.SpawnParticle(marble); + } + } + if (time == 0 && visual) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/ProtolithBangleSound"); + SoundSlot = SoundEngine.PlaySound(sound with { Volume = 1f, MaxInstances = -1 }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying) + Sound.Position = Projectile.Center; + time++; + } + public void MakePusle(Vector2 position) + { + if (!visual) + return; + + Particle pulse = new CustomPulse(position, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Projectile.scale * Vector2.One, 0, 0.3f, 0.65f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + + for (int i = 0; i < 18; i++) + { + Vector2 outerVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5, 7); + Particle marble = new CustomSpark(position + outerVel * 5, -outerVel * 0.6f, "CalamityMod/Particles/Square", false, Main.rand.Next(10, 15 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 10, Color.Lerp(Color.White, Color.Khaki, Main.rand.NextFloat()), new Vector2(1f, Main.rand.NextFloat(1, 2)), false, false, extraRotation: Main.rand.NextFloat(-4, 4)); + GeneralParticleHandler.SpawnParticle(marble); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + float critDamage = Math.Min(Owner.GetTotalCritChance(AverageDamageClass.Instance) * 0.01f, 1f); + + float minMult = 0.1f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult + critDamage; + + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY; + float launchPower = 6; + target.MoveNPC(launchVel, launchPower, true); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + bool hasCD = Owner.Calamity().cooldowns.TryGetValue(GenericBandCooldown.ID, out CooldownInstance bandCD); + + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().generalBandCooldown > ProtolithBangle.cooldown / 2) + { + Owner.Calamity().generalBandCooldown -= ProtolithBangle.cooldown / 2; + if (hasCD) + bandCD.timeLeft -= ProtolithBangle.cooldown / 2; + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); + public override bool? CanDamage() + { + if (time >= damageTime) + return null; + else + return false; + } + } +} diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index 831a4ae3f5..a99c92601f 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -478,7 +478,9 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { Vector2 drawPos = Owner.MountedCenter + (drifting ? idealVel : Projectile.velocity).SafeNormalize(Vector2.UnitX) * (55 - 35 * Utils.GetLerpValue(0, 25, driftTimer, true)); - Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 }, Color.White, 3f * driftPowerScaling, effects: Math.Sign((drifting ? idealVel.X : Projectile.velocity.X)) == -1 ? Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically : Microsoft.Xna.Framework.Graphics.SpriteEffects.None, xPos: drawPos.X, yPos: drawPos.Y); + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 }, Color.White, 3f * driftPowerScaling, effects: Math.Sign((drifting ? idealVel.X : Projectile.velocity.X)) == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None, xPos: drawPos.X, yPos: drawPos.Y); + //Asset texBase = ModContent.Request(Texture); + //Main.EntitySpriteDraw(texBase.Value, drawPos, null, Color.White, Projectile.rotation, texBase.Size() * 0.5f, Projectile.scale, Math.Sign((drifting ? idealVel.X : Projectile.velocity.X)) == -1 ? Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically : Microsoft.Xna.Framework.Graphics.SpriteEffects.None); Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomRing").Value; Texture2D texture2 = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; diff --git a/Projectiles/Rogue/AcidBarrelDrop.cs b/Projectiles/Typeless/RustyMedallionDroplet.cs similarity index 76% rename from Projectiles/Rogue/AcidBarrelDrop.cs rename to Projectiles/Typeless/RustyMedallionDroplet.cs index d635b81c3f..d82bab90f3 100644 --- a/Projectiles/Rogue/AcidBarrelDrop.cs +++ b/Projectiles/Typeless/RustyMedallionDroplet.cs @@ -4,11 +4,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Rogue +namespace CalamityMod.Projectiles.Typeless { - public class AcidBarrelDrop : ModProjectile, ILocalizedModType + public class RustyMedallionDroplet : ModProjectile, ILocalizedModType { - public new string LocalizationCategory => "Projectiles.Rogue"; + public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; public override void SetStaticDefaults() @@ -25,10 +25,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = true; Projectile.ignoreWater = false; Projectile.timeLeft = 840; + Projectile.penetrate = 2; Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.DamageType = RogueDamageClass.Instance; + Projectile.DamageType = DamageClass.Generic; } public override void AI() { @@ -40,17 +41,7 @@ namespace CalamityMod.Projectiles.Rogue dust.velocity = -Projectile.velocity * 0.4f; } - if (Projectile.ai[0] < 3) - { - if (Projectile.timeLeft == 839) - Projectile.velocity *= 0.5f; - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Projectile.velocity.Y <= 12f) - { - Projectile.velocity.Y += 0.15f; - } - Projectile.tileCollide = Projectile.timeLeft <= 300; - } + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Typeless/TatteredFairyDust.cs b/Projectiles/Typeless/TatteredFairyDust.cs index 9d243ee0e6..054c3c2aa8 100644 --- a/Projectiles/Typeless/TatteredFairyDust.cs +++ b/Projectiles/Typeless/TatteredFairyDust.cs @@ -12,11 +12,9 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - Projectile.width = Projectile.height = 25; + Projectile.width = Projectile.height = 36; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Generic; - Projectile.penetrate = 3; - Projectile.timeLeft = 150; + Projectile.timeLeft = 180; } public override void AI() @@ -29,6 +27,15 @@ namespace CalamityMod.Projectiles.Typeless Dust lightedDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.TintableDustLighted, Main.rand.NextFloat(0.1f), Main.rand.NextFloat(0.1f), 0, new Color(190, 3, 252)); lightedDust.noGravity = true; } + + if (Projectile.timeLeft < 170) + { + foreach (Player player in Main.ActivePlayers) + { + if (Vector2.Distance(player.Center, Projectile.Center) < 24f && player.wingTime > 0f) + player.wingTime -= 4f; + } + } } } } diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index 493644d923..93f0df94db 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Typeless Point tilePos = Projectile.Center.ToTileCoordinates(); Tile tile = Main.tile[tilePos]; - if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo() || Owner.IsBlacklistedForGrappling(tilePos)) + if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo(Owner.miscEquips[4].type == ItemID.SquirrelHook) || Owner.IsBlacklistedForGrappling(tilePos)) State = HookState.Retracting; Projectile.velocity = Vector2.Zero; @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Typeless Tile tile = Main.tile[tilePos]; - if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo() || Owner.IsBlacklistedForGrappling(tilePos)) + if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo(Owner.miscEquips[4].type == ItemID.SquirrelHook) || Owner.IsBlacklistedForGrappling(tilePos)) continue; if (Main.myPlayer != Owner.whoAmI) continue; @@ -178,6 +178,7 @@ namespace CalamityMod.Projectiles.Typeless //Hook onto the tile Projectile.velocity = Vector2.Zero; State = HookState.Grappling; + Projectile.Center = grapplePos + Vector2.One * 8f; //effects WorldGen.KillTile(x, y, fail: true, effectOnly: true); @@ -190,7 +191,8 @@ namespace CalamityMod.Projectiles.Typeless Owner.grapCount++; //Owner.velocity = Vector2.Zero; } - + if (Owner.miscEquips[4].type == ItemID.QueenSlimeHook) + Owner.DoQueenSlimeHookTeleport(grapplePos + new Vector2(-(Owner.Center - Projectile.Center).Length() * 0.75f, 0).RotatedBy(Projectile.DirectionTo(Owner.Center).ToRotation())); mp.SwingLength = (Owner.Center - Projectile.Center).Length(); mp.OldPosition = Owner.Center - Owner.velocity; mp.SetSegments(Projectile.Center); diff --git a/Projectiles/Typeless/XykDeathAnim.cs b/Projectiles/Typeless/XykDeathAnim.cs index 96b2bb29b9..ede5e6ece1 100644 --- a/Projectiles/Typeless/XykDeathAnim.cs +++ b/Projectiles/Typeless/XykDeathAnim.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public ref float time => ref Projectile.ai[0]; public int endTime = 25; - public override string Texture => "CalamityMod/Items/LabFinders/RedSeekingMechanism"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { @@ -39,20 +39,7 @@ namespace CalamityMod.Projectiles.Typeless { Player Owner = Main.player[Projectile.owner]; bool Orange = Owner.Calamity().XykVisualsOrange; - Color effectColor = Orange ? Color.Gold : Color.DodgerBlue; - - float rate = Main.GlobalTimeWrappedHourly * 22; - List eColors = new List() - { - Orange ? Color.OrangeRed : Color.DodgerBlue, - Orange ? Color.Gold : Color.Cyan, - Orange ? Color.Orange : Color.RoyalBlue - }; - - int colorIndex = (int)(rate / 2 % eColors.Count); - Color currentColor = eColors[colorIndex]; - Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + Color effectColor = Owner.Calamity().XykFXColor; if (time == 0) { diff --git a/Projectiles/Typeless/XykWings.cs b/Projectiles/Typeless/XykWings.cs new file mode 100644 index 0000000000..222fc845b6 --- /dev/null +++ b/Projectiles/Typeless/XykWings.cs @@ -0,0 +1,328 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class XykWings : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color drawColor => Owner.Calamity().XykFXColor; + public int time = 0; + public int flightTimer = 0; + public float wingFlapHeight = 0; + public Vector2 expectedWingPosition1; + public Vector2 expectedWingPosition2; + public Vector2 WingVel1; + public Vector2 WingVel2; + public float backWingRot = 0; + public int lastDir = 0; + public float spawnFade = 0; + public float spawnFadePow => (Projectile.ai[1] == 5 ? 1 - (float)Math.Pow(spawnFade, 4) : (float)Math.Pow(spawnFade, 4)); + public int deathFadeTimer = 0; + + public bool iAmTopWing = false; + public Vector2 playerCenterPoint; + public int groundTime = 0; + public int dashTimer = 0; + public bool doDashEffect = true; + public float dashfx = 0; + public int timeFalling = 0; + public bool BreakApart = false; + + public ref float wingNum => ref Projectile.ai[0]; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.scale = 0; + } + + public override void AI() + { + float intendedScale = 0.85f; + float spawnAnimTime = 12 + wingNum; + if (time == 0) + { + expectedWingPosition1 = Owner.Center; + expectedWingPosition2 = Owner.Center; + playerCenterPoint = Owner.MountedCenter; + } + if (time <= spawnAnimTime) + { + spawnFade = Utils.GetLerpValue(0, spawnAnimTime, time, true); + Projectile.scale = intendedScale * Math.Min(spawnFade + 0.5f, 1); + if (time == spawnAnimTime) + { + Projectile.scale = 1.6f; + } + } + else if (Projectile.ai[1] == 0) + Projectile.scale = MathHelper.Lerp(Projectile.scale, intendedScale, 0.08f); + + if (moddedOwner.XykVisualsBlue || moddedOwner.XykVisualsOrange) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + playerCenterPoint = Owner.MountedCenter; + + if (Owner.wingTime == Owner.wingTimeMax && Owner.velocity.Y == 0 && Owner.dashDelay != -1) + groundTime++; + else + groundTime = 0; + if (((groundTime >= 180 || Owner.wingTime <= 0) && wingNum == checkActiveWings() - 1) || Projectile.ai[1] == 5) + { + if (Projectile.ai[1] == 0) + { + iAmTopWing = true; + foreach (Projectile p in Main.ActiveProjectiles) + if (p.type == ModContent.ProjectileType() && p.owner == Owner.whoAmI && p.ai[1] == 0) + p.ai[1] = 5; + return; + } + if (deathFadeTimer == 0) + BreakApart = Owner.wingTime <= 0; + if (BreakApart) + { + Projectile.extraUpdates = 1; + int startTime = (int)(6 * (wingNum + 1)); + if (deathFadeTimer == startTime) + { + WingVel1 = Vector2.UnitX * -Main.rand.NextFloat(4f, 7f) * lastDir + Vector2.UnitY.RotatedByRandom(0.3f) * -Main.rand.NextFloat(5, 7); + WingVel2 = Vector2.UnitX * Main.rand.NextFloat(4f, 7f) * lastDir + Vector2.UnitY.RotatedByRandom(0.3f) * -Main.rand.NextFloat(5, 7); + } + if (deathFadeTimer > startTime) + { + WingVel1.X *= 0.97f; + if (WingVel1.Y < 15) + WingVel1.Y += 0.2f; + if (WingVel1.Y < 5) + WingVel1.Y *= 0.97f; + WingVel2.X *= 0.97f; + if (WingVel2.Y < 15) + WingVel2.Y += 0.2f; + if (WingVel2.Y < 5) + WingVel2.Y *= 0.97f; + + expectedWingPosition1 += WingVel1; + expectedWingPosition2 += WingVel2; + + Projectile.rotation += 0.01f + wingNum * 0.005f; + backWingRot -= 0.01f + wingNum * 0.005f; + } + else + { + expectedWingPosition1 += Owner.velocity * 0.65f; + expectedWingPosition2 += Owner.velocity * 0.65f; + } + } + else + { + int startTime = (int)(2 * wingNum); + if (deathFadeTimer == startTime) + { + WingVel1 = (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 15; + WingVel2 = (backWingRot + MathHelper.PiOver2).ToRotationVector2() * 7; + } + if (deathFadeTimer > startTime) + { + expectedWingPosition1 += WingVel1; + expectedWingPosition2 += WingVel2; + WingVel1 *= 0.955f; + WingVel2 *= 0.955f; + } + else + { + expectedWingPosition1 += Owner.velocity * 0.85f; + expectedWingPosition2 += Owner.velocity * 0.85f; + } + } + + dashfx = MathHelper.Lerp(dashfx, 0, 0.07f); + deathFadeTimer++; + + int fadeTime = (BreakApart ? 90 : 20); + spawnFade = Utils.GetLerpValue(0, fadeTime, deathFadeTimer, true); + Projectile.scale = intendedScale * spawnFadePow; + if (deathFadeTimer >= fadeTime) + { + Projectile.Kill(); + return; + } + return; + } + + bool isFlying = Owner.controlJump; + bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0; + bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp; + bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting; + if (isFalling || timeFalling < 0) + timeFalling++; + else if (timeFalling > 0) + timeFalling -= 2; + float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 60, timeFalling, true), 3); + float topWingNum = (checkActiveWings() - 1); + + float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi); + + if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16) + { + dashfx = MathHelper.Lerp(dashfx, 1, 0.25f); + float bonusScale = 1; + if (Owner.Calamity().rageModeActive) + bonusScale += 0.25f; + if (Owner.Calamity().adrenalineModeActive) + bonusScale += 0.5f; + if (Projectile.scale < bonusScale) + Projectile.scale = bonusScale; + } + else + { + dashfx = MathHelper.Lerp(dashfx, 0, 0.03f); + if (dashfx > 0) + dashfx -= 0.01f; + else + dashfx = 0; + } + + float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3)); + + wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow; + + for (int i = -1; i <= 1; i += 2) + { + float dir = i * lastDir; + Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1); + float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1); + Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement; + + float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp)); + float spawnDistance = 150; + if (i == 1) + expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed; + else + expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed; + } + Projectile.Center = Owner.Center; + + Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + + if (wingNum == 0) + Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow); + + if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0)) + { + for (int i = -2; i <= 2; i += 1) + { + if (i == 0) + i++; + + bool front = i > 0; + Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f); + Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f); + + if (Owner.Calamity().XykVisualsBlue) + { + bool circle = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 1.5f * (circle ? 0 : 1f); + } + else + { + bool square = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 0.1f * (square ? 1 : 3f); + } + } + } + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + if (!BreakApart) + lastDir = Owner.direction; + + float topWingNum = (checkActiveWings() - 1); + float width = 1; + float height = 1; + Texture2D tex; + if (wingNum == 0) + tex = ModContent.Request("CalamityMod/Particles/XykWing2").Value; + else if (wingNum == topWingNum || iAmTopWing) + { + height = 1.5f; + tex = ModContent.Request("CalamityMod/Particles/XykWing1").Value; + } + else + { + width = 2; + height = 1f + 0.1f * wingNum; + tex = ModContent.Request("CalamityMod/Particles/XykWing3").Value; + } + + Texture2D glow = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 scale = new Vector2(width, height * spawnFadePow) * 0.12f * Projectile.scale; + Vector2 scaleBack = new Vector2(width * 1.5f, height * 0.7f * spawnFadePow) * 0.07f * Projectile.scale; + + if (dashfx > 0) + { + for (int i = 0; i < 4; i++) + { + Main.EntitySpriteDraw(glow, expectedWingPosition1 - Main.screenPosition, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, Projectile.rotation + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.7f : 1) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0); + Main.EntitySpriteDraw(glow, expectedWingPosition2 - Main.screenPosition, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, backWingRot + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.3f : 0.6f) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0); + } + int draws = 12; + for (int i = 0; i < draws; i++) + { + Vector2 addedPos = ((MathHelper.TwoPi * i / draws).ToRotationVector2() * 2.5f + Main.rand.NextVector2Circular(2, 2)) * dashfx; + Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + + Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + } + } + + Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + + Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + + return false; + } + public int checkActiveWings() + { + int numOfActiveWings = 0; + foreach (Projectile p in Main.ActiveProjectiles) + if (p.type == ModContent.ProjectileType() && p.owner == Owner.whoAmI && p.ai[1] == 0) + numOfActiveWings++; + if (Projectile.ai[1] == 5) + numOfActiveWings = 7; + return numOfActiveWings; + } + public override bool? CanDamage() => false; + } +} diff --git a/Scenes/MusicScenes/BioLabMusicScene.cs b/Scenes/MusicScenes/BioLabMusicScene.cs index 59ecadbe6a..d17e718d6f 100644 --- a/Scenes/MusicScenes/BioLabMusicScene.cs +++ b/Scenes/MusicScenes/BioLabMusicScene.cs @@ -31,31 +31,44 @@ namespace CalamityMod.Scenes.MusicScenes // (Tile range * Pixels per tile)^2 double labRadius = Math.Pow(80f * 16f, 2); - + // Checks if the player is behind any wall that naturally generates in Bio Labs bool behindLabWall = - backWall.WallType == WallID.ObsidianBrick || - backWall.WallType == WallID.Glass || - backWall.WallType == WallID.SnowWallUnsafe || - backWall.WallType == WallID.IceUnsafe || - backWall.WallType == WallID.Waterfall || - backWall.WallType == WallID.Lavafall || + backWall.WallType == WallID.AmberGemspark || + backWall.WallType == WallID.AncientSilverBrickWall || + backWall.WallType == WallID.CopperPlating || + backWall.WallType == WallID.EmeraldGemspark || + backWall.WallType == WallID.Granite || + backWall.WallType == WallID.GrayBrick || + backWall.WallType == WallID.IridescentBrick || backWall.WallType == WallID.IronBrick || - backWall.WallType == ModContent.WallType() || - backWall.WallType == ModContent.WallType() || - backWall.WallType == ModContent.WallType() || + backWall.WallType == WallID.Lavafall || + backWall.WallType == WallID.LavaMossBlockWall || + backWall.WallType == WallID.LeadBrick || + backWall.WallType == WallID.ObsidianBrick || + backWall.WallType == WallID.RubyGemspark || + backWall.WallType == WallID.SapphireGemspark || + backWall.WallType == WallID.SilverBrick || + backWall.WallType == WallID.StoneSlab || + backWall.WallType == WallID.TinPlating || + backWall.WallType == WallID.TopazGemspark || + backWall.WallType == WallID.Waterfall || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || backWall.WallType == ModContent.WallType() || - backWall.WallType == ModContent.WallType(); + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType(); // Checks if the player is within a specified range from the center point of any Bio Lab bool nearBioLabPoint = diff --git a/Schematics/Arsenal_Lab_Ice.csch b/Schematics/Arsenal_Lab_Ice.csch new file mode 100644 index 0000000000..21c092cf3c Binary files /dev/null and b/Schematics/Arsenal_Lab_Ice.csch differ diff --git a/Schematics/Arsenal_Lab_Onyx.csch b/Schematics/Arsenal_Lab_Onyx.csch new file mode 100644 index 0000000000..f5fd823ae0 Binary files /dev/null and b/Schematics/Arsenal_Lab_Onyx.csch differ diff --git a/Schematics/Arsenal_Lab_Plague.csch b/Schematics/Arsenal_Lab_Plague.csch new file mode 100644 index 0000000000..5c0bd55727 Binary files /dev/null and b/Schematics/Arsenal_Lab_Plague.csch differ diff --git a/Schematics/Arsenal_Lab_Planetoid.csch b/Schematics/Arsenal_Lab_Planetoid.csch new file mode 100644 index 0000000000..028c2220d5 Binary files /dev/null and b/Schematics/Arsenal_Lab_Planetoid.csch differ diff --git a/Schematics/Arsenal_Lab_Sunken.csch b/Schematics/Arsenal_Lab_Sunken.csch new file mode 100644 index 0000000000..f770b15419 Binary files /dev/null and b/Schematics/Arsenal_Lab_Sunken.csch differ diff --git a/Schematics/Arsenal_Lab_Underworld.csch b/Schematics/Arsenal_Lab_Underworld.csch new file mode 100644 index 0000000000..707fb92e10 Binary files /dev/null and b/Schematics/Arsenal_Lab_Underworld.csch differ diff --git a/Schematics/Barbed_Stockade1.csch b/Schematics/Barbed_Stockade1.csch new file mode 100644 index 0000000000..9d07e3aec6 Binary files /dev/null and b/Schematics/Barbed_Stockade1.csch differ diff --git a/Schematics/Barbed_Stockade2.csch b/Schematics/Barbed_Stockade2.csch new file mode 100644 index 0000000000..c21b797d8a Binary files /dev/null and b/Schematics/Barbed_Stockade2.csch differ diff --git a/Schematics/Barbed_Stockade3.csch b/Schematics/Barbed_Stockade3.csch new file mode 100644 index 0000000000..eae4b2cb42 Binary files /dev/null and b/Schematics/Barbed_Stockade3.csch differ diff --git a/Schematics/Barbed_Stockade4.csch b/Schematics/Barbed_Stockade4.csch new file mode 100644 index 0000000000..a49e0c86d5 Binary files /dev/null and b/Schematics/Barbed_Stockade4.csch differ diff --git a/Schematics/Bonescrapper_Cache1.csch b/Schematics/Bonescrapper_Cache1.csch new file mode 100644 index 0000000000..d5411fa3e7 Binary files /dev/null and b/Schematics/Bonescrapper_Cache1.csch differ diff --git a/Schematics/Bonescrapper_Cache2.csch b/Schematics/Bonescrapper_Cache2.csch new file mode 100644 index 0000000000..1145d46c6e Binary files /dev/null and b/Schematics/Bonescrapper_Cache2.csch differ diff --git a/Schematics/Bonescrapper_Cache3.csch b/Schematics/Bonescrapper_Cache3.csch new file mode 100644 index 0000000000..cb90d99889 Binary files /dev/null and b/Schematics/Bonescrapper_Cache3.csch differ diff --git a/Schematics/Bonescrapper_Cache4.csch b/Schematics/Bonescrapper_Cache4.csch new file mode 100644 index 0000000000..21fa20a226 Binary files /dev/null and b/Schematics/Bonescrapper_Cache4.csch differ diff --git a/Schematics/Bonescrapper_Cache5.csch b/Schematics/Bonescrapper_Cache5.csch new file mode 100644 index 0000000000..09a4f5d4fa Binary files /dev/null and b/Schematics/Bonescrapper_Cache5.csch differ diff --git a/Schematics/Bonescrapper_Cache6.csch b/Schematics/Bonescrapper_Cache6.csch new file mode 100644 index 0000000000..76ecd82c41 Binary files /dev/null and b/Schematics/Bonescrapper_Cache6.csch differ diff --git a/Schematics/Brimstone_Atrium1.csch b/Schematics/Brimstone_Atrium1.csch new file mode 100644 index 0000000000..257b3872c6 Binary files /dev/null and b/Schematics/Brimstone_Atrium1.csch differ diff --git a/Schematics/Brimstone_Atrium2.csch b/Schematics/Brimstone_Atrium2.csch new file mode 100644 index 0000000000..a0b5250357 Binary files /dev/null and b/Schematics/Brimstone_Atrium2.csch differ diff --git a/Schematics/Brimstone_Atrium3.csch b/Schematics/Brimstone_Atrium3.csch new file mode 100644 index 0000000000..258c97d742 Binary files /dev/null and b/Schematics/Brimstone_Atrium3.csch differ diff --git a/Schematics/Demonic_Dungeon1.csch b/Schematics/Demonic_Dungeon1.csch new file mode 100644 index 0000000000..7b7595096d Binary files /dev/null and b/Schematics/Demonic_Dungeon1.csch differ diff --git a/Schematics/Demonic_Dungeon2.csch b/Schematics/Demonic_Dungeon2.csch new file mode 100644 index 0000000000..c8116e9d3d Binary files /dev/null and b/Schematics/Demonic_Dungeon2.csch differ diff --git a/Schematics/DraedonsLab_Cavern.csch b/Schematics/DraedonsLab_Cavern.csch deleted file mode 100644 index 189f23904a..0000000000 Binary files a/Schematics/DraedonsLab_Cavern.csch and /dev/null differ diff --git a/Schematics/DraedonsLab_Hell.csch b/Schematics/DraedonsLab_Hell.csch deleted file mode 100644 index 8743c23f3c..0000000000 Binary files a/Schematics/DraedonsLab_Hell.csch and /dev/null differ diff --git a/Schematics/DraedonsLab_Ice.csch b/Schematics/DraedonsLab_Ice.csch deleted file mode 100644 index 7df7875366..0000000000 Binary files a/Schematics/DraedonsLab_Ice.csch and /dev/null differ diff --git a/Schematics/DraedonsLab_Plague.csch b/Schematics/DraedonsLab_Plague.csch deleted file mode 100644 index 4bf586fca1..0000000000 Binary files a/Schematics/DraedonsLab_Plague.csch and /dev/null differ diff --git a/Schematics/DraedonsLab_Planetoid.csch b/Schematics/DraedonsLab_Planetoid.csch deleted file mode 100644 index f6247936d7..0000000000 Binary files a/Schematics/DraedonsLab_Planetoid.csch and /dev/null differ diff --git a/Schematics/DraedonsLab_SunkenSea.csch b/Schematics/DraedonsLab_SunkenSea.csch deleted file mode 100644 index f4a3e047ff..0000000000 Binary files a/Schematics/DraedonsLab_SunkenSea.csch and /dev/null differ diff --git a/Schematics/Hellstone_Stronghold1.csch b/Schematics/Hellstone_Stronghold1.csch new file mode 100644 index 0000000000..f7a79c9c73 Binary files /dev/null and b/Schematics/Hellstone_Stronghold1.csch differ diff --git a/Schematics/Hellstone_Stronghold2.csch b/Schematics/Hellstone_Stronghold2.csch new file mode 100644 index 0000000000..f05f1d9ef6 Binary files /dev/null and b/Schematics/Hellstone_Stronghold2.csch differ diff --git a/Schematics/Sanctum_of_Oblivion1.csch b/Schematics/Sanctum_of_Oblivion1.csch new file mode 100644 index 0000000000..1746bf4e6b Binary files /dev/null and b/Schematics/Sanctum_of_Oblivion1.csch differ diff --git a/Schematics/Sanctum_of_Oblivion2.csch b/Schematics/Sanctum_of_Oblivion2.csch new file mode 100644 index 0000000000..924291f7b7 Binary files /dev/null and b/Schematics/Sanctum_of_Oblivion2.csch differ diff --git a/Schematics/Sanctum_of_Oblivion3.csch b/Schematics/Sanctum_of_Oblivion3.csch new file mode 100644 index 0000000000..13e833b9e2 Binary files /dev/null and b/Schematics/Sanctum_of_Oblivion3.csch differ diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index 64ef097fca..f6b72244b5 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -13,6 +13,66 @@ namespace CalamityMod.Schematics { public sealed class SchematicManager : ModSystem { + internal const string BrimstoneAtriumType1Key = "Brimstone Atrium Type 1 Key"; + internal const string BrimstoneAtriumType1Filename = "Schematics/Brimstone_Atrium1.csch"; + + internal const string BrimstoneAtriumType2Key = "Brimstone Atrium Type 2 Key"; + internal const string BrimstoneAtriumType2Filename = "Schematics/Brimstone_Atrium2.csch"; + + internal const string BrimstoneAtriumType3Key = "Brimstone Atrium Type 3 Key"; + internal const string BrimstoneAtriumType3Filename = "Schematics/Brimstone_Atrium3.csch"; + + internal const string BonescrapperCacheType1Key = "Bonescrapper Cache Type 1 Key"; + internal const string BonescrapperCacheType1Filename = "Schematics/Bonescrapper_Cache1.csch"; + + internal const string BonescrapperCacheType2Key = "Bonescrapper Cache Type 2 Key"; + internal const string BonescrapperCacheType2Filename = "Schematics/Bonescrapper_Cache2.csch"; + + internal const string BonescrapperCacheType3Key = "Bonescrapper Cache Type 3 Key"; + internal const string BonescrapperCacheType3Filename = "Schematics/Bonescrapper_Cache3.csch"; + + internal const string BonescrapperCacheType4Key = "Bonescrapper Cache Type 4 Key"; + internal const string BonescrapperCacheType4Filename = "Schematics/Bonescrapper_Cache4.csch"; + + internal const string BonescrapperCacheType5Key = "Bonescrapper Cache Type 5 Key"; + internal const string BonescrapperCacheType5Filename = "Schematics/Bonescrapper_Cache5.csch"; + + internal const string BonescrapperCacheType6Key = "Bonescrapper Cache Type 6 Key"; + internal const string BonescrapperCacheType6Filename = "Schematics/Bonescrapper_Cache6.csch"; + + internal const string SanctumofOblivionType1Key = "Sanctum of Oblivion Type 1 Key"; + internal const string SanctumofOblivionType1Filename = "Schematics/Sanctum_of_Oblivion1.csch"; + + internal const string SanctumofOblivionType2Key = "Sanctum of Oblivion Type 2 Key"; + internal const string SanctumofOblivionType2Filename = "Schematics/Sanctum_of_Oblivion2.csch"; + + internal const string SanctumofOblivionType3Key = "Sanctum of Oblivion Type 3 Key"; + internal const string SanctumofOblivionType3Filename = "Schematics/Sanctum_of_Oblivion3.csch"; + + internal const string HellstoneStrongholdType1Key = "Hellstone Stronghold Type 1 Key"; + internal const string HellstoneStrongholdType1Filename = "Schematics/Hellstone_Stronghold1.csch"; + + internal const string HellstoneStrongholdType2Key = "Hellstone Stronghold Type 2 Key"; + internal const string HellstoneStrongholdType2Filename = "Schematics/Hellstone_Stronghold2.csch"; + + internal const string DemonicDungeonType1Key = "Demonic Dungeon Type 1 Key"; + internal const string DemonicDungeonType1Filename = "Schematics/Demonic_Dungeon1.csch"; + + internal const string DemonicDungeonType2Key = "Demonic Dungeon Type 2 Key"; + internal const string DemonicDungeonType2Filename = "Schematics/Demonic_Dungeon2.csch"; + + internal const string BarbedStockadeType1Key = "Barbed Stockade Type 1 Key"; + internal const string BarbedStockadeType1Filename = "Schematics/Barbed_Stockade1.csch"; + + internal const string BarbedStockadeType2Key = "Barbed Stockade Type 2 Key"; + internal const string BarbedStockadeType2Filename = "Schematics/Barbed_Stockade2.csch"; + + internal const string BarbedStockadeType3Key = "Barbed Stockade Type 3 Key"; + internal const string BarbedStockadeType3Filename = "Schematics/Barbed_Stockade3.csch"; + + internal const string BarbedStockadeType4Key = "Barbed Stockade Type 4 Key"; + internal const string BarbedStockadeType4Filename = "Schematics/Barbed_Stockade4.csch"; + internal const string RustedWorkshopKey = "Rusted Workshop"; internal const string RustedWorkshopFilename = "Schematics/RustedWorkshop.csch"; @@ -20,22 +80,22 @@ namespace CalamityMod.Schematics internal const string ResearchOutpostFilename = "Schematics/ResearchOutpost.csch"; internal const string SunkenSeaLabKey = "Sunken Sea Laboratory"; - internal const string SunkenSeaLabFilename = "Schematics/DraedonsLab_SunkenSea.csch"; + internal const string SunkenSeaLabFilename = "Schematics/Arsenal_Lab_Sunken.csch"; internal const string PlanetoidLabKey = "Planetoid Laboratory"; - internal const string PlanetoidLabFilename = "Schematics/DraedonsLab_Planetoid.csch"; + internal const string PlanetoidLabFilename = "Schematics/Arsenal_Lab_Planetoid.csch"; internal const string PlagueLabKey = "Plague Laboratory"; - internal const string PlagueLabFilename = "Schematics/DraedonsLab_Plague.csch"; + internal const string PlagueLabFilename = "Schematics/Arsenal_Lab_Plague.csch"; internal const string HellLabKey = "Hell Laboratory"; - internal const string HellLabFilename = "Schematics/DraedonsLab_Hell.csch"; + internal const string HellLabFilename = "Schematics/Arsenal_Lab_Underworld.csch"; internal const string IceLabKey = "Ice Laboratory"; - internal const string IceLabFilename = "Schematics/DraedonsLab_Ice.csch"; + internal const string IceLabFilename = "Schematics/Arsenal_Lab_Ice.csch"; internal const string CavernLabKey = "Cavern Laboratory"; - internal const string CavernLabFilename = "Schematics/DraedonsLab_Cavern.csch"; + internal const string CavernLabFilename = "Schematics/Arsenal_Lab_Onyx.csch"; internal const string CorruptionShrineKey = "Corruption Shrine"; internal const string CorruptionShrineFilename = "Schematics/Shrine_Corruption.csch"; @@ -106,6 +166,28 @@ namespace CalamityMod.Schematics PilePlacementMaps = new Dictionary(); TileMaps = new Dictionary { + // Underworld structures + [BrimstoneAtriumType1Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType1Filename), + [BrimstoneAtriumType2Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType2Filename), + [BrimstoneAtriumType3Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType3Filename), + [BonescrapperCacheType1Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType1Filename), + [BonescrapperCacheType2Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType2Filename), + [BonescrapperCacheType3Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType3Filename), + [BonescrapperCacheType4Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType4Filename), + [BonescrapperCacheType5Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType5Filename), + [BonescrapperCacheType6Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType6Filename), + [SanctumofOblivionType1Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType1Filename), + [SanctumofOblivionType2Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType2Filename), + [SanctumofOblivionType3Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType3Filename), + [HellstoneStrongholdType1Key] = CalamitySchematicIO.LoadSchematic(HellstoneStrongholdType1Filename), + [HellstoneStrongholdType2Key] = CalamitySchematicIO.LoadSchematic(HellstoneStrongholdType2Filename), + [DemonicDungeonType1Key] = CalamitySchematicIO.LoadSchematic(DemonicDungeonType1Filename), + [DemonicDungeonType2Key] = CalamitySchematicIO.LoadSchematic(DemonicDungeonType2Filename), + [BarbedStockadeType1Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType1Filename), + [BarbedStockadeType2Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType2Filename), + [BarbedStockadeType3Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType3Filename), + [BarbedStockadeType4Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType4Filename), + // Draedon's Arsenal world gen structures [RustedWorkshopKey] = CalamitySchematicIO.LoadSchematic(RustedWorkshopFilename), [ResearchOutpostKey] = CalamitySchematicIO.LoadSchematic(ResearchOutpostFilename), diff --git a/Sounds/CommonCalamitySounds.cs b/Sounds/CommonCalamitySounds.cs index 817b9a3b8f..fd0f455921 100644 --- a/Sounds/CommonCalamitySounds.cs +++ b/Sounds/CommonCalamitySounds.cs @@ -19,7 +19,9 @@ namespace CalamityMod.Sounds public static readonly SoundStyle WyrmScreamSound = new("CalamityMod/Sounds/Custom/WyrmScream"); - public static readonly SoundStyle LightningSound = new("CalamityMod/Sounds/Custom/LightningStrike") { Volume = 1.5f }; //This is just the regular SoundID.Thunder sound, except its only the first variant + public static readonly SoundStyle LightningSound = new("CalamityMod/Sounds/Custom/LightningStrike") { Volume = 1.6f }; //This is just the regular SoundID.Thunder sound, except its only the first variant + + public static readonly SoundStyle LightningTelegraph = new("CalamityMod/Sounds/Custom/LightningTelegraph") { Volume = 0.7f }; //This is just the regular SoundID.Thunder sound, except its only the fifth variant public static readonly SoundStyle LaserCannonSound = new("CalamityMod/Sounds/Item/LaserCannon") { Volume = 0.85f }; @@ -51,5 +53,9 @@ namespace CalamityMod.Sounds public static readonly SoundStyle LouderSwingWoosh = new("CalamityMod/Sounds/Custom/LoudSwingWoosh"); + public static readonly SoundStyle VoidstoneMine = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; + + public static readonly SoundStyle PlatingMine = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + } } diff --git a/Sounds/Custom/ExoMechs/THanosGFBeam.ogg b/Sounds/Custom/ExoMechs/THanosGFBeam.ogg new file mode 100644 index 0000000000..6bd2111021 Binary files /dev/null and b/Sounds/Custom/ExoMechs/THanosGFBeam.ogg differ diff --git a/Sounds/Custom/LightningTelegraph.ogg b/Sounds/Custom/LightningTelegraph.ogg new file mode 100644 index 0000000000..3a3d95c15f Binary files /dev/null and b/Sounds/Custom/LightningTelegraph.ogg differ diff --git a/Sounds/Custom/OldDukeDash.ogg b/Sounds/Custom/OldDukeDash.ogg new file mode 100644 index 0000000000..8ed052153b Binary files /dev/null and b/Sounds/Custom/OldDukeDash.ogg differ diff --git a/Sounds/Custom/OldDukeDashP3.ogg b/Sounds/Custom/OldDukeDashP3.ogg new file mode 100644 index 0000000000..eda6b95524 Binary files /dev/null and b/Sounds/Custom/OldDukeDashP3.ogg differ diff --git a/Sounds/Custom/OldDukeVortexSpawn.ogg b/Sounds/Custom/OldDukeVortexSpawn.ogg new file mode 100644 index 0000000000..c11112ea24 Binary files /dev/null and b/Sounds/Custom/OldDukeVortexSpawn.ogg differ diff --git a/Sounds/Item/BatholithBangleSound.ogg b/Sounds/Item/BatholithBangleSound.ogg new file mode 100644 index 0000000000..a9093f226f Binary files /dev/null and b/Sounds/Item/BatholithBangleSound.ogg differ diff --git a/Sounds/Item/BlackGlassBandSound.ogg b/Sounds/Item/BlackGlassBandSound.ogg new file mode 100644 index 0000000000..9f93b8508e Binary files /dev/null and b/Sounds/Item/BlackGlassBandSound.ogg differ diff --git a/Sounds/Item/FestiveJingle.ogg b/Sounds/Item/FestiveJingle.ogg new file mode 100644 index 0000000000..2e311faad5 Binary files /dev/null and b/Sounds/Item/FestiveJingle.ogg differ diff --git a/Sounds/Item/ProtolithBangleSound.ogg b/Sounds/Item/ProtolithBangleSound.ogg new file mode 100644 index 0000000000..0e6ccdeff7 Binary files /dev/null and b/Sounds/Item/ProtolithBangleSound.ogg differ diff --git a/Sounds/Item/SHPCVacuumEnd.ogg b/Sounds/Item/SHPCVacuumEnd.ogg new file mode 100644 index 0000000000..025be3e9c2 Binary files /dev/null and b/Sounds/Item/SHPCVacuumEnd.ogg differ diff --git a/Sounds/Item/SHPCVacuumLoop.ogg b/Sounds/Item/SHPCVacuumLoop.ogg new file mode 100644 index 0000000000..bf81d0cbad Binary files /dev/null and b/Sounds/Item/SHPCVacuumLoop.ogg differ diff --git a/Sounds/Item/SHPCVacuumStart.ogg b/Sounds/Item/SHPCVacuumStart.ogg new file mode 100644 index 0000000000..79ef8a962f Binary files /dev/null and b/Sounds/Item/SHPCVacuumStart.ogg differ diff --git a/Systems/Collections/SharedStaticIFramesIDSet.cs b/Systems/Collections/SharedStaticIFramesIDSet.cs index d01cc7bd6a..b6495ebf96 100644 --- a/Systems/Collections/SharedStaticIFramesIDSet.cs +++ b/Systems/Collections/SharedStaticIFramesIDSet.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Systems.Collections ProjectileID.SporeGas3 ], - [ // Set 6: Astral Staff and Asteroid Staff + [ // Set 6: Astral Staff ModContent.ProjectileType(), ModContent.ProjectileType() ], diff --git a/Systems/Collections/VeneratedLocketBanList.cs b/Systems/Collections/VeneratedLocketBanList.cs index e7a6921a99..2aef022abf 100644 --- a/Systems/Collections/VeneratedLocketBanList.cs +++ b/Systems/Collections/VeneratedLocketBanList.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Systems.Collections { List = [ - ItemType(), ItemType(), ItemType(), ItemType(), diff --git a/Systems/Graphic/LightingEffectsSystem.cs b/Systems/Graphic/LightingEffectsSystem.cs index e9568a49a7..6fa1fddea4 100644 --- a/Systems/Graphic/LightingEffectsSystem.cs +++ b/Systems/Graphic/LightingEffectsSystem.cs @@ -67,10 +67,6 @@ namespace CalamityMod.Systems } } } - - // Bat Wings give stronger night vision - if (Main.LocalPlayer.wingsLogic == (int)VanillaWingID.BatWings) - scale *= 1.08f; } public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor) diff --git a/Systems/Mechanic/DifficultyModeSystem.cs b/Systems/Mechanic/DifficultyModeSystem.cs index afbfc41794..106dd9bdef 100644 --- a/Systems/Mechanic/DifficultyModeSystem.cs +++ b/Systems/Mechanic/DifficultyModeSystem.cs @@ -1,15 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items.Armor.Demonshade; +using CalamityMod.UI.ModeIndicator; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.Graphics; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -40,6 +43,17 @@ namespace CalamityMod.Systems Difficulties = null; } + // Makes the world automatically convert to Death if in Master, or out of Death if in Expert + public override void PostUpdateWorld() + { + if (!Main.expertMode) + ModeIndicatorUI.SwitchToDifficulty(NoDifficulty.Instance); + if (Main.expertMode && !Main.masterMode && GetCurrentDifficulty == DeathDifficulty.Instance) + ModeIndicatorUI.SwitchToDifficulty(RevengeanceDifficulty.Instance); + if (Main.masterMode && GetCurrentDifficulty == RevengeanceDifficulty.Instance) + ModeIndicatorUI.SwitchToDifficulty(DeathDifficulty.Instance); + } + public static DifficultyMode GetCurrentDifficulty { get @@ -182,7 +196,10 @@ namespace CalamityMod.Systems ActivationSound = SoundID.MenuTick with { Volume = 1f }; ChatTextColor = Color.White; + Instance = this; } + + public static NoDifficulty Instance { get; private set; } = null; } public class RevengeanceDifficulty : DifficultyMode @@ -227,7 +244,10 @@ namespace CalamityMod.Systems ActivationSound = SoundID.Item119; ChatTextColor = Color.Crimson; + Instance = this; } + + public static RevengeanceDifficulty Instance { get; private set; } = null; } public class DeathDifficulty : DifficultyMode @@ -264,6 +284,7 @@ namespace CalamityMod.Systems ActivationSound = DemonshadeHelm.ActivationSound; ChatTextColor = Color.MediumOrchid; + Instance = this; } public override int FavoredDifficultyAtTier(int tier) @@ -278,5 +299,6 @@ namespace CalamityMod.Systems return 0; } + public static DeathDifficulty Instance { get; private set; } = null; } } diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index a798f03d95..a44c41515f 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -560,8 +560,8 @@ namespace CalamityMod.Systems // Demon Conch Recipe.Create(ItemID.DemonConch). - AddIngredient(ItemID.HellstoneBar, 4). - AddIngredient(8). + AddIngredient(20). + AddIngredient(ItemID.BlackPearl). AddTile(TileID.Hellforge). Register(); @@ -833,6 +833,9 @@ namespace CalamityMod.Systems // Make Enchanted Boomerang slightly harder to obtain { Vanilla(ItemID.EnchantedBoomerang), EnchantedBoomerangRecipeEdit }, + // Adjust Fertilizer decrafting and add an alternate recipe + { Vanilla(ItemID.Fertilizer), FertilizerRecipeEdit }, + // Add 20 Souls of Flight to vanilla Luminite wings { VanillaEach(ItemID.WingsSolar, ItemID.WingsVortex, ItemID.WingsNebula, ItemID.WingsStardust), LunarWingsRecipeEdits }, @@ -1017,6 +1020,24 @@ namespace CalamityMod.Systems // Increase amount of Fallen Stars used r.requiredItem[2].stack = 6; } + + private static void FertilizerRecipeEdit(Recipe r) + { + // Custom Shimmer result, to prevent Scorched Bone -> Bone shenanigans + r.AddCustomShimmerResult(ItemID.PoopBlock, 3); + r.AddCustomShimmerResult(ItemType(), 3); + r.AddCustomShimmerResult(ItemID.AshBlock, 3); + + // Alternative recipe using (a bit more) Scorched Bones + Recipe r2 = Recipe.Create(ItemID.Fertilizer); + r2.AddIngredient(ItemID.PoopBlock, 3); + r2.AddIngredient(6); + r2.AddIngredient(ItemID.AshBlock, 3); + r2.AddTile(TileID.Bottles); + r2.Register(); + r2.SortAfterFirstRecipesOf(ItemID.Fertilizer); + r2.DisableDecraft(); + } #endregion #region Shimmer Recipes @@ -1066,6 +1087,7 @@ namespace CalamityMod.Systems r.AddIngredient(2); r.AddTile(TileID.Furnaces); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.Bowl); r.DisableDecraft(); // Clay Pot @@ -1073,6 +1095,7 @@ namespace CalamityMod.Systems r.AddIngredient(5); r.AddTile(TileID.Furnaces); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.ClayPot); r.DisableDecraft(); // Pink Vase @@ -1080,6 +1103,7 @@ namespace CalamityMod.Systems r.AddIngredient(4); r.AddTile(TileID.Furnaces); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.PinkVase); r.DisableDecraft(); // Plate @@ -1087,6 +1111,7 @@ namespace CalamityMod.Systems r.AddIngredient(2); r.AddTile(TileID.Furnaces); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.FoodPlatter); r.DisableDecraft(); // Teapot @@ -1095,6 +1120,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Bone, 12); r.AddTile(TileID.Furnaces); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.TeaKettle); r.DisableDecraft(); // Wandering Jingasa @@ -1103,6 +1129,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Firefly, 3); // Does not use the recipe group in Vanilla r.AddTile(TileID.Loom); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.RoninHat); r.DisableDecraft(); } #endregion @@ -1178,6 +1205,7 @@ namespace CalamityMod.Systems r.AddIngredient(5); r.AddTile(TileID.AlchemyTable); r.Register(); + r.SortAfterFirstRecipesOf(potion); r.DisableDecraft(); } foreach (var potion in TenOrbGroup) @@ -1187,6 +1215,7 @@ namespace CalamityMod.Systems r.AddIngredient(10); r.AddTile(TileID.AlchemyTable); r.Register(); + r.SortAfterFirstRecipesOf(potion); r.DisableDecraft(); } foreach (var potion in FifteenOrbGroup) @@ -1196,6 +1225,7 @@ namespace CalamityMod.Systems r.AddIngredient(15); r.AddTile(TileID.AlchemyTable); r.Register(); + r.SortAfterFirstRecipesOf(potion); r.DisableDecraft(); } } @@ -1204,135 +1234,160 @@ namespace CalamityMod.Systems #region Cooked Food private static void AddCookedFood() { + #region Alternative Recipes + #region Cooked Fish Recipe r = Recipe.Create(ItemID.CookedFish); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CookedFish); r.DisableDecraft(); - #region Prismatic Guppy - r = Recipe.Create(ItemID.CookedFish); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CookedFish); r.DisableDecraft(); r = Recipe.Create(ItemID.CookedFish); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CookedFish); r.DisableDecraft(); r = Recipe.Create(ItemID.CookedFish); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CookedFish); r.DisableDecraft(); + #endregion - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.DisableDecraft(); - + #region Seafood Dinner r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(); // Consistency would be 2, but considering you need only 1 for Golden Delight, I'm leaving this at 1 r.AddTile(TileID.CookingPots); r.Register(); - r.DisableDecraft(); - - #endregion - - r = Recipe.Create(ItemID.Sashimi); - r.AddIngredient(); - r.AddTile(TileID.WorkBenches); - r.Register(); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.CookedShrimp); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); + r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); r.DisableDecraft(); r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); + r.DisableDecraft(); + #endregion + + #region Golden Delight + r = Recipe.Create(ItemID.GoldenDelight); + r.AddIngredient(); + r.AddTile(TileID.CookingPots); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); - - r = Recipe.Create(ItemID.Bacon); - r.AddIngredient(); - r.AddTile(TileID.Hellforge); - r.Register(); - r.DisableDecraft(); + #endregion r = Recipe.Create(ItemID.BowlofSoup); r.AddIngredient(ItemID.Mushroom); r.AddIngredient(); r.AddTile(TileID.CookingPots); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.BowlofSoup); + r.DisableDecraft(); + + r = Recipe.Create(ItemID.Sashimi); + r.AddIngredient(); + r.AddTile(TileID.WorkBenches); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.Sashimi); + r.DisableDecraft(); + + r = Recipe.Create(ItemID.CookedShrimp); + r.AddIngredient(); + r.AddTile(TileID.CookingPots); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CookedShrimp); + r.DisableDecraft(); + #endregion + + #region New Recipes + r = Recipe.Create(ItemID.Bacon); + r.AddIngredient(); + r.AddTile(TileID.Hellforge); + r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.ApplePie); @@ -1369,6 +1424,7 @@ namespace CalamityMod.Systems r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); + #endregion } #endregion @@ -1755,6 +1811,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.SoulofSight); r.AddTile(TileID.TinkerersWorkbench); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.MechanicalGlove); r.DisableDecraft(); // Celestial Emblem directly from correct class emblem for cheaper (compromise) @@ -1766,6 +1823,7 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.SoulofSight); r.AddTile(TileID.TinkerersWorkbench); r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CelestialEmblem); r.DisableDecraft(); // Tiershift Mini Nuke 1s to post Moon Lord. diff --git a/Systems/VisualTimerSystem.cs b/Systems/VisualTimerSystem.cs new file mode 100644 index 0000000000..838774ed08 --- /dev/null +++ b/Systems/VisualTimerSystem.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class VisualTimerSystem : ModSystem + { + /// + /// Dummy global variable that increments by one every frame. Good for animated visual effects. Not synced server side. + /// + public static float GlobalVisualTimer = 0f; + + public override void PostUpdateEverything() + { + GlobalVisualTimer++; + } + } +} diff --git a/Systems/World/WorldMiscUpdateSystem.cs b/Systems/World/WorldMiscUpdateSystem.cs index 8020b3d9e7..411eae4315 100644 --- a/Systems/World/WorldMiscUpdateSystem.cs +++ b/Systems/World/WorldMiscUpdateSystem.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.CalPlayer; +using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs; @@ -67,7 +68,9 @@ namespace CalamityMod.Systems // Handle Acid Rain update logic. if (AcidRainEvent.AcidRainEventIsOngoing) + { AcidRainEvent.Update(); + } else { if (AcidRainEvent.TimeSinceEventStarted != 0) @@ -112,6 +115,9 @@ namespace CalamityMod.Systems CalamityGlobalNPC.AttemptToSpawnLavaNPCs(p); } + // Spawn the Old Man if Skeletron hasn't been defeated and there is no Old Man, it takes too fucking long otherwise. + TrySpawnOldMan(); + // Make the cultist countdown happen much more quickly. if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -147,6 +153,100 @@ namespace CalamityMod.Systems public static void HandleTileGrowth() { + double worldUpdateRate = WorldGen.GetWorldUpdateRate(); + if (worldUpdateRate == 0) + return; + + // Used for growing herbs at an accelerated rate + double herbGrowthRateSurface = 3E-05f * (float)worldUpdateRate; + double herbGrowthRateUnderground = 1.5E-05f * (float)worldUpdateRate; + double remixWorldHerbGrowthRate = 2.5E-05f * (float)worldUpdateRate; + + // 5% chance to boost non-planter box herb growth rate + // 50% chance to boost correct planter box herb growth rate + int oneInXChanceToBoostHerbGrowthRate = 20; + int oneInXChanceToBoostHerbGrowthRate_PlanterBox = 2; + + int oneInXMaximumChanceToPlaceHerb = 15100; + int oneInXMinimumChanceToPlaceHerb = (int)(oneInXMaximumChanceToPlaceHerb * 2.8); + double chanceAdjustmentBasedOnWorldSize = Utils.Clamp((double)Main.maxTilesX / 4200D - 1D, 0D, 1D); + int herbPlacementChance = (int)Utils.Lerp(oneInXMaximumChanceToPlaceHerb, oneInXMinimumChanceToPlaceHerb, chanceAdjustmentBasedOnWorldSize); + + for (int herbPlacementIndex = 0; (double)herbPlacementIndex < (double)(Main.maxTilesX * Main.maxTilesY) * herbGrowthRateSurface; herbPlacementIndex++) + { + // Call this again to give effectively double the chance for new herbs to be placed in the world + if (Main.rand.NextBool(herbPlacementChance)) + WorldGen.PlantAlch(); + + // Surface-only herb growth + // Increase the growth rate of herbs in planter boxes + // Slightly increase the growth rate of herbs not in planter boxes + int herbGrowthRangeX = WorldGen.genRand.Next(10, Main.maxTilesX - 10); + int herbGrowthRangeY = WorldGen.genRand.Next(10, (int)Main.worldSurface - 1); + if (Main.tileAlch[Main.tile[herbGrowthRangeX, herbGrowthRangeY].TileType]) + { + // If you use the wrong planter box you get fuck all + if (Main.tile[herbGrowthRangeX, herbGrowthRangeY + 1].TileType == TileID.PlanterBox) + { + int herbType = Main.tile[herbGrowthRangeX, herbGrowthRangeY].TileFrameX / 18; + int planterBoxType = Main.tile[herbGrowthRangeX, herbGrowthRangeY + 1].TileFrameY / 18; + if (IsCorrectPlanterBox(herbType: herbType, planterBoxType: planterBoxType) && WorldGen.genRand.NextBool(oneInXChanceToBoostHerbGrowthRate_PlanterBox)) + WorldGen.GrowAlch(herbGrowthRangeX, herbGrowthRangeY); + } + else if (WorldGen.genRand.NextBool(oneInXChanceToBoostHerbGrowthRate)) + WorldGen.GrowAlch(herbGrowthRangeX, herbGrowthRangeY); + } + } + + if (Main.remixWorld) + { + // Remix seed checks the entire world at once for herb growth + for (int herbGrowthIndex = 0; (double)herbGrowthIndex < (double)(Main.maxTilesX * Main.maxTilesY) * remixWorldHerbGrowthRate; herbGrowthIndex++) + { + // Increase the growth rate of herbs in planter boxes + // Slightly increase the growth rate of herbs not in planter boxes + int herbGrowthRangeX = WorldGen.genRand.Next(10, Main.maxTilesX - 10); + int herbGrowthRangeY = WorldGen.genRand.Next((int)Main.worldSurface - 1, Main.maxTilesY - 20); + if (Main.tileAlch[Main.tile[herbGrowthRangeX, herbGrowthRangeY].TileType]) + { + // If you use the wrong planter box you get fuck all + if (Main.tile[herbGrowthRangeX, herbGrowthRangeY + 1].TileType == TileID.PlanterBox) + { + int herbType = Main.tile[herbGrowthRangeX, herbGrowthRangeY].TileFrameX / 18; + int planterBoxType = Main.tile[herbGrowthRangeX, herbGrowthRangeY + 1].TileFrameY / 18; + if (IsCorrectPlanterBox(herbType: herbType, planterBoxType: planterBoxType) && WorldGen.genRand.NextBool(oneInXChanceToBoostHerbGrowthRate_PlanterBox)) + WorldGen.GrowAlch(herbGrowthRangeX, herbGrowthRangeY); + } + else if (WorldGen.genRand.NextBool(oneInXChanceToBoostHerbGrowthRate)) + WorldGen.GrowAlch(herbGrowthRangeX, herbGrowthRangeY); + } + } + } + else + { + // Underground-only herb growth + for (int herbGrowthIndex = 0; (double)herbGrowthIndex < (double)(Main.maxTilesX * Main.maxTilesY) * herbGrowthRateUnderground; herbGrowthIndex++) + { + // Increase the growth rate of herbs in planter boxes + // Slightly increase the growth rate of herbs not in planter boxes + int herbGrowthRangeX = WorldGen.genRand.Next(10, Main.maxTilesX - 10); + int herbGrowthRangeY = WorldGen.genRand.Next((int)Main.worldSurface - 1, Main.maxTilesY - 20); + if (Main.tileAlch[Main.tile[herbGrowthRangeX, herbGrowthRangeY].TileType]) + { + // If you use the wrong planter box you get fuck all + if (Main.tile[herbGrowthRangeX, herbGrowthRangeY + 1].TileType == TileID.PlanterBox) + { + int herbType = Main.tile[herbGrowthRangeX, herbGrowthRangeY].TileFrameX / 18; + int planterBoxType = Main.tile[herbGrowthRangeX, herbGrowthRangeY + 1].TileFrameY / 18; + if (IsCorrectPlanterBox(herbType: herbType, planterBoxType: planterBoxType) && WorldGen.genRand.NextBool(oneInXChanceToBoostHerbGrowthRate_PlanterBox)) + WorldGen.GrowAlch(herbGrowthRangeX, herbGrowthRangeY); + } + else if (WorldGen.genRand.NextBool(oneInXChanceToBoostHerbGrowthRate)) + WorldGen.GrowAlch(herbGrowthRangeX, herbGrowthRangeY); + } + } + } + // 2MAY2025: Lucille: By default, the assumption that these values are within a natural min/max relationship with searchBottom being greater than searchTop is sensible. // However, in subworlds where these lines may be placed arbitrarily (such as shoving the surface line near the bottom of the world), this no longer holds true, and results // in the logic below causing a storm of minValue >= maxValue exceptions. @@ -156,7 +256,7 @@ namespace CalamityMod.Systems return; int l = 0; - float mult2 = (float)(1.5E-05f * WorldGen.GetWorldUpdateRate()); + float mult2 = (float)(1.5E-05f * worldUpdateRate); while (l < Main.maxTilesX * Main.maxTilesY * mult2) { int x = WorldGen.genRand.Next(10, Main.maxTilesX - 10); @@ -423,6 +523,72 @@ namespace CalamityMod.Systems return true; } + + public static bool IsCorrectPlanterBox(int herbType, int planterBoxType) + { + bool usingCorrectPlanterBox = false; + switch (herbType) + { + default: + break; + + case (int)HerbType.Daybloom: + if (planterBoxType == (int)PlanterBoxType.Daybloom) + usingCorrectPlanterBox = true; + break; + + case (int)HerbType.Moonglow: + if (planterBoxType == (int)PlanterBoxType.Moonglow) + usingCorrectPlanterBox = true; + break; + + case (int)HerbType.Blinkroot: + if (planterBoxType == (int)PlanterBoxType.Blinkroot) + usingCorrectPlanterBox = true; + break; + + case (int)HerbType.Deathweed: + if (planterBoxType == (int)PlanterBoxType.Deathweed || planterBoxType == (int)PlanterBoxType.DeathweedCrimson) + usingCorrectPlanterBox = true; + break; + + case (int)HerbType.Waterleaf: + if (planterBoxType == (int)PlanterBoxType.Waterleaf) + usingCorrectPlanterBox = true; + break; + + case (int)HerbType.Fireblossom: + if (planterBoxType == (int)PlanterBoxType.Fireblossom) + usingCorrectPlanterBox = true; + break; + + case (int)HerbType.Shiverthorn: + if (planterBoxType == (int)PlanterBoxType.Shiverthorn) + usingCorrectPlanterBox = true; + break; + } + + return usingCorrectPlanterBox; + } + #endregion + + #region Handle Old Man Spawn + public static void TrySpawnOldMan() + { + if (Main.netMode == NetmodeID.MultiplayerClient || NPC.downedBoss3 || Main.dayTime) + return; + + if (NPC.AnyNPCs(NPCID.OldMan)) + return; + + if (NPC.AnyNPCs(NPCID.SkeletronHead)) + return; + + int oldMan = NPC.NewNPC(NPC.GetSource_TownSpawn(), Main.dungeonX * 16 + 8, Main.dungeonY * 16, NPCID.OldMan); + Main.npc[oldMan].homeless = false; + Main.npc[oldMan].homeTileX = Main.dungeonX; + Main.npc[oldMan].homeTileY = Main.dungeonY; + } #endregion #region Handle Dungeon Guardian Spawns diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 3cd6970006..df971eb101 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -44,6 +44,23 @@ namespace CalamityMod.Systems CustomUnderworld.NewUnderworld(); }); + // Better Underworld structures after the world has been smoothed + int UnderworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); + tasks.Insert(UnderworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value; + CustomUnderworld.NewUnderworldStructures(); + + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldPillars").Value; + CustomUnderworld.NewUnderworldPillars(); + + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; + CustomUnderworld.AshTreesAndGrass(); + + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value; + CustomUnderworld.PlaceGeyserTraps(); + })); + // Evil Floating Island int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); if (islandIndex != -1) @@ -168,7 +185,6 @@ namespace CalamityMod.Systems { tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; int sunkenSeaY = Main.maxTilesY / 2; @@ -181,13 +197,25 @@ namespace CalamityMod.Systems }; // place each piece of the sunken sea based on the above positons + + // messages intentionally in the "incorrect" order for the player's experience. + // they'll see the OG message first, then subsequent biomes are placed in vertical order. + // it breaks up the 3 minute gen time and makes it more interesting for those who dont tab out while worldgen runs, + // rather than keeping the player in the dark about what's happening. + // it doesn't have to make sense, just be cool for the players :) -ena + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.TimelessShores").Value; SunkenSea.PlaceRadiantReefs(sunkenSeaX, sunkenSeaY + 110); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.RadiantReefs").Value; SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.PolypForest").Value; SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GleamingBurrows").Value; SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BasaltGully").Value; SunkenSea.PlaceSunkenSeaAmbience(); })); } @@ -476,6 +504,20 @@ namespace CalamityMod.Systems } } + // Fix vanilla's stupidity with Gold Chests being able to have Meteorite Bars in them near the Underworld + if (isGoldChest) + { + for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) + { + if (chest.item[inventoryIndex].type == ItemID.MeteoriteBar) + { + int oldStack = chest.item[inventoryIndex].stack; + chest.item[inventoryIndex].SetDefaults(WorldGen.genRand.NextBool() ? ItemID.PlatinumBar : ItemID.GoldBar); + chest.item[inventoryIndex].stack = oldStack; + } + } + } + // Give Dead Man's Chests better loot. if (isDeadManChest) { diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index 305b23f87e..0f925720ae 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -125,9 +125,10 @@ namespace CalamityMod.TileEntities // If the turret is too far off its mark or hasn't been around for long enough, don't fire at all. float deltaAngle = MathHelper.WrapAngle(Angle - targetAngle); bool angleCloseEnough = Math.Abs(deltaAngle) <= MaxTargetAngleDeviance; - if (!angleCloseEnough || FiringTime < FiringStartupDelay || !Collision.CanHitLine(turretPos, 1, 1, targetPos, 1, 1)) + if (!angleCloseEnough || FiringTime < FiringStartupDelay || !CalamityUtils.PreciseCanHitInLine(turretPos, (targetPos - turretPos).ToRotation(), (targetPos - turretPos).Length())) return; + // Don't shoot every frame, but sync up the firing cadence to the startup delay. if ((FiringTime - FiringStartupDelay) % FiringUseTime == 0) Shoot(turretPos); diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs index 9a9483acf8..9b54151ee2 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs @@ -39,10 +39,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, new Color(157, 175, 15), Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs index 78b8f09f8c..d14576a275 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs @@ -50,10 +50,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, new Color(157, 175, 15), Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs index 4068da5232..3400db98ff 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs @@ -50,10 +50,10 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, new Color(157, 175, 15), Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/Abyss/AcidWoodTree.cs b/Tiles/Abyss/AcidWoodTree.cs index 59f1194b03..0e790dcafb 100644 --- a/Tiles/Abyss/AcidWoodTree.cs +++ b/Tiles/Abyss/AcidWoodTree.cs @@ -3,6 +3,7 @@ using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using CalamityMod.NPCs.AcidRain; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -54,6 +55,15 @@ namespace CalamityMod.Tiles.Abyss // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) @@ -115,7 +125,7 @@ namespace CalamityMod.Tiles.Abyss if (type != -1) Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.NextBool(3)) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index e34c381cb3..4d54898971 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; +using CalamityMod.Sounds; using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +9,6 @@ namespace CalamityMod.Tiles.Abyss { public class PyreMantle : ModTile { - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -25,7 +19,7 @@ namespace CalamityMod.Tiles.Abyss CalamityUtils.MergeWithAbyss(Type); TileID.Sets.ChecksForMerge[Type] = true; - HitSound = MineSound; + HitSound = CommonCalamitySounds.VoidstoneMine; MineResist = 10f; MinPick = 180; AddMapEntry(new Color(43, 40, 40)); diff --git a/Tiles/Abyss/PyreMantleMolten.cs b/Tiles/Abyss/PyreMantleMolten.cs index a0f968d2e5..5a9676d6c4 100644 --- a/Tiles/Abyss/PyreMantleMolten.cs +++ b/Tiles/Abyss/PyreMantleMolten.cs @@ -1,12 +1,8 @@ using System; -using System.Collections.Generic; -using CalamityMod.Systems; +using CalamityMod.Sounds; using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,8 +11,6 @@ namespace CalamityMod.Tiles.Abyss { public class PyreMantleMolten : GlowMaskTile { - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/PyreMantleMolten_Glowmask"; public override void SetupStatic() @@ -30,7 +24,7 @@ namespace CalamityMod.Tiles.Abyss CalamityUtils.MergeWithAbyss(Type); TileID.Sets.ChecksForMerge[Type] = true; - HitSound = MineSound; + HitSound = CommonCalamitySounds.VoidstoneMine; MineResist = 10f; MinPick = 180; AddMapEntry(new Color(113, 49, 16)); diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 58306e6d98..1b616a1000 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -77,13 +77,13 @@ namespace CalamityMod.Tiles.Abyss public override void NearbyEffects(int i, int j, bool closer) { - if (closer && Main.rand.NextBool(200) && j > Main.worldSurface) + if (closer && Main.rand.NextBool(j > Main.worldSurface ? 200 : 300) && j > (Main.worldSurface - CalamityUtils.TilesToPixels(200))) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(22, 255, 0), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, j > Main.worldSurface ? new Color(200, 255, 0) : Color.Lime, Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index 4c2f9f609c..a5661202be 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; +using CalamityMod.Sounds; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,8 +11,6 @@ namespace CalamityMod.Tiles.Abyss { public class Voidstone : GlowMaskTile { - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - public override string GlowMaskAsset => "CalamityMod/Tiles/Abyss/Voidstone_Glowmask"; public GrayscaleTexture2D NoiseTexture; @@ -32,7 +26,7 @@ namespace CalamityMod.Tiles.Abyss CalamityUtils.MergeWithAbyss(Type); TileID.Sets.ChecksForMerge[Type] = true; - HitSound = MineSound; + HitSound = CommonCalamitySounds.VoidstoneMine; MineResist = 15f; MinPick = 180; AddMapEntry(new Color(15, 15, 15)); diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 4361cf3493..d7440d736b 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -73,6 +74,15 @@ namespace CalamityMod.Tiles.Astral // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) { @@ -137,7 +147,7 @@ namespace CalamityMod.Tiles.Astral type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.NextBool(3)) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index 6c0d7fc4fe..3fb709e4d8 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -71,6 +72,16 @@ namespace CalamityMod.Tiles.AstralDesert // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? (WorldGen.genRand.NextBool() ? ItemID.Coconut : ItemID.Banana) + : (WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType()); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) @@ -123,12 +134,12 @@ namespace CalamityMod.Tiles.AstralDesert type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.Next(36) < 5) // Vanilla palm fruit logic goes first + else if (Main.rand.NextBool(12)) // Vanilla palm fruit logic goes first { int fruitType = Main.rand.NextBool() ? ItemID.Coconut : ItemID.Banana; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); } - else if (Main.rand.Next(36) < 5) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/AstralSnow/AstralSnowTree.cs b/Tiles/AstralSnow/AstralSnowTree.cs index aaa2519155..e8becab1b5 100644 --- a/Tiles/AstralSnow/AstralSnowTree.cs +++ b/Tiles/AstralSnow/AstralSnowTree.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -74,6 +75,15 @@ namespace CalamityMod.Tiles.AstralSnow // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) @@ -137,7 +147,7 @@ namespace CalamityMod.Tiles.AstralSnow type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.NextBool(3)) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index b35b83a285..cee684049a 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Abyss; @@ -23,7 +25,6 @@ namespace CalamityMod.Tiles { public class CalamityGlobalTile : GlobalTile { - public static List GrowthTiles = new List() { TileType(), @@ -47,8 +48,10 @@ namespace CalamityMod.Tiles public override void PreShakeTree(int x, int y, TreeTypes treeType) { - // Add an additional 25% chance to drop vanilla fruits - if (WorldGen.genRand.NextBool(4)) + // All trees have a 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ItemType() && WorldGen.genRand.NextBool(3)) { int treeDropItemType = 0; switch (treeType) @@ -302,16 +305,53 @@ namespace CalamityMod.Tiles // Drop Evil Smasher on every 12 alter smashed if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) - { DropItem(i, j, ItemType(), quantity: 1, asStack: true); - } } + // Drop Golden Bombs at a 0.33% chance from Pots if (type == TileID.Pots) { if (Main.rand.NextBool(300)) - { DropItem(i, j, ItemType(), quantity: 1, asStack: true); + } + + // Mature herbs always drop 1 seed (Blooming herbs drop between 1 and 3 seeds, more with Regrowth items) + if (type == TileID.MatureHerbs) + { + int herbType = Main.tile[i, j].TileFrameX / 18; + int seedQuantity = Main.rand.Next(2) + 1; + switch (herbType) + { + default: + break; + + case (int)HerbType.Daybloom: + DropItem(i, j, ItemID.DaybloomSeeds, quantity: seedQuantity, asStack: true); + break; + + case (int)HerbType.Moonglow: + DropItem(i, j, ItemID.MoonglowSeeds, quantity: seedQuantity, asStack: true); + break; + + case (int)HerbType.Blinkroot: + DropItem(i, j, ItemID.BlinkrootSeeds, quantity: seedQuantity, asStack: true); + break; + + case (int)HerbType.Deathweed: + DropItem(i, j, ItemID.DeathweedSeeds, quantity: seedQuantity, asStack: true); + break; + + case (int)HerbType.Waterleaf: + DropItem(i, j, ItemID.WaterleafSeeds, quantity: seedQuantity, asStack: true); + break; + + case (int)HerbType.Fireblossom: + DropItem(i, j, ItemID.FireblossomSeeds, quantity: seedQuantity, asStack: true); + break; + + case (int)HerbType.Shiverthorn: + DropItem(i, j, ItemID.ShiverthornSeeds, quantity: seedQuantity, asStack: true); + break; } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs b/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs index 3104c250d7..bf857ae736 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class AgedBiolight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 89; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs index e3cf7fc74e..3da6bb123f 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class AgedBlacklight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 173; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs index 10195c0bc6..68899755d7 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class AgedCinderlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 6; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs index 5582d62a8a..823fa54776 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class AgedFlamelight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 60; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs index 1944b32d90..557f857324 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class AgedFloodlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 187; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs index 778a36dbc8..076122c0d9 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class AgedFrostlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 247; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/AgedLablight.cs b/Tiles/DraedonStructures/CagedLights/AgedLablight.cs index 6e9d5af3c4..8c154b9031 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedLablight.cs @@ -10,13 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class AgedLablight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -24,7 +23,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs index f4e36ad4ab..76f5061edd 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class CagedBiolight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 89; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs index 70abb33441..702af106f2 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class CagedBlacklight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 173; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs index e570ae6940..7514c37cf2 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class CagedCinderlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 6; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs index dc6cbda8d6..f330d1371d 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class CagedFlamelight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 60; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs index 0341b99b43..59539ee4f6 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class CagedFloodlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 187; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs index 46ebb7ed84..1102fa25b9 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class CagedFrostlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 247; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/CagedLablight.cs b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs index 1a59406c11..6997a227ba 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class CagedLablight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.cs index 02d5c1385e..563b2ca3ca 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedBiolight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniAgedBiolight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 89; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.cs index cfc8b84013..12b3c3ff4e 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedBlacklight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniAgedBlacklight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 173; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.cs index 15d7c4a15e..8f48dd04d6 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedCinderlight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniAgedCinderlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 6; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.cs index 0d858be4dc..1db1d0ef48 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedFlamelight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniAgedFlamelight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 60; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.cs index de6f883b24..df76534a6d 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedFloodlight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniAgedFloodlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 187; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.cs index c2343e0bd9..722546b05e 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedFrostlight.cs @@ -10,12 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniAgedFrostlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetStaticDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 247; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.cs b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.cs index 8d163d7207..e3f1538b27 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniAgedLablight.cs @@ -10,13 +10,12 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniAgedLablight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -24,7 +23,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs index b410cb04c0..5182d284ce 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniCagedBiolight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 89; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs index 68cca8784d..59d2c0fdc5 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniCagedBlacklight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 173; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs index 1603d07df8..a16ca2442e 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniCagedCinderlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 6; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs index 778be69f0e..343108cbbe 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniCagedFlamelight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 60; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs index f440165a54..bd62faf223 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniCagedFloodlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 187; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs index c693efb99d..258de16d99 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniCagedFrostlight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 247; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs index 0c49ecb2a5..84b4b7deaf 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs @@ -9,13 +9,12 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { public class MiniCagedLablight : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/DraedonStructures/HazardChevronPanels.cs b/Tiles/DraedonStructures/HazardChevronPanels.cs index b6e91de50f..4c5e8174c9 100644 --- a/Tiles/DraedonStructures/HazardChevronPanels.cs +++ b/Tiles/DraedonStructures/HazardChevronPanels.cs @@ -1,4 +1,5 @@ -using CalamityMod.Systems; +using CalamityMod.Sounds; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -9,7 +10,6 @@ namespace CalamityMod.Tiles.DraedonStructures { public class HazardChevronPanels : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.SetMerge(Type, ModContent.TileType()); CalamityUtils.SetMerge(Type, ModContent.TileType()); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 19; MinPick = 30; AddMapEntry(new Color(163, 150, 73)); diff --git a/Tiles/DraedonStructures/LaboratoryPanels.cs b/Tiles/DraedonStructures/LaboratoryPanels.cs index d63549d56c..765ed309cb 100644 --- a/Tiles/DraedonStructures/LaboratoryPanels.cs +++ b/Tiles/DraedonStructures/LaboratoryPanels.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,9 +11,6 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPanels : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - - public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,7 +19,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); CalamityUtils.SetMerge(Type, ModContent.TileType()); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 109; MinPick = 30; AddMapEntry(new Color(36, 35, 37)); diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.cs b/Tiles/DraedonStructures/LaboratoryPipePlating.cs index 39ab00a1d2..3701b16d73 100644 --- a/Tiles/DraedonStructures/LaboratoryPipePlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPipePlating.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,9 +12,6 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPipePlating : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - - public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,7 +19,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 32; MinPick = 30; AddMapEntry(new Color(91, 64, 56)); diff --git a/Tiles/DraedonStructures/LaboratoryPlating.cs b/Tiles/DraedonStructures/LaboratoryPlating.cs index 85b19b55de..873109a23f 100644 --- a/Tiles/DraedonStructures/LaboratoryPlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPlating.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,9 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPlating : ModTile - { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - + { public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -20,7 +19,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 30; MinPick = 30; AddMapEntry(new Color(162, 157, 150)); diff --git a/Tiles/DraedonStructures/RustedPlating.cs b/Tiles/DraedonStructures/RustedPlating.cs index 5244fb8a56..02f1bfe3d8 100644 --- a/Tiles/DraedonStructures/RustedPlating.cs +++ b/Tiles/DraedonStructures/RustedPlating.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,9 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.DraedonStructures { public class RustedPlating : ModTile - { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - + { public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -20,7 +19,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 32; MinPick = 30; AddMapEntry(new Color(128, 90, 77)); diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.cs b/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.cs index 8945a76fcb..e6a02eaa5f 100644 --- a/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.cs +++ b/Tiles/FurnitureWulfrum/AnodizedWulfrumPanels.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,8 +12,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public class AnodizedWulfrumPanels : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,7 +20,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; AddMapEntry(new Color(89, 113, 91)); } diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.cs b/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.cs index 619ac0c860..4554777cec 100644 --- a/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.cs +++ b/Tiles/FurnitureWulfrum/AnodizedWulfrumTrim.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,7 +12,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public class AnodizedWulfrumTrim : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); private const short subsheetWidth = 216; private const short subsheetHeight = 72; public static int TypeCache; @@ -25,7 +25,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; AddMapEntry(new Color(133, 13, 13)); } diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs index 41a4aeb59a..8d0a4d96ff 100644 --- a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs +++ b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -11,13 +11,12 @@ using Terraria.ObjectData; using Terraria.Audio; using CalamityMod.Systems; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.FurnitureWulfrum { public class ChargedWulfrumWallMountedBulb : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -25,7 +24,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs b/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs index bb3feb86ec..a109d4e836 100644 --- a/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs +++ b/Tiles/FurnitureWulfrum/RoundedAnodizedWulfrumPanels.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,7 +12,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public class RoundedAnodizedWulfrumPanels : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); private const short subsheetWidth = 216; private const short subsheetHeight = 72; public static int TypeCache; @@ -25,7 +25,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; AddMapEntry(new Color(164, 150, 125)); } diff --git a/Tiles/FurnitureWulfrum/WulfrumPanels.cs b/Tiles/FurnitureWulfrum/WulfrumPanels.cs index da1bfab3e4..62c47e60dd 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPanels.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPanels.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,7 +12,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumPanels : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); private const short subsheetWidth = 216; private const short subsheetHeight = 72; public override void SetStaticDefaults() @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; AddMapEntry(new Color(89, 113, 91)); } diff --git a/Tiles/FurnitureWulfrum/WulfrumPlating.cs b/Tiles/FurnitureWulfrum/WulfrumPlating.cs index ef7187ab11..06631c29cd 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPlating.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPlating.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,7 +12,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumPlating : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); private const short subsheetWidth = 216; private const short subsheetHeight = 72; @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; AddMapEntry(new Color(155, 171, 117)); } diff --git a/Tiles/FurnitureWulfrum/WulfrumSheets.cs b/Tiles/FurnitureWulfrum/WulfrumSheets.cs index 9b26f02b4d..fc211c5554 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSheets.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSheets.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,7 +12,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumSheets : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); private const short subsheetWidth = 216; private const short subsheetHeight = 72; public static int TypeCache; @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; AddMapEntry(new Color(109, 132, 101)); } diff --git a/Tiles/FurnitureWulfrum/WulfrumSiding.cs b/Tiles/FurnitureWulfrum/WulfrumSiding.cs index 8df1d946d3..5a4c21108d 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSiding.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSiding.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Sounds; using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,8 +12,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumSiding : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,7 +20,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; AddMapEntry(new Color(164, 150, 125)); } diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs index 17e276d470..b13c236cc4 100644 --- a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs +++ b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -11,13 +11,12 @@ using Terraria.ObjectData; using Terraria.Audio; using CalamityMod.Systems; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Sounds; namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumWallMountedBulb : ModTile { - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -25,7 +24,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); diff --git a/Tiles/Plates/Cinderplate.cs b/Tiles/Plates/Cinderplate.cs index f59526667e..8143932a4e 100644 --- a/Tiles/Plates/Cinderplate.cs +++ b/Tiles/Plates/Cinderplate.cs @@ -1,12 +1,8 @@ - +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -14,7 +10,6 @@ namespace CalamityMod.Tiles.Plates { public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/CinderplateGlow"; - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetupStatic() @@ -27,7 +22,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; MineResist = 1f; AddMapEntry(new Color(242, 216, 131)); } diff --git a/Tiles/Plates/Elumplate.cs b/Tiles/Plates/Elumplate.cs index 9578aae8e5..e8279dfded 100644 --- a/Tiles/Plates/Elumplate.cs +++ b/Tiles/Plates/Elumplate.cs @@ -1,12 +1,9 @@ - +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -14,7 +11,6 @@ namespace CalamityMod.Tiles.Plates { public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/ElumplateGlow"; - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetupStatic() @@ -27,7 +23,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; MineResist = 1f; AddMapEntry(new Color(121, 180, 212)); } diff --git a/Tiles/Plates/Havocplate.cs b/Tiles/Plates/Havocplate.cs index 92040fd0a1..b8cc2b699f 100644 --- a/Tiles/Plates/Havocplate.cs +++ b/Tiles/Plates/Havocplate.cs @@ -1,9 +1,6 @@ - +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,8 +12,6 @@ namespace CalamityMod.Tiles.Plates { public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/HavocplateGlow"; - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - internal static GrayscaleTexture1D PulseGradient; public override void SetupStatic() @@ -29,7 +24,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; MineResist = 1f; AddMapEntry(new Color(235, 108, 108)); } diff --git a/Tiles/Plates/Navyplate.cs b/Tiles/Plates/Navyplate.cs index af79386386..9015e5bf4a 100644 --- a/Tiles/Plates/Navyplate.cs +++ b/Tiles/Plates/Navyplate.cs @@ -1,12 +1,8 @@ - +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -14,7 +10,6 @@ namespace CalamityMod.Tiles.Plates { public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/NavyplateGlow"; - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetupStatic() @@ -27,7 +22,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; MineResist = 1f; AddMapEntry(new Color(85, 151, 196)); } diff --git a/Tiles/Plates/Onyxplate.cs b/Tiles/Plates/Onyxplate.cs index 35af4fe794..154e56c050 100644 --- a/Tiles/Plates/Onyxplate.cs +++ b/Tiles/Plates/Onyxplate.cs @@ -1,12 +1,7 @@ -using CalamityMod.Systems; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -14,7 +9,6 @@ namespace CalamityMod.Tiles.Plates { public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/OnyxplateGlow"; - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetupStatic() { @@ -26,7 +20,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; MineResist = 1f; DustType = 173; AddMapEntry(new Color(182, 28, 232)); diff --git a/Tiles/Plates/PlagueContainmentCells.cs b/Tiles/Plates/PlagueContainmentCells.cs index f06f934d1c..3df0c8bb82 100644 --- a/Tiles/Plates/PlagueContainmentCells.cs +++ b/Tiles/Plates/PlagueContainmentCells.cs @@ -1,12 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Tiles.Plates { @@ -14,7 +10,6 @@ namespace CalamityMod.Tiles.Plates { public override string GlowMaskAsset => "CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow"; - public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static GrayscaleTexture1D PulseGradient; public override void SetupStatic() { @@ -26,7 +21,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = MinePlatingSound; + HitSound = CommonCalamitySounds.PlatingMine; MineResist = 1f; AddMapEntry(new Color(128, 188, 67)); } diff --git a/Tiles/Pylons/CragsPylonTile.cs b/Tiles/Pylons/CragsPylonTile.cs index a4987d44d6..370845883d 100644 --- a/Tiles/Pylons/CragsPylonTile.cs +++ b/Tiles/Pylons/CragsPylonTile.cs @@ -25,6 +25,6 @@ namespace CalamityMod.Tiles.Pylons //Doesnt require npcs to function public override bool ValidTeleportCheck_NPCCount(TeleportPylonInfo pylonInfo, int defaultNecessaryNPCCount) => true; - public override bool ValidTeleportCheck_BiomeRequirements(TeleportPylonInfo pylonInfo, SceneMetrics sceneData) => BiomeTileCounterSystem.BrimstoneCragTiles >= 100; + public override bool ValidTeleportCheck_BiomeRequirements(TeleportPylonInfo pylonInfo, SceneMetrics sceneData) => BiomeTileCounterSystem.BrimstoneCragTiles >= 500; } } diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs index 4dc342e39b..63805279aa 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs @@ -44,10 +44,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, new Color(157, 175, 15), Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs index fe0ed10bd6..c811db26d1 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs @@ -55,10 +55,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, new Color(157, 175, 15), Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs index 685953dfa9..72d7b09a77 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs @@ -55,10 +55,10 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) { Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, new Color(157, 175, 15), Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/Rubblemaker/SunkenSea/BranchCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/BranchCoralEcho.cs new file mode 100644 index 0000000000..66fe2f1267 --- /dev/null +++ b/Tiles/Rubblemaker/SunkenSea/BranchCoralEcho.cs @@ -0,0 +1,18 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Ambient.SunkenSea +{ + public class BranchCoralEcho : BranchCoral + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/BranchCoral"; + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + RegisterItemDrop(ModContent.ItemType(), Type, 0); + FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); + } + } +} diff --git a/Tiles/Rubblemaker/SunkenSea/MediumSeaPrismCrystalEcho.cs b/Tiles/Rubblemaker/SunkenSea/MediumSeaPrismCrystalEcho.cs new file mode 100644 index 0000000000..5415fd964b --- /dev/null +++ b/Tiles/Rubblemaker/SunkenSea/MediumSeaPrismCrystalEcho.cs @@ -0,0 +1,23 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.SunkenSea; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Ambient.SunkenSea +{ + public class MediumSeaPrismCrystalEcho : MediumSeaPrismCrystal + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal"; + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + RegisterItemDrop(ModContent.ItemType(), Type, 0); + FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); + } + + // Don't drop items + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs index 22fd3f6af7..31659dbcdb 100644 --- a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs +++ b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public override void SetStaticDefaults() { + AnimationFrameHeight = 50; Main.tileLighted[Type] = true; Main.tileCut[Type] = true; Main.tileSolid[Type] = false; @@ -56,5 +57,16 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient g *= brightness; b *= brightness; } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + if (++frameCounter >= 12) + { + frameCounter = 0; + if (++frame >= 6) + { + frame = 0; + } + } + } } } diff --git a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png index 2cef1eb725..dfbd21fca3 100644 Binary files a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png and b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png differ diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs index 388636ce9e..229c3fc952 100644 --- a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs +++ b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs @@ -46,24 +46,17 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void NearbyEffects(int i, int j, bool closer) { - // Light Cyan - if (closer && Main.rand.NextBool(600)) + if (closer && Main.rand.NextBool(300)) { + // this comment will exist until The Great Dustpan is merged: + // vanilla's Firefly dust (304) is completely yellow. + // therefore, it is completely unable to be turned blue due to how draw colour works! + // so it will always appear grey when you try to draw blue, and red/green/yellow otherwise. Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(136, 206, 215), 1.7f)]; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 280, 280, DustID.Firefly, 0.2f, 0f, 0, Color.Lerp(new Color(0, 76, 255), new Color(76, 0, 255), Main.rand.NextFloat()), Main.rand.NextFloat(1f, 2f))]; dust.noGravity = true; dust.noLight = true; - dust.fadeIn = 2.5813954f; - } - - //Lilac - if (closer && Main.rand.NextBool(600)) - { - Dust dust; - dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(236, 194, 252), 1.6f)]; - dust.noGravity = true; - dust.noLight = true; - dust.fadeIn = 2.5813954f; + dust.fadeIn = 2.5f; } } diff --git a/Tiles/SunkenSea/BlackPearlPile.cs b/Tiles/SunkenSea/BlackPearlPile.cs index 2f7bb19c6e..7749b43860 100644 --- a/Tiles/SunkenSea/BlackPearlPile.cs +++ b/Tiles/SunkenSea/BlackPearlPile.cs @@ -1,8 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Sounds; +using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,6 @@ namespace CalamityMod.Tiles.SunkenSea { public class BlackPearlPile : ModTile { - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -23,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - HitSound = MineSound; + HitSound = CommonCalamitySounds.VoidstoneMine; DustType = DustID.Lead; AddMapEntry(new Color(29, 33, 38)); diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs index 44c4396200..430664f3a3 100644 --- a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs +++ b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs @@ -61,8 +61,6 @@ namespace CalamityMod.Tiles.SunkenSea TileObjectData.newAlternate.Origin = new Point16(0, 0); TileObjectData.addAlternate(24); TileObjectData.addTile(Type); - - FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/PinkPearlPile.cs b/Tiles/SunkenSea/PinkPearlPile.cs index ac2f11245f..7bcd41ef34 100644 --- a/Tiles/SunkenSea/PinkPearlPile.cs +++ b/Tiles/SunkenSea/PinkPearlPile.cs @@ -1,8 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Sounds; +using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,6 @@ namespace CalamityMod.Tiles.SunkenSea { public class PinkPearlPile : ModTile { - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -21,7 +20,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - HitSound = MineSound; + HitSound = CommonCalamitySounds.VoidstoneMine; DustType = DustID.Ice_Pink; AddMapEntry(new Color(204, 143, 174)); Main.tileShine[Type] = 3500; diff --git a/Tiles/SunkenSea/Shellstone.cs b/Tiles/SunkenSea/Shellstone.cs index fc2dc12221..1d62336adb 100644 --- a/Tiles/SunkenSea/Shellstone.cs +++ b/Tiles/SunkenSea/Shellstone.cs @@ -28,17 +28,15 @@ namespace CalamityMod.Tiles.SunkenSea this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); - } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) => TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + public override void RandomUpdate(int i, int j) { Tile Tile = Framing.GetTileSafely(i, j); Tile Below = Framing.GetTileSafely(i, j + 1); Tile Above = Framing.GetTileSafely(i, j - 1); - if (!Below.HasTile && Below.LiquidType <= 0 && !Tile.BottomSlope) + if (!Below.HasTile && Below.LiquidType == LiquidID.Water && !Tile.BottomSlope) { if (Main.rand.NextBool(10)) { @@ -46,9 +44,7 @@ namespace CalamityMod.Tiles.SunkenSea Below.HasTile = true; WorldGen.SquareTileFrame(i, j + 1, true); if (Main.dedServ) - { NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); - } } } } diff --git a/Tiles/SunkenSea/WhitePearlPile.cs b/Tiles/SunkenSea/WhitePearlPile.cs index 8a1df3286a..94938f9b10 100644 --- a/Tiles/SunkenSea/WhitePearlPile.cs +++ b/Tiles/SunkenSea/WhitePearlPile.cs @@ -1,8 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Sounds; +using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,6 @@ namespace CalamityMod.Tiles.SunkenSea { public class WhitePearlPile : ModTile { - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -24,7 +23,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileShine[Type] = 3500; Main.tileShine2[Type] = true; - HitSound = MineSound; + HitSound = CommonCalamitySounds.VoidstoneMine; DustType = DustID.Slush; AddMapEntry(new Color(217, 209, 213)); diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs index ac14c0266e..4af87f7c90 100644 --- a/Tiles/VernalSoil.cs +++ b/Tiles/VernalSoil.cs @@ -175,7 +175,7 @@ namespace CalamityMod.Tiles Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j)); Texture2D leaves = ModContent.Request("CalamityMod/Tiles/VernicFernGrass").Value; - if (uptile.HasTile) + if (uptile.HasTile && uptile.IsTileFull()) { return; } diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs index bcd80a65c7..1ffaa9d7da 100644 --- a/Utilities/CollisionUtils.cs +++ b/Utilities/CollisionUtils.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; namespace CalamityMod { @@ -61,6 +62,7 @@ namespace CalamityMod return distanceToClosestPoint <= radius; } + /// /// Determines the distance required before a ray in a given direction from a given starting position hits solid tiles. Gives up after a certain quantity of tiles, or when a world border is reached. /// /// The point to check from. @@ -90,5 +92,153 @@ namespace CalamityMod return null; } + /// + /// Determines the distance required before a ray in a given direction from a given starting position hits solid tiles, taking slopes into account. + /// + /// The point to check from. + /// The direction in which tiles are checked. + /// How far in the direction that will be checked. + /// How many units moved forward each loop. Greater = less precise. + /// The length until the first collision detected. Returns input length if no collision occurs. + public static float PreciseDistanceToTileCollisionHit(Vector2 start, float rotation, float length, float step = 1) + { + Vector2 unitVect = rotation.ToRotationVector2(); + Vector2 end = unitVect * length; + + if (length < 1f) + { + Point endWorldPos = end.ToTileCoordinates(); + return ParanoidTileRetrieval(endWorldPos.X, endWorldPos.Y).IsTileSolid() ? 0 : length; + } + + Vector2 currentPos = start; + Point lastAirPos = new Point(-1, -1); + for (float i = 0; i < length; i += step) + { + currentPos += unitVect * step; + + Point tilePos = currentPos.ToTileCoordinates(); + + if (tilePos == lastAirPos) + continue; + + if (!WorldGen.InWorld(tilePos.X, tilePos.Y)) + continue; + + Tile tile = Main.tile[tilePos.X, tilePos.Y]; + if (!tile.IsTileSolid()) + { + lastAirPos = tilePos; + continue; + } + + if (tile.Slope == SlopeType.Solid && !tile.IsHalfBlock) + return (currentPos - start).Length(); + + Vector2 tileWorldPos = new Vector2(tilePos.X * 16, tilePos.Y * 16); + Vector2 currentPosInTile = currentPos - tileWorldPos; + if (tile.IsHalfBlock) + { + if (currentPosInTile.Y >= 8f) + return (currentPos - start).Length(); + } + else if (tile.Slope == SlopeType.SlopeDownLeft) + { + if (currentPosInTile.X <= currentPosInTile.Y) + return (currentPos - start).Length(); + } + else if (tile.Slope == SlopeType.SlopeDownRight) + { + if ((16 - currentPosInTile.X) <= currentPosInTile.Y) + return (currentPos - start).Length(); + } + else if (tile.Slope == SlopeType.SlopeUpLeft) + { + if (currentPosInTile.X <= (16 - currentPosInTile.Y)) + return (currentPos - start).Length(); + } + else if (tile.Slope == SlopeType.SlopeUpRight) + { + if (currentPosInTile.X >= currentPosInTile.Y) + return (currentPos - start).Length(); + } + } + + return length; + } + /// + /// Determines the distance required before a ray in a given direction from a given starting position hits solid tiles, taking slopes into account. + /// + /// The point to check from. + /// The direction in which tiles are checked. + /// How far in the direction that will be checked. + /// How many units moved forward each loop. Greater = less precise. + /// False if there is a tile collision before checking the full length of the line. + public static bool PreciseCanHitInLine(Vector2 start, float rotation, float length, float step = 1) + { + Vector2 unitVect = rotation.ToRotationVector2(); + Vector2 end = unitVect * length; + + if (length < 1f) + { + Point endWorldPos = end.ToTileCoordinates(); + return !ParanoidTileRetrieval(endWorldPos.X, endWorldPos.Y).IsTileSolid(); + } + + Vector2 currentPos = start; + Point lastAirPos = new Point(-1, -1); + for (float i = 0; i < length; i += step) + { + currentPos += unitVect * step; + + Point tilePos = currentPos.ToTileCoordinates(); + + if (tilePos == lastAirPos) + continue; + + if (!WorldGen.InWorld(tilePos.X, tilePos.Y)) + continue; + + Tile tile = Main.tile[tilePos.X, tilePos.Y]; + if (!tile.IsTileSolid()) + { + lastAirPos = tilePos; + continue; + } + + if (tile.Slope == SlopeType.Solid && !tile.IsHalfBlock) + return false; + + Vector2 tileWorldPos = new Vector2(tilePos.X * 16, tilePos.Y * 16); + Vector2 currentPosInTile = currentPos - tileWorldPos; + if (tile.IsHalfBlock) + { + if (currentPosInTile.Y >= 8f) + return false; + } + else if (tile.Slope == SlopeType.SlopeDownLeft) + { + if (currentPosInTile.X <= currentPosInTile.Y) + return false; + } + else if (tile.Slope == SlopeType.SlopeDownRight) + { + if ((16 - currentPosInTile.X) <= currentPosInTile.Y) + return false; + } + else if (tile.Slope == SlopeType.SlopeUpLeft) + { + if (currentPosInTile.X <= (16 - currentPosInTile.Y)) + return false; + } + else if (tile.Slope == SlopeType.SlopeUpRight) + { + if (currentPosInTile.X >= currentPosInTile.Y) + return false; + } + } + + return true; + } } } diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 9ed32533e5..ce5b774884 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -41,6 +41,21 @@ namespace CalamityMod new Color(199, 62, 62), }; + /// + /// The transformation matrix used for drawing backgrounds in Vanilla Terraria. Should be used for any custom background drawing or CustomSky + /// drawing, such as independent sky entities or background shader effects. + /// + public static Matrix BackgroundMatrix + { + get + { + Matrix backgroundMatrix = Main.BackgroundViewMatrix.TransformationMatrix; + Vector3 translationDirection = new(1f, Main.BackgroundViewMatrix.Effects.HasFlag(SpriteEffects.FlipVertically) ? -1f : 1f, 1f); + backgroundMatrix.Translation -= Main.BackgroundViewMatrix.ZoomMatrix.Translation * translationDirection; + return backgroundMatrix; + } + } + #region Projectile Afterimages /// /// Draws a projectile as a series of afterimages. The first of these afterimages is centered on the center of the projectile's hitbox.
@@ -412,9 +427,7 @@ namespace CalamityMod { Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f); - Color color = new Color(250, 250, 250, item.alpha); - if (item.type == ModContent.ItemType()) - color = Color.White; + Color color = Color.White; spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, color, rotation, origin, 1f, SpriteEffects.None, 0f); } diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 460f0f32d4..e66a64ece0 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -136,7 +136,7 @@ namespace CalamityMod return ret; } - public static float GetRangedAmmoCostReduction(this Player player) + public static float GetAmmoCostReduction(this Player player) { // Tally up all possible vanilla effects. float vanillaCost = player.ammoBox ? 0.8f : 1f; @@ -148,7 +148,7 @@ namespace CalamityMod vanillaCost *= 0.75f; // Account for Calamity effects. - return vanillaCost * player.Calamity().rangedAmmoCost; + return vanillaCost * player.Calamity().ammoCost; } public static float GetStandingStealthRegen(this Player player) diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 5d09f8fb37..e8b9ab486f 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -38,6 +38,20 @@ namespace CalamityMod return false; } + public static bool AnyOwnedProjectiles(int projectileID, int ownerID) + { + // Efficiently loop through all projectiles, using a specially designed continue continue that attempts to minimize the amount of OR + // checks per iteration. + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type != projectileID || p.owner != ownerID) + continue; + + return true; + } + + return false; + } public static int CountProjectiles(int projectileID) => Main.projectile.Count(proj => proj.type == projectileID && proj.active); public static int CountOwnedProjectiles(int projectileID, int ownerID) => Main.projectile.Count(proj => proj.active && proj.type == projectileID && proj.owner == ownerID); @@ -107,6 +121,50 @@ namespace CalamityMod public static void ExpandHitboxBy(this Projectile projectile, Vector2 newSize) => projectile.ExpandHitboxBy((int)newSize.X, (int)newSize.Y); public static void ExpandHitboxBy(this Projectile projectile, float expandRatio) => projectile.ExpandHitboxBy((int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); + /// + /// Prevents a projectile from colliding with tiles until it's no longer inside tiles.
+ /// Useful for large projectiles that would otherwise collide with tiles instantly after spawning.
+ /// Make sure to set Projectile.tileCollide = false; in the projectile's SetDefaults before calling this function in the projectile's AI. + ///
+ public static void PreventTileCollisionUntilHitboxIsOutsideOfTiles(Projectile projectile) + { + if (!projectile.tileCollide) + { + bool canCollide = true; + Vector2 tilePosition; + Point tilePositionPoint; + Tile tileSafely; + float increment = 16f; + float offset = increment * 2f; + float startIndexX = projectile.position.X - increment; + float endIndexX = startIndexX + offset + projectile.width; + float startIndexY = projectile.position.Y - increment; + float endIndexY = projectile.position.Y + offset + projectile.height; + for (float i = startIndexX; i < endIndexX; i += increment) + { + if (!canCollide) + break; + + for (float j = startIndexY; j < endIndexY; j += increment) + { + tilePosition.X = i; + tilePosition.Y = j; + tilePositionPoint = tilePosition.ToTileCoordinates(); + tileSafely = Framing.GetTileSafely(tilePositionPoint); + bool isInSolidTile = tileSafely.HasUnactuatedTile && Main.tileSolid[tileSafely.TileType] && !Main.tileSolidTop[tileSafely.TileType] && !TileID.Sets.Platforms[tileSafely.TileType]; + if (isInSolidTile) + { + canCollide = false; + break; + } + } + } + + if (canCollide) + projectile.tileCollide = true; + } + } + public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia) { if (!projectile.friendly) @@ -647,10 +705,15 @@ namespace CalamityMod Vector2 drawPosition = ((xPos == 0 && yPos == 0) ? projectile.Center : new Vector2(xPos, yPos)) - Main.screenPosition; Vector2 origin = frame.Value.Size() * 0.5f; Color backAfterimageColor = backglowColor * projectile.Opacity; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1 && effects == SpriteEffects.None) spriteEffects = SpriteEffects.FlipHorizontally; + else spriteEffects = effects; + for (int i = 0; i < 10; i++) { Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; - Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, effects, 0f); + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); } } @@ -664,12 +727,16 @@ namespace CalamityMod Vector2 drawPosition = projectile.Center - Main.screenPosition; Vector2 origin = frame.Value.Size() * 0.5f; Color backAfterimageColor = backglowColor * projectile.Opacity; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; + for (int i = 0; i < 10; i++) { Vector2 off = Vector2.Zero; if (offset != null) off += offset.Value; Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; - Main.spriteBatch.Draw(texture, drawPosition + drawOffset + off, frame, backAfterimageColor, projectile.rotation, origin, scale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition + drawOffset + off, frame, backAfterimageColor, projectile.rotation, origin, scale, spriteEffects, 0f); } } @@ -683,8 +750,12 @@ namespace CalamityMod Vector2 drawPosition = ((xPos == 0 && yPos == 0) ? projectile.Center : new Vector2(xPos, yPos)) - Main.screenPosition; Vector2 origin = frame.Value.Size() * 0.5f; - projectile.DrawBackglow(backglowColor, backglowArea, texture, frame, effects, xPos, yPos); - Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, effects, 0f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1 && effects == SpriteEffects.None) spriteEffects = SpriteEffects.FlipHorizontally; + else spriteEffects = effects; + + projectile.DrawBackglow(backglowColor, backglowArea, texture, frame, spriteEffects, xPos, yPos); + Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, spriteEffects, 0f); } public static void DrawStarTrail(this Projectile projectile, Color outer, Color inner, float auraHeight = 10f) diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 83c3e8e955..4877f181e9 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -702,7 +702,7 @@ namespace CalamityMod /// Determines if a tile is solid based on whether it's active and not actuated or if the tile is solid. This will not count platforms and other non-solid ground tiles ///
/// The tile to check. - public static bool IsTileSolid(this Tile tile) => tile != null && tile.HasUnactuatedTile && Main.tileSolid[tile.TileType] && !TileID.Sets.Platforms[tile.TileType]; + public static bool IsTileSolid(this Tile tile) => tile != null && tile.HasUnactuatedTile && Main.tileSolid[tile.TileType] && !Main.tileSolidTop[tile.TileType]; /// /// Determines if a tile is "full" based on if the tile is solid. This will count platforms and actuated tiles but no other non-solid ground tiles. diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index a239873c54..3553030f40 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -46,8 +46,7 @@ namespace CalamityMod.Walls int yPos = tile.WallFrameY; Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); - Color drawcolor; - drawcolor = WorldGen.paintColor(tile.WallColor); + Color drawcolor = WorldGen.paintColor(tile.WallColor); drawcolor.A = 255; Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -67,12 +66,9 @@ namespace CalamityMod.Walls brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawcolor *= brightness; - Color glowColor = drawcolor * 0.4f; - if (lightColor.R > glowColor.R) glowColor.R = lightColor.R; - if (lightColor.G > glowColor.G) glowColor.G = lightColor.G; - if (lightColor.B > glowColor.B) glowColor.B = lightColor.B; + brightness = MathHelper.Clamp(brightness, 0f, 1f); + Color glowColor = drawcolor *= brightness; if (glowColor.R <= 0 && glowColor.G <= 0 && glowColor.B <= 0) return; diff --git a/Walls/VoidstoneWallUnsafe _Glowmask.png b/Walls/VoidstoneWallUnsafe _Glowmask.png deleted file mode 100644 index a3f5c24d2b..0000000000 Binary files a/Walls/VoidstoneWallUnsafe _Glowmask.png and /dev/null differ diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 6469477f7c..2f8aa9fc12 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -55,8 +55,7 @@ namespace CalamityMod.Walls int yPos = tile.WallFrameY; Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); - Color drawcolor; - drawcolor = WorldGen.paintColor(tile.WallColor); + Color drawcolor = WorldGen.paintColor(tile.WallColor); drawcolor.A = 255; Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -76,12 +75,9 @@ namespace CalamityMod.Walls brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawcolor *= brightness; - Color glowColor = drawcolor * 0.4f; - if (lightColor.R > glowColor.R) glowColor.R = lightColor.R; - if (lightColor.G > glowColor.G) glowColor.G = lightColor.G; - if (lightColor.B > glowColor.B) glowColor.B = lightColor.B; + brightness = MathHelper.Clamp(brightness, 0f, 1f); + Color glowColor = drawcolor *= brightness; if (glowColor.R <= 0 && glowColor.G <= 0 && glowColor.B <= 0) return; @@ -90,7 +86,7 @@ namespace CalamityMod.Walls // But maybe we could squeeze bit more by removing the loop for (int k = 0; k < 3; k++) { - Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k; + Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * (0.2f * k); spriteBatch.Draw(GlowMask.Texture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } diff --git a/World/CustomUnderworld.cs b/World/CustomUnderworld.cs index 92cca95128..23df6a3460 100644 --- a/World/CustomUnderworld.cs +++ b/World/CustomUnderworld.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using CalamityMod.Schematics; using Microsoft.Xna.Framework; using ReLogic.Utilities; using Terraria; @@ -6,13 +8,30 @@ using Terraria.DataStructures; using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.WorldBuilding; -using static tModPorter.ProgressUpdate; +using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World { public class CustomUnderworld { + // Ash island variables + private const double AshIslandGenStart = 0.36; + private const double AshIslandGenStart_Remix = 0.38; + private const double AshIslandGenEnd = 0.64; + private const double AshIslandGenEnd_Remix = 0.62; + private const int AshIslandDepthMaxAboveTheUnderworldFloor = 135; + private const int AshIslandHeightMaxAboveTheUnderworldFloor = 160; private const int MaxIslands = 8; + private const int SmallWorldIslands = 4; + private const int MediumWorldIslands = 6; + private const int LargeWorldIslands = MaxIslands; + private const int SmallWorldOuterIslands = 1; + private const int MediumAndLargeWorldOuterIslands = 2; + + // Pillar variables + private const int MaxPillarHeight = 68; + private const int RandomizedPillarSectionHeight = 4; + private const int MaxPillarDepthAboveTheUnderworldFloor = 40; public static void NewUnderworld() { @@ -153,32 +172,34 @@ namespace CalamityMod.World // Remix world stuff, the Ash islands in the middle // Start generating islands at this point - int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.38 : 0.36)); + int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenStart_Remix : AshIslandGenStart)); // Stop generating islands at this point - int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.62 : 0.64)); + int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenEnd_Remix : AshIslandGenEnd)); // Ash island gen limits - int ashIslandDepthLimit = Main.maxTilesY - 135; - int ashIslandHeightLimit = Main.maxTilesY - 160; + int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; + int ashIslandHeightLimit = Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor; // Multiple islands in non-remix if (!WorldGen.remixWorldGen) { // Large = 8, Medium = 6, Small = 4 int numIslands = (int)(Main.maxTilesX / 4200f * 4f); + bool smallWorld = numIslands == SmallWorldIslands; // Total extra distance between islands for lava lakes int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); // Extra distance per island // Due to this being done on both sides of each island, it is divided by 2 - int extraDistanceBetweenAshIslands = totalExtraDistanceBetweenAshIslands / numIslands / 2; + int extraDistanceBetweenAshIslands_PerIslandSide = totalExtraDistanceBetweenAshIslands / numIslands / 2; // Calculate distance between islands int distanceBetweenIslands = (ashIslandX2 - ashIslandX) / numIslands; // Used for island height randomization + int minHeightForOuterIslands = 8; int[] randomHeightAdjustmentLimits = new int[MaxIslands] { 28, @@ -194,6 +215,7 @@ namespace CalamityMod.World // Used for island edge drop off randomization // Taller islands have steeper drop offs // This is also used to decrease the width of the islands + int minDropOffForOuterIslands = 11; int[] randomDropOffAdjustmentLimits = new int[MaxIslands] { 3, @@ -218,6 +240,15 @@ namespace CalamityMod.World int randomizedIslandDropOffAdjustment = randomDropOffAdjustmentLimits[chosenIslandSize]; int randomizedIslandHeightAdjustment = randomHeightAdjustmentLimits[chosenIslandSize]; + + // Islands on the edges are taller in order to have more structures + bool isTallerIsland = smallWorld ? (i == 0 || i == numIslands - SmallWorldOuterIslands) : (i < MediumAndLargeWorldOuterIslands || i >= numIslands - MediumAndLargeWorldOuterIslands); + if (isTallerIsland && randomizedIslandHeightAdjustment > minHeightForOuterIslands) + { + randomizedIslandHeightAdjustment = minHeightForOuterIslands; + randomizedIslandDropOffAdjustment = minDropOffForOuterIslands; + } + int randomizedAshIslandDepthLimit = ashIslandDepthLimit + randomizedIslandHeightAdjustment; int randomizedAshIslandHeightLimit = ashIslandHeightLimit + randomizedIslandHeightAdjustment; @@ -228,8 +259,8 @@ namespace CalamityMod.World // Taller islands have a greater reduction in width int randomWidthReduction_LeftSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); int randomWidthReduction_RightSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); - int ashIslandTilePlacementX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands + randomWidthReduction_LeftSide; - int ashIslandTilePlacementX2 = ashIslandX2 - ashIslandX2Adjustment - extraDistanceBetweenAshIslands - randomWidthReduction_RightSide; + int ashIslandTilePlacementX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands_PerIslandSide + randomWidthReduction_LeftSide; + int ashIslandTilePlacementX2 = ashIslandX2 - ashIslandX2Adjustment - extraDistanceBetweenAshIslands_PerIslandSide - randomWidthReduction_RightSide; int ashIslandGenLimiter = Main.maxTilesY - 1; bool ashIslandGenLimitHit = false; Liquid.QuickWater(-2); @@ -256,46 +287,57 @@ namespace CalamityMod.World { // More randomized terrain depending on island type // Lower islands have smoother terrain - switch (chosenIslandSize) + // Islands on the edges have smoother terrain + if (isTallerIsland) { - default: - case 0: - case 1: - if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(8)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - break; + if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(8)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + } + else + { + switch (chosenIslandSize) + { + default: + case 0: + case 1: + if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(8)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + break; - case 2: - case 3: - if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(9)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; + case 2: + case 3: + if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(9)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; - case 4: - case 5: - if (WorldGen.genRand.NextBool()) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; + case 4: + case 5: + if (WorldGen.genRand.NextBool()) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; - case 6: - case 7: - if (WorldGen.genRand.NextBool()) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; + case 6: + case 7: + if (WorldGen.genRand.NextBool()) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; + } } } @@ -318,20 +360,19 @@ namespace CalamityMod.World } // This is necessary due to earlier calculations - int startX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands + randomWidthReduction_LeftSide; - - // Lava holes in ash islands + int startX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands_PerIslandSide + randomWidthReduction_LeftSide; + int endX = ashIslandTilePlacementX2 + extraDistanceBetweenAshIslands_PerIslandSide * 2; // Small holes double holeFrequency = 0.00005 / numIslands; for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * holeFrequency); j++) - WorldGen.TileRunner(WorldGen.genRand.Next(startX, ashIslandTilePlacementX2), WorldGen.genRand.Next(randomizedAshIslandHeightLimit + 30, Main.maxTilesY), WorldGen.genRand.Next(4, 7), WorldGen.genRand.Next(4, 7), -2); + WorldGen.TileRunner(WorldGen.genRand.Next(startX, endX), WorldGen.genRand.Next(randomizedAshIslandHeightLimit + 30, Main.maxTilesY), WorldGen.genRand.Next(4, 7), WorldGen.genRand.Next(4, 7), -2); // Place smaller hellstone splotches in the ash island // I don't want there to be too many here because I don't want to encourage players to destroy the environmental Wall of Flesh arena double hellstoneFrequency = 0.0002 / numIslands; for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * hellstoneFrequency); j++) - WorldGen.TileRunner(WorldGen.genRand.Next(startX, ashIslandTilePlacementX2), WorldGen.genRand.Next(randomizedAshIslandHeightLimit, Main.maxTilesY), WorldGen.genRand.Next(1, 5), WorldGen.genRand.Next(2, 5), TileID.Hellstone); + WorldGen.TileRunner(WorldGen.genRand.Next(startX, endX), WorldGen.genRand.Next(randomizedAshIslandHeightLimit, Main.maxTilesY), WorldGen.genRand.Next(1, 5), WorldGen.genRand.Next(2, 5), TileID.Hellstone); } } else @@ -390,11 +431,11 @@ namespace CalamityMod.World } // Generate a line of background walls from the approximate underworld lava line and down - int maxWallHeight = 68; - int randomizedWallSectionsHeight = 4; + int maxWallHeight = MaxPillarHeight; + int randomizedWallSectionsHeight = RandomizedPillarSectionHeight; int maxWallTypes = 4; int newWallTypeStart = maxWallHeight / maxWallTypes; - int maxWallDepth = Main.maxTilesY - 40; + int maxWallDepth = Main.maxTilesY - MaxPillarDepthAboveTheUnderworldFloor; int smoulderingStoneWallStartDepth = maxWallDepth - maxWallHeight; int cinderWallStartDepth = smoulderingStoneWallStartDepth + newWallTypeStart; int emberWallStartDepth = cinderWallStartDepth + newWallTypeStart; @@ -607,23 +648,643 @@ namespace CalamityMod.World } } - // Place ash trees - for (int x = ashIslandX; x < ashIslandX2 + 15; x++) - { - for (int y = Main.maxTilesY - 200; y < ashIslandDepthLimit + 30; y++) - { - if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) - WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); - } - } - // Obsidian and hellstone towers... AddHellHouses(); + } + + public static void NewUnderworldStructures() + { + if (!WorldGen.remixWorldGen) + { + // Generate some structures on the ash islands + int ashIslandX = (int)((double)Main.maxTilesX * AshIslandGenStart); + int ashIslandX2 = (int)((double)Main.maxTilesX * AshIslandGenEnd); + bool cragsLocationIsLeft = GenVars.dungeonLocation < Main.maxTilesX / 2; + int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; + int ashIslandHeightLimit = Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor; + + // Keep track of world size to adjust house distances + float houseDistanceMult = Main.maxTilesX / 4200f; + + // Large = 8, Medium = 6, Small = 4 + int numIslands = (int)(Main.maxTilesX / 4200f * 4f); + + // Small and medium worlds get less structures + bool smallWorld = numIslands == SmallWorldIslands; + bool mediumWorld = numIslands == MediumWorldIslands; + bool largeWorld = numIslands == LargeWorldIslands; + + // Total extra distance between islands for lava lakes + int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); + + // Extra distance per island + // The right side looks better with half of this adjustment subtracted + int divisor = cragsLocationIsLeft ? 2 : 4; + int extraDistanceBetweenAshIslands_PerIslandSide = totalExtraDistanceBetweenAshIslands / numIslands / divisor; + + // Calculate distance between islands + int sideAdjustmentMultiplier = cragsLocationIsLeft ? 1 : -1; + int distanceBetweenStructures = (ashIslandX2 - ashIslandX) / numIslands; + int firstIslandWidth = distanceBetweenStructures + (extraDistanceBetweenAshIslands_PerIslandSide * sideAdjustmentMultiplier); + int firstStructureDistanceFromIslandEdge = firstIslandWidth / 2; + int distanceBetweenStructures_AfterFirstIsland = distanceBetweenStructures; + + // Pick an atrium type + // Small worlds get a random single atrium + // Medium and large worlds get a guaranteed shadow chest atrium and another random non-shadow chest atrium + string atriumMapKey; + int atriumType = smallWorld ? WorldGen.genRand.Next(3) : WorldGen.genRand.Next(2); + int numAtriums = smallWorld ? 1 : 2; + if (!smallWorld) + { + switch (atriumType) + { + default: + case 0: + atriumMapKey = BrimstoneAtriumType1Key; + break; + + case 1: + atriumMapKey = BrimstoneAtriumType3Key; + break; + } + } + else + { + switch (atriumType) + { + default: + case 0: + atriumMapKey = BrimstoneAtriumType1Key; + break; + + case 1: + atriumMapKey = BrimstoneAtriumType2Key; + break; + + case 2: + atriumMapKey = BrimstoneAtriumType3Key; + break; + } + } + var atriumSchematic = TileMaps[atriumMapKey]; + + // Pick stockade types + List stockades = new List(); + int numStockades = largeWorld ? 2 : 1; + int stockadeTypes = 4; + do + { + // Chose a random stockade to add to the list + int chosenStockade = WorldGen.genRand.Next(stockadeTypes); + + // Don't choose the same stockade twice + bool alreadyContainsThisStockadeType = stockades.Contains(chosenStockade); + + if (!alreadyContainsThisStockadeType) + stockades.Add(chosenStockade); + } + while (stockades.Count < numStockades); + + string[] stockadesToGenerate = new string[numStockades]; + for (int stockadeIndex = 0; stockadeIndex < numStockades; stockadeIndex++) + { + switch (stockades[stockadeIndex]) + { + default: + case 0: + stockadesToGenerate[stockadeIndex] = BarbedStockadeType1Key; + break; + + case 1: + stockadesToGenerate[stockadeIndex] = BarbedStockadeType2Key; + break; + + case 2: + stockadesToGenerate[stockadeIndex] = BarbedStockadeType3Key; + break; + + case 3: + stockadesToGenerate[stockadeIndex] = BarbedStockadeType4Key; + break; + } + } + + // Offsets for structures + int atriumOffsetY = 8; + + int cacheOffsetY = 45; + + int sanctumOffsetY = 65; + + int strongholdOffsetX = cragsLocationIsLeft ? 40 : 20; + int strongholdOffsetY = 3; + int secondStrongholdOffsetY = 5; + + int dungeonOffsetX = cragsLocationIsLeft ? 30 : 50; + int dungeonOffsetY = 4; + + int stockadeOffsetX = largeWorld ? strongholdOffsetX : 0; + int secondStockadeOffsetX = dungeonOffsetX; + int stockadeOffsetY = stockadesToGenerate[0] == BarbedStockadeType4Key ? -7 : 8; + + // Place structures + if (cragsLocationIsLeft) + { + // + // Place atriums + // + // Atrium location is on the crags side + int atriumGenX = ashIslandX + firstStructureDistanceFromIslandEdge; + int atriumGenY = ashIslandHeightLimit; + while (!Main.tile[atriumGenX, atriumGenY].HasTile) + atriumGenY++; + + Point atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); + SchematicAnchor anchorType = SchematicAnchor.Center; + bool place = true; + if (!smallWorld) + { + PlaceSchematic(BrimstoneAtriumType2Key, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + + // Protect the structure + Rectangle atriumProtectionArea = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(atriumProtectionArea, 10); + + // Move index further along to keep structures spread apart + atriumGenX += distanceBetweenStructures_AfterFirstIsland; + + // Reset the Y index + atriumGenY = ashIslandHeightLimit; + while (!Main.tile[atriumGenX, atriumGenY].HasTile) + atriumGenY++; + + // Placement point for the second atrium + atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); + } + + if (atriumMapKey == BrimstoneAtriumType2Key) + PlaceSchematic(atriumMapKey, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + else + PlaceSchematic>(atriumMapKey, atriumPlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle atriumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(atriumProtectionArea2, 10); + + // + // Place sanctums, strongholds, dungeons, and stockades + // + // All of these structures are on the demonic side + int sanctumGenX = ashIslandX2 - firstStructureDistanceFromIslandEdge; + int sanctumGenY = ashIslandDepthLimit + sanctumOffsetY; + + int strongholdGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX + strongholdOffsetX, strongholdGenY].HasTile) + strongholdGenY++; + + int dungeonGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX - dungeonOffsetX, dungeonGenY].HasTile) + dungeonGenY++; + + int stockadeGenX = sanctumGenX - (smallWorld ? distanceBetweenStructures_AfterFirstIsland : distanceBetweenStructures_AfterFirstIsland * 2); + int stockadeGenY = ashIslandHeightLimit; + while (!Main.tile[stockadeGenX + stockadeOffsetX, stockadeGenY].HasTile) + stockadeGenY++; + + Point sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); + Point strongholdPlacementPoint = new Point(sanctumGenX + strongholdOffsetX, strongholdGenY + strongholdOffsetY); + Point dungeonPlacementPoint = new Point(sanctumGenX - dungeonOffsetX, dungeonGenY + dungeonOffsetY); + Point stockadePlacementPoint = new Point(stockadeGenX + stockadeOffsetX, stockadeGenY + stockadeOffsetY); + if (largeWorld) + { + PlaceSchematic>(stockadesToGenerate[0], stockadePlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle stockadeProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[stockadesToGenerate[0]], stockadePlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(stockadeProtectionArea, 10); + + // Reset the Y index for stockades + stockadeGenY = ashIslandHeightLimit; + while (!Main.tile[stockadeGenX - secondStockadeOffsetX, stockadeGenY].HasTile) + stockadeGenY++; + + // Placement point for the second stockade + int secondStockadeOffsetY = stockadesToGenerate[1] == BarbedStockadeType4Key ? -7 : 8; + stockadePlacementPoint = new Point(stockadeGenX - secondStockadeOffsetX, stockadeGenY + secondStockadeOffsetY); + } + if (!smallWorld) + { + PlaceSchematic>(SanctumofOblivionType1Key, sanctumPlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle sanctumProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[SanctumofOblivionType1Key], sanctumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(sanctumProtectionArea, 10); + + PlaceSchematic(HellstoneStrongholdType1Key, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + + // Protect the structure + Rectangle strongholdProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[HellstoneStrongholdType1Key], strongholdPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(strongholdProtectionArea, 10); + + PlaceSchematic>(DemonicDungeonType1Key, dungeonPlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle dungeonProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[DemonicDungeonType1Key], dungeonPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(dungeonProtectionArea, 10); + + // Move index further along to keep structures spread apart + sanctumGenX -= distanceBetweenStructures_AfterFirstIsland; + + // Reset the Y index for strongholds + strongholdGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX + strongholdOffsetX, strongholdGenY].HasTile) + strongholdGenY++; + + // Placement point for the second stronghold + strongholdPlacementPoint = new Point(sanctumGenX + strongholdOffsetX, strongholdGenY + secondStrongholdOffsetY); + + // Reset the Y index for dungeons + dungeonGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX - dungeonOffsetX, dungeonGenY].HasTile) + dungeonGenY++; + + // Placement point for the second dungeon + dungeonPlacementPoint = new Point(sanctumGenX - dungeonOffsetX, dungeonGenY + dungeonOffsetY); + + // Placement point for the second sanctum + sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); + } + + // Large worlds have two stockades + string secondStockade = largeWorld ? stockadesToGenerate[1] : stockadesToGenerate[0]; + PlaceSchematic>(secondStockade, stockadePlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle stockadeProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStockade], stockadePlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(stockadeProtectionArea2, 10); + + // Small worlds only have one sanctum + string secondSanctum = smallWorld ? SanctumofOblivionType1Key : (WorldGen.genRand.NextBool() ? SanctumofOblivionType2Key : SanctumofOblivionType3Key); + PlaceSchematic>(secondSanctum, sanctumPlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle sanctumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondSanctum], sanctumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(sanctumProtectionArea2, 10); + + // Small worlds only have one stronghold + string secondStronghold = smallWorld ? HellstoneStrongholdType1Key : HellstoneStrongholdType2Key; + PlaceSchematic(secondStronghold, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + + // Protect the structure + Rectangle strongholdProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStronghold], strongholdPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(strongholdProtectionArea2, 10); + + // Small worlds only have one dungeon + string secondDungeon = smallWorld ? DemonicDungeonType1Key : DemonicDungeonType2Key; + PlaceSchematic>(secondDungeon, dungeonPlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle dungeonProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondDungeon], dungeonPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(dungeonProtectionArea2, 10); + } + else + { + int atriumGenX = ashIslandX2 - firstStructureDistanceFromIslandEdge; + int atriumGenY = ashIslandHeightLimit; + while (!Main.tile[atriumGenX, atriumGenY].HasTile) + atriumGenY++; + + Point atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); + SchematicAnchor anchorType = SchematicAnchor.Center; + bool place = true; + if (!smallWorld) + { + PlaceSchematic(BrimstoneAtriumType2Key, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + + Rectangle atriumProtectionArea = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(atriumProtectionArea, 10); + + atriumGenX -= distanceBetweenStructures_AfterFirstIsland; + + atriumGenY = ashIslandHeightLimit; + while (!Main.tile[atriumGenX, atriumGenY].HasTile) + atriumGenY++; + + atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); + } + + if (atriumMapKey == BrimstoneAtriumType2Key) + PlaceSchematic(atriumMapKey, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + else + PlaceSchematic>(atriumMapKey, atriumPlacementPoint, anchorType, ref place); + + Rectangle atriumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(atriumProtectionArea2, 10); + + int sanctumGenX = ashIslandX + firstStructureDistanceFromIslandEdge; + int sanctumGenY = ashIslandDepthLimit + sanctumOffsetY; + + int strongholdGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX - strongholdOffsetX, strongholdGenY].HasTile) + strongholdGenY++; + + int dungeonGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX + dungeonOffsetX, dungeonGenY].HasTile) + dungeonGenY++; + + int stockadeGenX = sanctumGenX + (smallWorld ? distanceBetweenStructures_AfterFirstIsland : distanceBetweenStructures_AfterFirstIsland * 2); + int stockadeGenY = ashIslandHeightLimit; + while (!Main.tile[stockadeGenX - stockadeOffsetX, stockadeGenY].HasTile) + stockadeGenY++; + + Point sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); + Point strongholdPlacementPoint = new Point(sanctumGenX - strongholdOffsetX, strongholdGenY + strongholdOffsetY); + Point dungeonPlacementPoint = new Point(sanctumGenX + dungeonOffsetX, dungeonGenY + dungeonOffsetY); + Point stockadePlacementPoint = new Point(stockadeGenX - stockadeOffsetX, stockadeGenY + stockadeOffsetY); + if (largeWorld) + { + PlaceSchematic>(stockadesToGenerate[0], stockadePlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle stockadeProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[stockadesToGenerate[0]], stockadePlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(stockadeProtectionArea, 10); + + // Reset the Y index for stockades + stockadeGenY = ashIslandHeightLimit; + while (!Main.tile[stockadeGenX + secondStockadeOffsetX, stockadeGenY].HasTile) + stockadeGenY++; + + // Placement point for the second stockade + int secondStockadeOffsetY = stockadesToGenerate[1] == BarbedStockadeType4Key ? -7 : 8; + stockadePlacementPoint = new Point(stockadeGenX + secondStockadeOffsetX, stockadeGenY + secondStockadeOffsetY); + } + if (!smallWorld) + { + PlaceSchematic>(SanctumofOblivionType1Key, sanctumPlacementPoint, anchorType, ref place); + + Rectangle sanctumProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[SanctumofOblivionType1Key], sanctumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(sanctumProtectionArea, 10); + + PlaceSchematic(HellstoneStrongholdType1Key, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + + Rectangle strongholdProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[HellstoneStrongholdType1Key], strongholdPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(strongholdProtectionArea, 10); + + PlaceSchematic>(DemonicDungeonType1Key, dungeonPlacementPoint, anchorType, ref place); + + Rectangle dungeonProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[DemonicDungeonType1Key], dungeonPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(dungeonProtectionArea, 10); + + sanctumGenX += distanceBetweenStructures_AfterFirstIsland; + + strongholdGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX - strongholdOffsetX, strongholdGenY].HasTile) + strongholdGenY++; + + strongholdPlacementPoint = new Point(sanctumGenX - strongholdOffsetX, strongholdGenY + secondStrongholdOffsetY); + + dungeonGenY = ashIslandHeightLimit; + while (!Main.tile[sanctumGenX + dungeonOffsetX, dungeonGenY].HasTile) + dungeonGenY++; + + dungeonPlacementPoint = new Point(sanctumGenX + dungeonOffsetX, dungeonGenY + dungeonOffsetY); + + sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); + } + + string secondStockade = largeWorld ? stockadesToGenerate[1] : stockadesToGenerate[0]; + PlaceSchematic>(secondStockade, stockadePlacementPoint, anchorType, ref place); + + Rectangle stockadeProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStockade], stockadePlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(stockadeProtectionArea2, 10); + + string secondSanctum = smallWorld ? SanctumofOblivionType1Key : (WorldGen.genRand.NextBool() ? SanctumofOblivionType2Key : SanctumofOblivionType3Key); + PlaceSchematic>(secondSanctum, sanctumPlacementPoint, anchorType, ref place); + + Rectangle sanctumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondSanctum], sanctumPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(sanctumProtectionArea2, 10); + + string secondStronghold = smallWorld ? HellstoneStrongholdType1Key : HellstoneStrongholdType2Key; + PlaceSchematic(secondStronghold, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); + + Rectangle strongholdProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStronghold], strongholdPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(strongholdProtectionArea2, 10); + + string secondDungeon = smallWorld ? DemonicDungeonType1Key : DemonicDungeonType2Key; + PlaceSchematic>(secondDungeon, dungeonPlacementPoint, anchorType, ref place); + + Rectangle dungeonProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondDungeon], dungeonPlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(dungeonProtectionArea2, 10); + } + + // Pick cache types + List caches = new List(); + int numCaches = largeWorld ? 8 : 4; // THIS NUMBER MUST BE EVEN!!! + int cacheTypes = 6; + int totalCachePositions = numCaches / 2; + do + { + // Chose a random cache to add to the list + int chosenCache = WorldGen.genRand.Next(cacheTypes); + + // Don't choose the same cache twice + bool alreadyContainsThisCacheType = caches.Contains(chosenCache); + + // Avoid an infinite loop by picking a random duplicate cache if the max is reached + bool pickRandomDuplicateCache = caches.Count >= cacheTypes; + if (pickRandomDuplicateCache) + pickRandomDuplicateCache = caches[caches.Count - totalCachePositions] != chosenCache; + + if (!alreadyContainsThisCacheType || pickRandomDuplicateCache) + caches.Add(chosenCache); + } + while (caches.Count < numCaches); + + // Chose random caches to not place + // 1 is not placed in a small/medium world + // 3 are not placed in a large world + List cachesToNotPlace = new List(); + int numCachesToNotPlace = largeWorld ? 3 : 1; + do + { + // Chose a random cache to add to the list + int chosenCache = WorldGen.genRand.Next(numCaches); + + // Don't choose the same cache twice + bool alreadyContainsThisCacheType = cachesToNotPlace.Contains(chosenCache); + if (!alreadyContainsThisCacheType) + cachesToNotPlace.Add(chosenCache); + } + while (cachesToNotPlace.Count < numCachesToNotPlace); + + // + // Place caches + // + int cacheGenX = ashIslandX + firstStructureDistanceFromIslandEdge + (distanceBetweenStructures_AfterFirstIsland * numAtriums); + int cacheGenY = ashIslandDepthLimit + cacheOffsetY; + int randomAdjustmentX = 0; + int randomAdjustmentY = 0; + int minRandomX = -30; + int maxRandomX = -20; + int minRandomY = 15; + int maxRandomY = 20; + for (int cacheIndex = 0; cacheIndex < totalCachePositions; cacheIndex++) + { + randomAdjustmentX += WorldGen.genRand.Next(minRandomX, maxRandomX + 1); + randomAdjustmentX = (int)MathHelper.Clamp(randomAdjustmentX, minRandomX, maxRandomX); + randomAdjustmentY += WorldGen.genRand.Next(minRandomY, maxRandomY + 1); + randomAdjustmentY = (int)MathHelper.Clamp(randomAdjustmentY, minRandomY, maxRandomY); + + string cacheMapKey; + switch (caches[cacheIndex]) + { + default: + case 0: + cacheMapKey = BonescrapperCacheType1Key; + break; + + case 1: + cacheMapKey = BonescrapperCacheType2Key; + break; + + case 2: + cacheMapKey = BonescrapperCacheType3Key; + break; + + case 3: + cacheMapKey = BonescrapperCacheType4Key; + break; + + case 4: + cacheMapKey = BonescrapperCacheType5Key; + break; + + case 5: + cacheMapKey = BonescrapperCacheType6Key; + break; + } + + Point cachePlacementPoint = new Point(cacheGenX + randomAdjustmentX, cacheGenY + randomAdjustmentY); + SchematicAnchor anchorType = SchematicAnchor.Center; + bool place = true; + + bool canPlaceEvenCache = true; + switch (cacheIndex) + { + default: + case 0: + canPlaceEvenCache = !cachesToNotPlace.Contains(0); + break; + + case 1: + canPlaceEvenCache = !cachesToNotPlace.Contains(2); + break; + + case 2: + canPlaceEvenCache = !cachesToNotPlace.Contains(4); + break; + + case 3: + canPlaceEvenCache = !cachesToNotPlace.Contains(6); + break; + } + + // Cache types 2, 3, and 6 have chests + if (canPlaceEvenCache) + { + if (cacheMapKey == BonescrapperCacheType2Key || cacheMapKey == BonescrapperCacheType3Key || cacheMapKey == BonescrapperCacheType6Key) + PlaceSchematic(cacheMapKey, cachePlacementPoint, anchorType, ref place, new Action(FillCacheChests)); + else + PlaceSchematic>(cacheMapKey, cachePlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle cacheProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[cacheMapKey], cachePlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(cacheProtectionArea, 5); + } + + string secondCacheMapKey; + switch (caches[cacheIndex + totalCachePositions]) + { + default: + case 0: + secondCacheMapKey = BonescrapperCacheType1Key; + break; + + case 1: + secondCacheMapKey = BonescrapperCacheType2Key; + break; + + case 2: + secondCacheMapKey = BonescrapperCacheType3Key; + break; + + case 3: + secondCacheMapKey = BonescrapperCacheType4Key; + break; + + case 4: + secondCacheMapKey = BonescrapperCacheType5Key; + break; + + case 5: + secondCacheMapKey = BonescrapperCacheType6Key; + break; + } + + bool canPlaceOddCache = true; + switch (cacheIndex) + { + default: + case 0: + canPlaceOddCache = !cachesToNotPlace.Contains(1); + break; + + case 1: + canPlaceOddCache = !cachesToNotPlace.Contains(3); + break; + + case 2: + canPlaceOddCache = !cachesToNotPlace.Contains(5); + break; + + case 3: + canPlaceOddCache = !cachesToNotPlace.Contains(7); + break; + } + + // Place second cache to the right of the first + if (canPlaceOddCache) + { + Point secondCachePlacementPoint = cachePlacementPoint + new Point(WorldGen.genRand.Next(60, 76), 0); + if (secondCacheMapKey == BonescrapperCacheType2Key || secondCacheMapKey == BonescrapperCacheType3Key || secondCacheMapKey == BonescrapperCacheType6Key) + PlaceSchematic(secondCacheMapKey, secondCachePlacementPoint, anchorType, ref place, new Action(FillCacheChests)); + else + PlaceSchematic>(secondCacheMapKey, secondCachePlacementPoint, anchorType, ref place); + + // Protect the structure + Rectangle cacheProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondCacheMapKey], secondCachePlacementPoint, anchorType); + CalamityUtils.AddProtectedStructure(cacheProtectionArea2, 5); + } + + // Reset positions and move cache placement along the X axis + cacheGenX = ashIslandX + firstStructureDistanceFromIslandEdge + (distanceBetweenStructures_AfterFirstIsland * (numAtriums + cacheIndex + 1)); + cacheGenY = ashIslandDepthLimit + cacheOffsetY; + } + } + } + + public static void NewUnderworldPillars() + { + int maxWallHeight = MaxPillarHeight; + int randomizedWallSectionsHeight = RandomizedPillarSectionHeight; + int maxWallDepth = Main.maxTilesY - MaxPillarDepthAboveTheUnderworldFloor; + int smoulderingStoneWallStartDepth = maxWallDepth - maxWallHeight; // Generate after houses to avoid complications // Place pillars of walls to show that the roof of the underworld is being held up // Do not place any pillars in the Brimstone Crags - bool cragsLocationIsLeft = GenVars.dungeonX < Main.maxTilesX / 2; + bool cragsLocationIsLeft = GenVars.dungeonLocation < Main.maxTilesX / 2; int brimstoneCragsSize = Main.maxTilesX / 5; int brimstoneCragsLocationStart = cragsLocationIsLeft ? (25 + brimstoneCragsSize) : ((Main.maxTilesX - brimstoneCragsSize) - 25); int pillarDistanceFromCragsLimit = 160; @@ -795,6 +1456,28 @@ namespace CalamityMod.World } } } + } + + public static void AshTreesAndGrass() + { + // Start generating islands at this point + int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenStart_Remix : AshIslandGenStart)); + + // Stop generating islands at this point + int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenEnd_Remix : AshIslandGenEnd)); + + // Ash island gen limits + int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; + + // Place ash trees + for (int x = ashIslandX; x < ashIslandX2 + 15; x++) + { + for (int y = Main.maxTilesY - 200; y < ashIslandDepthLimit + 30; y++) + { + if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) + WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); + } + } // Drunk world ash grass and trees if (WorldGen.drunkWorldGen) @@ -821,10 +1504,25 @@ namespace CalamityMod.World } } } + } + public static void PlaceGeyserTraps() + { // Place Geyser Traps on ash islands + // These are only generated in the no-man's land central islands if (!WorldGen.remixWorldGen) { + // Large = 8, Medium = 6, Small = 4 + // No-man's land islands: Large = 4, Medium = 2, Small = 2 + int numIslands = (int)(Main.maxTilesX / 4200f * 4f); + bool mediumWorld = numIslands == MediumWorldIslands; + + // Start generating traps at this point + int ashIslandX = (int)((double)Main.maxTilesX * (mediumWorld ? 0.453 : 0.43)); + + // Stop generating traps at this point + int ashIslandX2 = (int)((double)Main.maxTilesX * (mediumWorld ? 0.546 : 0.57)); + // Small = 12.6 Medium = 19.2 Large = 25.2 double trapFrequency = (double)Main.maxTilesX * 0.003; if (WorldGen.noTrapsWorldGen) @@ -841,7 +1539,7 @@ namespace CalamityMod.World for (int trapIndex2 = 0; trapIndex2 < maxTrapPlacementAttempts; trapIndex2++) { int trapPlacementX = WorldGen.genRand.Next(ashIslandX, ashIslandX2); - int trapPlacementY = WorldGen.genRand.Next(Main.maxTilesY - 160, Main.maxTilesY - 100); + int trapPlacementY = WorldGen.genRand.Next(Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor, Main.maxTilesY - 100); if (GeyserTraps(trapPlacementX, trapPlacementY)) break; @@ -880,6 +1578,11 @@ namespace CalamityMod.World if (Main.tile[geyserX + 1, geyserPlacementY].HasTile) return false; + // Only place on ash grass to avoid placing in the schematics + if (Main.tile[geyserX, geyserPlacementY + 1].TileType != TileID.AshGrass || + Main.tile[geyserX + 1, geyserPlacementY + 1].TileType != TileID.AshGrass) + return false; + for (int k = geyserX; k <= geyserX + 1; k++) { int j2 = geyserPlacementY + 1; @@ -944,49 +1647,6 @@ namespace CalamityMod.World } } - if (!WorldGen.remixWorldGen) - { - // Generate some structures on the ash island - int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.38 : 0.36)); - int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.62 : 0.64)); - int ashIslandDistance = ashIslandX2 - ashIslandX; - int flatDistanceBetweenHellHouses = ashIslandDistance / 3; - - // Keep track of world size to adjust house distances - float houseDistanceMult = Main.maxTilesX / 4200f; - int maxRandomDistanceBetweenHouses = (int)(75 * houseDistanceMult); - - // ashIslandX + 100 places the first hell house at the perfect position on the left shore of the ash island - // Add some random variance so that it doesn't feel so artificial - int firstHouseLocation = ashIslandX + 100 + WorldGen.genRand.Next(maxRandomDistanceBetweenHouses); - - // Max amount of houses generated on ash island - int maxHouses = 3; - int placedHouses = 0; - for (int i = firstHouseLocation; i < ashIslandX2 - 100; i++) - { - // Start searching at Main.maxTilesY - 130 because ashIsland's max depth is Main.maxTilesY - 135 - int hellHouseGenY = Main.maxTilesY - 130; - while (Main.tile[i, hellHouseGenY].HasTile || Main.tile[i, hellHouseGenY].LiquidAmount > 0) - hellHouseGenY--; - - if (Main.tile[i, hellHouseGenY + 1].HasTile) - { - // Place house - // TODO -- Stip's houses will be generated here eventually - //WorldGen.HellHouse(i, hellHouseGenY); - - // Move index further along to keep houses spread apart - i += flatDistanceBetweenHellHouses + WorldGen.genRand.Next(maxRandomDistanceBetweenHouses); - - // Increment placed houses index and break loop once enough are placed - placedHouses++; - if (placedHouses >= maxHouses) - break; - } - } - } - // Placing torches in towers float torchAmountMult = Main.maxTilesX / 4200f; for (int torchIndex = 0; (float)torchIndex < 200f * torchAmountMult; torchIndex++) @@ -1505,5 +2165,56 @@ namespace CalamityMod.World } } } + + private static void FillAtriumChests(Chest chest, int Type, bool place) + { + int shadowChestItems = Utils.SelectRandom(WorldGen.genRand, ItemID.Sunfury, ItemID.FlowerofFire, ItemID.Flamelash, ItemID.DarkLance, ItemID.HellwingBow); + int shadowChestItems2 = Utils.SelectRandom(WorldGen.genRand, ItemID.HellMinecart, ItemID.OrnateShadowKey, ItemID.HellCake); + List contents = new List() + { + new ChestItem(shadowChestItems, 1), + new ChestItem(shadowChestItems2, 1), + new ChestItem(ItemID.ObsidianSkinPotion, WorldGen.genRand.Next(2, 5)), + new ChestItem(ItemID.LifeforcePotion, WorldGen.genRand.Next(2, 5)), + new ChestItem(ItemID.TeleportationPotion, WorldGen.genRand.Next(2, 5)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(3, 6)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + + private static void FillCacheChests(Chest chest, int Type, bool place) + { + int shadowChestItems = Utils.SelectRandom(WorldGen.genRand, ItemID.Sunfury, ItemID.FlowerofFire, ItemID.Flamelash, ItemID.DarkLance, ItemID.HellwingBow); + int barTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.MeteoriteBar, GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar); + int ammoTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.HellfireArrow, GenVars.silverBar == TileID.Silver ? ItemID.SilverBullet : ItemID.TungstenBullet); + int potionTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.ManaRegenerationPotion, ItemID.MagicPowerPotion, ItemID.InvisibilityPotion, ItemID.HunterPotion, ItemID.HeartreachPotion); + int potionTypes2 = Utils.SelectRandom(WorldGen.genRand, ItemID.GravitationPotion, ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.BattlePotion, ItemID.InfernoPotion); + int potionTypes3 = Utils.SelectRandom(WorldGen.genRand, ItemID.RecallPotion, ItemID.PotionOfReturn); + int lightSourceTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.Torch, ItemID.Glowstick); + List contents = new List() + { + new ChestItem(shadowChestItems, 1), + new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(1, 3)), + new ChestItem(barTypes, WorldGen.genRand.Next(15, 31)), + new ChestItem(ammoTypes, WorldGen.genRand.Next(50, 76)), + new ChestItem(ItemID.RestorationPotion, WorldGen.genRand.Next(15, 21)), + new ChestItem(potionTypes, WorldGen.genRand.Next(1, 3)), + new ChestItem(potionTypes2, WorldGen.genRand.Next(1, 3)), + new ChestItem(potionTypes3, WorldGen.genRand.Next(1, 3)), + new ChestItem(lightSourceTypes, WorldGen.genRand.Next(15, 31)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 5)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } } } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 5bb14468dc..9914b11e72 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -558,7 +558,7 @@ namespace CalamityMod.World new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(8, 14 + 1)), new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(7, 12 + 1)), new ChestItem(ItemID.HerbBag, WorldGen.genRand.Next(12, 17 + 1)), - new ChestItem(ItemID.DayBloomPlanterBox, WorldGen.genRand.Next(5, 9 + 1)), + //new ChestItem(ItemID.DayBloomPlanterBox, WorldGen.genRand.Next(5, 9 + 1)), Removed from the chest because they're placed within the lab new ChestItem(ItemID.BlinkrootPlanterBox, WorldGen.genRand.Next(5, 9 + 1)), new ChestItem(ItemID.FireBlossomPlanterBox, WorldGen.genRand.Next(5, 9 + 1)), new ChestItem(ItemID.MoonglowPlanterBox, WorldGen.genRand.Next(5, 9 + 1)), diff --git a/World/MechanicShed.cs b/World/MechanicShed.cs index 86d7e392ef..172e2fb573 100644 --- a/World/MechanicShed.cs +++ b/World/MechanicShed.cs @@ -106,8 +106,6 @@ namespace CalamityMod.World } Point placementPoint = new Point(placementPositionX, placementPositionY); - - Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); SchematicAnchor anchorType = SchematicAnchor.BottomCenter; bool place = true; diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index 22ac59402b..5fcae1af48 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -14,7 +14,7 @@ namespace CalamityMod.World.Planets public static void GenerateAllBasePlanetoids(GenerationProgress progress, GameConfiguration config) { - progress.Message = "Enriching low Terraria orbit"; + progress.Message = CalamityUtils.GetTextValue("UI.Planetoids"); var config2 = WorldGenConfiguration.FromEmbeddedPath("Terraria.GameContent.WorldBuilding.Configuration.json"); int GrassPlanetoidCount = Main.maxTilesX / 750; diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index f36f8899d5..03ea993426 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -93,18 +93,14 @@ namespace CalamityMod.World } ForLoop.Invoke(startPosX - biomeSize - 5, startPosX + biomeSize + 20, 15, (X) => { - float height = MathHelper.Lerp( - startPosY + 35, //top - startPosY - 15, //bottom - trapezoidLateralSteep(Utils.GetLerpValue(startPosX - biomeSize - 20, startPosX + biomeSize + 20, X))); - + float height = MathHelper.Lerp(startPosY + 35, startPosY - 15, trapezoidLateralSteep(Utils.GetLerpValue(startPosX - biomeSize - 20, startPosX + biomeSize + 20, X))); for (int Y = startPosY + 25; Y >= height; Y -= 10) { ShapeData circle = new ShapeData(); WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(30), Actions.Chain(new GenAction[] { - //new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle), + // new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle), })); WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); } @@ -116,66 +112,53 @@ namespace CalamityMod.World const int totalCuveDepth = 90; ForLoop.Invoke(startPosX - biomeSize - 10, startPosX - biomeSize + 200, 10, (x) => { - int curveDepth = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, x, true))); - + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, x, true))); for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) { ShapeData circle = new(); WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] { - //new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle), + // new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle) })); WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); } }); ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize + 10, 5, (x) => { - int curveDepth = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, x, true))); - + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, x, true))); for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) { ShapeData circle = new(); WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] { - //new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle), + // new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle) })); WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); } }); - //clear a smaller square out of the center where the biomes stuff will be - //Added curves to the top of the biome via curve depth -hpu 02/19/25 + // Clear a smaller square out of the center where the biomes stuff will be + // Added curves to the top of the biome via curve depth -hpu 02/19/25 ForLoop.Invoke(startPosX - biomeSize + 10, startPosX + biomeSize - 10, 1, (X) => { - int curveDepth = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, X, true))); - int curveDepth2 = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, X, true))); + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, X, true))); + int random = WorldGen.genRand.Next(-40, 10); for (int Y = startPosY - 25 + curveDepth + curveDepth2; Y <= startPosY + 50; Y++) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y + random), new Shapes.Mound(WorldGen.genRand.Next(7, 10),5), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + random), new Shapes.Mound(WorldGen.genRand.Next(7, 10), 5), Actions.Chain(new GenAction[] { - blotchMod.Output(circle) + blotchMod.Output(circle) })); WorldUtils.Gen(new Point(X, Y + random), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - new Actions.Clear() + new Actions.Clear() })); } }); @@ -192,7 +175,7 @@ namespace CalamityMod.World int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize + 27, startPosX - biomeSize + 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); }); ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize - 15, 20, (moundX) => @@ -205,7 +188,7 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); }); - + // // Makes a large platform in the middle of the Timeless Shores. @@ -217,13 +200,13 @@ namespace CalamityMod.World { // This makes the "stem" of the platform be thinner towards the base and then expand on the top. int thickness = (int)(MathF.Pow(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, platformX)), 3f) * platformDepth) + platformHeight; - for (int platformY = startPosY + platformHeight; platformY <= startPosY + thickness; platformY++) { WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] { - new Actions.ClearTile(), // Clears all tiles - new Actions.PlaceTile((ushort)ModContent.TileType()) // Places tiles. + // Clear all tiles and place tiles. + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()) })); } }); @@ -232,18 +215,15 @@ namespace CalamityMod.World float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, x, true)); int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); WorldUtils.Gen(new Point(x, startPosY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); - }); - const int furthestDistanceFromCenter = 100; - const int shortestDistanceFromCenter = 60; - const int holeStart = 10; - const int holeDepth = 80; - // Platu + }); + + // Plateau ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 100, (wallPillarX) => { int randomDisplacement = WorldGen.genRand.Next(-27, 46); int RandomX = Main.rand.Next(15, 20); int RandomH = Main.rand.Next(20, 35); - + for (int wallPillarY = startPosY + RandomH; wallPillarY <= startPosY + 60; wallPillarY += 10) { // Along the height of the pillar, it becomes shorter the more closer to the center we get. @@ -255,12 +235,13 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Circle(RandomX - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] { - blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. + // Applies a blotch filter to the rectangle. + blotchFilter.Output(rectangle) })); WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { - new Actions.SetTile((ushort)ModContent.TileType()) + new Actions.SetTile((ushort)ModContent.TileType()) })) ; } @@ -276,9 +257,11 @@ namespace CalamityMod.World Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; } }); + // // Generates pillars made out of walls at random points in the Timeless Shores. // + const int furthestDistanceFromCenter = 100; ForLoop.Invoke(startPosX - (biomeSize / 2) - furthestDistanceFromCenter, startPosX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => { int randomDisplacementX = WorldGen.genRand.Next(-10, 10); @@ -295,13 +278,13 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 15), Actions.Chain(new GenAction[] { - ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. - blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. + ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. + blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. })); WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { - new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. + new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. })) ; } @@ -313,18 +296,15 @@ namespace CalamityMod.World // ForLoop.Invoke(startPosX - biomeSize - 30, startPosX + biomeSize + 30, 20, (x) => { - int curveDepth = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 30, startPosX + biomeSize - 200, x, true))); - int curveDepth2 = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 30, startPosX - biomeSize + 200, x, true))); + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 30, startPosX + biomeSize - 200, x, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 30, startPosX - biomeSize + 200, x, true))); + for (int y = startPosY - 5; y >= startPosY - 149; y -= 15) { float interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - float ditherStrength = MathHelper.Lerp(0f, 0.0f, interpolator); + + // This lerp does absolutely nothing. - Fabsol + float ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { @@ -333,7 +313,8 @@ namespace CalamityMod.World new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); - // changing these makes the walls dither higher up than tiles, to prevent the biome from changing earlier than expected. still looks nice imo :) + + // Changing these makes the walls dither higher up than tiles, to prevent the biome from changing earlier than expected. Still looks nice imo :) interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 200, y, true); ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); @@ -345,7 +326,7 @@ namespace CalamityMod.World new Actions.PlaceWall((ushort)ModContent.WallType()), })); - // i forgot to change this one. :peepotired: + // I forgot to change this one. :peepotired: interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] @@ -377,41 +358,35 @@ namespace CalamityMod.World })); } } - - //place layer of sand on valid runestone blocks - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => + + // Place layer of sand on valid runestone blocks. + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => { for (int Y = startPosY - 100; Y <= startPosY + 100; Y++) { - bool canPlaceSand = false; - - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceSand = true; - } - + bool canPlaceSand = + Main.tile[X, Y].TileType == ModContent.TileType() && + !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && + !Main.tile[X, Y - 5].HasTile; + if (canPlaceSand) - { PlaceSand(X, Y, 5, ModContent.TileType()); - } - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + + // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { WorldGen.KillTile(X, Y); - } - //kill random single floating tiles + // Kill random single floating tiles if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { WorldGen.KillTile(X, Y); - } - //Timeless Shores ambiant tiles + + // Timeless Shores ambiant tiles //if (Main.tile[X, Y].TileType == ModContent.TileType()) //{ // //Driftwood Ambiance @@ -437,18 +412,16 @@ namespace CalamityMod.World }); - //slope tiles + // Slope tiles ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => { for (int Y = startPosY - 300; Y <= startPosY + 200; Y++) - { Tile.SmoothSlope(X, Y); - } }); }); } - //sides of the sunken sea (radiant reefs) + // Sides of the sunken sea (radiant reefs) public static void PlaceRadiantReefs(int startPosX, int startPosY) { int cavePerlinSeed = WorldGen.genRand.Next(); @@ -471,8 +444,8 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; - bool runonce = false; // this is used to make the wall on the left side go boom on the second run - //generate the actual caverns + // Generate the actual caverns + bool runOnce = false; // This is used to make the wall on the left side go boom on the second run for (int X = origin.X - biomeSize - 170; X <= origin.X + biomeSize + 170; X++) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) @@ -481,48 +454,39 @@ namespace CalamityMod.World { float percent = dist / constant; float blurPercent = 0.99f; - - if (percent > blurPercent) { - if (runonce = false) - //place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + if (!runOnce) { WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); - runonce = true; + runOnce = true; } - if (runonce = true) - //place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - { + + // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + if (runOnce) WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), false, 0f, 0f, true, true); - } } else { - //clear absolutely everything before generating the caverns + // Clear absolutely everything before generating the caverns Main.tile[X, Y].ClearEverything(); - //generate perlin noise caves + // Generate perlin noise caves float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 90f, Y / 90f, 3, unchecked(cavePerlinSeed + 1)) * 0.01f; float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, unchecked(cavePerlinSeed - 1)) + 0.5f; float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.380f; - //kill or place tiles depending on the noise map + // Kill or place tiles depending on the noise map if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { WorldGen.KillTile(X, Y); - } else - { WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); - } - - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through + // Place walls in the biome using a different "seed" so it differs from the cave generation + // This creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 2, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; @@ -530,13 +494,9 @@ namespace CalamityMod.World float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { WorldGen.PlaceWall(X, Y, ModContent.WallType()); - } if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) - { WorldGen.KillTile(X, Y); - } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; @@ -545,82 +505,70 @@ namespace CalamityMod.World } } - //cleanup + // Cleanup ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { WorldGen.KillTile(X, Y); - } - //kill random single floating tiles + // Kill random single floating tiles if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { WorldGen.KillTile(X, Y); - } } } }); - //place layer of sand blocks on valid surfaces + // Place layer of sand blocks on valid surfaces ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - bool canPlaceSand = false; - - //place sand clumps on top of exposed shellstone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceSand = true; - } + bool canPlaceSand = + Main.tile[X, Y].TileType == ModContent.TileType() && + !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && + !Main.tile[X, Y - 5].HasTile; + // Place sand clumps on top of exposed shellstone if (canPlaceSand) - { PlaceSand(X, Y, 5, ModContent.TileType()); - } } } }); - //cleanup again + // Cleanup again ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { WorldGen.KillTile(X, Y); - } - //kill random single floating tiles + // Kill random single floating tiles if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { WorldGen.KillTile(X, Y); - } - //if any sand is floating, put tiles below it + // If any sand is floating, put tiles below it if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) { WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); @@ -633,7 +581,7 @@ namespace CalamityMod.World }); } - //middle of the sunken sea (polyp forest) + // Middle of the sunken sea (polyp forest) public static void PlacePolypForest(int startPosX, int startPosY) { int cavePerlinSeed = WorldGen.genRand.Next(); @@ -656,7 +604,7 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; - //place the polyp forest caverns + // Place the polyp forest caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { for (int Y = (int)(origin.Y + verticalRadius * 0.4f) + 3; Y >= origin.Y - verticalRadius - 3; Y--) @@ -667,10 +615,10 @@ namespace CalamityMod.World float percent = dist / constant; float blurPercent = 0.98f; - //biome "blending" on the edges (disabled for now) + // Biome "blending" on the edges (disabled for now) if (percent > blurPercent) { - + if (Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) { ShapeData circle = new ShapeData(); @@ -714,7 +662,7 @@ namespace CalamityMod.World float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.235f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.3f; if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { @@ -780,7 +728,7 @@ namespace CalamityMod.World { PlaceSand(X, Y, 4, ModContent.TileType()); } - + } } }); @@ -806,7 +754,7 @@ namespace CalamityMod.World } } }); - + //cleanup again ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => @@ -1404,7 +1352,7 @@ namespace CalamityMod.World { ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - + ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] @@ -1510,8 +1458,8 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 2); } } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { //stalactites if (WorldGen.genRand.NextBool(10)) { @@ -1525,7 +1473,7 @@ namespace CalamityMod.World { WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } - + //stalagmites if (WorldGen.genRand.NextBool(12)) @@ -1761,7 +1709,7 @@ namespace CalamityMod.World } if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) { - if (WorldGen.genRand.NextBool(1)) + if (WorldGen.genRand.NextBool()) { WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); } diff --git a/icon.png b/icon.png index bcc6cce92b..80069a3be1 100644 Binary files a/icon.png and b/icon.png differ diff --git a/icon_workshop.png b/icon_workshop.png index df0f63ecf2..1edebb0978 100644 Binary files a/icon_workshop.png and b/icon_workshop.png differ