diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs deleted file mode 100644 index 40f8c46216..0000000000 --- a/Buffs/DamageOverTime/HeavyBleeding.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.DamageOverTime -{ - public class HeavyBleeding : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavy Bleeding"); - Description.SetDefault("You're losing a lot of blood"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) => player.Calamity().waterLeechBleeding = true; - } -} diff --git a/Buffs/DamageOverTime/HeavyBleeding.png b/Buffs/DamageOverTime/HeavyBleeding.png deleted file mode 100644 index 26ea11ef6b..0000000000 Binary files a/Buffs/DamageOverTime/HeavyBleeding.png and /dev/null differ diff --git a/Buffs/StatBuffs/Afflicted.png b/Buffs/StatBuffs/Afflicted.png index a18eba6244..cbabb0498f 100644 Binary files a/Buffs/StatBuffs/Afflicted.png and b/Buffs/StatBuffs/Afflicted.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5343c75a2f..653b0bf2a3 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -91,7 +91,6 @@ namespace CalamityMod.CalPlayer public static int chaosStateDuration_NR = 1200; public bool killSpikyBalls = false; public double acidRoundMultiplier = 1D; - public int waterLeechTarget = -1; public float KameiTrailXScale = 0.1f; public int KameiBladeUseDelay = 0; public Vector2[] OldPositions = new Vector2[4]; @@ -125,6 +124,7 @@ namespace CalamityMod.CalPlayer public DoGCartSegment[] DoGCartSegments = new DoGCartSegment[DoGCartMount.SegmentCount]; public float SmoothenedMinecartRotation; public bool LungingDown = false; + public Vector2? BossRushReturnPosition = null; public float moveSpeedBonus = 0f; public int momentumCapacitorTime = 0; @@ -225,6 +225,7 @@ namespace CalamityMod.CalPlayer public int aBulwarkRareTimer = 0; public int spiritOriginBullseyeShootCountdown = 0; public int spiritOriginConvertedCrit = 0; + public int RustyMedallionCooldown = 0; public float SulphWaterPoisoningLevel; private const int DashDisableCooldown = 12; @@ -571,7 +572,7 @@ namespace CalamityMod.CalPlayer public int phantomicHeartRegen = 0; // 0 = can spawn, 720 = regen applied, 600 = regen stops and 10 sec cd before it can spawn again public bool silvaWings = false; public int icicleCooldown = 0; - public bool rustyMedal = false; + public bool RustyMedallionDroplets = false; public bool noStupidNaturalARSpawns = false; public bool roverDrive = false; public int roverDriveTimer = 0; @@ -773,7 +774,6 @@ namespace CalamityMod.CalPlayer public bool iCantBreathe = false; //Frozen Lungs debuff public bool cragsLava = false; public bool vaporfied = false; - public bool waterLeechBleeding = false; public bool banishingFire = false; public bool wither = false; public bool ManaBurn = false; @@ -1647,7 +1647,7 @@ namespace CalamityMod.CalPlayer camper = false; silvaWings = false; corrosiveSpine = false; - rustyMedal = false; + RustyMedallionDroplets = false; noStupidNaturalARSpawns = false; roverDrive = false; rottenDogTooth = false; @@ -1807,7 +1807,6 @@ namespace CalamityMod.CalPlayer iCantBreathe = false; cragsLava = false; vaporfied = false; - waterLeechBleeding = false; banishingFire = false; wither = false; ManaBurn = false; @@ -2124,6 +2123,7 @@ namespace CalamityMod.CalPlayer auralisAurora = 0; fungalSymbioteTimer = 0; aBulwarkRareTimer = 0; + RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; spiritOriginConvertedCrit = 0; rage = 0f; @@ -2195,7 +2195,6 @@ namespace CalamityMod.CalPlayer iCantBreathe = false; cragsLava = false; vaporfied = false; - waterLeechBleeding = false; banishingFire = false; wither = false; #endregion @@ -3061,166 +3060,77 @@ namespace CalamityMod.CalPlayer #endregion #region TeleportMethods - public void HandleTeleport(int teleportType, bool forceHandle = false, int whoAmI = 0) - { - bool syncData = forceHandle || Main.netMode == NetmodeID.SinglePlayer; - if (syncData) - { - TeleportPlayer(teleportType, forceHandle, whoAmI); - } - else - { - SyncTeleport(teleportType); - } - } - - public static void TeleportPlayer(int teleportType, bool syncData = false, int whoAmI = 0) - { - Player player; - if (!syncData) - { - player = Main.LocalPlayer; - } - else - { - player = Main.player[whoAmI]; - } - switch (teleportType) - { - case 0: - UnderworldTeleport(player, syncData); - break; - case 1: - DungeonTeleport(player, syncData); - break; - case 2: - JungleTeleport(player, syncData); - break; - default: - break; - } - } - - public void SyncTeleport(int teleportType) - { - ModPacket netMessage = Mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.TeleportPlayer); - netMessage.Write(teleportType); - netMessage.Send(); - } - - public static void UnderworldTeleport(Player player, bool syncData = false) - { - if (Main.netMode == NetmodeID.SinglePlayer) - player.DemonConch(); - else if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) - NetMessage.SendData(MessageID.RequestTeleportationByServer, -1, -1, null, 2); - } - - public static void DungeonTeleport(Player player, bool syncData = false) - { - ModTeleport(player, new Vector2(Main.dungeonX, Main.dungeonY), syncData, true); - } - - public static void JungleTeleport(Player player, bool syncData = false) + public static Vector2? GetJunglePosition(Player player) { + bool canSpawn = false; int teleportStartX = Abyss.AtLeftSideOfWorld ? (int)(Main.maxTilesX * 0.65) : (int)(Main.maxTilesX * 0.2); int teleportRangeX = (int)(Main.maxTilesX * 0.15); - int teleportStartY = (int)Main.worldSurface - 75; int teleportRangeY = 50; - bool flag = false; - int num = 0; - int num2 = 0; - int num3 = 0; - int width = player.width; - Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height); - while (!flag && num < 1000) - { - num++; - num2 = teleportStartX + Main.rand.Next(teleportRangeX); - num3 = teleportStartY + Main.rand.Next(teleportRangeY); - vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height); - if (!Collision.SolidCollision(vector, width, player.height)) - { - int i = 0; - while (i < 100) - { - Tile tile = Main.tile[num2, num3 + i]; - vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height); - Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height); - if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X) - { - bool arg_1FE_0 = vector2.Y == vector.Y; - } - if (arg_1FF_0) - { - i++; - } - else - { - if (tile.HasTile && !tile.HasUnactuatedTile && Main.tileSolid[(int)tile.TileType]) - { - break; - } - i++; - } - } - if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f) - { - Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false); - if (Collision.SolidCollision(vector, width, player.height) && i < 99) - { - Vector2 vector3 = Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitX * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - vector3 = -Vector2.UnitY * 16f; - if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) - { - flag = true; - break; - } - } - } - } - } - } - } - } - if (!flag) - { - return; - } + Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings + { + mostlySolidFloor = true, + avoidAnyLiquid = true, + avoidLava = true, + avoidHurtTiles = true, + avoidWalls = true, + attemptsBeforeGivingUp = 1000, + maximumFallDistanceFromOrignalPoint = 30 + }; - ModTeleport(player, vector, syncData, false); + Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, teleportRangeY, settings); + + if (canSpawn) + { + return (Vector2?)vector; + } + return null; } - public static void ModTeleport(Player player, Vector2 pos, bool syncData = false, bool convertFromTiles = false) + public static Vector2? GetUnderworldPosition(Player player) + { + bool canSpawn = false; + int num = Main.maxTilesX / 2; + int num2 = 100; + int num3 = num2 / 2; + int teleportStartY = Main.UnderworldLayer + 20; + int teleportRangeY = 80; + Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings + { + mostlySolidFloor = true, + avoidAnyLiquid = true, + avoidLava = true, + avoidHurtTiles = true, + avoidWalls = true, + attemptsBeforeGivingUp = 1000, + maximumFallDistanceFromOrignalPoint = 30 + }; + + Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num3, num2, teleportStartY, teleportRangeY, settings); + if (!canSpawn) + vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num2, num3, teleportStartY, teleportRangeY, settings); + + if (!canSpawn) + vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num + num3, num3, teleportStartY, teleportRangeY, settings); + + if (canSpawn) + { + return (Vector2?)vector; + } + return null; + } + + public static void ModTeleport(Player player, Vector2 pos, bool playSound = true, int style = TeleportationStyleID.RecallPotion) { bool postImmune = player.immune; int postImmuneTime = player.immuneTime; - if (convertFromTiles) - { - pos = new Vector2(pos.X * 16 + 8 - player.width / 2, pos.Y * 16 - player.height); - } - player.grappling[0] = -1; - player.grapCount = 0; - for (int index = 0; index < Main.maxProjectiles; ++index) - { - if (Main.projectile[index].active && Main.projectile[index].owner == player.whoAmI && Main.projectile[index].aiStyle == 7) - { - Main.projectile[index].Kill(); - } - } - player.Teleport(pos, 2, 0); + player.StopVanityActions(false); + player.RemoveAllGrapplingHooks(); + player.Teleport(pos, style); + if (Main.netMode == NetmodeID.Server) + RemoteClient.CheckSection(player.whoAmI, player.Center); + NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, style, 0, 0); player.velocity = Vector2.Zero; player.immune = postImmune; player.immuneTime = postImmuneTime; @@ -3230,16 +3140,8 @@ namespace CalamityMod.CalPlayer } Main.TeleportEffect(player.getRect(), 1); Main.TeleportEffect(player.getRect(), 3); - SoundEngine.PlaySound(SoundID.Item6, player.position); - if (Main.netMode != NetmodeID.Server) - { - return; - } - if (syncData) - { - RemoteClient.CheckSection(player.whoAmI, player.position, 1); - NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, 3, 0, 0); - } + if (playSound) + SoundEngine.PlaySound(SoundID.Item6, player.Center); } #endregion @@ -3982,10 +3884,6 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(Player.name + " fell prey to their sins."); } - if (waterLeechBleeding) - { - damageSource = PlayerDeathReason.ByCustomReason(Player.name + " lost too much blood."); - } if (shadowflame) { damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s spirit was turned to ash."); @@ -5265,24 +5163,20 @@ namespace CalamityMod.CalPlayer } } - if (rustyMedal) + if (RustyMedallionDroplets && RustyMedallionCooldown <= 0) { if (item.CountsAsClass()) { - if (Main.rand.NextBool(5)) + int d = (int)Player.GetTotalDamage().ApplyTo(Items.Accessories.RustyMedallion.AcidDropBaseDamage); + Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; + Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); + int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType(), d, 0f, Player.whoAmI); + if (drop.WithinBounds(Main.maxProjectiles)) { - for (int i = 0; i < 3; i++) - { - Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; - Vector2 directionToMouse = (startingPosition - Main.MouseWorld).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); - int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3), 0f, Player.whoAmI); - if (drop.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[drop].penetrate = 2; - Main.projectile[drop].DamageType = DamageClass.Generic; - } - } + Main.projectile[drop].penetrate = 2; + Main.projectile[drop].DamageType = DamageClass.Generic; } + RustyMedallionCooldown = RustyMedallion.AcidCreationCooldown; } } @@ -6824,7 +6718,6 @@ namespace CalamityMod.CalPlayer int frame = HandlePSCAnimationFrames(animType); Player.legFrame.Y = Player.legFrame.Height * frame; } - waterLeechTarget = -1; } #endregion diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 1e7155e0e3..eefa9b0d24 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -220,19 +220,6 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 60; } - if (waterLeechBleeding) - { - if (Player.lifeRegen > 0) - Player.lifeRegen = 0; - - Player.lifeRegenTime = 0; - lifeRegenLost += 6; - if (DownedBossSystem.downedAquaticScourge) - lifeRegenLost += 6; - if (DownedBossSystem.downedPolterghast) - lifeRegenLost += 12; - } - if (pFlames) { if (Player.lifeRegen > 0) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index fb29d51169..07eae50cc3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1221,6 +1221,8 @@ namespace CalamityMod.CalPlayer monolithAccursedShader--; if (miningSetCooldown > 0) miningSetCooldown--; + if (RustyMedallionCooldown > 0) + RustyMedallionCooldown--; // God Slayer Armor dash debuff immunity if (DashID == GodSlayerDash.ID && Player.dashDelay < 0) diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index c0ec0cd579..89ddf81c54 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -193,9 +193,6 @@ namespace CalamityMod int countdown3 = reader.ReadInt32(); BossRushEvent.HostileProjectileKillCounter = countdown3; break; - case CalamityModMessageType.TeleportPlayer: - Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI); - break; // // Acid Rain @@ -357,7 +354,6 @@ namespace CalamityMod BossRushEndTimer, EndBossRush, BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames". - TeleportPlayer, // also used by Astral Arcanum. // Acid Rain AcidRainSync, diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index a2830d2e3c..40ec339aae 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Effects public static Effect SideStreakTrailShader; public static Effect HeavenlyGaleTrailShader; public static Effect HeavenlyGaleLightningShader; + public static Effect PrimTextureOverlayShader; public static Effect BaseFusableParticleEdgeShader; public static Effect AdditiveFusableParticleEdgeShader; @@ -87,6 +88,7 @@ namespace CalamityMod.Effects SideStreakTrailShader = CalamityMod.Instance.Assets.Request("Effects/SideStreakTrail", AssetRequestMode.ImmediateLoad).Value; HeavenlyGaleTrailShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleTrailShader", AssetRequestMode.ImmediateLoad).Value; HeavenlyGaleLightningShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleLightningShader", AssetRequestMode.ImmediateLoad).Value; + PrimTextureOverlayShader = CalamityMod.Instance.Assets.Request("Effects/PrimTextureOverlayShader", AssetRequestMode.ImmediateLoad).Value; BaseFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/BaseFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; AdditiveFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; @@ -129,6 +131,7 @@ namespace CalamityMod.Effects GameShaders.Misc["CalamityMod:SideStreakTrail"] = new MiscShaderData(new Ref(SideStreakTrailShader), "TrailPass"); GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"] = new MiscShaderData(new Ref(HeavenlyGaleTrailShader), "PiercePass"); GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"] = new MiscShaderData(new Ref(HeavenlyGaleLightningShader), "TrailPass"); + GameShaders.Misc["CalamityMod:PrimitiveTexture"] = new MiscShaderData(new Ref(PrimTextureOverlayShader), "TrailPass"); GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"] = new MiscShaderData(new Ref(BaseFusableParticleEdgeShader), "ParticlePass"); GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"] = new MiscShaderData(new Ref(AdditiveFusableParticleEdgeShader), "ParticlePass"); diff --git a/Effects/PrimTextureOverlayShader.fx b/Effects/PrimTextureOverlayShader.fx new file mode 100644 index 0000000000..d4b7a4abed --- /dev/null +++ b/Effects/PrimTextureOverlayShader.fx @@ -0,0 +1,66 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; +float2 uPrimitiveSize; +bool flipVertically; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates * uPrimitiveSize / uImageSize1; + coords.x = 1 - frac(coords.x); + coords.y = saturate(input.TextureCoordinates.y); + if (flipVertically) + coords.y = 1 - coords.y; + + float4 texColor = tex2D(uImage1, coords); + return texColor * input.Color; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/PrimTextureOverlayShader.xnb b/Effects/PrimTextureOverlayShader.xnb new file mode 100644 index 0000000000..f139435fc6 Binary files /dev/null and b/Effects/PrimTextureOverlayShader.xnb differ diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index dce85d6dcc..a8ae4cf92f 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -132,8 +132,7 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 0.75f, AcidRainSpawnRequirement.Anywhere) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) } + { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) } }; PossibleEnemiesAS = new() { @@ -144,7 +143,6 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) } }; PossibleEnemiesPolter = new() @@ -156,7 +154,6 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) } }; diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index c60f91356e..dbb5a592ef 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -225,7 +225,7 @@ namespace CalamityMod.Events new Boss(NPCID.Golem, TimeChangeContext.Day, type => { - int shittyStatueBoss = NPC.NewNPC(Source, (int)(Main.player[ClosestPlayerToWorldCenter].position.X + Main.rand.Next(-100, 101)), (int)(Main.player[ClosestPlayerToWorldCenter].position.Y - 400f), type, 1); + int shittyStatueBoss = NPC.NewNPC(Source, (int)(Main.player[ClosestPlayerToWorldCenter].position.X + Main.rand.Next(-100, 101)), (int)(Main.player[ClosestPlayerToWorldCenter].position.Y - 600f), type, 1); Main.npc[shittyStatueBoss].timeLeft *= 20; CalamityUtils.BossAwakenMessage(shittyStatueBoss); }, permittedNPCs: new int[] { NPCID.GolemFistLeft, NPCID.GolemFistRight, NPCID.GolemHead, NPCID.GolemHeadFree }), @@ -313,6 +313,16 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), spawnContext: type => { + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + if (p.FindBuffIndex(ModContent.BuffType()) > -1) + p.ClearBuff(ModContent.BuffType()); + } + } + Player player = Main.player[ClosestPlayerToWorldCenter]; SoundEngine.PlaySound(RuneofKos.CVSound, player.Center); @@ -384,18 +394,9 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), spawnContext: type => { - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player = Main.player[playerIndex]; - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); - } - } SoundEngine.PlaySound(SupremeCalamitas.SpawnSound, Main.player[ClosestPlayerToWorldCenter].Center); CalamityUtils.SpawnBossBetter(Main.player[ClosestPlayerToWorldCenter].Top - new Vector2(42f, 84f), type); - }, specialSpawnCountdown: 420, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + }, specialSpawnCountdown: 840, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), // new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), @@ -407,6 +408,22 @@ namespace CalamityMod.Events { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierOneEndText", XerocTextColor); CreateTierAnimation(2); + + // Teleport players to where they came from + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + if (p.Calamity().BossRushReturnPosition.HasValue) + { + CalamityPlayer.ModTeleport(p, p.Calamity().BossRushReturnPosition.Value, false); + p.Calamity().BossRushReturnPosition = null; + } + p.Calamity().BossRushReturnPosition = null; + SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center); + } + } }, [NPCID.Plantera] = npc => { @@ -593,6 +610,16 @@ namespace CalamityMod.Events public static void End() { + // Reset BossRushReturnPosition + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + p.Calamity().BossRushReturnPosition = null; + } + } + if (Main.netMode == NetmodeID.SinglePlayer) { EndEffects(); @@ -678,6 +705,20 @@ namespace CalamityMod.Events BossRushStage++; CalamityUtils.KillAllHostileProjectiles(); HostileProjectileKillCounter = 3; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + p.Calamity().BossRushReturnPosition = p.Center; + Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p); + if (!underworld.HasValue) + break; + CalamityPlayer.ModTeleport(p, underworld.Value, false); + SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center); + } + } } // This is the generic form of "Are there any remaining NPCs on the boss list for this boss rush stage?" check. diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index e521f228eb..355fcbe2f1 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -9,11 +9,16 @@ namespace CalamityMod.Items.Accessories { public class RustyMedallion : ModItem { + public const int AcidDropBaseDamage = 9; + + // BAD Minishark! You will NOT become stupid sleeper agent item! + public const int AcidCreationCooldown = 25; + public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Rusty Medallion"); - Tooltip.SetDefault("Causes most ranged weapons to sometimes release acid droplets from the sky\n" + + Tooltip.SetDefault("Causes most ranged weapons to release acid droplets from the sky\n" + "Grants immunity to Irradiated"); } @@ -29,7 +34,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rustyMedal = true; + modPlayer.RustyMedallionDroplets = true; player.buffImmune[ModContent.BuffType()] = true; } diff --git a/Items/Placeables/Banners/WaterLeechBanner.cs b/Items/Placeables/Banners/WaterLeechBanner.cs deleted file mode 100644 index feaeeaf974..0000000000 --- a/Items/Placeables/Banners/WaterLeechBanner.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CalamityMod.Tiles; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Banners -{ - public class WaterLeechBanner : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Water Leech"); - } - - public override void SetDefaults() - { - Item.width = 10; - Item.height = 24; - Item.maxStack = 99; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 114; - } - } -} diff --git a/Items/Placeables/Banners/WaterLeechBanner.png b/Items/Placeables/Banners/WaterLeechBanner.png deleted file mode 100644 index 7774a58ccf..0000000000 Binary files a/Items/Placeables/Banners/WaterLeechBanner.png and /dev/null differ diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.cs b/Items/SummonItems/Invasion/MartianDistressBeacon.cs deleted file mode 100644 index 896dea699e..0000000000 --- a/Items/SummonItems/Invasion/MartianDistressBeacon.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.SummonItems.Invasion -{ - public class MartianDistressBeacon : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Martian Distress Beacon"); - Tooltip.SetDefault("Summons the Martian Madness\n" + - "Not consumable"); - ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear - } - - public override void SetDefaults() - { - Item.width = 30; - Item.height = 60; - Item.maxStack = 1; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 10; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.consumable = false; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; - } - - public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; - - public override bool? UseItem(Player player) - { - Main.StartInvasion(InvasionID.MartianMadness); - return true; - } - } -} diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.png b/Items/SummonItems/Invasion/MartianDistressBeacon.png deleted file mode 100644 index 32afb9a520..0000000000 Binary files a/Items/SummonItems/Invasion/MartianDistressBeacon.png and /dev/null differ diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs new file mode 100644 index 0000000000..d3dbfe6ba4 --- /dev/null +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.Invasion +{ + [LegacyName("MartianDistressBeacon")] + public class MartianDistressRemote : ModItem + { + public int frameCounter = 0; + public int frame = 0; + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Martian Distress Remote"); + Tooltip.SetDefault("Summons the Martian Madness\n" + + "Not consumable"); + ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Solar Tablet / Bloody Tear + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 52; + Item.maxStack = 1; + Item.rare = ItemRarityID.Yellow; + Item.useAnimation = 10; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = false; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } + + public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; + + public override bool? UseItem(Player player) + { + Main.StartInvasion(InvasionID.MartianMadness); + return true; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Invasion/MartianDistressRemote_Animated").Value; + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Invasion/MartianDistressRemote_Animated").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.png b/Items/SummonItems/Invasion/MartianDistressRemote.png new file mode 100644 index 0000000000..d54d3ecba2 Binary files /dev/null and b/Items/SummonItems/Invasion/MartianDistressRemote.png differ diff --git a/Items/SummonItems/Invasion/MartianDistressRemote_Animated.png b/Items/SummonItems/Invasion/MartianDistressRemote_Animated.png new file mode 100644 index 0000000000..b2aa585e34 Binary files /dev/null and b/Items/SummonItems/Invasion/MartianDistressRemote_Animated.png differ diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index 9de17755d5..e3d56a692b 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType() })); - itemLoot.Add(ModContent.ItemType(), 10); + itemLoot.Add(ModContent.ItemType(), 10); // Equipment itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index 24a03b41b2..a6175d8821 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -91,5 +93,14 @@ namespace CalamityMod.Items.Weapons.Magic } return false; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddIngredient(35). + AddTile(TileID.Anvils). + Register(); + } } } diff --git a/Items/Weapons/Rogue/TheReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs similarity index 94% rename from Items/Weapons/Rogue/TheReaper.cs rename to Items/Weapons/Rogue/TheOldReaper.cs index 2172bff473..8843fe2591 100644 --- a/Items/Weapons/Rogue/TheReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -8,11 +8,12 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class TheReaper : RogueWeapon + [LegacyName("TheReaper")] + public class TheOldReaper : RogueWeapon { public override void SetStaticDefaults() { - DisplayName.SetDefault("The Reaper"); + DisplayName.SetDefault("The Old Reaper"); Tooltip.SetDefault("Slice 'n dice\n" + "Stealth strikes throw four at once"); SacrificeTotal = 1; diff --git a/Items/Weapons/Rogue/TheReaper.png b/Items/Weapons/Rogue/TheOldReaper.png similarity index 100% rename from Items/Weapons/Rogue/TheReaper.png rename to Items/Weapons/Rogue/TheOldReaper.png diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 8681a07131..9f5c7d614d 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -13,18 +13,23 @@ using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using System.Linq; namespace CalamityMod.NPCs.AcidRain { public class AcidEel : ModNPC { public Player Target => Main.player[NPC.target]; + + public PrimitiveTrail SegmentDrawer = null; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Eel"); Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.TrailCacheLength[NPC.type] = 7; + NPCID.Sets.TrailCacheLength[NPC.type] = 12; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { PortraitPositionXOverride = 0 @@ -35,11 +40,11 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { - NPC.width = 72; - NPC.height = 18; + NPC.width = 20; + NPC.height = 20; NPC.damage = 20; - NPC.lifeMax = 80; + NPC.lifeMax = 42; NPC.defense = 4; NPC.knockBackResist = 0.9f; @@ -47,14 +52,14 @@ namespace CalamityMod.NPCs.AcidRain { NPC.DR_NERD(0.05f); NPC.damage = 100; - NPC.lifeMax = 3300; + NPC.lifeMax = 2000; NPC.defense = 20; NPC.knockBackResist = 0.7f; } else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 50; - NPC.lifeMax = 240; + NPC.lifeMax = 176; } NPC.value = Item.buyPrice(0, 0, 3, 32); @@ -77,8 +82,8 @@ namespace CalamityMod.NPCs.AcidRain { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Along its spine runs an undulating dorsal fin which they can put to great use for their streamlined form, as they rush at prey underwater.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("Along its spine runs an undulating dorsal fin which they can put to great use for their streamlined form, as they rush at prey underwater.") }); } @@ -104,6 +109,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.velocity.X *= 0.95f; if (NPC.velocity.Y < 14f) NPC.velocity.Y += 0.15f; + NPC.spriteDirection = NPC.direction; } public void SwimTowardsTarget() @@ -115,17 +121,17 @@ namespace CalamityMod.NPCs.AcidRain swimSpeed += 4f; // Swim upwards if sufficiently under water. - bool waterAbove = false; + bool airAbove = false; for (int dy = -160; dy < 0; dy += 8) { - if (Collision.WetCollision(NPC.position + Vector2.UnitY * dy, NPC.width, 16)) + if (!Collision.WetCollision(NPC.position + Vector2.UnitY * dy, NPC.width, 16)) { - waterAbove = true; + airAbove = true; break; } } - if (waterAbove) + if (!airAbove) NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y - 0.25f, -14f, 14f); else NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.4f, -4f, 8f); @@ -170,11 +176,60 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public float SegmentWidthFunction(float completionRatio) => NPC.width * NPC.scale * 0.5f; + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - CalamityGlobalNPC.DrawGlowmask(NPC, spriteBatch, ModContent.Request(Texture + "Glow").Value); - if (NPC.velocity.Length() > 1.5f) - CalamityGlobalNPC.DrawAfterimage(NPC, spriteBatch, drawColor, Color.Transparent, directioning: true); + // Initialize the segment drawer. + SegmentDrawer ??= new(SegmentWidthFunction, _ => NPC.GetAlpha(Color.White), null, GameShaders.Misc["CalamityMod:PrimitiveTexture"]); + + Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelTail").Value; + Vector2 headDrawPosition = NPC.Center - screenPos; + Vector2[] segmentPositions = (Vector2[])NPC.oldPos.Clone(); + + Vector2 segmentAreaTopLeft = Vector2.One * 999999f; + Vector2 segmentAreaTopRight = Vector2.Zero; + if (NPC.IsABestiaryIconDummy) + { + for (int i = 0; i < segmentPositions.Length; i++) + segmentPositions[i] = NPC.TopLeft + Vector2.UnitX * i * 5f; + } + segmentPositions = segmentPositions.Where(p => p != Vector2.Zero).ToArray(); + + for (int i = 0; i < segmentPositions.Length; i++) + { + segmentPositions[i] += NPC.Size * 0.5f - screenPos - NPC.rotation.ToRotationVector2() * Math.Sign(NPC.velocity.X) * 8f; + if (segmentAreaTopLeft.X > segmentPositions[i].X) + segmentAreaTopLeft.X = segmentPositions[i].X; + if (segmentAreaTopLeft.Y > segmentPositions[i].Y) + segmentAreaTopLeft.Y = segmentPositions[i].Y; + + if (segmentAreaTopRight.X < segmentPositions[i].X) + segmentAreaTopRight.X = segmentPositions[i].X; + if (segmentAreaTopRight.Y < segmentPositions[i].Y) + segmentAreaTopRight.Y = segmentPositions[i].Y; + } + + // Set shader parameters. + float offsetAngle = (NPC.position - NPC.oldPos[1]).ToRotation(); + Vector2 primitiveArea = (segmentAreaTopRight - segmentAreaTopLeft).RotatedBy(offsetAngle); + Rectangle tailArea = NPC.frame with { Width = 28 }; + GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBody")); + GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["uPrimitiveSize"].SetValue(primitiveArea); + GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["flipVertically"].SetValue(NPC.velocity.X > 0f); + + SpriteEffects direction = NPC.velocity.X < 0f ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.EntitySpriteDraw(headTexture, headDrawPosition, NPC.frame, NPC.GetAlpha(Color.White), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); + + if (segmentPositions.Length >= 2) + { + float tailRotation = (segmentPositions[0] - segmentPositions[1]).ToRotation() + MathHelper.Pi; + Main.EntitySpriteDraw(tailTexture, segmentPositions[^1], tailArea, NPC.GetAlpha(Color.White), tailRotation, tailArea.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0); + SegmentDrawer.Draw(segmentPositions, Vector2.Zero, 36); + } + + return false; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AcidRain/AcidEel.png b/NPCs/AcidRain/AcidEel.png index 1f913c9b1e..2c5316c349 100644 Binary files a/NPCs/AcidRain/AcidEel.png and b/NPCs/AcidRain/AcidEel.png differ diff --git a/NPCs/AcidRain/AcidEelBody.png b/NPCs/AcidRain/AcidEelBody.png new file mode 100644 index 0000000000..d3e6f9f966 Binary files /dev/null and b/NPCs/AcidRain/AcidEelBody.png differ diff --git a/NPCs/AcidRain/AcidEelGlow.png b/NPCs/AcidRain/AcidEelGlow.png deleted file mode 100644 index 14e5183f3a..0000000000 Binary files a/NPCs/AcidRain/AcidEelGlow.png and /dev/null differ diff --git a/NPCs/AcidRain/AcidEelTail.png b/NPCs/AcidRain/AcidEelTail.png new file mode 100644 index 0000000000..0abf7dc4b9 Binary files /dev/null and b/NPCs/AcidRain/AcidEelTail.png differ diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 7c24854f5f..f6058d0672 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.AcidRain // Rise upward. case 0: Vector2 flyDestination = Target.Center + new Vector2((Target.Center.X < NPC.Center.X).ToDirectionInt() * 400f, -240f); - Vector2 idealVelocity = NPC.SafeDirectionTo(flyDestination) * 12f; + Vector2 idealVelocity = NPC.SafeDirectionTo(flyDestination) * 10f; NPC.velocity = (NPC.velocity * 29f + idealVelocity) / 29f; NPC.velocity = NPC.velocity.MoveTowards(idealVelocity, 1.5f); diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index c18ec8c856..5bfa84165b 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -20,9 +20,13 @@ namespace CalamityMod.NPCs.AcidRain public class SulphurousSkater : ModNPC { public bool Flying = false; + public Player Target => Main.player[NPC.target]; + public ref float JumpTimer => ref NPC.ai[0]; + public const int JumpDelay = 64; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Skater"); @@ -31,10 +35,6 @@ namespace CalamityMod.NPCs.AcidRain NPCID.Sets.TrailCacheLength[NPC.type] = 6; } - public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); - - public override void ReceiveExtraAI(BinaryReader reader) => Flying = reader.ReadBoolean(); - public override void SetDefaults() { NPC.width = 48; @@ -69,6 +69,10 @@ namespace CalamityMod.NPCs.AcidRain SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); + + public override void ReceiveExtraAI(BinaryReader reader) => Flying = reader.ReadBoolean(); + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { @@ -127,13 +131,13 @@ namespace CalamityMod.NPCs.AcidRain NPC.velocity.X *= 0.85f; JumpTimer++; - float lungeForwardSpeed = 15f; + float lungeForwardSpeed = 12f; float jumpSpeed = 4f; if (Collision.CanHit(NPC.Center, 1, 1, Target.Center, 1, 1)) lungeForwardSpeed *= 1.2f; // Jump after a short amount of time. - if (JumpTimer >= 17) + if (JumpTimer >= JumpDelay) { JumpTimer = 0f; NPC.velocity.Y -= jumpSpeed; diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs deleted file mode 100644 index 0592722621..0000000000 --- a/NPCs/AcidRain/WaterLeech.cs +++ /dev/null @@ -1,228 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Magic; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.AcidRain -{ - public class WaterLeech : ModNPC - { - public Player Target => Main.player[NPC.target]; - public bool LatchingOntoTarget - { - get => NPC.ai[0] == 1f; - set => NPC.ai[0] = value.ToInt(); - } - public ref float LackOfWaterDeathTimer => ref NPC.ai[2]; - public const float ChasePromptDistance = 55f; - public const float ChaseMaxDistance = 140f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water Leech"); - Main.npcFrameCount[NPC.type] = 4; - } - - public override void SetDefaults() - { - NPC.width = 26; - NPC.height = 14; - - NPC.lifeMax = 30; - NPC.damage = 0; - - if (DownedBossSystem.downedPolterghast) - { - NPC.lifeMax = 1235; - NPC.defense = 10; - } - else if (DownedBossSystem.downedAquaticScourge) - NPC.lifeMax = 90; - - NPC.value = Item.buyPrice(0, 0, 2, 5); - NPC.lavaImmune = false; - NPC.noGravity = true; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit33; - NPC.DeathSound = SoundID.NPCDeath1; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - 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[] { - - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("It can smell the scent of flesh from far distances and will eagerly squirm its way to the source. Once attached to the host, they rapidly intake blood and discharge venom, both of which heavily disadvantage its prey.") - }); - } - - public override void SendExtraAI(BinaryWriter writer) => writer.Write(NPC.dontTakeDamage); - - public override void ReceiveExtraAI(BinaryReader reader) => NPC.dontTakeDamage = reader.ReadBoolean(); - - public override void AI() - { - if (NPC.localAI[0] == 0f) - { - NPC.TargetClosest(); - NPC.localAI[0] = 1f; - } - - bool playerAlreadyTargeted = false; - float antiStickyAcceleration = 0.25f; - - // Repel other leeches from this one. Also determine if one is already targeting a player. - // Only one leech is allowed to target one player at a time. - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type != NPC.type || !Main.npc[i].active || Main.npc[i].whoAmI == NPC.whoAmI) - continue; - - if (Main.npc[i].target == NPC.target && !playerAlreadyTargeted) - playerAlreadyTargeted = true; - if (Main.npc[i].Hitbox.Intersects(NPC.Hitbox)) - NPC.velocity += NPC.DirectionFrom(Main.npc[i].Center) * antiStickyAcceleration; - } - - if (!playerAlreadyTargeted || Target.Calamity().waterLeechTarget == -1) - Target.Calamity().waterLeechTarget = NPC.whoAmI; - - if (LatchingOntoTarget) - { - LatchOntoTarget(); - return; - } - - NPC.direction = NPC.spriteDirection = (NPC.velocity.X > 0).ToDirectionInt(); - - // If the leech is not in water, fall and quickly cease horizontal movement. - // After some time, if still not in water, die due to a lack of water. - if (!NPC.wet) - { - NPC.velocity.X *= 0.97f; - NPC.velocity.Y = MathHelper.Clamp(NPC.velocity.Y + 0.4f, -4f, 16f); - LackOfWaterDeathTimer++; - if (LackOfWaterDeathTimer >= 300f) - { - NPC.life = 0; - NPC.HitEffect(); - NPC.active = false; - NPC.netUpdate = true; - } - } - - // Swim towards the target if they are in water. - else if (Target.wet && Target.Calamity().waterLeechTarget == NPC.whoAmI) - { - float swimSpeed = Target.wet ? 23f : 17f; - float swimIntertia = 24f; - if (DownedBossSystem.downedPolterghast) - { - swimSpeed *= 1.6f; - swimIntertia = 17f; - } - NPC.velocity = (NPC.velocity * (swimIntertia - 1f) + NPC.SafeDirectionTo(Target.Center, -Vector2.UnitY) * swimSpeed) / swimIntertia; - } - - // Rapidly slow down if the target is not in water. - else if (!Target.wet) - NPC.velocity *= 0.9f; - - if (NPC.WithinRange(Target.Top, ChasePromptDistance) && Target.active && !Target.dead) - { - LatchingOntoTarget = true; - NPC.netUpdate = true; - } - - // If the target is not in water, become invincible. - bool shouldNotTakeDamage = !Target.wet; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.dontTakeDamage != shouldNotTakeDamage) - { - NPC.dontTakeDamage = shouldNotTakeDamage; - NPC.netUpdate = true; - } - } - - public void LatchOntoTarget() - { - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.dontTakeDamage) - { - NPC.dontTakeDamage = false; - NPC.netUpdate = true; - } - - // If the target moved far enough away, stop attempting to attach to them. - if (!NPC.WithinRange(Target.Center, ChaseMaxDistance)) - { - LatchingOntoTarget = false; - NPC.netUpdate = true; - return; - } - - Vector2 destination = (Target.gravDir == 1f ? Target.Top : Target.Bottom) + Target.direction * Vector2.UnitX * 4f; - float speed = MathHelper.Lerp(7f, 23f, Utils.GetLerpValue(10f, ChaseMaxDistance, NPC.Distance(destination), true)); - NPC.velocity = NPC.SafeDirectionTo(destination) * speed; - - if (NPC.WithinRange(destination, 45f)) - { - Target.AddBuff(BuffID.Bleeding, 180, true); - Target.AddBuff(ModContent.BuffType(), 30, true); - } - - // Stop searching if the target is not in water anymore and they're not close. - else if (!NPC.wet && !NPC.WithinRange(destination, 85f)) - { - LatchingOntoTarget = false; - NPC.netUpdate = true; - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter >= 4) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y >= Main.npcFrameCount[NPC.type] * frameHeight) - NPC.frame.Y = 0; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.PlayerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !Main.raining) - return 0f; - - return 0.115f; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 8; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - LeadingConditionRule postAS = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourge); - postAS.Add(ModContent.ItemType(), 100, hideLootReport: !DownedBossSystem.downedAquaticScourge); - postAS.AddFail(ModContent.ItemType(), 20, hideLootReport: DownedBossSystem.downedAquaticScourge); - } - } -} diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 9bdd68a05c..57613ad6fd 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4596,21 +4596,6 @@ namespace CalamityMod.NPCs } } - if (npc.life <= 0 && BossRushEvent.BossRushActive && npc.type == NPCID.WallofFlesh && BossRushEvent.CurrentlyFoughtBoss == npc.type) - { - // Post-Wall of Flesh teleport back to spawn. - // This appears to only work correctly client-side in MP. - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - bool appropriatePlayer = Main.myPlayer == playerIndex; - if (Main.player[playerIndex].active && appropriatePlayer) - { - Main.player[playerIndex].Spawn(PlayerSpawnContext.RecallFromItem); - SoundEngine.PlaySound(BossRushEvent.TeleportSound with { Volume = 1.6f }, Main.player[playerIndex].Center); - } - } - } - if (pFlames > 0 && npc.life <= 0) { Rectangle hitbox = npc.Hitbox; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 6b96c7d8e5..09cef6a4b8 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1585,7 +1585,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Cyborg) { SetShopItem(ref shop, ref nextSlot, ItemID.RocketLauncher, NPC.downedGolemBoss, Item.buyPrice(0, 25)); - SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 50)); + SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 50)); SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedPolterghast); } diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index b67e64aba4..bacd6c58e1 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -435,7 +435,7 @@ namespace CalamityMod.NPCs.OldDuke ModContent.ItemType() }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); - normalOnly.Add(ModContent.ItemType(), 10); + normalOnly.Add(ModContent.ItemType(), 10); // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); diff --git a/NPCs/AcidRain/WaterLeechGlow.png b/Projectiles/Magic/WaterLeechGlow.png similarity index 100% rename from NPCs/AcidRain/WaterLeechGlow.png rename to Projectiles/Magic/WaterLeechGlow.png diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index 92d9d8a7db..faeccebd46 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -12,8 +12,6 @@ namespace CalamityMod.Projectiles.Magic { public class WaterLeechProj : ModProjectile { - public override string Texture => "CalamityMod/NPCs/AcidRain/WaterLeech"; - public override void SetStaticDefaults() { DisplayName.SetDefault("Leech"); @@ -82,7 +80,8 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Color color = Projectile.GetAlpha(lightColor); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), color, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); return false; } @@ -96,7 +95,8 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/NPCs/AcidRain/WaterLeechGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Color color = Projectile.GetAlpha(Color.White); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Magic/WaterLeechGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); } public override void Kill(int timeLeft) diff --git a/NPCs/AcidRain/WaterLeech.png b/Projectiles/Magic/WaterLeechProj.png similarity index 100% rename from NPCs/AcidRain/WaterLeech.png rename to Projectiles/Magic/WaterLeechProj.png diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index 46f43511a3..4b36ad7a24 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,14 +26,22 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = false; Projectile.timeLeft = 420; Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 17; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Projectile.velocity.Y <= 8f) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(600f, !Projectile.tileCollide); + if (potentialTarget is not null) { - Projectile.velocity.Y += 0.15f; + float flySpeed = Projectile.velocity.Length(); + if (flySpeed < 5f) + flySpeed = 5f; + + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * flySpeed, 0.085f); } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.tileCollide = Projectile.timeLeft <= 300; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 09aeeaa58e..ffa7c2e940 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,11 +9,11 @@ namespace CalamityMod.Projectiles.Rogue { public class ReaperProjectile : ModProjectile { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheReaper"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheOldReaper"; public override void SetStaticDefaults() { - DisplayName.SetDefault("The Reaper"); + DisplayName.SetDefault("The Old Reaper"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index 018368fb1b..7d76ad10f1 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -14,13 +14,13 @@ namespace CalamityMod.Projectiles.Summon public class DormantBrimseekerBab : ModProjectile { public const float DistanceToCheck = 1600f; - public const float TurnTime = 25f; + public const int TurnTime = 7; public bool SeekingTarget = false; public float MaxChargeTime { get { - return (Projectile.localAI[1] == 1f) ? 21 : 38; + return (Projectile.localAI[1] == 1f) ? 16 : 25; } } public override void SetStaticDefaults() @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.timeLeft *= 5; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 15; Projectile.DamageType = DamageClass.Summon; } @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.ai[0] = 0f; // Disable charge animation when not attacking } - Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.2f); Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X < 0).ToDirectionInt(); Projectile.ai[1] += MathHelper.ToRadians(3f); if (Projectile.ai[1] >= MathHelper.Pi * 4f) @@ -109,13 +109,13 @@ namespace CalamityMod.Projectiles.Summon } else { - if (Projectile.Distance(potentialTarget.Center) < 1100f && Projectile.ai[0] == 0f) + if (Projectile.Distance(potentialTarget.Center) < 400f && Projectile.ai[0] == 0f) { SoundEngine.PlaySound(SoundID.DD2_DrakinShot, Projectile.Center); Projectile.ai[0]++; - float acceleration = (Projectile.localAI[1] == 1f) ? 1.6f : 0.8f; - float minSpeed = (Projectile.localAI[1] == 1f) ? 13f : 8f; - float maxSpeed = (Projectile.localAI[1] == 1f) ? 21f : 18f; + float acceleration = (Projectile.localAI[1] == 1f) ? 1.85f : 1.1f; + float minSpeed = (Projectile.localAI[1] == 1f) ? 21.5f : 15f; + float maxSpeed = (Projectile.localAI[1] == 1f) ? 32f : 24f; Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + acceleration, minSpeed, maxSpeed); Projectile.rotation = Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi; } @@ -124,17 +124,17 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0]++; SeekingTarget = false; } - else if (Projectile.Distance(potentialTarget.Center) >= 1100f) + else if (Projectile.Distance(potentialTarget.Center) >= 400f) { - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); - Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + 2f, 6f, 15f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.3f); + Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(Projectile.velocity.Length() + 2f, 10f, 32f); SeekingTarget = true; Projectile.ai[0] = 0f; } if (Projectile.ai[0] >= MaxChargeTime) { - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.1f); + Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(potentialTarget.Center) + (Projectile.spriteDirection == 1).ToInt() * MathHelper.Pi, 0.3f); } Projectile.frameCounter++; diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index e4431c6c90..8a1ba16b6b 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.timeLeft = 2; } - if (!modPlayer.pArtifact || (!modPlayer.profanedCrystal && !modPlayer.WearingPostMLSummonerSet)) + if (!modPlayer.pArtifact && !modPlayer.profanedCrystal) { modPlayer.gOffense = false; Projectile.active = false; diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 47271f0f04..84894a6a14 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.timeLeft = 2; } - if (!modPlayer.pArtifact || (player.maxMinions < 10 && !modPlayer.profanedCrystal)) + if (!modPlayer.pArtifact && !modPlayer.profanedCrystal) { modPlayer.gDefense = false; Projectile.active = false; diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index 4f2b289538..a97ab6baa3 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -2,9 +2,10 @@ using CalamityMod.Items; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.GameContent.Events; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Typeless { @@ -43,8 +44,18 @@ namespace CalamityMod.Projectiles.Typeless public override void Kill(int timeLeft) { BossRushEvent.End(); - Player p = Main.LocalPlayer; - p.QuickSpawnItemDirect(p.GetSource_Misc("CalamityMod_BossRushRock"), ModContent.ItemType()); + for (int i = Main.maxPlayers - 1; i >= 0; i--) + { + Player p = Main.player[i]; + if (p is null || !p.active) + continue; + int rock = Item.NewItem(p.GetSource_Misc("CalamityMod_BossRushRock"), (int)p.position.X, (int)p.position.Y, p.width, p.height, ModContent.ItemType()); + if (Main.netMode == NetmodeID.Server) + { + Main.timeItemSlotCannotBeReusedFor[rock] = 54000; + NetMessage.SendData(MessageID.InstancedItem, i, -1, null, rock); + } + } CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFiveEndText", BossRushEvent.XerocTextColor); } } diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 6d06e990e3..d7724172a8 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -1,12 +1,13 @@ -using CalamityMod.Events; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent; -using ReLogic.Content; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.UI { @@ -69,14 +70,6 @@ namespace CalamityMod.UI public static void UpdateAndDraw(SpriteBatch sb) { //Don't do anything if not open - bool forceOpenAndTeleport = BossRushEvent.BossRushStage < BossRushEvent.Bosses.Count - 1 && BossRushEvent.CurrentlyFoughtBoss == NPCID.WallofFlesh && - !CalamityUtils.AnyBossNPCS() && !Main.player[Main.myPlayer].ZoneUnderworldHeight; - if (forceOpenAndTeleport) - { - Open = true; - } - else if (BossRushEvent.BossRushActive) - Open = false; if (!Open) return; @@ -104,26 +97,21 @@ namespace CalamityMod.UI CircleStyle style = CircleStyle.Normal; //If the mouse is in the circle - if (c.Contains(Main.MouseScreen) || forceOpenAndTeleport) + if (c.Contains(Main.MouseScreen)) { style = CircleStyle.Selected; Main.LocalPlayer.mouseInterface = true; - if (forceOpenAndTeleport) - { - current = 0; - } - selectedCircle = current; //If left clicked - if ((Main.mouseLeft && Main.mouseLeftRelease) || forceOpenAndTeleport) + if ((Main.mouseLeft && Main.mouseLeftRelease)) { Main.mouseLeftRelease = false; Main.mouseLeft = false; - DoTeleportation(current, forceOpenAndTeleport); + DoTeleportation(current); } } @@ -151,31 +139,42 @@ namespace CalamityMod.UI Utils.DrawBorderStringFourWay(sb, FontAssets.MouseText.Value, text, CenterPoint.X - size.X / 2f, CenterPoint.Y + CircleOffset + CircleTextureSize / 2 + 4, Color.White, Color.Black, default); } - public static void DoTeleportation(int circle, bool forcedByBossRush) + public static void DoTeleportation(int circle) { Open = false; Player p = Main.LocalPlayer; - if (forcedByBossRush) - SoundEngine.PlaySound(BossRushEvent.TeleportSound with { Volume = 1.6f }, p.position); - - if (circle == 3) + switch (circle) { - if (Main.netMode == NetmodeID.SinglePlayer) - { - p.TeleportationPotion(); - if (!forcedByBossRush) - SoundEngine.PlaySound(SoundID.Item6, p.position); - } - else if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.RequestTeleportationByServer, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else - { - Main.LocalPlayer.Calamity().HandleTeleport(circle, false, 0); + case 0: + Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p); + if (!underworld.HasValue) + return; + CalamityPlayer.ModTeleport(p, underworld.Value, true, TeleportationStyleID.DemonConch); + break; + case 1: + CalamityPlayer.ModTeleport(p, new Vector2(Main.dungeonX * 16, Main.dungeonY * 16 - 8)); + break; + case 2: + Vector2? jungle = CalamityPlayer.GetJunglePosition(p); + if (!jungle.HasValue) + return; + CalamityPlayer.ModTeleport(p, jungle.Value); + break; + case 3: + if (Main.netMode == NetmodeID.SinglePlayer) + { + p.TeleportationPotion(); + SoundEngine.PlaySound(SoundID.Item6, p.position); + } + else if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.RequestTeleportationByServer, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + break; + default: + break; } } diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 5e1d1d60d8..500fff2930 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -688,9 +688,6 @@ namespace CalamityMod case 113: item = ModContent.ItemType(); break; - case 114: - item = ModContent.ItemType(); - break; case 115: item = ModContent.ItemType(); break; @@ -1047,9 +1044,6 @@ namespace CalamityMod case 113: npc = ModContent.NPCType(); break; - case 114: - npc = ModContent.NPCType(); - break; case 115: npc = ModContent.NPCType(); break; diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 4189f4264d..428e46b063 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -220,7 +220,6 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, - { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) },