diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 4a53e1304f..f13faa6246 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4812,7 +4812,7 @@ namespace CalamityMod.CalPlayer Player.velocity.Y = 0.5f; } else - Player.velocity.Y = 0f; + Player.velocity.Y = 1E-05f; if (CalamityKeybinds.ExoChairSlowdownHotkey.Current) Player.velocity *= 0.5f; @@ -6053,7 +6053,10 @@ namespace CalamityMod.CalPlayer float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size * 0.4f; if (ProfanedMoonlightAuroraDrawer is null || ProfanedMoonlightAuroraDrawer.Size != size) + { + ProfanedMoonlightAuroraDrawer?.Dispose(); ProfanedMoonlightAuroraDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f); + } int sourceArea = (int)Math.Ceiling(6f / ProfanedMoonlightAuroraDrawer.Scale) + 1; ProfanedMoonlightAuroraDrawer.ShouldUpdate = Player.miscCounter % 2 == 0; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index b25b3a0648..7f42739dd9 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -709,7 +709,10 @@ namespace CalamityMod.ILEditing ref FluidField calamityFireDrawer = ref player.Calamity().CalamityFireDrawer; ref Vector2 firePosition = ref player.Calamity().FireDrawerPosition; if (calamityFireDrawer is null || calamityFireDrawer.Size != size) + { + calamityFireDrawer?.Dispose(); calamityFireDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f); + } // Update the fire draw position. firePosition = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 5279d97606..509c7bad01 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -394,8 +394,9 @@ namespace CalamityMod.Items if (showTheTip) { - var str = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"].First().ToString(); - tooltips.Insert(++lastTooltipIndex, (new TooltipLine(Mod, "CalamityMod:AltExpandTooltip", CalamityUtils.GetTextValue("Misc.AltExpand").Replace("{0}", str)))); + var bind = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"]; + string str = bind.Count == 0 ? GetTextValue("Misc.HotkeyNotBound") : bind.First().ToString(); + tooltips.Insert(++lastTooltipIndex, (new TooltipLine(Mod, "CalamityMod:AltExpandTooltip", GetTextValue("Misc.AltExpand").Replace("{0}", str)))); tooltips[lastTooltipIndex].OverrideColor = new Color(170, 170, 170); } else if (foundDebuff) diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index cc4ed7049d..fc1d07b505 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 66; Item.height = 82; - Item.damage = 290; + Item.damage = 333; Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 8292bc329c..bab713548b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -731,11 +731,7 @@ SquirrelSquireStaff: { StaffOfNecrosteocytes: { DisplayName: Staff of Necrosteocytes - Tooltip: - ''' - Summons small skeletons to fight for you - The skeletons leave behind bone cells as they move - ''' + Tooltip: Summons small skeletons to fight for you } StarspawnHelixStaff: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index c7ede7f1b5..f259231f8f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -184,7 +184,6 @@ PrinceFlameSmall.DisplayName: Holy Fire RainbowComet.DisplayName: Comet RainbowRocket.DisplayName: Rainbow Rocket RancorArm.DisplayName: Vengeful Arm -RancorFog.DisplayName: The Fog Is Coming RancorLargeCinder.DisplayName: Lava Cinder RancorLaserbeam.DisplayName: The Angy Beam RancorMagicCircle.DisplayName: Magic Circle diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 13eaba493e..c674e58cd9 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -7,6 +7,7 @@ using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; @@ -208,7 +209,8 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().newAI[0]++; if (NPC.Calamity().newAI[0] % 5 == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + RancorFog fog = new(NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs); RancorLavaMetaball.SpawnParticle(NPC.Bottom + Main.rand.NextVector2Circular(10f, 10f), 135f); } if (NPC.Calamity().newAI[0] % 30 == 0 && Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 009ac238f8..732b8af651 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4510,8 +4510,10 @@ namespace CalamityMod.NPCs if (ashesOnDeath > 0) { if (Main.rand.NextBool(4)) - Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0.475f); - + { + RancorFog fog = new(npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), 180, Main.rand.NextFloat(0.45f, 0.75f), Main.rand.NextFloat(MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs); + } if (Main.rand.NextBool(6)) { Vector2 randomPosition = new(npc.position.X + Main.rand.NextFloat(-10f, npc.width + 10f), npc.position.Y + Main.rand.NextFloat(-10f, npc.height + 10f)); diff --git a/Particles/RancorFog.cs b/Particles/RancorFog.cs new file mode 100644 index 0000000000..924ea7d408 --- /dev/null +++ b/Particles/RancorFog.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod.Particles +{ + public class RancorFog : Particle + { + private float Opacity = 0f; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public RancorFog(Vector2 position, Vector2 velocity, int lifetime, float scale, float rotation) + { + Position = position; + Velocity = velocity; + Lifetime = lifetime; + Scale = scale; + Rotation = rotation; + } + + public override void Update() + { + Rotation += Velocity.X * 0.004f; + Velocity *= 0.985f; + Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 90f, Time, true); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = GeneralParticleHandler.GetTexture(Type); + float opacity = Opacity * 0.5f; + Color drawColor = new Color(236, 0, 68) * opacity; + Main.EntitySpriteDraw(texture, Position - Main.screenPosition, null, drawColor, Rotation, texture.Size() * 0.5f, Scale, SpriteEffects.None); + } + } +} diff --git a/Projectiles/Magic/RancorFog.png b/Particles/RancorFog.png similarity index 100% rename from Projectiles/Magic/RancorFog.png rename to Particles/RancorFog.png diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs deleted file mode 100644 index bc4ee599e4..0000000000 --- a/Projectiles/Magic/RancorFog.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class RancorFog : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public ref float LightPower => ref Projectile.ai[0]; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 184; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.timeLeft = 210; - Projectile.hide = true; - Projectile.ignoreWater = true; - } - - public override void AI() - { - // Decide scale and initial rotation on the first frame this projectile exists. - if (Projectile.localAI[0] == 0f) - { - Projectile.scale = Main.rand.NextFloat(1f, 1.7f) * Projectile.ai[1]; - Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); - Projectile.localAI[0] = 1f; - } - - Projectile.rotation += Projectile.velocity.X * 0.004f; - Projectile.velocity *= 0.985f; - - // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.dedServ) - return; - - // Calculate light power. This checks below the position of the fog to check if this fog is underground. - // Without this, it may render over the fullblack that the game renders for obscured tiles. - float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); - LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); - Projectile.Opacity = Utils.GetLerpValue(210f, 195f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); - } - - public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) - { - behindNPCsAndTiles.Add(index); - } - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.SetBlendState(BlendState.Additive); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Vector2 origin = texture.Size() * 0.5f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f; - Color drawColor = new Color(236, 0, 68) * opacity; - Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale; - Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0); - - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - return false; - } - } -} diff --git a/Projectiles/Magic/RancorHoldout.cs b/Projectiles/Magic/RancorHoldout.cs index 8091e26805..0b1e159ae2 100644 --- a/Projectiles/Magic/RancorHoldout.cs +++ b/Projectiles/Magic/RancorHoldout.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic // Cast the magic circle on the first frame. if (Main.myPlayer == Projectile.owner && Time == 1f) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner); // Handle frames. Projectile.frameCounter++; diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index c79eea665f..be82b4092d 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -4,6 +4,7 @@ using System.Linq; using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -128,7 +129,8 @@ namespace CalamityMod.Projectiles.Magic public void CreateTileHitEffects() { Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner, 0f, 1f); + RancorFog fog = new(endOfLaser, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs); if (Main.rand.NextBool()) { diff --git a/Projectiles/Magic/RancorMagicCircle.cs b/Projectiles/Magic/RancorMagicCircle.cs index 908e460f4d..33ecd8b802 100644 --- a/Projectiles/Magic/RancorMagicCircle.cs +++ b/Projectiles/Magic/RancorMagicCircle.cs @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Zombie104, Projectile.Center); if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.identity); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner, Projectile.identity); } } diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index 649136df35..b00bfce76c 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged public class AuroraFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; + public override string Texture => "CalamityMod/Particles/RancorFog"; public static int Lifetime => 480; public static int Fadetime => 450; diff --git a/Projectiles/Ranged/BlissfulBombardierHoldout.cs b/Projectiles/Ranged/BlissfulBombardierHoldout.cs index 5fcbb6ddc3..d2cbdc12f4 100644 --- a/Projectiles/Ranged/BlissfulBombardierHoldout.cs +++ b/Projectiles/Ranged/BlissfulBombardierHoldout.cs @@ -96,8 +96,14 @@ namespace CalamityMod.Projectiles.Ranged } public override void HoldoutAI() { - // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. - if (Owner.CantUseHoldout() && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f)) + // If there's no player, or the player isn't holding fire, or the player's stunned, there'll be no holdout. + // The holdout will persist if on cooldown, but it is absolutely imperative that it can disappear if dead, CCed, etc. + if (Owner == null || !Owner.active || Owner.dead || Owner.CCed || Owner.noItems) + { + Projectile.Kill(); + return; + } + if (!Owner.channel && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f)) { Projectile.Kill(); return; diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index 9a9a0820d6..4f823e1c52 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Ranged public class PristineSecondary : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; + public override string Texture => "CalamityMod/Particles/RancorFog"; public ref float ScaleFactor => ref Projectile.ai[0]; public float LightPower = 0; diff --git a/Projectiles/Rogue/AntlionSkewerSandCloud.cs b/Projectiles/Rogue/AntlionSkewerSandCloud.cs index dae0dba88c..2e08edf867 100644 --- a/Projectiles/Rogue/AntlionSkewerSandCloud.cs +++ b/Projectiles/Rogue/AntlionSkewerSandCloud.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue public class AntlionSkewerSandCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog"; + public override string Texture => "CalamityMod/Particles/RancorFog"; public ref float CloudHue => ref Projectile.ai[0]; public override void SetDefaults() diff --git a/Scenes/MusicScenes/ProvidenceMusicScene.cs b/Scenes/MusicScenes/ProvidenceMusicScene.cs index 57c5e761e3..83bad91d2c 100644 --- a/Scenes/MusicScenes/ProvidenceMusicScene.cs +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -21,10 +21,11 @@ namespace CalamityMod.Systems if (ProvidenceSpawnState() == 180f) Main.musicFade[ProvidenceTrack] = 1f; } + public static float ProvidenceSpawnState() { int provIndex = CalamityGlobalNPC.holyBoss; - if (provIndex < 0 || provIndex >= Main.maxNPCs || !Main.npc[provIndex].active) + if (!Main.npc.IndexInRange(provIndex)) return -1f; var prov = Main.npc[provIndex]; diff --git a/Tiles/Furniture/Paintings/BaseCanvasPainting.cs b/Tiles/Furniture/Paintings/BaseCanvasPainting.cs index 6c036b064e..ebf85fd7f9 100644 --- a/Tiles/Furniture/Paintings/BaseCanvasPainting.cs +++ b/Tiles/Furniture/Paintings/BaseCanvasPainting.cs @@ -93,18 +93,18 @@ namespace CalamityMod.Tiles.Furniture.Paintings var t = Main.tile[i, j]; var texture = TextureAssets.Tile[Type].Value; var cube = CalamityUtils.FindTileEntity(i, j, 1, 1); - var pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset; if (cube != null && t.TileFrameX == 0) { var fPX = (int)cube.framePosition.X; var fPY = (int)cube.framePosition.Y; var scale = (int)(texture.Width * 0.1f * cube.scale); + var rasterizer = Main.LocalPlayer.gravDir == -1f ? RasterizerState.CullNone : Main.Rasterizer; spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, rasterizer, null); spriteBatch.Draw(texture, pos - Main.screenPosition, new Rectangle(fPX, fPY, scale, scale), Lighting.GetColor(i, j), 0, new Vector2(0, 0), 1 / cube.scale * Scale, 0, 0); spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, null); + spriteBatch.Begin(); } // Calculate and draw the borders if (t.TileFrameX == 0 && t.TileFrameY == 0) diff --git a/World/CustomConditions.cs b/World/CustomConditions.cs index 67badca1ee..337a4e3d78 100644 --- a/World/CustomConditions.cs +++ b/World/CustomConditions.cs @@ -33,7 +33,7 @@ namespace CalamityMod.World public class SolidOrPlatform : GenCondition { - protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(x, y); + protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(Framing.GetTileSafely(x, y)); } public class IsNotTouchingAir : GenCondition