diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 29b8c5dd69..2e098fedb4 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -167,9 +167,6 @@ namespace CalamityMod.Balancing // 50% resist to Aegis Blade's explosions because the true melee resist ain't enough. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 40% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 35% resist to Flying Dragon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); @@ -213,9 +210,6 @@ namespace CalamityMod.Balancing // 35% resist to Aerial Bane. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); - // 35% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 30% resist to Aurora Blazer. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); @@ -254,9 +248,6 @@ namespace CalamityMod.Balancing // 50% resist to Galactus Blade. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType()))); - // 40% resist to Pristine Fury's alt fire. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType()))); - // 40% resist to Stellar Torus Staff. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType()))); #endregion @@ -274,9 +265,6 @@ namespace CalamityMod.Balancing // 50% resist to Legion of Celestia. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Pristine Fury's alt fire. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Tactician's Trump Card's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); diff --git a/Buffs/Alcohol/BloodyMaryBuff.png b/Buffs/Alcohol/BloodyMaryBuff.png index 40355f1d96..87d65d2345 100644 Binary files a/Buffs/Alcohol/BloodyMaryBuff.png and b/Buffs/Alcohol/BloodyMaryBuff.png differ diff --git a/Buffs/Alcohol/CaribbeanRumBuff.png b/Buffs/Alcohol/CaribbeanRumBuff.png index 3996666a07..52499ee117 100644 Binary files a/Buffs/Alcohol/CaribbeanRumBuff.png and b/Buffs/Alcohol/CaribbeanRumBuff.png differ diff --git a/Buffs/Alcohol/CinnamonRollBuff.png b/Buffs/Alcohol/CinnamonRollBuff.png index a1a2c0ae34..2aacbc8b75 100644 Binary files a/Buffs/Alcohol/CinnamonRollBuff.png and b/Buffs/Alcohol/CinnamonRollBuff.png differ diff --git a/Buffs/Alcohol/EverclearBuff.png b/Buffs/Alcohol/EverclearBuff.png index 3f275ba54f..b6f4007bb3 100644 Binary files a/Buffs/Alcohol/EverclearBuff.png and b/Buffs/Alcohol/EverclearBuff.png differ diff --git a/Buffs/Alcohol/EvergreenGinBuff.png b/Buffs/Alcohol/EvergreenGinBuff.png index f7e2133cd3..85d925b5e5 100644 Binary files a/Buffs/Alcohol/EvergreenGinBuff.png and b/Buffs/Alcohol/EvergreenGinBuff.png differ diff --git a/Buffs/Alcohol/FireballBuff.png b/Buffs/Alcohol/FireballBuff.png index a81dcc472f..53dd87aa12 100644 Binary files a/Buffs/Alcohol/FireballBuff.png and b/Buffs/Alcohol/FireballBuff.png differ diff --git a/Buffs/Alcohol/GrapeBeerBuff.png b/Buffs/Alcohol/GrapeBeerBuff.png index 258910c643..b073557b01 100644 Binary files a/Buffs/Alcohol/GrapeBeerBuff.png and b/Buffs/Alcohol/GrapeBeerBuff.png differ diff --git a/Buffs/Alcohol/ManhattanBuff.png b/Buffs/Alcohol/ManhattanBuff.png index 8d3c026da5..5029f83753 100644 Binary files a/Buffs/Alcohol/ManhattanBuff.png and b/Buffs/Alcohol/ManhattanBuff.png differ diff --git a/Buffs/Alcohol/MargaritaBuff.png b/Buffs/Alcohol/MargaritaBuff.png index 94de724886..61d01e45fd 100644 Binary files a/Buffs/Alcohol/MargaritaBuff.png and b/Buffs/Alcohol/MargaritaBuff.png differ diff --git a/Buffs/Alcohol/MoonshineBuff.png b/Buffs/Alcohol/MoonshineBuff.png index 028834ea24..21fb314785 100644 Binary files a/Buffs/Alcohol/MoonshineBuff.png and b/Buffs/Alcohol/MoonshineBuff.png differ diff --git a/Buffs/Alcohol/MoscowMuleBuff.png b/Buffs/Alcohol/MoscowMuleBuff.png index a9cf2f5a18..088da9641d 100644 Binary files a/Buffs/Alcohol/MoscowMuleBuff.png and b/Buffs/Alcohol/MoscowMuleBuff.png differ diff --git a/Buffs/Alcohol/OldFashionedBuff.png b/Buffs/Alcohol/OldFashionedBuff.png index a3ba916b88..150b908bc8 100644 Binary files a/Buffs/Alcohol/OldFashionedBuff.png and b/Buffs/Alcohol/OldFashionedBuff.png differ diff --git a/Buffs/Alcohol/PurpleHazeBuff.png b/Buffs/Alcohol/PurpleHazeBuff.png index c7fbec83bd..a2b6ca1235 100644 Binary files a/Buffs/Alcohol/PurpleHazeBuff.png and b/Buffs/Alcohol/PurpleHazeBuff.png differ diff --git a/Buffs/Alcohol/RedWineBuff.png b/Buffs/Alcohol/RedWineBuff.png index 556b48d8fc..7b063a46a3 100644 Binary files a/Buffs/Alcohol/RedWineBuff.png and b/Buffs/Alcohol/RedWineBuff.png differ diff --git a/Buffs/Alcohol/RumBuff.png b/Buffs/Alcohol/RumBuff.png index e43b540c7a..a23a1e56d9 100644 Binary files a/Buffs/Alcohol/RumBuff.png and b/Buffs/Alcohol/RumBuff.png differ diff --git a/Buffs/Alcohol/ScrewdriverBuff.png b/Buffs/Alcohol/ScrewdriverBuff.png index 4d24f45ebd..2e12c6fd40 100644 Binary files a/Buffs/Alcohol/ScrewdriverBuff.png and b/Buffs/Alcohol/ScrewdriverBuff.png differ diff --git a/Buffs/Alcohol/StarBeamRyeBuff.png b/Buffs/Alcohol/StarBeamRyeBuff.png index f93dc9cfec..b75b146cca 100644 Binary files a/Buffs/Alcohol/StarBeamRyeBuff.png and b/Buffs/Alcohol/StarBeamRyeBuff.png differ diff --git a/Buffs/Alcohol/TequilaBuff.png b/Buffs/Alcohol/TequilaBuff.png index ea4d7ed14a..570af3086f 100644 Binary files a/Buffs/Alcohol/TequilaBuff.png and b/Buffs/Alcohol/TequilaBuff.png differ diff --git a/Buffs/Alcohol/TequilaSunriseBuff.png b/Buffs/Alcohol/TequilaSunriseBuff.png index 9d36c9250e..269f727796 100644 Binary files a/Buffs/Alcohol/TequilaSunriseBuff.png and b/Buffs/Alcohol/TequilaSunriseBuff.png differ diff --git a/Buffs/Alcohol/VodkaBuff.png b/Buffs/Alcohol/VodkaBuff.png index ba5666ddbc..ee994b6d8b 100644 Binary files a/Buffs/Alcohol/VodkaBuff.png and b/Buffs/Alcohol/VodkaBuff.png differ diff --git a/Buffs/Alcohol/WhiskeyBuff.png b/Buffs/Alcohol/WhiskeyBuff.png index fce1a5403b..53196936b8 100644 Binary files a/Buffs/Alcohol/WhiskeyBuff.png and b/Buffs/Alcohol/WhiskeyBuff.png differ diff --git a/Buffs/Alcohol/WhiteWineBuff.png b/Buffs/Alcohol/WhiteWineBuff.png index bfa64feecc..8d5ec47e7b 100644 Binary files a/Buffs/Alcohol/WhiteWineBuff.png and b/Buffs/Alcohol/WhiteWineBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c8bca67e6f..1780685c6f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -61,7 +61,6 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.Shortswords; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; @@ -70,6 +69,7 @@ using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Mechanic; using CalamityMod.Utilities; +using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -85,7 +85,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Net; -using Terraria.WorldBuilding; using static Terraria.Main; using static Terraria.ModLoader.ModContent; @@ -141,6 +140,13 @@ namespace CalamityMod.CalPlayer /// public bool heldGaelsLastFrame = false; /// + /// Tracks whether or not the player is currently holding Elephant Killer.
+ /// Used to reset stealth when swapping to this item. + ///
+ public bool heldElephantKillerLastFrame = false; + public float elephantKillerJoke = 0; + public bool drawingElephantKillerJoke = false; + /// /// Tracks whether or not the player currently has Draedon's Heart equipped.
/// Used to reset Adrenaline when (un)equipped to prevent exploits. ///
@@ -3083,6 +3089,7 @@ namespace CalamityMod.CalPlayer if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0) consecutiveCaughtFish = 0; heldGaelsLastFrame = false; + heldElephantKillerLastFrame = false; partialLifeRegenCounter = 0f; gaelSwipes = 0; whitewaterHeal = 0; @@ -4288,12 +4295,217 @@ namespace CalamityMod.CalPlayer vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles + smallerCheckRadius, smallerCheckRadius, teleportStartY, teleportRangeY, settings); if (canSpawn) - { return (Vector2?)vector; - } + return null; } + /// + /// Returns a random position in the Lihzhard Temple to teleport the player to.

+ /// Used primarily for . + ///
+ public static Vector2? GetTempleTeleportPosition(Player player) + { + int foundX = -1; + int foundY = -1; + bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; + int xSearchEnd = dungeonOnRightSide ? 20 : Main.maxTilesX - 20; + + if (dungeonOnRightSide) + { + for (int i = Main.spawnTileX; i >= xSearchEnd; i -= 2) + { + for (int j = (int)Main.worldSurface; j < Main.maxTilesY - 210; j++) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + { + foundX = i; + foundY = j; + break; + } + } + if (foundX != -1) + break; + } + } + else + { + for (int i = Main.spawnTileX; i <= xSearchEnd; i += 2) + { + for (int j = (int)Main.worldSurface; j < Main.maxTilesY - 210; j++) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.WallType == WallID.LihzahrdBrickUnsafe) + { + foundX = i; + foundY = j; + break; + } + } + + if (foundX != -1) + break; + } + } + + if (foundX == -1) + return null; + + int attempts = 25; + int rangeX = 300; + int rangeY = 300; + int randomFluff = 500; + Point finalTeleportPoint = Point.Zero; + for (int i = 0; i < attempts; i++) + { + for (int x = 0; x <= rangeX; x++) + { + for (int y = 0; y <= rangeY; y++) + { + int teleportPosX = foundX + x + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosY = foundY + y + Main.rand.Next(-randomFluff, randomFluff); + Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); + Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); + Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); + + if (!tileAbove.HasTile && tileBelow.HasTile && tile.WallType == WallID.LihzahrdBrickUnsafe) + { + finalTeleportPoint = new(tile.X(), tile.Y()); + if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) + break; + } + } + } + } + + return finalTeleportPoint.ToWorldCoordinates() - new Vector2(player.width, player.height); + } + + /// + /// Returns a random position in the Void (Abyss Layer 4) to teleport the player to.

+ /// Used primarily for . + ///
+ public static Vector2? GetAbyssVoidTeleportPosition(Player player) + { + bool canSpawn = false; + int halfWorldWidth = Main.maxTilesX / 2; + + int abyssStartX = Abyss.AtLeftSideOfWorld ? halfWorldWidth - (halfWorldWidth - 135) + 35 : halfWorldWidth + (halfWorldWidth - 135) - 35; + int abyssXRange = 50; + + int teleportStartY = Main.remixWorld ? SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.6f) : Main.maxTilesY - 300; + int teleportRangeY = 80; + + Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings + { + mostlySolidFloor = false, + avoidAnyLiquid = false, + avoidLava = true, + avoidHurtTiles = true, + avoidWalls = false, + attemptsBeforeGivingUp = 1000, + maximumFallDistanceFromOrignalPoint = 10 + }; + + Vector2 teleportPosition = player.CheckForGoodTeleportationSpot(ref canSpawn, abyssStartX, abyssXRange, teleportStartY, teleportRangeY, settings); + return canSpawn ? teleportPosition : null; + } + + /// + /// Returns a random position in the Forsaken Archives to teleport the player to.

+ /// Used primarily for . + ///
+ public static Vector2? GetDungeonArchivesTeleportPosition(Player player) + { + // Define an area around the center to search for a valid spot to tp + int teleportStartX = WorldgenManagementSystem.DungeonArchivePos.X; + int teleportStartY = WorldgenManagementSystem.DungeonArchivePos.Y; + + // Manually search for the Archives from the bottom of the world if the Archive position isn't saved. + if (WorldgenManagementSystem.DungeonArchivePos == Point.Zero) + { + int foundX = -1; + int foundY = -1; + bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; + int xSearchStart = dungeonOnRightSide ? Main.maxTilesX - 20 : 20; + + if (dungeonOnRightSide) + { + for (int y = Main.UnderworldLayer; y > (int)Main.rockLayer; y--) + { + for (int x = xSearchStart; x >= Main.maxTilesX / 2; x -= 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) + { + foundX = x; + foundY = y; + break; + } + } + + if (foundY != -1) + break; + } + } + else + { + for (int y = Main.UnderworldLayer; y > (int)Main.rockLayer; y--) + { + for (int x = xSearchStart; x <= Main.maxTilesX / 2; x += 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) + { + foundX = x; + foundY = y; + break; + } + } + + if (foundY != -1) + break; + } + } + + if (foundY == -1) + return null; + + teleportStartX = foundX; + teleportStartY = foundY; + } + + int attempts = 25; + int rangeX = 100; + int rangeY = 200; + int randomFluff = 60; + Point finalTeleportPoint = Point.Zero; + for (int i = 0; i < attempts; i++) + { + for (int x = -rangeX; x <= rangeX; x++) + { + for (int y = 0; y <= rangeY; y++) + { + int teleportPosX = teleportStartX + x + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosY = teleportStartY + y + Main.rand.Next(-randomFluff, randomFluff); + Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); + Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); + Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); + + if (!tileAbove.HasTile && tileBelow.HasUnactuatedTile && Main.wallDungeon[tile.WallType]) + { + finalTeleportPoint = new(tile.X(), tile.Y()); + if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) + break; + } + } + } + } + + return finalTeleportPoint.ToWorldCoordinates() - new Vector2(player.width, player.height); + } + public static void ModTeleport(Player player, Vector2 pos, bool playSound = true, int style = TeleportationStyleID.RecallPotion) { bool postImmune = player.immune; @@ -4610,12 +4822,12 @@ namespace CalamityMod.CalPlayer } //Multiply vertical speed - if (redWine) + if (redWine || Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) { if (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f) { redWineStoredY = Player.velocity.Y; - Player.velocity.Y *= 1 + RedWine.VerticalSpeedBoost; + Player.velocity.Y *= 1 + (redWine ? RedWine.VerticalSpeedBoost : 0) + (Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine) ? RedWine.VerticalSpeedBoost : 0); } else { @@ -4922,7 +5134,7 @@ namespace CalamityMod.CalPlayer #region PostUpdateEquips public override void PostUpdateEquips() { - + var dripPlayer = Player.GetModPlayer(); var item = Player.HeldItem; if (!(item.IsAir || item.damage <= 0)) { @@ -4931,11 +5143,13 @@ namespace CalamityMod.CalPlayer TimeHoldingMelee++; if (TimeHoldingMelee > Whiskey.TimeToDischarge) TimeHoldingMelee = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingMelee / Whiskey.TimeToDischarge); - } - } else + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingMelee / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Melee) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingMelee / Whiskey.TimeToDischarge); + } + else { TimeHoldingMelee -= 2; if (TimeHoldingMelee < 0) @@ -4945,11 +5159,12 @@ namespace CalamityMod.CalPlayer { TimeHoldingRanged++; if (TimeHoldingRanged > Whiskey.TimeToDischarge) - TimeHoldingRanged = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingRanged / Whiskey.TimeToDischarge); - } + TimeHoldingRanged = (int)Whiskey.TimeToDischarge; + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingRanged / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Ranged) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingRanged / Whiskey.TimeToDischarge); } else { @@ -4962,10 +5177,11 @@ namespace CalamityMod.CalPlayer TimeHoldingMagic++; if (TimeHoldingMagic > Whiskey.TimeToDischarge) TimeHoldingMagic = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingMagic / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingMagic / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Magic) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingMagic / Whiskey.TimeToDischarge); } else { @@ -4978,10 +5194,11 @@ namespace CalamityMod.CalPlayer TimeHoldingSummon++; if (TimeHoldingSummon > Whiskey.TimeToDischarge) TimeHoldingSummon = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingSummon / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingSummon / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(DamageClass.Summon) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingSummon / Whiskey.TimeToDischarge); } else { @@ -4994,10 +5211,12 @@ namespace CalamityMod.CalPlayer TimeHoldingRogue++; if (TimeHoldingRogue > Whiskey.TimeToDischarge) TimeHoldingRogue = (int)Whiskey.TimeToDischarge; - if (whiskey) - { - Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.MaxDamageBoost, Whiskey.MinDamageBoost, TimeHoldingRogue / Whiskey.TimeToDischarge); - } + + if (dripPlayer.HasAlcohol(AlcoholType.Whiskey) && whiskey) + Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.CombinedDamageCeiling, Whiskey.CombinedDamageFloor, TimeHoldingRogue / Whiskey.TimeToDischarge); + else if (whiskey || dripPlayer.HasAlcohol(AlcoholType.Whiskey)) + Player.GetDamage(RogueDamageClass.Instance) += MathHelper.Lerp(Whiskey.StandardDamageCeiling, Whiskey.StandardDamageFloor, TimeHoldingRogue / Whiskey.TimeToDischarge); + } else { @@ -5018,6 +5237,10 @@ namespace CalamityMod.CalPlayer if (TimeHoldingRogue-- < 0) TimeHoldingRogue = 0; } + if (dripPlayer.HasAlcohol(AlcoholType.Moonshine)) + { + Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1 + Moonshine.MaxLifePercentBoost)); + } // PostUpdateMiscEffects runs after the cap has been applied. Do NOT put mining speed stuff there. @@ -5154,7 +5377,7 @@ namespace CalamityMod.CalPlayer } //reset the stored Y value for red wine's increased vertical speed - if (redWine && (redWineStoredY > 0.2f || redWineStoredY < -0.2f) && (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f)) + if ((redWine || Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) && (redWineStoredY > 0.2f || redWineStoredY < -0.2f) && (Player.velocity.Y > 0.2f || Player.velocity.Y < -0.2f)) { Player.velocity.Y = redWineStoredY; } @@ -5307,16 +5530,18 @@ namespace CalamityMod.CalPlayer } #endregion - if (Player.Calamity().baconOil && !Player.mount.Active) + if ((Player.Calamity().baconOil || Player.GetModPlayer().HasAlcohol(AlcoholType.BaconOil)) && !Player.mount.Active) { Player.noFallDmg = true; - + + float stackScale = (Player.Calamity().baconOil && Player.GetModPlayer().HasAlcohol(AlcoholType.BaconOil)) ? 1.33f : 1; + float velX = Math.Abs(Player.velocity.X); float velY = Math.Abs(Player.velocity.Y); float speedMult = Player.GetBestClassDamage().ApplyTo(1); - float maxMoveSpeed = 10.5f * speedMult; - float minMoveSpeed = 3; // Minimum move speed to be at if the player can bounce + float maxMoveSpeed = 10.5f * speedMult * stackScale; + float minMoveSpeed = 3 * stackScale; // Minimum move speed to be at if the player can bounce float hitboxSizeMult = 0.45f; bool onPlatform = false; @@ -5335,9 +5560,9 @@ namespace CalamityMod.CalPlayer bool hitDown = velY > minMoveSpeed && (Collision.SolidCollision(Player.Bottom + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1) || onPlatform); bool hitUp = velY > minMoveSpeed && Collision.SolidCollision(Player.Top + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1); bool hitSide = velX > minMoveSpeed && Collision.SolidCollision(Vector2.Lerp(Player.TopLeft, Player.Left, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult)) || Collision.SolidCollision(Vector2.Lerp(Player.TopRight, Player.Right, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult)); - float acceleration = 0.05f; + float acceleration = 0.05f * stackScale; float decceleration = -0.025f / speedMult; - float riseSpeed = 0.8f; // The speed the player rises when in water or rain + float riseSpeed = 0.8f * stackScale; // The speed the player rises when in water or rain float slipPower = 0.85f; //How strong the slippery effect is float bounceReduction = 0.9f; @@ -5365,7 +5590,7 @@ namespace CalamityMod.CalPlayer { if (baconOilSoundCooldown < soundCDMax) baconOilSoundCooldown += 30; - float pitch = 0.55f * Utils.GetLerpValue(0, soundCDMax, baconOilSoundCooldown, true); + float pitch = (0.55f * stackScale) * Utils.GetLerpValue(0, soundCDMax, baconOilSoundCooldown, true); SoundStyle boyoyoing = new("CalamityMod/Sounds/Item/BaconOilBounce"); SoundEngine.PlaySound(boyoyoing with { Volume = 0.45f, Pitch = hitSide ? pitch - 0.3f : pitch, MaxInstances = 5 }, Player.Center); } @@ -5422,7 +5647,8 @@ namespace CalamityMod.CalPlayer // Apply weapon modifier stealth strike damage bonus // 01OCT2023: Ozzatron: This is a multiplicative bonus because it is a prefix. // It should be equivalent to x1.15 (or whatever multiplier) on the base damage of the weapon for stealth only. - if (rogueItem.StealthStrikePrefixBonus != 0f && StealthStrikeAvailable()) + bool dontProvideStealthDamage = Player.HeldItem.type == ModContent.ItemType(); + if (rogueItem.StealthStrikePrefixBonus != 0f && StealthStrikeAvailable() && !dontProvideStealthDamage) damage *= rogueItem.StealthStrikePrefixBonus; // This number centers on 1f, so 1.15f = 1.15x damage. } } @@ -5434,6 +5660,8 @@ namespace CalamityMod.CalPlayer if (moscowMule) knockback += MoscowMule.KnockbackBoost; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.MoscowMule)) + knockback += MoscowMule.KnockbackBoost; if (titanHeartMantle && rogue) knockback += TitanHeartMantle.RogueKnockbackBoost; @@ -5612,7 +5840,7 @@ namespace CalamityMod.CalPlayer { if (bladeArmEnchant) return false; - if (purpleHaze) + if (purpleHaze || Player.GetModPlayer().HasAlcohol(AlcoholType.PurpleHaze)) { if (item.CountsAsClass() && StealthStrikeAvailable()) { @@ -6145,6 +6373,10 @@ namespace CalamityMod.CalPlayer if (it.type == ItemType()) playerUsingWeapon = false; + // Elephant Killer consumes stealth in a special wa- hey maybe this is a sign this class needs some work huh + if (it.type == ItemType()) + playerUsingWeapon = false; + // Animation check depends on whether the item is "clockwork", like Clockwork Assault Rifle. // "Clockwork" weapons can chain-fire multiple stealth strikes (really only 2 max) until you run out of stealth. bool animationCheck = it.useAnimation == it.useTime @@ -6211,7 +6443,7 @@ namespace CalamityMod.CalPlayer Player.ownedProjectileCounts[ProjectileType()]; // If you are actively using an item, you cannot gain stealth. - if (Player.itemAnimation > 0 || finalDawnProjCount > 0) + if (Player.itemAnimation > 0 || finalDawnProjCount > 0 || (Player.ownedProjectileCounts[ProjectileType()] > 0 || Player.HeldItem.type == ModContent.ItemType())) return 0f; if (shadow) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 50bd493bad..3b4064ccb5 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -438,6 +438,10 @@ namespace CalamityMod.CalPlayer if (Player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) fishingLevel = fishingLevel * HeronRod.FishingPowerBiomeMult; + // Rage bait gives free sonar effect + if (bait.type == ModContent.ItemType()) + Player.sonarPotion = true; + // Prevent the player from fishing if they have the Bloodworm if (bait.type == ModContent.ItemType()) { diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 0c6d477f4b..95a2c0e762 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1354,11 +1354,11 @@ namespace CalamityMod.CalPlayer if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0) { - int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + int cooldownTime = RelicOfResilience.baseCooldown; rOfResilienceCooldown = cooldownTime; Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); SoundStyle youGotHit = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); - SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.5f }, Player.Center); } if (alchFlask) @@ -1529,6 +1529,7 @@ namespace CalamityMod.CalPlayer Player.AddCooldown(GlobalDodge.ID, cooldownDuration); else Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, IconToUse); + Player.SetImmuneTimeForAllTypes(Player.longInvince ? 120 : 80); } //Dodge activation order is as follows: @@ -2888,8 +2889,9 @@ namespace CalamityMod.CalPlayer defenseDamageRecoveryFrames = 0; // Directly add the base defense damage recovery time to whatever recovery time the player already has. - int baseTime = DefenseDamageBaseRecoveryTime * (moonshine ? 3 : 1); + int baseTime = DefenseDamageBaseRecoveryTime * (moonshine ? 3 : 1) * (Player.GetModPlayer().HasAlcohol(AlcoholType.Moonshine) ? 3 : 1); totalDefenseDamageRecoveryFrames = defenseDamageRecoveryFrames + baseTime; + if (totalDefenseDamageRecoveryFrames > DefenseDamageMaxRecoveryTime) totalDefenseDamageRecoveryFrames = DefenseDamageMaxRecoveryTime; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index fcbf9daa02..ed58cd05ea 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -190,17 +190,34 @@ namespace CalamityMod.CalPlayer #endregion #region Alcohol + var dripPlayer = Player.GetModPlayer(); + for (int l = 0; l < Player.MaxBuffs; l++) { int buff = Player.buffType[l]; - if (BuffDatasets.DebuffDataset[buff] is not null && BuffDatasets.DebuffDataset[buff].AlcoholLevel > 0) - alcoholPoisonLevel += BuffDatasets.DebuffDataset[buff].AlcoholLevel; + if (buff <= 0) continue; + + var data = BuffDatasets.DebuffDataset[buff]; + if (data?.AlcoholLevel > 0) + alcoholPoisonLevel += data.AlcoholLevel; } - if (Player.Calamity().ivDrip) // +1 stack of poisoning while IV Drip is equipped - alcoholPoisonLevel++; + + if (dripPlayer.ivDripEquipped && dripPlayer.currentAlcohol != AlcoholType.None) + { + int ivBuffID = BuffDatasets.GetBuffIDFromAlcoholType(dripPlayer.currentAlcohol); + + if (ivBuffID != -1) + { + var ivData = BuffDatasets.DebuffDataset[ivBuffID]; + if (ivData?.AlcoholLevel > 0) + alcoholPoisonLevel += ivData.AlcoholLevel; + } + } + if (everclear) totalNegativeLifeRegen += Everclear.RegenLoss; - + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Everclear)) + totalNegativeLifeRegen += Everclear.RegenLoss; // Blanket effect for all alcohols if (alcoholPoisonLevel > 0) { @@ -267,8 +284,11 @@ namespace CalamityMod.CalPlayer // At the last second, Reaver defense helm reduces DoT debuffs by 20% if (reaverDefense) totalNegativeLifeRegen -= (int)(totalNegativeLifeRegen * ReaverHeadTank.SetBonusDebuffDamageReduction); + if (tequilaSunrise) totalNegativeLifeRegen = (int)(totalNegativeLifeRegen * TequilaSunrise.DoTMultiplier); + if (Player.GetModPlayer().HasAlcohol(AlcoholType.TequilaSunrise)) + totalNegativeLifeRegen = (int)(totalNegativeLifeRegen * TequilaSunrise.DoTMultiplier); Player.lifeRegen -= (int)totalNegativeLifeRegen; @@ -340,8 +360,18 @@ namespace CalamityMod.CalPlayer if (tequilaSunrise) Player.lifeRegenTime += 1800; + } + if (dripPlayer.HasAlcohol(AlcoholType.TequilaSunrise)) + { + if (hadLifeRegenHinderingDebuff && !hasLifeRegenHinderingDebuff) + { + Player.lifeRegenTime += 1800; + } + } + + #endregion // During Silva revive or God Slayer dash, all negative life regen is canceled diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 89edb7cb36..27e89828b2 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; @@ -45,6 +44,7 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; @@ -239,6 +239,21 @@ namespace CalamityMod.CalPlayer rage = 0f; } + bool holdingElephantKiller = Player.HeldItem.type == ModContent.ItemType(); + if (holdingElephantKiller && !heldElephantKillerLastFrame) + { + Player.Calamity().rogueStealth = 0; + heldElephantKillerLastFrame = true; + } + else if (!holdingElephantKiller) + heldElephantKillerLastFrame = false; + + if (!drawingElephantKillerJoke) + elephantKillerJoke = 0; + else + elephantKillerJoke++; + drawingElephantKillerJoke = false; + if (furyFuel < FuryFuelMax && furyRefuelTimer >= 0) { furyFuel += (int)furyRefuelTimer; @@ -257,7 +272,9 @@ namespace CalamityMod.CalPlayer } // Apply stealth damage to rogue. - Player.GetDamage() += stealthDamage; + bool dontProvideStealthDamage = Player.HeldItem.type == ModContent.ItemType(); + if (!dontProvideStealthDamage) + Player.GetDamage() += stealthDamage; if ((XykVisualsBlue || XykVisualsOrange)) { @@ -562,9 +579,16 @@ namespace CalamityMod.CalPlayer if (cinnamonRoll && !(Main.getGoodWorld && Main.npc.Any(x=> x.active && x.type == ModContent.NPCType()))) { if (dashStart) - Player.velocity.X *= 3; + Player.velocity.X *= 2f; else if (Player.dashDelay == -1) - Player.velocity.X *= 0.8f; + Player.velocity.X *= 0.825f; + } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.CinnamonRoll) && !(Main.getGoodWorld && Main.npc.Any(x => x.active && x.type == ModContent.NPCType()))) + { + if (dashStart) + Player.velocity.X *= 2f; + else if (Player.dashDelay == -1) + Player.velocity.X *= 0.825f; } if (Player.dashDelay == -1) @@ -1277,6 +1301,18 @@ namespace CalamityMod.CalPlayer } } } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Margarita)) + { + if (Main.myPlayer == Player.whoAmI) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int buffID = Player.buffType[l]; + if (Player.buffTime[l] > 2 && CalamityBuffSets.IsDebuff[buffID]) + Player.buffTime[l]--; + } + } + } // Update the Providence Burn effect drawer if applicable. float providenceBurnIntensity = 0f; @@ -1657,46 +1693,59 @@ namespace CalamityMod.CalPlayer if (bootLevel > 0) HeatDebuffMultiplier += 0.25f * bootLevel; - if (rOfResilienceEffect > 0) - rOfResilienceEffect--; - if (Player.HeldItem.type == ModContent.ItemType()) // All players close to a player holding RoR get the benefits + bool holdingRoR = Player.HeldItem.type == ModContent.ItemType(); + bool shieldIsSetup = (rOfResilienceEffect >= RelicOfResilience.baseTimeMax); + bool chargedButNotHolding = (rOfResilienceEffect > RelicOfResilience.baseTimeMax && !holdingRoR); + bool reduceEffect = (!shieldIsSetup || chargedButNotHolding); + if (rOfResilienceEffect > 0 && reduceEffect) + { rOfResilienceEffect -= (chargedButNotHolding ? 4 : 1); if (shieldIsSetup && rOfResilienceEffect < RelicOfResilience.baseTimeMax) rOfResilienceEffect = RelicOfResilience.baseTimeMax; if (rOfResilienceEffect < 0) rOfResilienceEffect = 0; } + if (holdingRoR) // All players close to a player holding RoR get the benefits { - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead && Main.netMode != NetmodeID.MultiplayerClient) { Projectile relic = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); } for (int index = 0; index < Main.player.Length; index++) { Player fella = Main.player[index]; - if (Utils.Distance(fella.Center, Player.Center) < 650 && fella.team == Player.team) + float maxDistancePlayersCanBe = 1000; + bool validEffectBoost = Utils.Distance(fella.Center, Player.Center) < maxDistancePlayersCanBe && fella.team == Player.team && fella.Calamity().rOfResilienceEffect < RelicOfResilience.maxPowerTime + && fella.Calamity().rOfResilienceCooldown == 0 && (fella.Calamity().rOfResilienceEffect > RelicOfResilience.baseTimeMax ? holdingRoR : true); + if (validEffectBoost) { - fella.Calamity().rOfResilienceEffect = (fella != Player ? 480 : 2); + fella.Calamity().rOfResilienceEffect += (reduceEffect ? 2 : 1) + (Player.Calamity().profanedSoulRelicBuff ? 1 : 0); // gets subtracted by 1 every frame, so this goes up by more to keep up } } } + // Adds a floor for defense and dr, will not ignore defense damage + if (Player.Calamity().rOfResilienceCooldown >= RelicOfResilience.baseCooldown / 2|| Player.Calamity().rOfResilienceCooldown == 0) + { + float fadeInStats = Utils.GetLerpValue(0, RelicOfResilience.baseTimeMax, rOfResilienceEffect, true); + float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? fadeInStats : MathF.Pow(Utils.GetLerpValue(RelicOfResilience.baseCooldown / 2, RelicOfResilience.baseCooldown, Player.Calamity().rOfResilienceCooldown, true), 3)); + float overchargeBoost = 1 + (Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, rOfResilienceEffect, true) * (Player.Calamity().profanedSoulRelicBuff ? RelicOfResilience.additionalMaxPowerDefensesMult * 5 : RelicOfResilience.additionalMaxPowerDefensesMult)); // The amount of bulk this gives with artifact is way overkill but it is REALLY funny + int def = (int)(RelicOfResilience.baseDefenseFloor * overchargeBoost); + float dr = RelicOfResilience.baseDrFloor * overchargeBoost; + int maxDefFloor = (int)(def * fadeStats); + float MaxDRFloor = dr * fadeStats; + if (Player.statDefense < maxDefFloor) + Player.statDefense += maxDefFloor - Player.statDefense; + if (Player.endurance < MaxDRFloor) + Player.endurance += MaxDRFloor - Player.endurance; + } if (rOfResilienceEffect > 0) { - if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0) + if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0 && holdingRoR) { - int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + int cooldownTime = RelicOfResilience.baseCooldown; rOfResilienceCooldown = cooldownTime; Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); SoundStyle y = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); SoundEngine.PlaySound(y with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); } - // Adds a floor for defense and dr at 150 and 10% respectivley, will not ignore defense damage - if (Player.Calamity().rOfResilienceCooldown > 300 || Player.Calamity().rOfResilienceCooldown == 0) - { - float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? 1 : Utils.GetLerpValue(300, 600, Player.Calamity().rOfResilienceCooldown, true)); - int maxDefFloor = (int)(150 * fadeStats); - float MaxDRFloor = 0.10f * fadeStats; - if (Player.statDefense < maxDefFloor) - Player.statDefense += maxDefFloor - Player.statDefense; - if (Player.endurance < MaxDRFloor) - Player.endurance += MaxDRFloor - Player.endurance; - } - + int shardBaseCap = (Player.Calamity().profanedSoulRelicBuff ? (int)(RelicOfResilience.baseMaxShardCount * 1.5f) : RelicOfResilience.baseMaxShardCount); + float postMaxedShards = MathHelper.Lerp(shardBaseCap, shardBaseCap * RelicOfResilience.maxPowerShardMult, MathF.Pow(Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, rOfResilienceEffect, true), 2)); + int maxShards = (int)(postMaxedShards * Utils.GetLerpValue(0, RelicOfResilience.baseTimeMax, rOfResilienceEffect, true)); int numOfShards = 0; for (int x = 0; x < Main.maxProjectiles; x++) { @@ -1706,7 +1755,26 @@ namespace CalamityMod.CalPlayer numOfShards++; } } - if (Player.miscCounter % (Player.Calamity().profanedSoulRelicBuff ? 4 : 8) == 0 && numOfShards < (Player.Calamity().profanedSoulRelicBuff ? 75 : 30) && Player.Calamity().rOfResilienceCooldown == 0) + float lowestNum = 0; + int whoAmI = 0; + if (numOfShards > maxShards) // Kill the most recent shard if there's too many + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Player.whoAmI && projectile.ai[2] > lowestNum) + { + whoAmI = projectile.whoAmI; + lowestNum = projectile.ai[2]; + } + } + if (whoAmI != 0) + { + Projectile shard = Main.projectile[whoAmI]; + shard.ai[1] = -1; + } + } + if (numOfShards < maxShards && Player.Calamity().rOfResilienceCooldown == 0 && (rOfResilienceEffect >= RelicOfResilience.baseTimeMax || holdingRoR)) { if (numOfShards == 0) { @@ -1714,12 +1782,13 @@ namespace CalamityMod.CalPlayer SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = -0.3f }, Player.Center); } - int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(420); - Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); + int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(Player.Calamity().profanedSoulRelicBuff ? RelicOfResilience.shardBaseDamage * 5 : RelicOfResilience.shardBaseDamage); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); } } if (rOfResilienceCooldown > 0) - rOfResilienceCooldown--; + { rOfResilienceCooldown -= (holdingRoR ? 2 : 1); if (rOfResilienceCooldown < 0) rOfResilienceCooldown = 0; } if (Player.Calamity().friendlyMinions > 0) { @@ -3357,6 +3426,7 @@ namespace CalamityMod.CalPlayer #region Other Buff Effects private void OtherBuffEffects() { + var dripPlayer = Player.GetModPlayer(); if (gravityNormalizer) { Player.buffImmune[BuffID.VortexDebuff] = true; @@ -3544,30 +3614,50 @@ namespace CalamityMod.CalPlayer { //this is so janky looking but it's the only way I could get it to work properly if (!(StealthStrikeAvailable() && Player.HeldItem.DamageType == RogueDamageClass.Instance)) - Player.GetDamage(DamageClass.Generic) += PurpleHaze.DamageBoost; + Player.GetDamage(DamageClass.Generic) += PurpleHaze.DamageBoost + ((dripPlayer.HasAlcohol(AlcoholType.PurpleHaze) && purpleHaze) ? PurpleHaze.DamageBoost : 0); else - stealthDamage -= PurpleHaze.StealthDamageLoss; + stealthDamage -= PurpleHaze.StealthDamageLoss + ((dripPlayer.HasAlcohol(AlcoholType.PurpleHaze) && purpleHaze) ? PurpleHaze.StealthDamageLoss : 0); } if (everclear) Player.GetDamage() += Everclear.DamageBoost; - + if (dripPlayer.HasAlcohol(AlcoholType.Everclear)) + Player.GetDamage() += Everclear.DamageBoost; if (caribbeanRum) { Player.gravity *= CaribbeanRum.GravityMultiplier; Player.moveSpeed += CaribbeanRum.MoveSpeedBoost; } + if (dripPlayer.HasAlcohol(AlcoholType.CaribbeanRum)) + { + Player.gravity *= CaribbeanRum.GravityMultiplier; + Player.moveSpeed += CaribbeanRum.MoveSpeedBoost; + } if (starBeamRye) { Player.manaRegenCount += StarBeamRye.ManaRegenBoost; Player.GetDamage() *= StarBeamRye.MagicDmgMult; } - - if (whiteWine) + if (dripPlayer.HasAlcohol(AlcoholType.StarBeamRye)) { - Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); + Player.manaRegenCount += StarBeamRye.ManaRegenBoost; + Player.GetDamage() *= StarBeamRye.MagicDmgMult; + } + + if (dripPlayer.HasAlcohol(AlcoholType.Ale) || dripPlayer.HasAlcohol(AlcoholType.Sake)) + { + Player.GetAttackSpeed() -= 0.1f; + // See CalamityGlobalItem and PlayerUtils for Ale's melee size increase + } + + if (whiteWine || dripPlayer.HasAlcohol(AlcoholType.WhiteWine)) + { + if (whiteWine) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); + if (Player.GetModPlayer().HasAlcohol(AlcoholType.WhiteWine)) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - WhiteWine.FlightTimeLoss)); float bonus = 0f; float MaxDistance = 640f; @@ -3579,7 +3669,12 @@ namespace CalamityMod.CalPlayer } else bonus = 0; - whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + + if (whiteWine) + whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.WhiteWine)) + whiteWineTimer += bonus * WhiteWine.FlightTimeRecoveryAmount; + while (whiteWineTimer > 1) { if (Player.wingTime < Player.wingTimeMax) @@ -3589,9 +3684,9 @@ namespace CalamityMod.CalPlayer } if (redWine) - { Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - RedWine.FlightTimeLoss)); - } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.RedWine)) + Player.wingTimeMax = (int)(Player.wingTimeMax * (1f - RedWine.FlightTimeLoss)); if (giantPearl) { @@ -4733,6 +4828,12 @@ namespace CalamityMod.CalPlayer if (Player.statDefense > 0) Player.statDefense -= (int)(Player.statDefense * Everclear.DefenseLossPercent); } + if (Player.GetModPlayer().HasAlcohol(AlcoholType.Everclear)) + { + if (Player.statDefense > 0) + Player.statDefense -= (int)(Player.statDefense * Everclear.DefenseLossPercent); + } + if (DesertProwlerHat.ShroudedInSmoke(Player, out _)) Player.statDefense -= (int)(Player.statDefense * DesertProwlerHat.SmokeDefenseMult); } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 21b30df04d..f33bdf1c43 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -90,7 +90,6 @@ namespace CalamityMod.CalPlayer target.Calamity().IncreasedElectricityEffects_Unused = false; target.Calamity().IncreasedHeatEffects_Fireball = fireball; - target.Calamity().IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; target.Calamity().IncreasedHeatEffects_FireBoots = bootLevel; target.Calamity().IncreasedSicknessEffects_ToxicHeart = toxicHeart; @@ -240,7 +239,10 @@ namespace CalamityMod.CalPlayer if (proj.type != ProjectileType()) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); - if (moscowMule) + var ivDripPlayer = Player.GetModPlayer(); + + // "Heavy" Knockback effect + if (moscowMule || ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule)) { var center = Player.Center; if (proj.IsMinionOrSentryRelated) @@ -255,10 +257,16 @@ namespace CalamityMod.CalPlayer { proj.damage = (int)(proj.damage * (moscowMule ? 0.8f : 1f) * (bloodyMary ? 0.75f : 1f)); } - + } + if (ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule) || ivDripPlayer.HasAlcohol(AlcoholType.BloodyMary)) + { + if (!(PierceResistNPC.exemptProjectiles.Contains(proj.type) || (PierceResistNPC.singleHitboxExemptProjectiles.ContainsKey(proj.type) && PierceResistNPC.singleHitboxExemptProjectiles[proj.type]))) + { + proj.damage = (int)(proj.damage * (ivDripPlayer.HasAlcohol(AlcoholType.MoscowMule) ? 0.8f : 1f) * (ivDripPlayer.HasAlcohol(AlcoholType.BloodyMary) ? 0.75f : 1f)); + } } - if (witheringWeaponEnchant) + if (witheringWeaponEnchant) witheringDamageDone += (int)(damageDone * (hit.Crit ? 2D : 1D)); cgn.TypelessDebuffMultiplier = TypelessDebuffMultiplier; cgn.HeatDebuffMultiplier = HeatDebuffMultiplier; @@ -1002,7 +1010,7 @@ namespace CalamityMod.CalPlayer if (xerocSet && xerocDmg <= 0 && Player.ownedProjectileCounts[ProjectileType()] < 3 && Player.ownedProjectileCounts[ProjectileType()] < 3) { - switch (Main.rand.Next(5)) + switch (Main.rand.Next(4)) { case 0: // Exodus Rogue Stars: 80% @@ -1030,13 +1038,6 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), blastDamage, 0f, proj.owner, 0f, 0f); break; - case 4: - // Exodus Rogue Bubble: 60% - int bubbleDamage = (int)(proj.damage * 0.6f); - CalamityUtils.SpawnOrb(proj, bubbleDamage, ProjectileType(), 800f, 15f); - xerocDmg += (int)(bubbleDamage * 0.5); - break; - default: break; } diff --git a/Cooldowns/RelicOfResilienceCooldown.cs b/Cooldowns/RelicOfResilienceCooldown.cs index 18da908039..cf3109b412 100644 --- a/Cooldowns/RelicOfResilienceCooldown.cs +++ b/Cooldowns/RelicOfResilienceCooldown.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Tools; +using Microsoft.Xna.Framework; using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.Cooldowns { @@ -12,5 +14,11 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => new Color(255, 191, 73); public override Color CooldownStartColor => new Color(122, 66, 59); public override Color CooldownEndColor => new Color(165, 103, 87); + + public override void Tick() + { + if (instance.player.HeldItem.type == ModContent.ItemType()) + instance.timeLeft--; + } } } diff --git a/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs index d76bf10843..2a70fe931f 100644 --- a/DataStructures/DebuffData.cs +++ b/DataStructures/DebuffData.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,6 +12,7 @@ namespace CalamityMod.DataStructures [ReinitializeDuringResizeArrays] public static class BuffDatasets { + private static DebuffData Alch(int level) => new DebuffData() { AlcoholLevel = level }; public static DebuffData[] DebuffDataset = BuffID.Sets.Factory.CreateNamedSet("DebuffData") .Description("Stores DebuffData for a particular debuff") .RegisterCustomSet(null, @@ -24,8 +27,69 @@ namespace CalamityMod.DataStructures BuffID.Poisoned, DebuffData.Poisoned, BuffID.Venom, DebuffData.AcidVenom, BuffID.Electrified, DebuffData.Electrified, - BuffID.Oiled, DebuffData.Oiled + BuffID.Oiled, DebuffData.Oiled, + + BuffID.Tipsy, Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + ModContent.BuffType(), Alch(1), + + ModContent.BuffType(), Alch(2), + ModContent.BuffType(), Alch(3) ); + public static int GetBuffIDFromAlcoholType(AlcoholType type) + { + return type switch + { + AlcoholType.BaconOil => ModContent.BuffType(), + AlcoholType.BloodyMary => ModContent.BuffType(), + AlcoholType.CaribbeanRum => ModContent.BuffType(), + AlcoholType.CinnamonRoll => ModContent.BuffType(), + AlcoholType.Everclear => ModContent.BuffType(), + AlcoholType.EvergreenGin => ModContent.BuffType(), + AlcoholType.Fireball => ModContent.BuffType(), + AlcoholType.GrapeBeer => ModContent.BuffType(), + AlcoholType.Manhattan => ModContent.BuffType(), + AlcoholType.Margarita => ModContent.BuffType(), + AlcoholType.Moonshine => ModContent.BuffType(), + AlcoholType.MoscowMule => ModContent.BuffType(), + AlcoholType.OldFashioned => ModContent.BuffType(), + AlcoholType.PurpleHaze => ModContent.BuffType(), + AlcoholType.RedWine => ModContent.BuffType(), + AlcoholType.Rum => ModContent.BuffType(), + AlcoholType.Screwdriver => ModContent.BuffType(), + AlcoholType.StarBeamRye => ModContent.BuffType(), + AlcoholType.Tequila => ModContent.BuffType(), + AlcoholType.TequilaSunrise => ModContent.BuffType(), + AlcoholType.Vodka => ModContent.BuffType(), + AlcoholType.Whiskey => ModContent.BuffType(), + AlcoholType.WhiteWine => ModContent.BuffType(), + + // Vanilla treats both Ale and Sake as the "Tipsy" buff + AlcoholType.Ale => BuffID.Tipsy, + AlcoholType.Sake => BuffID.Tipsy, + + _ => -1 + }; + } } public class DebuffData { diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 0dbe910190..324678faa4 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -775,27 +775,31 @@ namespace CalamityMod.ILEditing } #endregion - #region Tweak Pygmy Staff aggro distance logic - + #region Tweak Pygmy Staff Aggro Distance Logic + // Code written by Habble private static void PygmyAggroOnClosestPointInHitbox(ILContext context) { + // Adjust Pygmy Staff's attack distance logic to be measured from the closest point to the enemy instead of the enemy's center. ILCursor cursor = new(context); + + // Go to the latest newly set variable near the point we wanna be, as that is an easy unique instruction to jump to. 131 is the number assigned to that local variable. if (!cursor.TryGotoNext(i => i.MatchStloc(131))) - {// Go to the latest newly set variable near the point we wanna be, as that is an easy unique instruction to jump to - // 131 is the number assigned to that variable in ILview + { LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate unique Stloc(131) instruction nearest to aggro distance check."); return; } + // Move before the minion range variable emission so as to receive the value being targetted at it. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdloc(126))) - {// Before the minion range variable emission so as to receive the value being targetted at it + { LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate the minion range variable."); return; } - cursor.Emit(OpCodes.Ldarg_0); // Emit the Projectile entity as we are in Projectile.cs::AI_026 - cursor.Emit(OpCodes.Ldloc, 129); // Emit the NPC index via the incremented loop variable - cursor.Emit(OpCodes.Ldloc, 6); // Emit the bool containing type check for pygmies + cursor.Emit(OpCodes.Ldarg_0); // Emits the Projectile entity itself + cursor.Emit(OpCodes.Ldloc, 129); // Emits the NPC index via the incremented loop variable + cursor.Emit(OpCodes.Ldloc, 6); // Emits the bool containing type check for Pygmies + // Replace the distance with a different value calculated off of closest point in hitboxes cursor.EmitDelegate((float distance, Projectile projectile, int npcIndex, bool pygmy) => - {// Replace the distance with a different value calculated off of closest point in hitboxes + { if (!pygmy) return distance; @@ -804,34 +808,39 @@ namespace CalamityMod.ILEditing float finalDistance = npc.Hitbox.ClosestPointInRect(player.Center).Distance(player.Hitbox.ClosestPointInRect(npc.Center)); return finalDistance; }); + // That was part 1, time for part 2. + // Go directly before the instruction that's meant to receive the distance value of this tagged NPC. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(185))) - {// Go directly before the instruction that's meant to receive the distance value of this tagged NPC + { LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate first unique Stloc(185) instruction."); return; } cursor.Emit(OpCodes.Ldarg_0); - cursor.Emit(OpCodes.Ldloc, 181); // Emit the tagged NPC + cursor.Emit(OpCodes.Ldloc, 181); // Emits the tagged NPC cursor.Emit(OpCodes.Ldloc, 6); + // Replace the distance with a different value calculated off of closest point in hitboxes cursor.EmitDelegate((float distance, Projectile projectile, NPC npc, bool pygmy) => - {// Replace the distance with a different value calculated off of closest point in hitboxes + { if (!pygmy) return distance; float finalDistance = npc.Hitbox.ClosestPointInRect(projectile.Center).Distance(projectile.Hitbox.ClosestPointInRect(npc.Center)); return finalDistance; }); - + + // Go directly before the instruction that's meant to receive the distance value of this NPC currently being iterated over. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(189))) - {// Go directly before the instruction that's meant to receive the distance value of this NPC currently being iterated over + { LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate first unique Stloc(189) instruction."); return; } cursor.Emit(OpCodes.Ldarg_0); - cursor.Emit(OpCodes.Ldloc, 186); // Emit the NPC index via the incremented loop variable + cursor.Emit(OpCodes.Ldloc, 186); // Emits the NPC index via the incremented loop variable cursor.Emit(OpCodes.Ldloc, 6); + // Replace the distance with a different value calculated off of closest point in hitboxes cursor.EmitDelegate((float distance, Projectile projectile, int npcIndex, bool pygmy) => - {// Replace the distance with a different value calculated off of closest point in hitboxes + { if (!pygmy) return distance; @@ -840,7 +849,6 @@ namespace CalamityMod.ILEditing return finalDistance; }); } - - #endregion Tweak Pygmy Staff aggro distance logic + #endregion } } diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index e853081cf6..a4463dddb6 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -105,6 +105,7 @@ namespace CalamityMod.ILEditing On_Main.DamageVar_float_int_float += AdjustDamageVariance; IL_NPC.ScaleStats_ApplyExpertTweaks += RemoveExpertHardmodeScaling; IL_Projectile.Damage += VanillaBossResistChanges; + IL_Projectile.AI_026 += PygmyAggroOnClosestPointInHitbox; IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; On_Projectile.AI_015_Flails += FlailsNoLongerAffectedByPlayerVelocity; IL_Projectile.AI_015_Flails += IncreaseFlowerPowRetSpeed; @@ -188,9 +189,6 @@ namespace CalamityMod.ILEditing // Fix vanilla behaviour of not calling CheckDead for NPCs that realLife is set IL_NPC.StrikeNPC_HitInfo_bool_bool += EnsureCheckDeadOnSegments; - // Change Pygmy Staff minion AI to check distance based on closest points in hitboxes - IL_Projectile.AI_026 += PygmyAggroOnClosestPointInHitbox; - //Additional detours that are in their own item files given they are only relevant to these specific items: //Rover drive detours on Player.DrawInfernoRings to draw its shield //Wulfrum armor hooks on Player.KeyDoubleTap and DrawPendingMouseText to activate its set bonus and spoof the mouse text to display the stats of the activated weapon if shift is held diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 38e435b56e..775374dc21 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -563,6 +563,8 @@ namespace CalamityMod.ILEditing { if (self.Calamity().oldFashioned) damage = (int)(damage * OldFashioned.DamageBoostMultiplier); + if (self.GetModPlayer().HasAlcohol(AlcoholType.OldFashioned)) + damage = (int)(damage * OldFashioned.DamageBoostMultiplier); orig(self, npc, damage, knockback, direction, crit, damageType, damageVariation); } #endregion diff --git a/Items/Accessories/DarkMatterSheath.cs b/Items/Accessories/DarkMatterSheath.cs index c77de6db38..c84de1d85c 100644 --- a/Items/Accessories/DarkMatterSheath.cs +++ b/Items/Accessories/DarkMatterSheath.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(5). + AddIngredient(14). //Consistent with Vanilla lunar wing costs AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/DiamondOfTheDeep.cs b/Items/Accessories/DiamondOfTheDeep.cs index ee6c3d8e97..316af2422c 100644 --- a/Items/Accessories/DiamondOfTheDeep.cs +++ b/Items/Accessories/DiamondOfTheDeep.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.dOfTheDeep = true; modPlayer.dOfTheDeepVisual = !hideVisual; - modPlayer.WaterDebuffMultiplier += 0.75f; + modPlayer.WaterDebuffMultiplier += 0.6f; } public override void AddRecipes() diff --git a/Items/Accessories/IVDripOnTheRocks.cs b/Items/Accessories/IVDripOnTheRocks.cs index aebb7705d0..dd58c8f289 100644 --- a/Items/Accessories/IVDripOnTheRocks.cs +++ b/Items/Accessories/IVDripOnTheRocks.cs @@ -1,21 +1,68 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Rarities; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.UI; namespace CalamityMod.Items.Accessories { + public enum AlcoholType + { + None, + BaconOil, + BloodyMary, + CaribbeanRum, + CinnamonRoll, + Everclear, + EvergreenGin, + Fireball, + GrapeBeer, + Manhattan, + Margarita, + Moonshine, + MoscowMule, + OldFashioned, + PurpleHaze, + RedWine, + Rum, + Screwdriver, + StarBeamRye, + Tequila, + TequilaSunrise, + Vodka, + Whiskey, + WhiteWine, + Ale, + Sake, + } + + public interface IAlcoholItem + { + Action IVDripAlcoholEffect { get; } + AlcoholType AlcoholVariant { get; } + LocalizedText DripEffectText { get; } + } + public class IVDripOnTheRocks : ModItem, ILocalizedModType { + public int containedAlcoholID = -1; + public AlcoholType currentAlcoholType = AlcoholType.None; public new string LocalizationCategory => "Items.Accessories"; - public static readonly float DamageBoostMultiplier = 1.25f; // Same as Old Fashioned but can be changed at any time - public static readonly float DamageReductionMultiplier = 0.75f; // Same as Old Fashioned but can be changed at any time - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); public override void SetDefaults() + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new Terraria.DataStructures.DrawAnimationVertical(1, 26)); + ItemID.Sets.AnimatesAsSoul[Item.type] = true; + } + + public override void SetDefaults() { Item.width = 58; Item.height = 60; @@ -24,19 +71,216 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void Load() { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.ivDrip = true; + On_ItemSlot.OverrideLeftClick += IvDripAlcoholEquip; } - public override void AddRecipes() + public override void Unload() { - CreateRecipe(). - AddIngredient(). - AddIngredient(6). - AddTile(TileID.MythrilAnvil). - Register(); + On_ItemSlot.OverrideLeftClick -= IvDripAlcoholEquip; + } + + private bool IvDripAlcoholEquip(On_ItemSlot.orig_OverrideLeftClick orig, Item[] inv, int context, int slot) + { + if (context == ItemSlot.Context.InventoryItem || context == ItemSlot.Context.ChestItem) + { + Item mouseItem = Main.mouseItem; + Item targetItem = inv[slot]; + + // Vanilla alcohols have to be applied manually + bool isMouseAle = mouseItem.type == ItemID.Ale; + bool isTargetAle = targetItem.type == ItemID.Ale; + bool isMouseSake = mouseItem.type == ItemID.Sake; + bool isTargetSake = targetItem.type == ItemID.Sake; + + // Alcohol into this acc + if (targetItem.ModItem is IVDripOnTheRocks drip && (mouseItem.ModItem is IAlcoholItem || isMouseAle || isMouseSake)) + { + if (drip.containedAlcoholID == -1) + { + drip.containedAlcoholID = mouseItem.type; + drip.currentAlcoholType = isMouseAle ? AlcoholType.Ale : (isMouseSake ? AlcoholType.Sake : (mouseItem.ModItem as IAlcoholItem).AlcoholVariant); + + mouseItem.stack--; + if (mouseItem.stack <= 0) + mouseItem.TurnToAir(); + + SoundEngine.PlaySound(SoundID.Grab); + return true; + } + } + + if (mouseItem.ModItem is IVDripOnTheRocks dripHeld && (targetItem.ModItem is IAlcoholItem || isTargetAle || isTargetSake)) + { + if (dripHeld.containedAlcoholID == -1) + { + dripHeld.containedAlcoholID = targetItem.type; + dripHeld.currentAlcoholType = isTargetAle ? AlcoholType.Ale : (isTargetSake ? AlcoholType.Sake : (targetItem.ModItem as IAlcoholItem).AlcoholVariant); + + targetItem.stack--; + if (targetItem.stack <= 0) + targetItem.TurnToAir(); + + SoundEngine.PlaySound(SoundID.Grab); + return true; + } + } + } + return orig(inv, context, slot); + } + + #region Shift-Right Click to Empty IV Drip + + // Allow shift-right clicking only if the IV drip actually contains alcohol + public override bool CanRightClick() => containedAlcoholID != -1 && Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift); + + public override void RightClick(Player player) + { + if (containedAlcoholID != -1) + { + // Give the alcohol back to the player + player.QuickSpawnItem(player.GetSource_ItemUse(Item), containedAlcoholID); + + containedAlcoholID = -1; + currentAlcoholType = AlcoholType.None; + + Item.stack++; + + SoundEngine.PlaySound(SoundID.Grab); + } + } + #endregion + public override void PreReforge() + { + if (containedAlcoholID != -1) + { + // Refund the alcohol to the player. + Main.LocalPlayer.QuickSpawnItem(Main.LocalPlayer.GetSource_ItemUse(Item), containedAlcoholID); + + containedAlcoholID = -1; + currentAlcoholType = AlcoholType.None; + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + IVDripPlayer dripPlayer = player.GetModPlayer(); + dripPlayer.ivDripEquipped = true; + + if (containedAlcoholID != -1) + { + dripPlayer.currentAlcohol = currentAlcoholType; + + Item alcoholItem = new Item(containedAlcoholID); + if (alcoholItem.ModItem is IAlcoholItem alcohol) + dripPlayer.ApplyIVDripAlcoholEffect(alcohol.IVDripAlcoholEffect); + } + } + + public override void ModifyTooltips(List tooltips) + { + if (tooltips == null) return; + + var effectLine = tooltips.FirstOrDefault(x => x.Text.Contains("[EFFECT]")); + var nameLine = tooltips.FirstOrDefault(x => x.Text.Contains("[NAME]")); + + if (containedAlcoholID == -1) + { + if (effectLine != null) + { + effectLine.Text = this.GetLocalizedValue("Empty"); + } + nameLine?.Hide(); + return; + } + + if (effectLine != null) + { + if (containedAlcoholID == ItemID.Ale || containedAlcoholID == ItemID.Sake) + effectLine.Text = this.GetLocalizedValue("SakeAndAleText"); + + else + { + Item alcoholItem = new Item(containedAlcoholID); + if (alcoholItem.ModItem is IAlcoholItem alcohol) + effectLine.Text = alcohol.DripEffectText.Value; + } + } + + if (nameLine != null) + { + string alcoholName = Lang.GetItemNameValue(containedAlcoholID); + nameLine.Text = this.GetLocalizedValue("CurrentAlcoholText") + $" [c/FF81E4:{alcoholName}]"; + } + } + + // Draw the correct alcohol variant frame + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = TextureAssets.Item[Item.type].Value; + + int frameHeight = texture.Height / 26; + int frameIndex = (int)currentAlcoholType; + + Rectangle targetFrame = new Rectangle(0, frameIndex * frameHeight, texture.Width, frameHeight); + + spriteBatch.Draw(texture, position, targetFrame, drawColor, 0f, origin, scale, SpriteEffects.None, 0f); + return false; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = TextureAssets.Item[Item.type].Value; + + int frameHeight = texture.Height / 26; + int frameIndex = (int)currentAlcoholType; + + Rectangle targetFrame = new Rectangle(0, frameIndex * frameHeight, texture.Width, frameHeight); + + Vector2 drawPosition = Item.position - Main.screenPosition + new Vector2(Item.width / 2, Item.height - frameHeight / 2); + Vector2 origin = targetFrame.Size() / 2f; + + spriteBatch.Draw(texture, drawPosition, targetFrame, lightColor, rotation, origin, scale, SpriteEffects.None, 0f); + return false; + } + } + + public class IVDripPlayer : ModPlayer + { + public Dictionary, float> IVDripAlcoholEffects = new(); + public bool ivDripEquipped; + public AlcoholType currentAlcohol = AlcoholType.None; + + // would otherwise be spamming these checks manually any time another class wants to check for if IV drip has a certain alcohol filled + public bool HasAlcohol(AlcoholType type) + { + return ivDripEquipped && currentAlcohol == type; + } + + public override void ResetEffects() + { + IVDripAlcoholEffects.Clear(); + ivDripEquipped = false; + currentAlcohol = AlcoholType.None; + } + + public void ApplyIVDripAlcoholEffect(Action effect) + { + if (effect == null) + return; + + if (IVDripAlcoholEffects.ContainsKey(effect)) + IVDripAlcoholEffects[effect] += 1f; + else + IVDripAlcoholEffects[effect] = 1f; + } + + public override void PostUpdateEquips() + { + foreach (var effect in IVDripAlcoholEffects) + { + effect.Key.Invoke(Player, effect.Value); + } } } } diff --git a/Items/Accessories/IVDripOnTheRocks.png b/Items/Accessories/IVDripOnTheRocks.png index b2736f4dac..24f80d57d7 100644 Binary files a/Items/Accessories/IVDripOnTheRocks.png and b/Items/Accessories/IVDripOnTheRocks.png differ diff --git a/Items/Accessories/PusSac.png b/Items/Accessories/PusSac.png deleted file mode 100644 index b7e706c8d0..0000000000 Binary files a/Items/Accessories/PusSac.png and /dev/null differ diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 08416580fe..91bac3cf1e 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(5). - AddIngredient(6). + AddIngredient(14). //Consistent with Vanilla lunar wing costs AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/Wings/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index 015f195b2d..2c7bd99117 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(ItemID.SoulofFlight, 20). - AddIngredient(14). + AddIngredient(14). AddIngredient(ItemID.LunarBar, 10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Ammo/HolyFireBullet.png b/Items/Ammo/HolyFireBullet.png index ade0ab6783..5c7ff644ff 100644 Binary files a/Items/Ammo/HolyFireBullet.png and b/Items/Ammo/HolyFireBullet.png differ diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index 4d16ffe959..0e0afa9361 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). + AddIngredient(20). AddIngredient(ItemID.LunarBar, 16). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Armor/Empyrean/EmpyreanCuisses.cs b/Items/Armor/Empyrean/EmpyreanCuisses.cs index ff7916ea14..54044dfcdd 100644 --- a/Items/Armor/Empyrean/EmpyreanCuisses.cs +++ b/Items/Armor/Empyrean/EmpyreanCuisses.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(15). AddIngredient(ItemID.LunarBar, 12). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index 08759c2a23..8c9505f16a 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(10). AddIngredient(ItemID.LunarBar, 8). AddTile(TileID.LunarCraftingStation). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/BleachedPowder.png b/Items/BleachedPowder.png deleted file mode 100644 index 46d1bb49eb..0000000000 Binary files a/Items/BleachedPowder.png and /dev/null differ diff --git a/Items/BloodBroccoli.png b/Items/BloodBroccoli.png deleted file mode 100644 index 2bc47a0418..0000000000 Binary files a/Items/BloodBroccoli.png and /dev/null differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index c4ba2b06f9..d7a05de04f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -884,8 +884,10 @@ namespace CalamityMod.Items // 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; - if (player.Calamity().ivDrip) - modifiers.SourceDamage *= IVDripOnTheRocks.DamageReductionMultiplier; + + var dripPlayer = player.GetModPlayer(); + if (dripPlayer.HasAlcohol(AlcoholType.OldFashioned)) + modifiers.SourceDamage *= OldFashioned.DamageReductionMultiplier; } public override void OnHitNPC(Item item, Player player, NPC target, NPC.HitInfo hit, int damageDone) @@ -936,7 +938,9 @@ namespace CalamityMod.Items { // Xyk 3MARCH2026: Doesn't work on any non use style 1 items currently, Doze will fix it if (item.CountsAsClass() && player.HasBuff(BuffID.Tipsy)) - scale += 0.15f; + scale += 0.25f; + if (item.CountsAsClass() && (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake))) + scale += 0.25f; } public override void UpdateArmorSet(Player player, string set) { diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index ee62c4b95a..f06be1b47f 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -1497,6 +1497,18 @@ namespace CalamityMod.Items #region Enchanted Rarity Text Drawing public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) { + if (line.Mod == "Terraria" && item.type == ModContent.ItemType() && CalamityClientConfig.Instance.TextEffects && line.Name == "Damage") + { + string fakeLine = line.Text.Replace(" " + RogueDamageClass.Instance.DisplayName.ToString(), DamageClass.Ranged.DisplayName.ToString()); + float fade = Utils.GetLerpValue(18, 120, Main.LocalPlayer.Calamity().elephantKillerJoke, true); + + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, fakeLine, new Vector2(line.X, line.Y), line.Color * (1 - fade), line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, new Vector2(line.X, line.Y), line.Color * fade, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } + + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType() && CalamityClientConfig.Instance.TextEffects) { Color rarityColor = Color.White; diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index a9f8fbccc5..6b32dc8db6 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -197,7 +197,7 @@ namespace CalamityMod.Items { ItemID.PurpleClubberfish, Do(UseTurn, KnockbackExact(10f)) }, // VANILLA: 8 KB { ItemID.PurplePhaseblade, phaseblade }, { ItemID.PurplePhasesaber, phasesaber }, - { ItemID.PygmyStaff, Do(DamageExact(63)) }, // VANILLA: 40 DMG + { ItemID.PygmyStaff, Do(DamageExact(60)) }, // VANILLA: 40 DMG { ItemID.RainbowGun, Do(DamageExact(60)) }, // VANILLA: 45 DMG { ItemID.RainbowRod, Do(DamageExact(40), KnockbackExact(8f)) }, // VANILLA: 50 DMG, 6 KB { ItemID.Rally, Do(DamageExact(18)) }, // VANILLA: 14 DMG diff --git a/Items/Fishing/FishingRods/TrustyOldRod.cs b/Items/Fishing/FishingRods/TrustyOldRod.cs new file mode 100644 index 0000000000..2f77e5458c --- /dev/null +++ b/Items/Fishing/FishingRods/TrustyOldRod.cs @@ -0,0 +1,33 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.FishingRods +{ + public class TrustyOldRod : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public static (int, int) enemyChance = (1, 3); // x/x Chance to pull up enemies + public override void SetDefaults() + { + Item.width = 70; + Item.height = 70; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 45; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(68f, -52f); + lineColor = new Color(171, 171, 171, 0); + } + } +} diff --git a/Items/Fishing/FishingRods/TrustyOldRod.png b/Items/Fishing/FishingRods/TrustyOldRod.png new file mode 100644 index 0000000000..4b0dddb409 Binary files /dev/null and b/Items/Fishing/FishingRods/TrustyOldRod.png differ diff --git a/Items/Fishing/RageBait.cs b/Items/Fishing/RageBait.cs new file mode 100644 index 0000000000..43c2ac8f62 --- /dev/null +++ b/Items/Fishing/RageBait.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing +{ + public class RageBait : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public static (int, int) junkChance = (2, 3); // x/x Chance to turn items to junk + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = Item.CommonMaxStack; + Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(copper: 1); + Item.bait = 100; + Item.consumable = true; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.FishingBait; + } + } +} diff --git a/Items/Fishing/RageBait.png b/Items/Fishing/RageBait.png new file mode 100644 index 0000000000..1d97f4c96d Binary files /dev/null and b/Items/Fishing/RageBait.png differ diff --git a/Items/Materials/DisgustingSlop.png b/Items/Materials/DisgustingSlop.png new file mode 100644 index 0000000000..6d88c2df93 Binary files /dev/null and b/Items/Materials/DisgustingSlop.png differ diff --git a/Items/Materials/MeldBlob.cs b/Items/Materials/MeldBlob.cs index c7bb47de1b..3b87947858 100644 --- a/Items/Materials/MeldBlob.cs +++ b/Items/Materials/MeldBlob.cs @@ -7,18 +7,26 @@ namespace CalamityMod.Items.Materials public class MeldBlob : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Materials"; + public override void SetStaticDefaults() { - Item.ResearchUnlockCount = 100; + Item.ResearchUnlockCount = 25; + ItemID.Sets.ItemIconPulse[Type] = true; } public override void SetDefaults() { - Item.width = 16; - Item.height = 14; + Item.width = 24; + Item.height = 22; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 20); - Item.rare = ItemRarityID.Red; + Item.rare = ItemRarityID.Cyan; + ItemID.Sets.ItemNoGravity[Type] = true; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(Item.Center, 0.5f * brightness, 0.5f * brightness, 0.5f * brightness); } } } diff --git a/Items/Materials/MeldBlob.png b/Items/Materials/MeldBlob.png index a24387680f..1c0aafc145 100644 Binary files a/Items/Materials/MeldBlob.png and b/Items/Materials/MeldBlob.png differ diff --git a/Items/Materials/MeldConstruct.cs b/Items/Materials/MeldConstruct.cs deleted file mode 100644 index 3fe527e5cc..0000000000 --- a/Items/Materials/MeldConstruct.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - [LegacyName("MeldiateBar")] - public class MeldConstruct : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - } - - public override void SetDefaults() - { - Item.width = 15; - Item.height = 12; - Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 42); - Item.rare = ItemRarityID.Red; - } - public override void AddRecipes() - { - CreateRecipe(3). - AddIngredient(6). - AddIngredient(3). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Materials/MeldConstruct.png b/Items/Materials/MeldConstruct.png deleted file mode 100644 index 1150c8db8f..0000000000 Binary files a/Items/Materials/MeldConstruct.png and /dev/null differ diff --git a/Items/Placeables/Furniture/GluttonyBlender.cs b/Items/Placeables/Furniture/GluttonyBlender.cs new file mode 100644 index 0000000000..86a53a4691 --- /dev/null +++ b/Items/Placeables/Furniture/GluttonyBlender.cs @@ -0,0 +1,67 @@ +using CalamityMod.Tiles.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class GluttonyBlender : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public const int OneInXChanceForGoodSlop = 5; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(gold: 5); + } + } + + public class QualitySlop : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override string Texture => "CalamityMod/Items/Potions/Food/QualitySlop"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = [ + new Color(183, 65, 68), + new Color(167, 116, 36), + new Color(175, 87, 190) + ]; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(32, 30, BuffID.WellFed3, CalamityUtils.MinutesToFrames(60)); + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Orange; + } + } + + public class DisgustingSlop : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override string Texture => "CalamityMod/Items/Materials/DisgustingSlop"; + + public override void SetStaticDefaults() + { + ItemID.Sets.ExtractinatorMode[Type] = ItemID.OldShoe; + } + public override void SetDefaults() + { + Item.width = 26; + Item.height = 36; + Item.maxStack = Item.CommonMaxStack; + Item.rare = ItemRarityID.Gray; + Item.MakeUsableWithChlorophyteExtractinator(); + } + } +} diff --git a/Items/Placeables/Furniture/GluttonyBlender.png b/Items/Placeables/Furniture/GluttonyBlender.png new file mode 100644 index 0000000000..18cc167ca0 Binary files /dev/null and b/Items/Placeables/Furniture/GluttonyBlender.png differ diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index 99b52e7168..cfaef17681 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -63,7 +63,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "CrabBar", "Critaquil", "Dandy", - "Dia", "Done", "dozezoze", "Flowaria", @@ -74,7 +73,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "LordMetarex", "Moonburn", "Ozzatron", - "Piky", "PokerFace", "Raesh", "Sagittariod", @@ -109,6 +107,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Daim", "DarkTiny", "Demik", + "Dia", "DM Dokuro", "Doog", "drh", @@ -165,6 +164,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Pbtopacio", "Phantasmal Deathray", "Phupperbat", + "Piky", "Pinkie Poss", "Poly", "Popo", diff --git a/Items/Potions/Alcohol/BaconOil.cs b/Items/Potions/Alcohol/BaconOil.cs index 29dd0948ff..d3b20577ee 100644 --- a/Items/Potions/Alcohol/BaconOil.cs +++ b/Items/Potions/Alcohol/BaconOil.cs @@ -1,25 +1,37 @@ -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class BaconOil : ModItem, ILocalizedModType + public class BaconOil : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BaconOil.DripEffect"); + public AlcoholType AlcoholVariant => AlcoholType.BaconOil; + public Action IVDripAlcoholEffect => ApplyBaconOilEffect; + + private static void ApplyBaconOilEffect(Player player, float intensity) + { + // See CalamityPlayer + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(204, 90, 73), new Color(168, 37, 37), new Color(120, 28, 28) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() @@ -28,5 +40,11 @@ namespace CalamityMod.Items.Potions.Alcohol Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 1 * player.direction; + player.itemLocation.Y -= 5; + } } } diff --git a/Items/Potions/Alcohol/BaconOil.png b/Items/Potions/Alcohol/BaconOil.png index 0c9a1f686a..a9b35f923c 100644 Binary files a/Items/Potions/Alcohol/BaconOil.png and b/Items/Potions/Alcohol/BaconOil.png differ diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 6dd7d3f933..39aa5c99b9 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,35 +1,55 @@ -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class BloodyMary : ModItem, ILocalizedModType + public class BloodyMary : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public static float PierceDamageMultiplier = 0.66f; + public static float SpawnRateGateMultiplier = 0.142f; + public static float IVDripAdditionalSpawnRateGateMultiplier = 0.7f; + public static float SpawnLimitMultiplier = 5f; + public static float IVDripAdditionalSpawnLimitMultiplier = 1.5f; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BloodyMary.DripEffect"); + public AlcoholType AlcoholVariant => AlcoholType.BloodyMary; + + public Action IVDripAlcoholEffect => ApplyBloodyMaryEffect; + + private static void ApplyBloodyMaryEffect(Player player, float intensity) + { + // See CalamityPlayerOnHit + } + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(204, 90, 73), new Color(168, 37, 37), new Color(120, 28, 28) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(34, 56, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } - public override void AddRecipes() + public override void AddRecipes() { CreateRecipe(10). AddIngredient(ItemID.Bottle, 10). @@ -37,5 +57,11 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 11; + } } } diff --git a/Items/Potions/Alcohol/BloodyMary.png b/Items/Potions/Alcohol/BloodyMary.png index 333f4ab986..60acaee69e 100644 Binary files a/Items/Potions/Alcohol/BloodyMary.png and b/Items/Potions/Alcohol/BloodyMary.png differ diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index ea3de081cf..1b51c9b792 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,35 +1,48 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CaribbeanRum : ModItem, ILocalizedModType + public class CaribbeanRum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MoveSpeedBoost = 0.25f; public static float GravityMultiplier = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), (1-GravityMultiplier).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CaribbeanRum.DripEffect").WithFormatArgs(MoveSpeedBoost.ToPercent(), (1 - GravityMultiplier).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.CaribbeanRum; + + public Action IVDripAlcoholEffect => ApplyCaribbeanRumEffect; + + private static void ApplyCaribbeanRumEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Based on the drink itself + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(105, 29, 14), new Color(128, 39, 22), new Color(138, 28, 7) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(28, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; @@ -43,5 +56,11 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.png b/Items/Potions/Alcohol/CaribbeanRum.png index 834ce1a26a..4a833a3dd4 100644 Binary files a/Items/Potions/Alcohol/CaribbeanRum.png and b/Items/Potions/Alcohol/CaribbeanRum.png differ diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 990fcb4353..04031b69ea 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,31 +1,44 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CinnamonRoll : ModItem, ILocalizedModType + public class CinnamonRoll : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public AlcoholType AlcoholVariant => AlcoholType.CinnamonRoll; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CinnamonRoll.DripEffect"); + public Action IVDripAlcoholEffect => ApplyCinnamonRollEffect; + + private static void ApplyCinnamonRollEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(245, 223, 181), new Color(222, 186, 147), new Color(176, 129, 106) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(28, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; @@ -38,5 +51,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.png b/Items/Potions/Alcohol/CinnamonRoll.png index 66f03882a4..d58d51053b 100644 Binary files a/Items/Potions/Alcohol/CinnamonRoll.png and b/Items/Potions/Alcohol/CinnamonRoll.png differ diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 3089c42d4d..0568ee5ec5 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Everclear : ModItem, ILocalizedModType + public class Everclear : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,20 +19,29 @@ namespace CalamityMod.Items.Potions.Alcohol public static int RegenLoss = 10; public static float DefenseLossPercent = 0.30f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Everclear.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Everclear; + public Action IVDripAlcoholEffect => ApplyEverclearEffect; + + private static void ApplyEverclearEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Everclear is clear so uhm... yeah? + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { new Color(153, 168, 162, 180), new Color(198, 205, 207, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(16, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -44,5 +56,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/Everclear.png b/Items/Potions/Alcohol/Everclear.png index 5e734af391..b7d15e16e5 100644 Binary files a/Items/Potions/Alcohol/Everclear.png and b/Items/Potions/Alcohol/Everclear.png differ diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index e1b4a1fa07..7e55b0710d 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,35 +1,51 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class EvergreenGin : ModItem, ILocalizedModType + public class EvergreenGin : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.EvergreenGin.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.EvergreenGin; + + public Action IVDripAlcoholEffect => ApplyEvergreenGinEffect; + private static void ApplyEvergreenGinEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.SicknessDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.WaterDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.ElectricDebuffMultiplier -= EvergreenGin.DebuffLoss; + cplayer.HeatDebuffMultiplier -= EvergreenGin.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Pale green-blue + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(201, 248, 248), new Color(201, 248, 221), new Color(177, 240, 184) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(34, 56, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -44,5 +60,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.png b/Items/Potions/Alcohol/EvergreenGin.png index 5f1f9ae1ff..5848d618af 100644 Binary files a/Items/Potions/Alcohol/EvergreenGin.png and b/Items/Potions/Alcohol/EvergreenGin.png differ diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index 8fcea00497..f6942b5d7e 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,34 +1,50 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Fireball : ModItem, ILocalizedModType + public class Fireball : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Fireball.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Fireball; + + public Action IVDripAlcoholEffect => ApplyFireballEffect; + + private static void ApplyFireballEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier += Fireball.DebuffBoost; + cplayer.SicknessDebuffMultiplier -= Fireball.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(245, 171, 22), new Color(227, 128, 41), new Color(237, 82, 31) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(16, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(20, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -36,7 +52,6 @@ namespace CalamityMod.Items.Potions.Alcohol public override void AddRecipes() { - CreateRecipe(10). AddIngredient(ItemID.Bottle, 10). AddIngredient(ItemID.LivingFireBlock, 50). @@ -44,5 +59,9 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Fireball.png b/Items/Potions/Alcohol/Fireball.png index 48ba41816b..a9b9596bcc 100644 Binary files a/Items/Potions/Alcohol/Fireball.png and b/Items/Potions/Alcohol/Fireball.png differ diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 231f2c2d19..3f46580767 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,37 +1,48 @@ -using CalamityMod.Buffs.Alcohol; using System; -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class GrapeBeer : ModItem, ILocalizedModType + public class GrapeBeer : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public static float CloseRangeDistance = 80; public static float LongRangeDistance = 1200; public static float CloseRangeDamage = 0.75f; public static float LongRangeDamage = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LongRangeDamage,LongRangeDistance/16f); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.GrapeBeer.DripEffect").WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public AlcoholType AlcoholVariant => AlcoholType.GrapeBeer; + public Action IVDripAlcoholEffect => ApplyGrapeBeerEffect; + + private static void ApplyGrapeBeerEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(36, 2, 41), new Color(56, 0, 64), new Color(82, 10, 92) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(12, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(20, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -44,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.png b/Items/Potions/Alcohol/GrapeBeer.png index 1727991aa4..dc93fd517a 100644 Binary files a/Items/Potions/Alcohol/GrapeBeer.png and b/Items/Potions/Alcohol/GrapeBeer.png differ diff --git a/Items/Potions/Alcohol/Manhattan.cs b/Items/Potions/Alcohol/Manhattan.cs index b2b338a0b3..dc38313a10 100644 --- a/Items/Potions/Alcohol/Manhattan.cs +++ b/Items/Potions/Alcohol/Manhattan.cs @@ -1,35 +1,49 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Manhattan : ModItem, ILocalizedModType + public class Manhattan : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Manhattan.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Manhattan; + public Action IVDripAlcoholEffect => ApplyManhattanEffect; + + private static void ApplyManhattanEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ColdDebuffMultiplier += Manhattan.DebuffBoost; + cplayer.WaterDebuffMultiplier -= Manhattan.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(225, 84, 33), new Color(244, 176, 77), new Color(255, 218, 102) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(19, 58, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; @@ -43,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 8 * player.direction; + player.itemLocation.Y -= 14; + } } } diff --git a/Items/Potions/Alcohol/Manhattan.png b/Items/Potions/Alcohol/Manhattan.png index c6226e8ff7..226f575e75 100644 Binary files a/Items/Potions/Alcohol/Manhattan.png and b/Items/Potions/Alcohol/Manhattan.png differ diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 4df44ae8fb..2a86e3127a 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Margarita : ModItem, ILocalizedModType + public class Margarita : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,21 +19,37 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffLoss = 0.5f; public static int MinuteDuration = 3; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Margarita.DripEffect").WithFormatArgs(DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Margarita; + public Action IVDripAlcoholEffect => ApplyMargaritaEffect; + + private static void ApplyMargaritaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.TypelessDebuffMultiplier -= Margarita.DebuffLoss; + // Also see CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(219, 227, 191), new Color(186, 189, 147), new Color(142, 161, 125) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(28, 40, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(42, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +62,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 14; + } } } diff --git a/Items/Potions/Alcohol/Margarita.png b/Items/Potions/Alcohol/Margarita.png index e147d8dfd4..3471d98bf5 100644 Binary files a/Items/Potions/Alcohol/Margarita.png and b/Items/Potions/Alcohol/Margarita.png differ diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index fd89995259..d684a80632 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,34 +1,46 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Moonshine : ModItem, ILocalizedModType + public class Moonshine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxLifePercentBoost = 0.33f; + public static float MaxLifePercentBoost = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Moonshine.DripEffect").WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Moonshine; + public Action IVDripAlcoholEffect => ApplyMoonshineEffect; + + private static void ApplyMoonshineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerHitHurt + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Another clear drink + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(237, 237, 218, 128), new Color(227, 219, 191, 128), new Color(209, 204, 194, 128) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(30, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; @@ -43,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Moonshine.png b/Items/Potions/Alcohol/Moonshine.png index f4131089b9..9eed064da5 100644 Binary files a/Items/Potions/Alcohol/Moonshine.png and b/Items/Potions/Alcohol/Moonshine.png differ diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 69406883aa..8e5c1c37e9 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,35 +1,46 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class MoscowMule : ModItem, ILocalizedModType + public class MoscowMule : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float KnockbackBoost = 0.5f; + public static float PierceDamageMultiplier = 0.7f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(KnockbackBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.MoscowMule.DripEffect").WithFormatArgs(KnockbackBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.MoscowMule; + public Action IVDripAlcoholEffect => ApplyMoscowMuleEffect; + + private static void ApplyMoscowMuleEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Pale green with a hint of red + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(194, 252, 192), new Color(226, 252, 192), new Color(250, 225, 222) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(32, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(46, 46, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -42,5 +53,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 8 * player.direction; + player.itemLocation.Y -= 12; + } } } diff --git a/Items/Potions/Alcohol/MoscowMule.png b/Items/Potions/Alcohol/MoscowMule.png index 9a3a129c08..3673e404b9 100644 Binary files a/Items/Potions/Alcohol/MoscowMule.png and b/Items/Potions/Alcohol/MoscowMule.png differ diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index 802234bc9d..f2f8c726c4 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,34 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class OldFashioned : ModItem, ILocalizedModType + public class OldFashioned : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static readonly float DamageBoostMultiplier = 1.25f; public static readonly float DamageReductionMultiplier = 0.75f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.OldFashioned.DripEffect").WithFormatArgs(DamageBoostMultiplier.ToString("N2"), DamageReductionMultiplier.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.OldFashioned; + public Action IVDripAlcoholEffect => ApplyOldFashionedEffect; + + private static void ApplyOldFashionedEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(255, 118, 3), new Color(255, 200, 82), new Color(255, 228, 122) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(30, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(38, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; @@ -41,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 12; + } } } diff --git a/Items/Potions/Alcohol/OldFashioned.png b/Items/Potions/Alcohol/OldFashioned.png index c46adf86ba..618028fba5 100644 Binary files a/Items/Potions/Alcohol/OldFashioned.png and b/Items/Potions/Alcohol/OldFashioned.png differ diff --git a/Items/Potions/Alcohol/PurpleHaze.cs b/Items/Potions/Alcohol/PurpleHaze.cs index 4c7792e387..5da0e3abdf 100644 --- a/Items/Potions/Alcohol/PurpleHaze.cs +++ b/Items/Potions/Alcohol/PurpleHaze.cs @@ -1,7 +1,10 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -9,28 +12,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { [LegacyName("FabsolsVodka")] - public class PurpleHaze : ModItem, ILocalizedModType + public class PurpleHaze : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DamageBoost = 0.25f; public static float StealthDamageLoss = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(),StealthDamageLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.PurpleHaze.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), StealthDamageLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.PurpleHaze; + + public Action IVDripAlcoholEffect => ApplyPurpleHazeEffect; + + private static void ApplyPurpleHazeEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(239, 123, 202), new Color(187, 56, 158), new Color(165, 47, 255) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(24, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; @@ -44,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/PurpleHaze.png b/Items/Potions/Alcohol/PurpleHaze.png index 2baf8212db..d43e134c80 100644 Binary files a/Items/Potions/Alcohol/PurpleHaze.png and b/Items/Potions/Alcohol/PurpleHaze.png differ diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index f0314cc7f1..2afbf3ad47 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,36 +1,49 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class RedWine : ModItem, ILocalizedModType + public class RedWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float VerticalSpeedBoost = 0.1f; public static float FlightTimeLoss = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.RedWine.DripEffect").WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.RedWine; + + public Action IVDripAlcoholEffect => ApplyRedWineEffect; + + private static void ApplyRedWineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(54, 5, 21), new Color(82, 9, 36), new Color(105, 4, 29) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6)); - + Item.DefaultToFood(20, 61, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; } @@ -42,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 1 * player.direction; + player.itemLocation.Y -= 5; + } } } diff --git a/Items/Potions/Alcohol/RedWine.png b/Items/Potions/Alcohol/RedWine.png index 025a1ad4fa..991922d87a 100644 Binary files a/Items/Potions/Alcohol/RedWine.png and b/Items/Potions/Alcohol/RedWine.png differ diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index e1b83237a8..59de073e29 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,34 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Rum : ModItem, ILocalizedModType + public class Rum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float NonMinionBoost = 1.15f; public static float MinionBoost = 0.85f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((NonMinionBoost-1).ToPercent(), (1- MinionBoost).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Rum.DripEffect").WithFormatArgs((NonMinionBoost - 1).ToPercent(), (1 - MinionBoost).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Rum; + public Action IVDripAlcoholEffect => ApplyRumEffect; + + private static void ApplyRumEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(237, 165, 9), new Color(247, 219, 54), new Color(255, 195, 31) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(24, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(30, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -41,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/Rum.png b/Items/Potions/Alcohol/Rum.png index 1f582e6294..fef2821ba3 100644 Binary files a/Items/Potions/Alcohol/Rum.png and b/Items/Potions/Alcohol/Rum.png differ diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 65c071fa43..ae75b8f518 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,36 +1,51 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Screwdriver : ModItem, ILocalizedModType + public class Screwdriver : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Screwdriver.DripEffect").WithFormatArgs(DebuffBoost.ToString("N2"), DebuffLoss.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.Screwdriver; + public Action IVDripAlcoholEffect => ApplyScrewdriverEffect; + + private static void ApplyScrewdriverEffect(Player player, float intensity) + { + player.blockRange += 5; + player.tileSpeed += 1; + player.wallSpeed += 1; + player.GetDamage(DamageClass.Generic) *= 0.75f; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(225, 84, 33), new Color(244, 176, 77), new Color(255, 218, 102) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(32, 46, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } @@ -42,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 10; + } } } diff --git a/Items/Potions/Alcohol/Screwdriver.png b/Items/Potions/Alcohol/Screwdriver.png index e499f35d90..aa6147ccb9 100644 Binary files a/Items/Potions/Alcohol/Screwdriver.png and b/Items/Potions/Alcohol/Screwdriver.png differ diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index bbc2dc0f21..7493d3d13c 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,35 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class StarBeamRye : ModItem, ILocalizedModType + public class StarBeamRye : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MagicDmgMult = 0.9f; public static int ManaRegenBoost = 30; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDmgMult); + public AlcoholType AlcoholVariant => AlcoholType.StarBeamRye; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.StarBeamRye.DripEffect").WithFormatArgs(MagicDmgMult); + public Action IVDripAlcoholEffect => ApplyStarBeamRyeEffect; + + private static void ApplyStarBeamRyeEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Dark red-orange + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(89, 18, 10), new Color(102, 39, 14), new Color(128, 31, 9) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(20, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(20, 54, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -42,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.png b/Items/Potions/Alcohol/StarBeamRye.png index 3c1d30b238..f61b9aea7d 100644 Binary files a/Items/Potions/Alcohol/StarBeamRye.png and b/Items/Potions/Alcohol/StarBeamRye.png differ diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index b9d4df742e..c5ba5d92f8 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.DataStructures; namespace CalamityMod.Items.Potions.Alcohol { - public class Tequila : ModItem, ILocalizedModType + public class Tequila : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,21 +19,32 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Tequila.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Tequila; + public Action IVDripAlcoholEffect => ApplyTequilaEffect; + + private static void ApplyTequilaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ElectricDebuffMultiplier += Tequila.DebuffBoost; + cplayer.ColdDebuffMultiplier -= Tequila.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(163, 110, 10), new Color(176, 135, 0), new Color(194, 132, 25) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(16, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(32, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -44,5 +58,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/Tequila.png b/Items/Potions/Alcohol/Tequila.png index 8ef6726cd6..87d5dd41e0 100644 Binary files a/Items/Potions/Alcohol/Tequila.png and b/Items/Potions/Alcohol/Tequila.png differ diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 2e04f06f82..71fd80ec42 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,35 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class TequilaSunrise : ModItem, ILocalizedModType + public class TequilaSunrise : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DoTMultiplier = 1.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DoTMultiplier-1).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.TequilaSunrise.DripEffect").WithFormatArgs((DoTMultiplier-1).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.TequilaSunrise; + public Action IVDripAlcoholEffect => ApplyTequilaSunriseEffect; + + private static void ApplyTequilaSunriseEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(220, 75, 59), new Color(229, 147, 47), new Color(255, 190, 76) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { Item.DefaultToFood(22, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 10; + } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.png b/Items/Potions/Alcohol/TequilaSunrise.png index 30974d148a..4f2ee50759 100644 Binary files a/Items/Potions/Alcohol/TequilaSunrise.png and b/Items/Potions/Alcohol/TequilaSunrise.png differ diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index ca404e6e3c..f91304ab41 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,30 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Vodka : ModItem, ILocalizedModType + public class Vodka : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.25f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Vodka.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Vodka; + public Action IVDripAlcoholEffect => ApplyVodkaEffect; + + private static void ApplyVodkaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.TypelessDebuffMultiplier += Vodka.DebuffBoost; + cplayer.HeatDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Vodka.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Another clear drink + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { new Color(219, 219, 208, 180), new Color(181, 181, 176, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() @@ -43,5 +60,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 2 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Vodka.png b/Items/Potions/Alcohol/Vodka.png index f1e7333959..5ffef8df03 100644 Binary files a/Items/Potions/Alcohol/Vodka.png and b/Items/Potions/Alcohol/Vodka.png differ diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 8affbb3282..fc77890852 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,37 +1,52 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Whiskey : ModItem, ILocalizedModType + public class Whiskey : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxDamageBoost = 0.15f; - public static float MinDamageBoost = -0.15f; + public static float StandardDamageCeiling = 0.15f; + public static float StandardDamageFloor = -0.15f; public static float TimeToDischarge = 600; public static float TimeToRecharge = 300; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinDamageBoost.ToPercent(), MaxDamageBoost.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public static float CombinedDamageCeiling = 0.3f; + public static float CombinedDamageFloor = -0.3f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Whiskey.DripEffect").WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge / 60).ToString("0.##"), (TimeToRecharge / 60).ToString("0.##"), CombinedDamageFloor.ToPercent(), CombinedDamageCeiling.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Whiskey; + + public Action IVDripAlcoholEffect => ApplyWhiskeyEffect; + + private static void ApplyWhiskeyEffect(Player player, float intensity) + { + // See CalamityPlayer + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(227, 148, 11), new Color(235, 177, 5), new Color(250, 190, 12) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } @@ -43,5 +58,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 2 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/Whiskey.png b/Items/Potions/Alcohol/Whiskey.png index 351f288939..b4e8e20c6d 100644 Binary files a/Items/Potions/Alcohol/Whiskey.png and b/Items/Potions/Alcohol/Whiskey.png differ diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 32890d06ad..17ab737b17 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,32 +1,43 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameInput; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class WhiteWine : ModItem, ILocalizedModType + public class WhiteWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float FlightTimeRecoveryAmount = 0.66f; public static float FlightTimeLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.WhiteWine.DripEffect").WithFormatArgs(FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.WhiteWine; + public Action IVDripAlcoholEffect => ApplyWhiteWineEffect; + + private static void ApplyWhiteWineEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Clear, yellow-green + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(242, 252, 177, 180), new Color(250, 252, 215, 180), new Color(228, 245, 181, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() @@ -48,5 +59,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 5; + } } } diff --git a/Items/Potions/Alcohol/WhiteWine.png b/Items/Potions/Alcohol/WhiteWine.png index 2341999a22..11d14186eb 100644 Binary files a/Items/Potions/Alcohol/WhiteWine.png and b/Items/Potions/Alcohol/WhiteWine.png differ diff --git a/Items/Potions/Food/QualitySlop.png b/Items/Potions/Food/QualitySlop.png new file mode 100644 index 0000000000..236e7ebf2d Binary files /dev/null and b/Items/Potions/Food/QualitySlop.png differ diff --git a/Items/Potions/TheElixir.cs b/Items/Potions/TheElixir.cs new file mode 100644 index 0000000000..9a18138074 --- /dev/null +++ b/Items/Potions/TheElixir.cs @@ -0,0 +1,111 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class TheElixir : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(159, 67, 199), + new Color(176, 147, 243), + new Color(84, 50, 185) + }; + } + + public override void SetDefaults() + { + Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; + Item.DefaultToFood(28, 51, 0, 0, true); + } + + // Player is unable to use the item when Chaos State is enabled to prevent spamming the item. + // Even though the item also inflicts Cursed, this is kept as a failsafe in the event the player has something equipped that + // provides immunity to Cursed. (i.e Countercurse Mantra or Nazar) + public override bool CanUseItem(Player player) + { + if (player.HasBuff(BuffID.ChaosState)) + return false; + + return base.CanUseItem(player); + } + + public override bool? UseItem(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + if (Main.rand.NextBool(4)) + { + int roll = Main.rand.Next(3); + Vector2? location = roll switch + { + 1 => CalamityPlayer.GetAbyssVoidTeleportPosition(player), + 2 => CalamityPlayer.GetTempleTeleportPosition(player), + _ => CalamityPlayer.GetDungeonArchivesTeleportPosition(player) + }; + + if (!location.HasValue) + return false; + + player.AddBuff(BuffID.ChaosState, 300, false); + player.AddBuff(BuffID.Cursed, 300, false); + CalamityPlayer.ModTeleport(player, location.Value, false, TeleportationStyleID.RecallPotion); + } + //If it doesn't fail, just act like a Potion of Return + else + player.DoPotionOfReturnTeleportationAndSetTheComebackPoint(); + + //Dust and Teleport sounds happen regardless of if it fails or not + Rectangle rect = player.getRect(); + int dustAmt = rect.Width * rect.Height / 5; + for (int k = 0; k < dustAmt; k++) + { + Dust dust = Dust.NewDustDirect(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.TeleportationPotion); + dust.scale = Main.rand.NextFloat(0.2f, 0.7f); + if (k < 10) + dust.scale += 0.25f; + if (k < 5) + dust.scale += 0.25f; + } + for (int k = 0; k < 70; k++) + { + Dust dust = Dust.NewDustDirect(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.DungeonSpirit); + dust.noGravity = true; + for (int i = 0; i < 5; i++) + { + if (Main.rand.NextBool(3)) + dust.velocity *= 0.75f; + } + if (Main.rand.NextBool(3)) + { + dust.velocity *= 2f; + dust.scale *= 1.2f; + } + if (Main.rand.NextBool(3)) + { + dust.velocity *= 2f; + dust.scale *= 1.2f; + } + if (Main.rand.NextBool()) + { + dust.fadeIn = Main.rand.NextFloat(0.75f, 1f); + dust.scale = Main.rand.NextFloat(0.25f, 0.75f); + } + dust.scale *= 0.8f; + } + SoundEngine.PlaySound(SoundID.Item6, player.Center); + } + return true; + } + } +} diff --git a/Items/Potions/TheElixir.png b/Items/Potions/TheElixir.png new file mode 100644 index 0000000000..1d25a72177 Binary files /dev/null and b/Items/Potions/TheElixir.png differ diff --git a/Items/SulphuricPowder.png b/Items/SulphuricPowder.png deleted file mode 100644 index a8241aba56..0000000000 Binary files a/Items/SulphuricPowder.png and /dev/null differ diff --git a/Items/Tools/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index 056e668089..444ac16aac 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe() - .AddIngredient(12) + .AddIngredient(12) .AddIngredient(ItemID.LunarBar, 10) .AddTile(TileID.LunarCraftingStation) .Register(); diff --git a/Items/Tools/RelicOfResilience.cs b/Items/Tools/RelicOfResilience.cs index af20a97f04..db68a53d8c 100644 --- a/Items/Tools/RelicOfResilience.cs +++ b/Items/Tools/RelicOfResilience.cs @@ -7,6 +7,16 @@ namespace CalamityMod.Items.Tools public class RelicOfResilience : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; + public static int baseTimeMax => 300; + public static int maxPowerTime => 1800; + public static int baseCooldown => 900; + public static int baseDefenseFloor => 200; + public static float baseDrFloor => 0.1f; + public static int shardBaseDamage => 180; + public static float orbitDamageMult => 0.2f; + public static int baseMaxShardCount => 30; + public static float maxPowerShardMult => 2; // Applied to number of shards at max power + public static float additionalMaxPowerDefensesMult => 1; // This is added to the base 100% effectiveness public override void SetDefaults() { Item.width = 40; diff --git a/Items/Weapons/AstralGelStaff.png b/Items/Weapons/AstralGelStaff.png deleted file mode 100644 index 0a59b58a09..0000000000 Binary files a/Items/Weapons/AstralGelStaff.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/Auger.cs b/Items/Weapons/DraedonsArsenal/Auger.cs index 6f20e1189a..f7ce73b68d 100644 --- a/Items/Weapons/DraedonsArsenal/Auger.cs +++ b/Items/Weapons/DraedonsArsenal/Auger.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { Item.width = 26; Item.height = 26; - Item.damage = 68; + Item.damage = 60; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useTime = Item.useAnimation = 12; Item.knockBack = 12f; diff --git a/Items/Weapons/Magic/Apathanull.cs b/Items/Weapons/Magic/Apathanull.cs index be57d1a227..71c021eeaa 100644 --- a/Items/Weapons/Magic/Apathanull.cs +++ b/Items/Weapons/Magic/Apathanull.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SpellTome). - AddIngredient(9). + AddIngredient(18). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 17e7676ecb..37450611ee 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 56; Item.height = 60; - Item.damage = 77; + Item.damage = 65; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 3b7300228c..9b8f4af53d 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 128; Item.height = 140; - Item.damage = 1075; + Item.damage = 888; Item.knockBack = 7.5f; Item.useAnimation = Item.useTime = 25; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index d1978f29e1..6fa77ead69 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 108b448374..0f9a59b975 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 44; Item.useStyle = ItemUseStyleID.Rapier; Item.damage = 600; - Item.DamageType = DamageClass.Melee; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 8; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index c22652b727..2adf365c8e 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 124; Item.height = 124; - Item.damage = 3777; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :( + Item.damage = 5777; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :( Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 77; Item.useTime = 77; diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 3b5ced3498..38d7b0ff16 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 130; Item.height = 130; - Item.damage = 515; + Item.damage = 360; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 35; Item.useTime = 35; diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index cc8e3162bd..2cd125a2a6 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee public bool spawnProj = true; public bool spawnTrueMeleeProj = true; public bool playSound = true; + public float scaling = 1; public Color clr = Color.MediumOrchid; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 78; Item.height = 78; - Item.damage = 310; + Item.damage = 280; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = Item.useTime = 20; @@ -48,10 +49,14 @@ namespace CalamityMod.Items.Weapons.Melee { return false; } + public override void ModifyItemScale(Player player, ref float scale) + { + scale = scaling = player.GetMeleeScale(); + } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC - float scale = 8f; + float scale = 8f * scaling; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); } @@ -60,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 mPos = player.Calamity().mouseWorld; Vector2 shootDir = player.Center.DirectionTo(mPos); float _ = float.NaN; - bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 145, Item.width * 3f, ref _); + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30 * scaling, player.Center + shootDir * 145 * scaling, Item.width * 3f * scaling, ref _); return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) @@ -109,9 +114,11 @@ namespace CalamityMod.Items.Weapons.Melee if (completion >= 0.65f && spawnProj) { if (!player.Calamity().bladeArmEnchant) // Manually remove projectiles when Tainted - Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); - - Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f, clr, new Vector2(1f, 1f), true, false, 0, false, false); + { + Projectile beam = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + beam.ai[1] = scaling; + } + Particle swipe = new CustomSpark(player.Center - shootDir * 5 * scaling, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f * scaling, clr, new Vector2(1f, 1f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); SoundEngine.PlaySound(SoundID.Item60, player.Center); @@ -123,7 +130,7 @@ namespace CalamityMod.Items.Weapons.Melee } float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); - bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180 * scaling; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); @@ -137,13 +144,14 @@ namespace CalamityMod.Items.Weapons.Melee { if (spawnTrueMeleeProj) { - int beamDamage = player.CalcIntDamage(Item.damage * 0.35f); + int beamDamage = player.CalcIntDamage(Item.damage * 0.2f); Vector2 mouseClamped = player.ClampedMouseWorld(); SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center); for (int i = 0; i < 2; i++) { Vector2 vel = player.Center.DirectionFrom(target.Center).RotatedByRandom(0.7f) * Main.rand.NextFloat(18, 20); - Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1); + Projectile star = Projectile.NewProjectileDirect(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1); + star.scale = scaling; } spawnTrueMeleeProj = false; } diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 27700e8c12..e1007508fa 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ModContent.RarityType(); } - public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", Main.zenithWorld ? "\n" + this.GetLocalizedValue("GFBFlavor") : ""); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 3152bb7eb5..581bcc23f6 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; @@ -92,33 +91,9 @@ namespace CalamityMod.Items.Weapons.Melee { if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) { - proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); - (proj2.ModProjectile as MirrorBlast).shardShield = 0; - (proj2.ModProjectile as MirrorBlast).shardNum = 11; - proj2.netUpdate = true; - } - } - reflectTimer = 0; - return; - } else - if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle)) - { - if (shardCount > 0) - { - SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center); - } - if (shardCount >= 10) - { - player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30); - } - proj.Calamity().multiplicativeDR += shardCount / 10f; - proj.Calamity().multiplicativeDRTimer = 60; - foreach (var proj2 in Main.projectile) - { - if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) - { - proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); + //Don't amplify Evolution shards + if (proj2.DamageType != DamageClass.Generic) + proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); (proj2.ModProjectile as MirrorBlast).shardShield = 0; (proj2.ModProjectile as MirrorBlast).shardNum = 11; proj2.netUpdate = true; @@ -127,6 +102,35 @@ namespace CalamityMod.Items.Weapons.Melee reflectTimer = 0; return; } + else + if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle)) + { + if (shardCount > 0) + { + SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center); + } + if (shardCount >= 10) + { + player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30); + } + proj.Calamity().multiplicativeDR += shardCount / 10f; + proj.Calamity().multiplicativeDRTimer = 60; + foreach (var proj2 in Main.projectile) + { + if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) + { + //Don't amplify Evolution shards + if (proj2.DamageType != DamageClass.Generic) + proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); + (proj2.ModProjectile as MirrorBlast).shardShield = 0; + (proj2.ModProjectile as MirrorBlast).shardNum = 11; + proj2.netUpdate = true; + } + } + reflectTimer = 0; + return; + } } } reflectTimer--; @@ -149,9 +153,9 @@ namespace CalamityMod.Items.Weapons.Melee hasShard = true; } } - + if (!alreadyReflecting && hasShard) - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy,player.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy, player.Center); return false; } return base.Shoot(player, source, position, velocity, type, damage, knockback); diff --git a/Items/Weapons/Melee/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index d3673b326a..5afd75b448 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 76; Item.height = 76; - Item.damage = 144; + Item.damage = 100; Item.DamageType = TrueMeleeDamageClass.Instance; Item.crit = 11; Item.useAnimation = Item.useTime = 90; // Yes it's actually supposed to be this slow diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index ac56bb47f4..19639914f2 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 146; Item.damage = 100; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.crit = 45; - Item.useAnimation = 12; + Item.crit = 41; + Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; Item.useTurn = true; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 30886f64d4..99fbf3df9e 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee public bool spawnProj = true; public bool spawnTrueMeleeProj = true; public bool playSound = true; + public float scaling = 1; public override void SetDefaults() { Item.width = Item.height = 112; @@ -46,6 +47,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.5f; } + public override void ModifyItemScale(Player player, ref float scale) + { + scale = scaling = player.GetMeleeScale(); + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { return false; @@ -53,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC - float scale = 8f; + float scale = 8f * scaling; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); } @@ -62,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 mPos = player.Calamity().mouseWorld; Vector2 shootDir = player.Center.DirectionTo(mPos); float _ = float.NaN; - bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 245, Item.width * 3f, ref _); + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30 * scaling, player.Center + shootDir * 215 * scaling, Item.width * 3f * scaling, ref _); return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) @@ -110,17 +115,19 @@ namespace CalamityMod.Items.Weapons.Melee { if (!player.Calamity().bladeArmEnchant) // Manually remove projectiles when Tainted { - Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); - + Projectile beam = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + beam.ai[1] = scaling; + for (int i = 0; i < 4; i++) { float rot = Main.rand.NextFloat(0.5f, 0.65f) * (Main.rand.NextBool() ? 1 : -1); Vector2 vel = (shootDir * 2.5f).RotatedByRandom(0.6f); - Projectile.NewProjectile(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1); + Projectile star = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1); + star.scale = scaling; } } - Particle swipe = new CustomSpark(player.Center - shootDir * 5 * Item.scale, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f * Item.scale, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false); + Particle swipe = new CustomSpark(player.Center - shootDir * 5 * scaling, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f * scaling, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); SoundEngine.PlaySound(SoundID.Item60, player.Center); @@ -132,8 +139,8 @@ namespace CalamityMod.Items.Weapons.Melee } float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); - bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 240; - Vector2 tipPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 240 * scaling; + Vector2 tipPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180 * scaling; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); @@ -147,7 +154,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (spawnTrueMeleeProj) { - int beamDamage = player.CalcIntDamage(Item.damage * 0.35f); + int beamDamage = player.CalcIntDamage(Item.damage * 0.10f); Vector2 mouseClamped = player.ClampedMouseWorld(); SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center); for (int i = 0; i < 2; i++) @@ -159,7 +166,8 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900); Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10; - Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); + Projectile skybeam = Projectile.NewProjectileDirect(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); + skybeam.scale = scaling; } spawnTrueMeleeProj = false; } diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index 568e60509b..bf7fad3b44 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 134; Item.height = 54; - Item.damage = 3725; + Item.damage = 1400; Item.crit = 18; Item.knockBack = 12f; Item.useTime = 5; diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 4147065fcb..56c8923805 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -47,6 +47,10 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool RangedPrefix() => true; //class identity is fake public override bool MeleePrefix() => false; + public override void ModifyItemScale(Player player, ref float scale) + { + scale = player.GetMeleeScale(); + } 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/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index ff12b06675..a38fd73aa6 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee public static float ScrewBazingaModeDamageMult = 6.5f; public static float ScrewBazingaAimAssistAngle = 0.52f; //This may look high but remember this is the FULL angle, so it actually checks for half that angle deviation public static float ScrewBazingaAimAssistReach = 600f; + public float scaler = 1; public override ModItem Clone(Item item) { @@ -99,6 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void HoldItem(Player player) { + scaler = player.GetMeleeScale(); player.Calamity().mouseWorldListener = true; if (Main.myPlayer == player.whoAmI) @@ -143,8 +145,8 @@ namespace CalamityMod.Items.Weapons.Melee //Prevent it from being thrown at any less than -1f chuckSpeed.Y = Math.Clamp(chuckSpeed.Y, -1f, 3f); - int p = Projectile.NewProjectile(source, position, chuckSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - + Projectile p = Projectile.NewProjectileDirect(source, position, chuckSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + p.scale = scaler + 0.2f; ScrewStored = false; return false; } @@ -188,7 +190,7 @@ namespace CalamityMod.Items.Weapons.Melee position = Vector2.Lerp(new Vector2(ScrewPosition.X, ScrewPosition.Y), new Vector2(ScrewStart.X, ScrewStart.Y), ProgressionOfScrew); float rotation = ScrewPosition.Z.AngleLerp(ScrewStart.Z, ProgressionOfScrew); float outlineOpacity = (float)Math.Pow(1 - ScrewTimer / ScrewTime, 2); - scale = 1.05f + 0.05f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f); + scale = 1.05f * scale + 0.05f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f); Main.spriteBatch.Draw(screwOutlineTex, position, null, Color.Lerp(Color.GreenYellow, Color.White, (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.5f + 0.5f) * outlineOpacity, rotation, screwOutlineTex.Size() / 2f, scale, 0, 0); Main.spriteBatch.Draw(screwTex, position, null, Color.White, rotation, screwTex.Size() / 2f, scale, 0, 0); diff --git a/Items/Weapons/NebulaBlaster.png b/Items/Weapons/NebulaBlaster.png deleted file mode 100644 index d98985b3c4..0000000000 Binary files a/Items/Weapons/NebulaBlaster.png and /dev/null differ diff --git a/Items/Weapons/Ranged/DeadSunsWind.cs b/Items/Weapons/Ranged/DeadSunsWind.cs index ac6a849c6c..75de902a0f 100644 --- a/Items/Weapons/Ranged/DeadSunsWind.cs +++ b/Items/Weapons/Ranged/DeadSunsWind.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/OmniGun.cs b/Items/Weapons/Ranged/OmniGun.cs index 2ee1c77800..8711433e00 100644 --- a/Items/Weapons/Ranged/OmniGun.cs +++ b/Items/Weapons/Ranged/OmniGun.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 118; Item.height = 32; - Item.damage = 72; + Item.damage = 57; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent; diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 233a1ecc5a..df4ff7caa0 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 100; Item.height = 46; - Item.damage = 77; + Item.damage = 60; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 15; @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().furyFuel > 0) { Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int)(damage * 0.25f), knockback, player.whoAmI); //.25x base damage + Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int)(damage * 0.2f), knockback, player.whoAmI); //.2x base damage Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); dust.noGravity = true; diff --git a/Items/Weapons/Rogue/ElephantKiller.cs b/Items/Weapons/Rogue/ElephantKiller.cs new file mode 100644 index 0000000000..615a7b1f52 --- /dev/null +++ b/Items/Weapons/Rogue/ElephantKiller.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class ElephantKiller : RogueWeapon + { + public static readonly SoundStyle Throw = new("CalamityMod/Sounds/Item/ElephantKillerThrow"); + public static readonly SoundStyle Catch = new("CalamityMod/Sounds/Item/ElephantKillerCatch"); + public static readonly SoundStyle Shot = new("CalamityMod/Sounds/Item/ElephantKillerShot"); + public static readonly SoundStyle ShotFail = new("CalamityMod/Sounds/Item/ElephantKillerShotFail"); + public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/ElephantKillerHit"); + public static readonly SoundStyle BoostedShotHit = new("CalamityMod/Sounds/Item/ElephantKillerBoostedShotHit"); + public static readonly SoundStyle ElephantSound = new("CalamityMod/Sounds/Item/ElephantKillerElephant"); + public static readonly SoundStyle Shine = new("CalamityMod/Sounds/Item/ElephantKillerShine"); + public static readonly SoundStyle Woosh = new("CalamityMod/Sounds/Item/ElephantKillerWoosh"); + + public static float stealthGainOnThrowHit => 0.25f; // Amount of stealth gained on a thrown hit based on max stealth + public static float stealthCostToShoot => 0.1f; // Amount of stealth it costs to fire the gun with right click based on max stealth + public static float stealthShotDamageMult => 1.9f; + public static float elephantBoostedShotDamageMult => 1.6f; // This is multiplicative with the stealth shot damage boost + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } + public override void SetDefaults() + { + Item.width = 46; + Item.height = 58; + Item.damage = 110; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useAnimation = Item.useTime = 38; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3f; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 15f; + Item.DamageType = RogueDamageClass.Instance; + } + public override bool PreDrawTooltipLine(DrawableTooltipLine line, ref int yOffset) + { + if (Main.LocalPlayer != null) + Main.LocalPlayer.Calamity().drawingElephantKillerJoke = true; + return base.PreDrawTooltipLine(line, ref yOffset); + } + public override void ModifyTooltips(List list) + { + if (Main.LocalPlayer != null) + { + list.FindAndReplace("[STEALTHCOST]", stealthCostToShoot.ToPercent()); + list.FindAndReplace("[STEALTHGAIN]", stealthGainOnThrowHit.ToPercent()); + } + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + bool shoot = player.Calamity().mouseRight; + Projectile gun = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0, shoot ? 1f : 0); + gun.scale = 0; + return false; + } + } +} diff --git a/Items/Weapons/Rogue/ElephantKiller.png b/Items/Weapons/Rogue/ElephantKiller.png new file mode 100644 index 0000000000..e5b2a62323 Binary files /dev/null and b/Items/Weapons/Rogue/ElephantKiller.png differ diff --git a/Items/Weapons/Rogue/ReboundingRainbow.cs b/Items/Weapons/Rogue/ReboundingRainbow.cs index e006335ca7..eef227ac32 100644 --- a/Items/Weapons/Rogue/ReboundingRainbow.cs +++ b/Items/Weapons/Rogue/ReboundingRainbow.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index 0489ff32d1..e588335fb2 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 108; Item.height = 108; - Item.damage = 10000; + Item.damage = 8800; Item.crit = 20; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index 40adf3c663..25dbb66d20 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 3c9d4d3ddf..e80d3a6b99 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/UHFMurasama.png b/Items/Weapons/UHFMurasama.png deleted file mode 100644 index f8054f7eaf..0000000000 Binary files a/Items/Weapons/UHFMurasama.png and /dev/null differ diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index 4704e2f28c..d4dc4bfd67 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -157,12 +157,12 @@ SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since t TownPiggy: Waddles its little legs around with little purpose. Rumored to be a clever and obsessive hoarder. //Boss Minions Brimling: Extensions of the Brimstone Elemental herself, and part of her very being. Both she and her Brimlings are of a single mind, so she naturally cares for them just as she cares for herself. When heavily wounded, they withdraw into a cocoon to protect themselves from further harm. -SoulSeeker: The Clone's attempt at wielding the souls of the damned as weapons, these retain slightly more autonomy than their Azafurian brethren. And yet given the striking resemblance the bear to the Clone's shell, it's arguable that they might be further from Calamitas' current soul seekers than those found in Azafure's ruins. +SoulSeeker: The Clone's attempt at wielding the souls of the damned as weapons, these retain slightly more autonomy than their Azafurian brethren. And yet given the striking resemblance they bear to the Clone's shell, it's arguable that they might be further from Calamitas' current soul seekers than those found in Azafure's ruins. DarkEnergy: - DesertNuisance: Though these serpents are of the Desert Scourge's species, they are notably younger and less developed. Choosing to hunt in a pack with the large scourge due to this weakness, many have seen them tear apart prey not unlike the piranhas that once populated the former sea. CosmicGuardian: Though of the same species as the nameless serpent, their minds and functions are far more basic. They possess very little will of their own and blindly follow the orders of their gluttonous master. DankCreeper: Divine puppeteers beheld incessantly through their devotees, an organic panopticon for a wicked hive mind. Their word was truth, and evidence otherwise was burned. Even in decay, they summon subjects to creep, spy and kill. -DarkHeart: Beneath all the schemes and lies, dark desires coiled inside the pitch-black hearts of these deities. With their forms rent beyond recognition, new hearts arise from their rot to beat with misery once more +DarkHeart: Beneath all the schemes and lies, dark desires coiled inside the pitch-black hearts of these deities. With their forms rent beyond recognition, new hearts arise from their rot to beat with misery once more. HiveBlob: The faceless are bulletproof, and so the corrupt coalescence shields itself behind dull pawns, as the gods it was birthed from once did. HiveTumor: This tumor acts as the brain of the putrid wasteland, being all that is left of the minds of the slain gods that lay there. The creatures of the Corruption exist to protect it, and those who attempt to harm it rarely live to tell the tale. AquaticAberration: A spawn of the immense Leviathan, their lifespan can be measured in hours. All they know is how to hunt for their masters. Even non-aquatic life is well within their reach, due to their uncanny ability to fly through air just as easily as swimming through water. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 492d117468..5112a6fa6a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1032,12 +1032,16 @@ IVDripOnTheRocks: { DisplayName: IV Drip on the Rocks Tooltip: ''' - Multiplies most non-weapon, non-debuff damage by {0}x - Multiplies all weapon damage by {1}x - Counts as an alcohol stack toward Alcohol Poisoning + [EFFECT] + [NAME] + Inserted alcohols contribute toward alcohol poisoning {$Common.AlcoholWarning} + [c/aaaaaa:Shift- this item in your inventory to empty its contents] [ceffect/drunk:'(drunken mumbling)'] ''' + Empty: Place an alcoholic beverage on this item in your inventory to pour its contents in + CurrentAlcoholText: Filled with + SakeAndAleText: Increases melee weapon scale by 25%, but decreases melee speed by 10% } JellyChargedBattery: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 4070a1c761..98400df192 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -372,6 +372,15 @@ TheDevourerofCods: { ''' } +TrustyOldRod: { + DisplayName: Trusty Old Rod + Tooltip: + ''' + This ol' thing has never failed to pull in a big haul + Who knows what it will reel in next! + ''' +} + VerstaltiteFishingRod: { DisplayName: Verstaltite Fishing Rod Tooltip: @@ -391,6 +400,15 @@ WulfrumRod: { } // Bait +RageBait: { + DisplayName: Rage Bait + Tooltip: + ''' + The absolute best bait on the market! And for so cheap too... + Even comes with free Sonar Potion effect! + ''' +} + GrandMarquisBait: { DisplayName: Grand Marquis Bait Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index ba2ebe56aa..4191c43316 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -175,12 +175,7 @@ Lumenyl: { MeldBlob: { DisplayName: Meld Blob - Tooltip: "" -} - -MeldConstruct: { - DisplayName: Meld Construct - Tooltip: "" + Tooltip: "'Shrieks of distorted memories echo within this mass' " } MiracleMatter: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 18c738eb26..eae8af8c7e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -329,3 +329,9 @@ LegendaryShortTooltip: [c/FF6F00:Tales of legends past radiate around you...] [c/BABABA:Hold Shift to listen closer] ''' + +// Add "Can be extractinated" line in 1.4.5 port +DisgustingSlop: { + DisplayName: Disgusting Slop + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index c166d29508..26d86e7fa2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -798,6 +798,15 @@ GloomTorch: { Tooltip: "" } +GluttonyBlender: { + DisplayName: Gluttony Blender + Tooltip: + ''' + A strange industrial contraption which appears to process food + Has the potential to turn food into something more useful... maybe + ''' +} + LanternCenter: { DisplayName: Lantern Center Tooltip: Lights up the night sky with celebratory lanterns diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 92307cae67..9c75b44983 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -181,6 +181,12 @@ BaconOil: { Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Provides "good" mobility that scales with your damage stat boosts + Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} + When combined with drinking Bacon Oil straight, mobility becomes zanier + ''' } BloodyMary: { @@ -191,6 +197,12 @@ BloodyMary: { Greatly reduces piercing weapon effectiveness {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases enemy spawn rates by 7x + Greatly reduces piercing weapon effectiveness + When combined with drinking Bloody Mary straight, enemy spawn rates are increased by 10x total + ''' } CaribbeanRum: { @@ -201,6 +213,11 @@ CaribbeanRum: { Reduces your gravity by {1}% {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases move speed by {0}% + Reduces your gravity by {1}% + ''' } CinnamonRoll: { @@ -211,14 +228,10 @@ CinnamonRoll: { Greatly reduces dash distance {$Common.AlcoholWarning} ''' -} - -PurpleHaze: { - DisplayName: Purple Haze - Tooltip: + DripEffect: ''' - For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% - {$Common.AlcoholWarning} + Greatly increases dash speed + Greatly reduces dash distance ''' } @@ -231,6 +244,12 @@ Everclear: { Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased damage + Reduces life regen by {1} HP/s and defense by {2}% + Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} + ''' } EvergreenGin: { @@ -241,6 +260,11 @@ EvergreenGin: { {1}% decreased Electric and Heat debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Water and Sickness debuff damage + {1}% decreased Electric and Heat debuff damage + ''' } Fireball: { @@ -251,6 +275,11 @@ Fireball: { {1}% decreased Sickness debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Heat debuff damage + {1}% decreased Sickness debuff damage + ''' } GrapeBeer: { @@ -262,6 +291,13 @@ GrapeBeer: { This reaches a minimum of {0}x damage at {1} tiles away {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Bullets, Arrows, Darts, and Rockets gain homing + Projectiles deal less damage the further the enemy is + This reaches a minimum of {0}x damage at {1} tiles away + When combined with drinking Grape Beer straight, homing range is increased + ''' } Manhattan: { @@ -272,6 +308,11 @@ Manhattan: { {1}% decreased Water debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Cold debuff damage + {1}% decreased Water debuff damage + ''' } Margarita: { @@ -282,6 +323,11 @@ Margarita: { Reduces damage of debuffs you inflict by {0}% {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Halves duration of harmful debuffs you receive + Reduces damage of debuffs you inflict by {0}% + ''' } Moonshine: { @@ -293,6 +339,12 @@ Moonshine: { Defense damage takes three times as long to recover {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases maximum health by {0}% + Attacks always take at least half your defense worth of defense damage + Defense damage takes three times as long to recover + ''' } MoscowMule: { @@ -303,6 +355,11 @@ MoscowMule: { Reduces the effectiveness of piercing weapons {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased knockback, all attacks inflict heavy knockback + Reduces the effectiveness of piercing weapons + ''' } OddMushroom: { @@ -323,6 +380,21 @@ OldFashioned: { Multiplies all weapon damage by {1}x {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Multiplies most non-weapon, non-debuff damage by {0}x + Multiplies all weapon damage by {1}x + ''' +} + +PurpleHaze: { + DisplayName: Purple Haze + Tooltip: + ''' + For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% + {$Common.AlcoholWarning} + ''' + DripEffect: For 5 seconds after a stealth strike, all damage increased by {0}%, but stealth strike damage reduced by {1}% } RedWine: { @@ -333,6 +405,11 @@ RedWine: { {1}% reduced flight time {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased vertical speed + {1}% reduced flight time + ''' } Rum: { @@ -343,6 +420,11 @@ Rum: { {1}% decreased minion damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased non-minion summon damage + {1}% decreased minion damage + ''' } Screwdriver: { @@ -353,6 +435,11 @@ Screwdriver: { Greatly reduces damage dealt {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Greatly increases tile and wall placement range and speed + Greatly reduces damage dealt + ''' } StarBeamRye: { @@ -363,6 +450,11 @@ StarBeamRye: { Magic weapons deal {0}x damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases Mana regeneration, even while using an item + Magic weapons deal {0}x damage + ''' } Tequila: { @@ -373,6 +465,11 @@ Tequila: { {1}% decreased Cold debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Electric debuff damage + {1}% decreased Cold debuff damage + ''' } TequilaSunrise: { @@ -383,6 +480,20 @@ TequilaSunrise: { {0}% increased damage taken from debuffs {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Greatly increases natural life regeneration after suffering a damaging debuff + {0}% increased damage taken from debuffs + ''' +} + +TheElixir: { + DisplayName: The Elixir + Tooltip: + ''' + Functions as a Potion of Return + Occasionally sends you... [c/AA23C4:somewhere else] + ''' } Vodka: { @@ -393,6 +504,11 @@ Vodka: { {1}% decreased elemental debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Typeless debuff damage + {1}% decreased elemental debuff damage + ''' } Whiskey: { @@ -405,6 +521,14 @@ Whiskey: { This boost recharges when holding weapons of a different class, taking {3} seconds to fully recharge {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Provides between {0}% and {1}% damage to the held weapon's class + Each class tracks this boost individually + This boost lowers the longer you hold weapons of the same class, taking {2} seconds to fully decay + This boost recharges when holding weapons of a different class, taking {3} seconds to fully recharge + When combined with drinking Whiskey straight, damage varies between {4}% and {5}% + ''' } WhiteWine: { @@ -415,6 +539,11 @@ WhiteWine: { {0}% reduced flight time {$Common.AlcoholWarning} ''' + DripEffect: + ''' + You regain flight time the closer you are to an enemy + {0}% reduced flight time + ''' } // Food @@ -451,6 +580,11 @@ Mangosteen: { ''' } +QualitySlop: { + DisplayName: Quality Slop + Tooltip: "{$CommonItemTooltip.MajorStats}" +} + Salak: { DisplayName: Salak Tooltip: "{$CommonItemTooltip.MinorStats}" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 6399fb7ce9..c730a6f062 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -337,10 +337,12 @@ RelicOfResilience: { Tooltip: ''' Holding this item creates orbiting rock shards around you and nearby allies + After 5 seconds, the relic will retain orbiting rocks even when not holding the item + Continuing to hold the item will steadily increase the number of rocks and defenses until reaching max power While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10% - Taking a hit or pressing will pull in the shards, then blast them outward, crippling hit enemies - This effect has a 10 second cooldown after taking a hit - Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you + Taking a hit or pressing while holding this item will pull in the shards, then blast them outward, crippling hit enemies + This effect has a 10 second cooldown after taking a hit, but recharges faster if holding the item + Holding out the shield heavily reduces the damage of all summons [c/FF8C00:I saw a massacre and did nothing to stop it. My vow broken, I was shunned.] [c/FF8C00:My will to forge ahead vanished. My final wish was simply to not die alone.] [c/FF8C00:But when She put faith in my shield, I would never again let it falter.] diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 410a5c6147..8e88ec30ee 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -405,7 +405,7 @@ DragonRage: { Tooltip: ''' Twirls a baton that causes explosions of [cbuff:CalamityMod/Dragonfire] on enemy hits - Every ten hits will summon a ring of fireballs + Once every two seconds, hits summon a ring of fireballs that target the enemy with the most health ''' } @@ -779,11 +779,9 @@ Lacerator: { The saw does more damage the more often the yoyo hits, and fades away when not striking enemies Enemies touching the edge of the sawblade get blood orbs torn out of them Picking up these blood orbs reduces the duration of [cbuffplr:PotionSickness] - The direction of the saw's spin depends on which direction you originally threw the yoyo - [GFB] + The direction of the saw's spin depends on which direction you originally threw the yoyo[GFB] ''' - TooltipNormal: Someone thought this was a viable weapon against DoG at one point lol - TooltipGFB: May be a viable weapon against DoG... + GFBFlavor: "[c/ff0a0a:May be a viable weapon against DoG...]" } LifehuntScythe: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index f048628a44..6f959058de 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -369,6 +369,22 @@ EclipsesFall: { ''' } +ElephantKiller: { + DisplayName: Elephant Killer + Tooltip: + ''' + Can be tossed to gain [STEALTHGAIN]% of max stealth on hit + to spend [STEALTHCOST]% of max stealth and fire the gun with increased damage + All gun shots always critically strike, with critical strike chance increasing critical strike damage + Stealth strikes fire a [c/87CEFA:Spectral Elephant] from the gun + Any gun shots that pass through the [c/87CEFA:Spectral Elephant] are redirected and greatly empowered + [c/D4827A:Natural stealth generation and stealth damage is disabled when holding this weapon] + [c/D78DDD:'Why's my gun called the Elephant Killer?] + [c/D78DDD:...] + [c/D78DDD:Don't worry about it'] + ''' +} + EnchantedAxe: { DisplayName: Enchanted Axe Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 927a547bf4..87c74c3ceb 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -52,7 +52,6 @@ CrimulanSpike.DisplayName: Crimulan Spike CursedFire.DisplayName: Eye Fire DarkEnergyBall.DisplayName: Dark Energy DarkEnergyBall2.DisplayName: Dark Energy -DarkOrb.DisplayName: Dark Orb DesertScourgeDiveSplash.DisplayName: Desert Scourge Dive Splash DesertScourgeSpit.DisplayName: Scourge Spit DestroyerCursedLaser.DisplayName: Cursed Laser @@ -61,7 +60,6 @@ DeusMine.DisplayName: Astral Mine DeusRitualDrama.DisplayName: Deus Ritual Drama DoGBeam.DisplayName: Portal Laser DoGBeamPortal.DisplayName: Beam Portal -DoGDeath.DisplayName: Death Beam DoGDeathBoom.DisplayName: Cosmic Explosion DoGFire.DisplayName: "[ceffect/dog:Faith Incinerator]" DoGLaserWalls.DisplayName: "[ceffect/dog:God's Bane Doombeam Array]" @@ -70,7 +68,6 @@ DoGP1EndPortal.DisplayName: Portal DoGRiftCrack.DisplayName: DoG Distortion Crack DoGTeleportRift.DisplayName: DoG Distortion Rift DraedonSummonLaser.DisplayName: Giant Fuck-off Deathray of Doom -DyingSun.DisplayName: Dying Sun EssenceDust.DisplayName: Cosmic Dust Flare.DisplayName: Flare FlareBomb.DisplayName: Flare Bomb @@ -162,7 +159,6 @@ ShadowflameFireball.DisplayName: Shadowflame Fireball Shadowflamethrower.DisplayName: Shadowflame Breath SignusScythe.DisplayName: Scythe SirenSong.DisplayName: Musical Note -SkyFlare.DisplayName: Sky Flare SkyFlareRevenge.DisplayName: Sky Flare SporeGasPlantera.DisplayName: Spore Gas StormWeaverFrostWaveTelegraph.DisplayName: Frost Wave Telegraph diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index f69845ce21..228285a23b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -94,6 +94,8 @@ EclipsesFall_StealthSpear.DisplayName: Spear of Obscuration EclipsesFall_StealthSpearExplosion.DisplayName: Third Contact EGloveSpark.DisplayName: Electrician's Spark EnchantedAxe2.DisplayName: Enchanted Axe +ElephantKillerElephant.DisplayName: Spectral Elephant +ElephantKillerThrown.DisplayName: Elephant Killer EnchantedAxeProj.DisplayName: Enchanted Axe EpidemicShredderProjectile.DisplayName: Epidemic Shredder EquanimityDarkShard.DisplayName: Dark Shard diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 109eb101f0..65d98bc2fe 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -51,7 +51,6 @@ DuneSandBallGun.DisplayName: Dunesand Ball EarlyBloomBobber.DisplayName: Early Bloom Bobber EmpyreanBlast.DisplayName: Empyrean Blast EmpyreanEmber.DisplayName: Empyrean Ember -EmpyreanGlob.DisplayName: Empyeran Glob EmpyreanMarble.DisplayName: Empyrean Marble EmpyreanStellarDetritus.DisplayName: Empyrean Stellar Detritus EnergyShell.DisplayName: Energy Shell @@ -72,10 +71,12 @@ FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem GenericElectricSpark.DisplayName: Electric Spark GhostlyBolt.DisplayName: Bolt +GluttonyBlenderAnimation.DisplayName: Gluttony Blender Animation GodKiller.DisplayName: God Killer GodSlayerShrapnel.DisplayName: Flame GodSlayerShrapnelRound.DisplayName: Round GreenLabSeeker.DisplayName: Seeking Mechanism +Gunshot.DisplayName: Gunshot HeronBobber.DisplayName: Heron Bobber HideOfAstrumDeusExplosion.DisplayName: Explosion HolyExplosionSupreme.DisplayName: Explosion @@ -153,6 +154,7 @@ TileSlamDamage.DisplayName: Grand Damage TitanHeartBoom.DisplayName: Titan Heart Boom TransformerAura.DisplayName: Transformer Aura TransformerBlob.DisplayName: Transformer Shard +TrustyOldBobber.DisplayName: Trusty Old Bobber UrsaSlash.DisplayName: Ursa Slash V8000SoulVisual.DisplayName: V8000 Soul VerstaltiteBobber.DisplayName: Verstaltite Bobber diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 4ef15e5896..a33ed0ebe9 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -209,7 +209,7 @@ EditedTooltip: { ArcheryPotion: 5% increased arrow damage and 20% increased arrow speed AleSake: ''' - Increases melee weapon scale by 15%, but decreases melee speed by 10% + Increases melee weapon scale by 25%, but decreases melee speed by 10% Counts as an alcohol for Alcohol Poisoning {$Common.AlcoholWarning} ''' @@ -255,8 +255,28 @@ BuffDescription: { WeaponImbueVenom: Melee, Whip, and Rogue attacks inflict acid venom on your targets } +HerbTooltips: { + Daybloom: "[C/FFEB8A:A cheerful herb which blooms under daylight]" + Moonglow: "[C/8AFFFF:A radiant herb which blossoms under moonlight]" + Waterleaf: "[C/8AFFAF:A tenacious herb that blossoms in the rain]" + Blinkroot: "[C/FFC28A:A fickle herb, whose blooming is unpredictable]" + Shiverthorn: "[C/AADEFA:A frigid herb that blooms slowly and permanently]" + Deathweed: "[C/A98AFF:A foul herb, blossoming under the Full or Blood Moon]" + Fireblossom: "[C/FF8063:A vibrant herb, blossoming in the sunset hours]" +} + +SeedTooltips: { + Daybloom: "[C/FFEB8A:Must be planted in regular Grass]" + Moonglow: "[C/8AFFFF:Must be planted in Jungle Grass]" + Waterleaf: "[C/8AFFAF:Must be placed in Sand]" + Blinkroot: "[C/FFC28A:Must be sown in Dirt or Mud]" + Shiverthorn: "[C/AADEFA:Must be placed in Snow or Ice]" + Deathweed: "[C/A98AFF:Must be buried in Evil Grass or Evil Stone]" + Fireblossom: "[C/FF8063:Must be buried in Ash]" +} + // Vanilla NPC dialogues added by Calamity -AnglerChat.SeaKing: Someone tell {0} to quit trying to throw me out of town, it's not going to work. +AnglerChat.SeaKing: Hey! Someone tell {0} to quit trying to throw me outta town, it's not gonna work! ArmsDealerChat: { MentionQuadBarrel: That old man left a cranky old gun on his deathbed. You catching my drift? @@ -275,20 +295,18 @@ ClothierChat: { CyborgChat: { MoonLordDefeated1: Always shoot for the moon! It has clearly worked before. - MoonLordDefeated2: Draedon? The guy who made these upgrades on me said he wanted to best him. But I never cared about that, I just wanted to shoot lasers from my eyes. MentionPlague: Those big green roaches in the Jungle don't threaten me, but all of the animals it has consumed... Please, do me a favor and protect them. Rain: All these moments will be lost in time. Like tears... in the rain. } DemolitionistChat: { - MentionSkynamite: Tired of blowing your legs off with dynamite? Not my problem, but if you aren't fond of it you could try throwing them into a Sky Mill to see if they fly. + MentionSkynamite: Tired of blowing your legs off with dynamite? That's part of the thrill! But maybe they'll fly if you try throwing them into a Sky Mill. DoGDefeated: God Slayer Dynamite? Boy do I like the sound of that! } DryadChat: { DarksunEclipse: There's a dark solar energy emanating from the moths that appear during this time. What's up with moths getting stronger as you do too? Hardmode: That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond? - Mushroom: I'm not here for any reason! Just picking up mushrooms for uh, later use. SulphurSea: My Goddess is resting deep below this sea. If you may excuse me, I wish to pay my respects to her alone. } @@ -310,28 +328,23 @@ GuideChat: { Hardmode2: That earthquake wasn't natural, something must have caused it... Beware when exploring, whatever caused it must be a powerful entity, perhaps even otherworldly. } -HerbTooltips: { - Daybloom: "[C/FFEB8A:A cheerful herb which blooms under daylight]" - Moonglow: "[C/8AFFFF:A radiant herb which blossoms under moonlight]" - Waterleaf: "[C/8AFFAF:A tenacious herb that blossoms in the rain]" - Blinkroot: "[C/FFC28A:A fickle herb, whose blooming is unpredictable]" - Shiverthorn: "[C/AADEFA:A frigid herb that blooms slowly and permanently]" - Deathweed: "[C/A98AFF:A foul herb, blossoming under the Full or Blood Moon]" - Fireblossom: "[C/FF8063:A vibrant herb, blossoming in the sunset hours]" -} - MechanicChat: { HasPortalGun: Just what is that contraption? It makes my Teleporters look like child's play! MoonLordDefeated: What do you mean your traps aren't making the cut? Don't look at me! Eclipse: Um... should my nightlight be on? - AcidRain: Maybe I should've waterproofed my gadgets... They're starting to corrode. + AcidRain: Oh darn! I should've waterproofed my gadgets, they're starting to corrode. } MerchantChat: { MoonLordDefeated: Every night seems more tense than the last. I feel unspeakable horrors are watching over us. Eclipse: Are you daft?! Turn off those lamps! AcidRain: If this acid rain keeps up, there'll be a shortage of Dirt Blocks soon enough! - Bandit: I happen to have several Angel Statues at the moment, a truely rare commodity. Want one? + Bandit: Have you any idea why I have several Angel Statues in my stock, friend? Please relieve me of them! +} + +NurseChat: { + Bandit: You wouldn't happen to be taking stuff from my biohazard container, would you? + PlanteraDefeatedAndBanditPresent: Things have been going missing lately. First used needles, then dirty scalpels, and now... waste IV bags? } PainterChat: { @@ -352,35 +365,25 @@ PainterChat: { } PartyGirlChat: { - Eclipse1: I think my light display is turning into an accidental bug zapper. At least the monsters are enjoying it. + Eclipse1: My light display is turning into an accidental bug zapper. Yeah I don't know, but at least the monsters are enjoying it. Eclipse2: Ooh! I love parties where everyone wears a scary costume! } PirateChat: { - PreLeviathan: Aye, I've heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there. + PreLeviathan: Aye, I hear of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there, matey! WetScourgeDefeated: I have to thank ye again for takin' care of that sea serpent. Or was that another one... - SeaKing: I remember legends about that {0}. He ain't quite how the stories make him out to be though. - Ocean: Now this is a scene that I can admire any time! I feel like something is watching me though. - SulphurSea1: It ain't much of a sight, but there's still life living in these waters. - SulphurSea2: Me ship might just sink from the acid alone. -} - -SeedTooltips: { - Daybloom: "[C/FFEB8A:Must be planted in regular Grass]" - Moonglow: "[C/8AFFFF:Must be planted in Jungle Grass]" - Waterleaf: "[C/8AFFAF:Must be placed in Sand]" - Blinkroot: "[C/FFC28A:Must be sown in Dirt or Mud]" - Shiverthorn: "[C/AADEFA:Must be placed in Snow or Ice]" - Deathweed: "[C/A98AFF:Must be buried in Evil Grass or Evil Stone]" - Fireblossom: "[C/FF8063:Must be buried in Ash]" + SeaKing: There be many a legend about that {0}! He ain't quite how the stories make him outta be though. + Ocean: Aye, the open waters! This be a scene any sea dog can admire! + SulphurSea1: It ain't much a sight, but these waters still be teamin' with life. + SulphurSea2: Argh, this is no proper dock! Me ship might just sink from the acid alone! } SkeletonMerchantChat.Normal: What'dya buyin'? SteampunkerChat: { MoonLordDefeated: Yep! I'm also considering being a space pirate now. - Astral: Some of my machines are starting to go haywire thanks to this Astral Infection. I probably shouldn't have built them here. - Hallow: I'm sorry I really don't have any Unicorn proof tech here, you're on your own. + Astral: Golly! Some of my machines are going haywire thanks to this Astral Infection. I shan't have built them here! + Hallow: I dinnae have any Unicorn proof tech here, you're a wee bit on your own mate. } StylistChat: { @@ -396,16 +399,16 @@ TaxCollectorChat: { DoGDefeated: Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by! PreBrimmy: So those punks on Azafure think they can live for free on my lands? Tell you what, do my job there and I might give you a bonus. HasSlickCane: Goodness! That cane has swagger! - Has500Plat: Where and how are you getting all of this money? Has100Plat: BAH! Doesn't seem like I'll ever be able to quarrel with the debts of the town again! + Has500Plat: Where and how are you getting all of this money?! Scram, you have no need for me! } TruffleChat.Normal: I don't feel very safe; I think there's pigs following me around and it frightens me. WitchDoctorChat: { BloodMoon: This is as good a time as any to pick up the best ingredients for potions. - PrePlantera: I remember hearing some rumours about some villagers that were creating a monster to defend their village, maybe their magic can be of use to you? - Jungle: I wonder how my relatives are doing, last time I checked on them they were too busy praising the... Sun, I think. + PrePlantera: I recall rumors about some villagers that were creating a monster to defend their village. Such magic could never tame beasts, but perhaps it can be of use to you. + Jungle: I wonder how my kind is doing. Last time I checked on them they were too busy praising the... Sun, I think. } WizardChat.Hardmode: Space just got way too close for comfort. diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index dae263984c..bbd5408e76 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -10,6 +10,8 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -115,7 +117,7 @@ namespace CalamityMod.NPCs.Abyss if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) NPC.TargetClosest(); - if (NPC.justHit || detectsPlayer || Main.player[NPC.target].chaosState || adultWyrmAlive || (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(160f)) + if (NPC.justHit || detectsPlayer || Main.player[NPC.target].ownedProjectileCounts[ModContent.ProjectileType()] > 0 || Main.player[NPC.target].chaosState || adultWyrmAlive || (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(160f)) { detectsPlayer = true; NPC.damage = Main.expertMode ? 340 : 170; diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index ceee4b8ef8..f1618f6bca 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -102,10 +103,14 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - bool phase1 = NPC.life > NPC.lifeMax * 0.5; - bool phase2 = NPC.life <= NPC.lifeMax * 0.5; + bool phase1 = NPC.localAI[2] != 5 && NPC.life > NPC.lifeMax * 0.5; + bool phase2 = NPC.localAI[2] == 5 || NPC.life <= NPC.lifeMax * 0.5; bool phase3 = NPC.life <= NPC.lifeMax * 0.1; NPC.chaseable = hasBeenHit; + if (hasBeenHit == false) + NPC.TargetClosest(false); + // If fished out, get mad + if (Main.player[NPC.target].ownedProjectileCounts[ModContent.ProjectileType()] > 0) { NPC.localAI[2] = 5; hasBeenHit = true; } if (NPC.soundDelay <= 0) { NPC.soundDelay = 360; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ea1ed3a49e..9722690a7f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -15,6 +15,7 @@ using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.PlagueReaper; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.Abyss; @@ -161,7 +162,6 @@ namespace CalamityMod.NPCs // Heat debuff effects public bool IncreasedHeatEffects_Fireball = false; - public bool IncreasedHeatEffects_CinnamonRoll = false; public int IncreasedHeatEffects_FireBoots = 0; // Toxic Heart effect @@ -194,6 +194,9 @@ namespace CalamityMod.NPCs /// Set this value to reduce target defense by a flat amount. public int miscDefenseLoss = 0; + /// If true, enemy will not drop any items. + public bool preventDrops = false; + /// /// Constant representing a distance of 200 tiles in pixel measurement.
/// Used by bosses to increase their velocity in order to catch up to their target. @@ -514,7 +517,6 @@ namespace CalamityMod.NPCs 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.IncreasedSicknessEffects_ToxicHeart = IncreasedSicknessEffects_ToxicHeart; myClone.IncreasedWaterEffects_Amulet1 = IncreasedWaterEffects_Amulet1; @@ -529,6 +531,8 @@ namespace CalamityMod.NPCs myClone.miscDefenseLoss = miscDefenseLoss; + myClone.preventDrops = preventDrops; + myClone.dashImmunityTime = new int[maxPlayerImmunities]; for (int i = 0; i < maxPlayerImmunities; ++i) myClone.dashImmunityTime[i] = dashImmunityTime[i]; @@ -4244,10 +4248,16 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 0.25); // 4x spawn rate maxSpawns = (int)(maxSpawns * 4f); } - if (player.Calamity().bloodyMary) + if (player.Calamity().bloodyMary || player.GetModPlayer().HasAlcohol(AlcoholType.BloodyMary)) { - spawnRate = (int)(spawnRate * 0.142); // ~7x spawn rate - maxSpawns = (int)(maxSpawns * 5f); // Only 5x the cap, however + spawnRate = (int)(spawnRate * BloodyMary.SpawnRateGateMultiplier); // ~7x spawn rate + maxSpawns = (int)(maxSpawns * BloodyMary.SpawnLimitMultiplier); // 5x spawn rate cap + } + // Only when BOTH effects are active, also applies the previous spawn rate and limit boosts multiplicatively + if (player.Calamity().bloodyMary && player.GetModPlayer().HasAlcohol(AlcoholType.BloodyMary)) + { + spawnRate = (int)(spawnRate * BloodyMary.IVDripAdditionalSpawnRateGateMultiplier); // 1.429x spawn rate, total of 10x + maxSpawns = (int)(maxSpawns * BloodyMary.IVDripAdditionalSpawnLimitMultiplier); // 1.5x spawn rate cap } // Reductions diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 5fa1266546..0fb3532bb7 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Placeables.Furniture.Paintings; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -1867,6 +1868,13 @@ DukeEditFailed: #region Pre Kill public override bool PreKill(NPC npc) { + if (npc.Calamity().preventDrops) + { + // This NEEDS to have an exception to function, so I put a very unlikely item to ever drop from an enemy + DropHelper.BlockEverything(ModContent.ItemType()); + npc.value = 0; + } + // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ if (CalamityWorld.revenge && (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || npc.type == NPCID.Creeper)) DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 86ec12c772..409ca846b9 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1021,7 +1021,7 @@ namespace CalamityMod.NPCs case NPCID.Cyborg: if (Main.rand.NextBool(5) && NPC.downedMoonlord) - chat = CalamityUtils.GetTextValue("Vanilla.CyborgChat.MoonLordDefeated" + Main.rand.Next(1, 2 + 1)); + chat = CalamityUtils.GetTextValue("Vanilla.CyborgChat.MoonLordDefeated"); else if (Main.rand.NextBool(10) && !DownedBossSystem.downedPlaguebringer && NPC.downedGolemBoss) chat = CalamityUtils.GetTextValue("Vanilla.CyborgChat.MentionPlague"); else if (Main.rand.NextBool(10) && Main.raining) @@ -1038,10 +1038,6 @@ namespace CalamityMod.NPCs case NPCID.Dryad: if (Main.rand.NextBool(5) && DownedBossSystem.downedDoG && Main.eclipse) chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.DarksunEclipse"); - else if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneGlowshroom) - { - chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom"); - } else if (Main.rand.NextBool(5) && Main.LocalPlayer.Calamity().ZoneSulphur) chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.SulphurSea"); else if (Main.rand.NextBool(5) && Main.hardMode) @@ -1093,6 +1089,14 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.MerchantChat.Bandit"); break; + case NPCID.Nurse: + if (Main.rand.NextBool(4) && NPC.downedPlantBoss && thief != -1) + chat = CalamityUtils.GetTextValue("Vanilla.NurseChat.PlanteraDefeatedAndBanditPresent"); + else if (Main.rand.NextBool(4) && thief != -1) + chat = CalamityUtils.GetTextValue("Vanilla.NurseChat.Bandit"); + + break; + case NPCID.Painter: if (Main.rand.NextBool(4) && Main.LocalPlayer.ZoneCorrupt) chat = CalamityUtils.GetTextValue("Vanilla.PainterChat.Corruption"); diff --git a/NPCs/DesertScourge/DesertPestBody.png b/NPCs/DesertScourge/DesertPestBody.png deleted file mode 100644 index 79e052b362..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody2.png b/NPCs/DesertScourge/DesertPestBody2.png deleted file mode 100644 index f651238e84..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody2.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody3.png b/NPCs/DesertScourge/DesertPestBody3.png deleted file mode 100644 index 2307268ff8..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody3.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody4.png b/NPCs/DesertScourge/DesertPestBody4.png deleted file mode 100644 index 922b55b874..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody4.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestHead.png b/NPCs/DesertScourge/DesertPestHead.png deleted file mode 100644 index 4d24a8bb61..0000000000 Binary files a/NPCs/DesertScourge/DesertPestHead.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestTail.png b/NPCs/DesertScourge/DesertPestTail.png deleted file mode 100644 index f6f82765e0..0000000000 Binary files a/NPCs/DesertScourge/DesertPestTail.png and /dev/null differ diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 9b1d42e7e7..22cafef865 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -249,12 +249,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int LaserWallDamage = 75; // 300 public static int LaserWallMiddleBeamDamage = 85; // 340 - public static int FireballDamage = 60; // 240 + public static int FireballDamage = 55; // 220 public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 250; // 500 + NPC.damage = 225; // 450 NPC.npcSlots = 5f; NPC.width = 104; NPC.height = 104; diff --git a/NPCs/NormalNPCs/WildBumblebirb.cs b/NPCs/NormalNPCs/WildBumblebirb.cs index 0670a351ec..e0f308ab27 100644 --- a/NPCs/NormalNPCs/WildBumblebirb.cs +++ b/NPCs/NormalNPCs/WildBumblebirb.cs @@ -80,6 +80,8 @@ namespace CalamityMod.NPCs.NormalNPCs float rotationMult = 4f; float rotationAmt = 0.04f; + NPC.ai[3]++; + if (Vector2.Distance(player.Center, NPC.Center) > 5600f) { if (NPC.timeLeft > 5) @@ -92,7 +94,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < Main.maxNPCs; i++) { - if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type) + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type && NPC.ai[3] >= 2) { Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center; if (otherSwarmerDirection.Length() < (NPC.width + NPC.height)) @@ -145,7 +147,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[0] = 1f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.ai[3] = 0f; } else if (swarmerIdleTargetDist.Length() > 400f) { @@ -190,7 +191,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.ai[3] = 0f; } NPC.ai[2] += 0.0166666675f; diff --git a/NPCs/Noxus/Noxus.png b/NPCs/Noxus/Noxus.png deleted file mode 100644 index 95ec42e62c..0000000000 Binary files a/NPCs/Noxus/Noxus.png and /dev/null differ diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index b35bc6f9c9..5e565e819d 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -337,26 +337,11 @@ namespace CalamityMod.NPCs.Perforator // This is possibly the best or worst idea ever conceived if (Main.zenithWorld) { - float laserOffset = 1500f; - float laserVelocity = 4f; - int type = ModContent.ProjectileType(); - int damage = LaserWallDamage; - NPC.Calamity().newAI[3]++; if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast { if (NPC.Calamity().newAI[3] % 60 == 59) - { - SoundEngine.PlaySound(SoundID.Item12, player.Center); - for (int i = -7; i < 8; i++) // 15 lasers - { - float laserGap = (i * 128f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center + Main.rand.NextVector2CircularEdge(600, 600), Vector2.Zero, ModContent.ProjectileType(), LaserWallDamage, 0, Main.myPlayer, 0.45f, 180, Main.rand.Next(5)); if (NPC.Calamity().newAI[3] >= 300f) NPC.Calamity().newAI[3] = -300f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 4699dddf4c..5b48c83dd6 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -162,9 +162,9 @@ namespace CalamityMod.NPCs.Perforator // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; - bool spawnSmall = Main.getGoodWorld ? lifeRatio < 0.85f : lifeRatio < 0.75f; - bool spawnMedium = Main.getGoodWorld ? lifeRatio < 0.60f : lifeRatio < 0.50f; - bool spawnLarge = Main.getGoodWorld ? lifeRatio < 0.45f : lifeRatio < 0.25f; + bool spawnSmall = lifeRatio < 0.75f; + bool spawnMedium = lifeRatio < 0.50f; + bool spawnLarge = lifeRatio < 0.25f; if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f || !(player.ZoneCrimson || BossRushEvent.BossRushActive)) { @@ -332,16 +332,6 @@ namespace CalamityMod.NPCs.Perforator GeneralParticleHandler.SpawnParticle(blood); } - - if (Main.getGoodWorld && lifeRatio < 0.5f && Main.netMode != NetmodeID.MultiplayerClient) - { - if (lifeRatio > 0.35f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.2f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.05f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - } if (wormType != -1) { squashTimer = squashInterval; // Start scaling animation diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index e9c9606af2..c81061ba3e 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - NPC.damage = 70; // 140 + NPC.damage = 60; // 120 NPC.width = 22; NPC.height = 22; NPC.defense = 20; diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 2e39de458b..1c1c256a20 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 80; // 160 + NPC.damage = 70; // 140 NPC.width = 42; NPC.height = 42; NPC.defense = 20; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 0b9018bce2..ffe5aefd53 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -83,13 +83,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public static int StingerDamage = 28; // 112 - public static int NukeDamage = 35; // 140; Also applies to GFB Peanuts and Gauss Nukes + public static int StingerDamage = 25; // 100 + public static int NukeDamage = 30; // 120; Also applies to GFB Peanuts and Gauss Nukes public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 90; // 180 + NPC.damage = 75; // 150 NPC.npcSlots = 64f; NPC.width = 198; NPC.height = 198; @@ -1378,7 +1378,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath target.AddBuff(BuffID.Poisoned, 480); target.AddBuff(BuffID.Venom, 480); } - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index dc21b19b4f..1cb25c3921 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -21,7 +21,6 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 16; - NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -34,7 +33,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = 0; // 0 contact damage, projectile damage is handled separately + NPC.damage = 45; NPC.width = 56; NPC.height = 42; NPC.defense = 22; diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 597eded883..a15fe0bf0c 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -22,7 +22,6 @@ namespace CalamityMod.NPCs.SulphurousSea public const float CheckDistance = 480f; public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 4; value.PortraitPositionYOverride = 24f; @@ -32,7 +31,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = 0; // 0 contact damage, projectile damage is handled separately + NPC.damage = 45; NPC.width = 54; NPC.height = 42; NPC.defense = 25; diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png index eba5d41efc..2bba092f4a 100644 Binary files a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png and b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png index 3e729e5486..82907f2312 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas.png and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index 8f4766b4cc..6a9ade6571 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -314,6 +314,7 @@ namespace CalamityMod.NPCs.TownNPCs .Add(CalamityConditions.DownedCalamitasClone) .Add(Condition.DownedPlantera) .Add(Condition.DownedPlantera) + .Add(Condition.DownedPlantera, Condition.NpcIsPresent(NPCID.Nurse)) .Add(Condition.DownedGolem) .Add(Condition.DownedMoonLord) .Add(CalamityConditions.DownedDevourerOfGods) diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/PlantAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/PlantAI.cs index b2e0a13494..e3a7b04717 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/PlantAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeaths/PlantAI.cs @@ -140,7 +140,7 @@ public static partial class RevengeanceAndDeathAI NPC.velocity.Y = -2f; } - if ((NPC.type == NPCID.GiantFungiBulb || NPC.type == NPCID.FungiBulb) && !Main.player[NPC.target].DeadOrGhost) + if (NPC.type == NPCID.GiantFungiBulb && !Main.player[NPC.target].DeadOrGhost) { if (NPC.localAI[0] > ((NPC.type == NPCID.GiantFungiBulb ? (CalamityWorld.revenge ? GiantFungiBulbSporeShootGateValue_Rev : GiantFungiBulbSporeShootGateValue) : FungiBulbSporeShootGateValue) - FungiBulbSporeTelegraphTime)) { diff --git a/Particles/BrightFlash.png b/Particles/BrightFlash.png new file mode 100644 index 0000000000..fd2fad8d76 Binary files /dev/null and b/Particles/BrightFlash.png differ diff --git a/Particles/FadeLine.png b/Particles/FadeLine.png new file mode 100644 index 0000000000..29d0d315fd Binary files /dev/null and b/Particles/FadeLine.png differ diff --git a/Prefixes/HorribleWeaponPrefix.cs b/Prefixes/HorribleWeaponPrefix.cs index bb77ea8798..8484b58f4f 100644 --- a/Prefixes/HorribleWeaponPrefix.cs +++ b/Prefixes/HorribleWeaponPrefix.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Prefixes public class Horrible : HorribleWeaponPrefix { - public override float damageMult => 0.50f; - public override float sizeMult => 3f; + public override float damageMult => 0.66f; + public override float sizeMult => 2f; } public abstract class HorribleWeaponPrefix : ModPrefix, ILocalizedModType { diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index aea1ac75f1..caf3411e63 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void OnSpawn(IEntitySource source) { - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.timeLeft = (int)(Owner.HeldItem.useAnimation * (Owner.HeldItem.CountsAsClass() ? Owner.inverseMeleeSpeed : 1)) + 1; } #region Fields @@ -47,12 +47,20 @@ namespace CalamityMod.Projectiles.BaseProjectiles public virtual Player Owner => Main.player[Projectile.owner]; /// - /// The amount of pixels out the center of the projectile's hitbox is. + /// The amount of extra size added to the projectile's scale. + /// + public virtual float AdditionalScale => 0; + /// + /// If the projectile should auto scale to it's Projectile.scale to 1 (or greater if it is a melee item) + /// + public virtual bool IgnoreAutoScale => false; + /// + /// The amount of pixels out the center of the projectile's hitbox is. Scales with Projectile.scale. /// public virtual float HitboxOutset => 30; /// - /// The projectile's hitbox size in pixels. + /// The projectile's hitbox size in pixels. Scales with Projectile.scale. /// public virtual Vector2 HitboxSize => new Vector2(30, 30); @@ -177,7 +185,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles { WhenSpawned(); whenSpawned = false; - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.timeLeft = (int)(Owner.HeldItem.useAnimation * (Owner.HeldItem.CountsAsClass() ? Owner.inverseMeleeSpeed : 1)) + 1; Projectile.netUpdate = true; } @@ -191,6 +199,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles Owner.Calamity().mouseWorldListener = true; Owner.Calamity().rightClickListener = true; + float finalScale = (Owner.HeldItem.CountsAsClass() ? Owner.GetMeleeScale() : Owner.HeldItem.scale) + AdditionalScale; + if (!IgnoreAutoScale) + Projectile.scale = MathHelper.Lerp(Projectile.scale, finalScale, 0.3f / Projectile.MaxUpdates); + if (ItemAnimationActive || IgnoreActiveAnimation) { Animation++; @@ -235,7 +247,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (Owner.itemAnimation == Owner.itemAnimationMax - 1) { - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.timeLeft = (int)(Owner.HeldItem.useAnimation * (Owner.HeldItem.CountsAsClass() ? Owner.inverseMeleeSpeed : 1)) + 1; OnBeginUse(); } @@ -263,8 +275,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void ModifyDamageHitbox(ref Rectangle hitbox) { - Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset); - hitbox = new Rectangle((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y); + Vector2 hitboxScale = HitboxSize * Projectile.scale; + Vector2 cen = Projectile.Center + new Vector2(HitboxOutset * Projectile.scale, 0).RotatedBy(FinalRotation + HitboxRotationOffset); + hitbox = new Rectangle((int)cen.X - (int)(hitboxScale.X / 2), (int)cen.Y - (int)(hitboxScale.Y / 2), (int)hitboxScale.X, (int)hitboxScale.Y); // Turn this on to show the hitbox, useful for testing if it's working how you want /*Particle blastRing = new CustomPulse(hitbox.TopLeft(), Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); diff --git a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs index 344bf53445..81a55e025a 100644 --- a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.Graphics.Primitives; -using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -117,7 +116,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// Whether or not this should get melee speed bonuses /// Defaults to TRUE ///
- public virtual bool useMeleeSpeed { get; set; } = true; + public virtual bool useAttackSpeed { get; set; } = true; /// /// Whether or not this should get melee size bonuses (Titan Glove) @@ -333,9 +332,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles StartupTime *= Projectile.MaxUpdates; CooldownTime *= Projectile.MaxUpdates; swingTime *= Projectile.MaxUpdates; - if (useMeleeSpeed) + if (useAttackSpeed) { - var speed = Main.player[Projectile.owner].GetAttackSpeed(); + var speed = Main.player[Projectile.owner].GetTotalAttackSpeed(Projectile.DamageType); if (speed > 3f) speed = 3f; @@ -352,8 +351,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles } if (useMeleeSize) { - if (player.meleeScaleGlove) Projectile.scale *= 1.1f; - Projectile.scale *= player.HeldItem.scale; + Projectile.scale *= player.GetMeleeScale(); } baseScale = Projectile.scale; ExistsTime = swingTime + StartupTime + CooldownTime; diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs deleted file mode 100644 index 07d6295347..0000000000 --- a/Projectiles/Boss/DarkOrb.cs +++ /dev/null @@ -1,564 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class DarkOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/LightningProj"; - - private bool start = true; - private Vector2 center = Vector2.Zero; - private Vector2 velocity = Vector2.Zero; - private double[] distances = new double[4]; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 3600; - CooldownSlot = ImmunityCooldownID.Bosses; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.localAI[0]); - writer.Write(Projectile.localAI[1]); - writer.Write(start); - writer.WriteVector2(center); - writer.Write(distances[0]); - writer.Write(distances[1]); - writer.Write(distances[2]); - writer.Write(distances[3]); - writer.WriteVector2(velocity); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.localAI[0] = reader.ReadSingle(); - Projectile.localAI[1] = reader.ReadSingle(); - start = reader.ReadBoolean(); - center = reader.ReadVector2(); - distances[0] = reader.ReadDouble(); - distances[1] = reader.ReadDouble(); - distances[2] = reader.ReadDouble(); - distances[3] = reader.ReadDouble(); - velocity = reader.ReadVector2(); - } - - public override void AI() - { - if (Projectile.ai[0] != 8f) - { - // Pulse in and out - if (Projectile.localAI[1] == 0f) - { - Projectile.scale -= 0.012f; - if (Projectile.scale <= 0.8f) - { - Projectile.scale = 0.8f; - Projectile.localAI[1] = 1f; - } - } - else - { - Projectile.scale += 0.012f; - if (Projectile.scale >= 1.2f) - { - Projectile.scale = 1.2f; - Projectile.localAI[1] = 0f; - } - } - } - - switch ((int)Projectile.ai[0]) - { - // No AI - case -1: - break; - - // Rotate around a point, spread outward and move - case 0: - case 1: - - if (start) - { - center = Projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center) * 2f; - start = false; - } - - center += velocity; - - double rad = MathHelper.ToRadians(Projectile.ai[1]); - - float amount = 1f - Projectile.localAI[0] / 360f; - if (amount < 0f) - amount = 0f; - - distances[0] += MathHelper.Lerp(1f, 6f, amount); - - if (Projectile.ai[0] == 0f) - { - Projectile.position.X = center.X - (int)(Math.Sin(rad) * distances[0]) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Cos(rad) * distances[0]) - Projectile.height / 2; - } - else - { - Projectile.position.X = center.X - (int)(Math.Cos(rad) * distances[0]) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Sin(rad) * distances[0]) - Projectile.height / 2; - } - - Projectile.ai[1] += 0.25f + amount; - Projectile.localAI[0] += 1f; - - break; - - // Lurch forward - case 2: - - LurchForward(0.05f, 0.95f, 1.05f); - - break; - - // Wavy motion - case 3: - case 4: - - bool useSin = Projectile.ai[0] == 3f; - - WavyMotion(0.1f, 0f, useSin, false); - - break; - - // Speed up then slow down on a timer - case 5: - case 16: - - float fastGateValue = Projectile.ai[0] == 5f ? 30f : 60f; - float maxVelocity = Projectile.ai[0] == 5f ? 12f : 6f; - - LurchForwardOnTimer(90f, fastGateValue, 3f, maxVelocity, 0.95f, 1.2f); - - break; - - // Split into 4 projectiles that can use any of the first 6 AIs - case 6: - - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] >= 90f) - { - if (Projectile.owner == Main.myPlayer) - { - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector, Projectile.type, Projectile.damage, 0f, Main.myPlayer, Main.rand.Next(6), 0f); - } - } - - Projectile.Kill(); - } - - break; - - // Split into 8 projectiles that can use either of the first 2 AIs - case 7: - - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] >= 120f) - { - if (Projectile.owner == Main.myPlayer) - { - int totalProjectiles = 8; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector, Projectile.type, Projectile.damage, 0f, Main.myPlayer, Main.rand.Next(2), 0f); - } - } - - Projectile.Kill(); - } - - break; - - // Split into 3 wavy projectiles multiple times - case 8: - - bool splitOnce = Projectile.timeLeft < 1800; - bool splitTwice = Projectile.timeLeft < 900; - bool splitThrice = Projectile.timeLeft < 450; - - if (splitOnce) - WavyMotion(0.05f, 2f, true, true); - - Projectile.localAI[0] += 1f; - - if (Projectile.localAI[0] >= 180f) - { - if (Projectile.owner == Main.myPlayer) - { - int totalProjectiles = 3; - float radians = MathHelper.TwoPi / totalProjectiles; - int spread = 8; - - if (splitOnce) - { - spread *= (splitTwice ? 3 : 0) + - (splitThrice ? 3 : 0); - } - - Vector2 vector = Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center; - vector.Normalize(); - vector *= 3f; - - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = splitOnce ? Projectile.velocity.RotatedBy(MathHelper.ToRadians(i * spread)) : new Vector2(0f, -3f).RotatedBy(radians * i); - - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector + vector2, Projectile.type, Projectile.damage, 0f, Main.myPlayer, 8f, 0f); - - Main.projectile[proj].timeLeft = Projectile.timeLeft / 2; - if (Main.projectile[proj].timeLeft < 150) - Main.projectile[proj].timeLeft = 150; - - Main.projectile[proj].scale = Projectile.scale * 0.6f; - } - } - - Projectile.Kill(); - } - - break; - - // idk yet - case 9: - case 10: - - bool useSin2 = Projectile.ai[0] == 9f; - - OscillationMotion(0.05f, useSin2); - - break; - - // Homing - case 11: - - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] >= 180f) - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] < 180f) - { - Vector2 vector = Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center; - float scaleFactor = Projectile.velocity.Length(); - vector.Normalize(); - vector *= scaleFactor; - Projectile.velocity = (Projectile.velocity * 15f + vector) / 16f; - Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor; - } - else if (Projectile.velocity.Length() < 18f) - Projectile.velocity *= 1.01f; - } - - break; - - // Rotate around a moving point and spread outward then inward in an oval pattern - case 12: - case 13: - - if (start) - { - center = Projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center); - start = false; - } - - center += velocity; - - float velocityGateValue3 = 240f; - float amount2 = 1f; - - bool flyOutward = Projectile.localAI[0] < velocityGateValue3; - - if (flyOutward) - amount2 -= Projectile.localAI[0] / velocityGateValue3; - else - amount2 = (Projectile.localAI[0] - velocityGateValue3) / velocityGateValue3; - - amount2 = MathHelper.Clamp(0f, 1f, amount2); - - double distanceVariable = MathHelper.Lerp(0f, 6f, amount2); - - distances[0] += flyOutward ? distanceVariable : -distanceVariable; - - double rad2 = MathHelper.ToRadians(Projectile.ai[1]); - - if (Projectile.ai[0] == 12f) - { - Projectile.position.X = center.X - (int)(Math.Sin(rad2) * distances[0] * 2D) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Cos(rad2) * distances[0]) - Projectile.height / 2; - } - else - { - Projectile.position.X = center.X - (int)(Math.Cos(rad2) * distances[0]) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Sin(rad2) * distances[0] * 2D) - Projectile.height / 2; - } - - Projectile.ai[1] += 0.25f + amount2; - Projectile.localAI[0] += 1f; - - break; - - // Spread out then drift inward after some time and then drift outward - case 14: - case 15: - - float velocityMult = 12f; - - if (start) - { - center = Projectile.Center; - velocity = Vector2.Normalize(Main.player[Player.FindClosest(Projectile.Center, 1, 1)].Center - Projectile.Center) * velocityMult; - start = false; - } - - center += velocity; - - float flyInwardGateValue = 240f; - - float amount3 = 1f - Projectile.localAI[0] / flyInwardGateValue; - if (amount3 < 0f) - amount3 = 0f; - - bool changeXPos = Projectile.ai[0] == 14f; - - float units = 6f; - - distances[0] += MathHelper.Lerp(1f, units, amount3); - - if (Projectile.localAI[0] > flyInwardGateValue) - { - distances[2] = changeXPos ? Math.Abs(center.X - Projectile.Center.X) : Math.Abs(center.Y - Projectile.Center.Y); - - if (distances[3] == 0D) - distances[3] = distances[2] - units * 10f; - - distances[3] += changeXPos ? velocity.X : velocity.Y; - - distances[1] -= distances[2] < (units * 10f) ? distances[2] * 0.1f : MathHelper.Lerp(units, units + 2f, (float)(distances[2] / distances[3])); - } - else - { - float slowDownGateValue = 30f; - - if (Projectile.localAI[0] > flyInwardGateValue - slowDownGateValue) - velocity *= 1f - velocityMult / slowDownGateValue; - - distances[1] = distances[0]; - } - - double distanceX = changeXPos ? distances[1] : distances[0]; - double distanceY = changeXPos ? distances[0] : distances[1]; - - double rad3 = MathHelper.ToRadians(Projectile.ai[1]); - - Projectile.position.X = center.X - (int)(Math.Sin(rad3) * distanceX) - Projectile.width / 2; - Projectile.position.Y = center.Y - (int)(Math.Cos(rad3) * distanceY) - Projectile.height / 2; - - Projectile.localAI[0] += 1f; - - if (Projectile.localAI[0] > 600f) - Projectile.Kill(); - - break; - } - } - - private void WavyMotion(float frequency, float amplitude, bool useSin, bool waveWithVelocity) - { - if (start) - { - velocity = Projectile.velocity; - start = false; - } - - Projectile.ai[1] += frequency; - - if (amplitude == 0f) - amplitude = velocity.Length(); - - float wavyVelocity = useSin ? (float)Math.Sin(Projectile.ai[1]) : (float)Math.Cos(Projectile.ai[1]); - - if (waveWithVelocity) - Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity) * amplitude; - else - Projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; - } - - private void LurchForward(float frequncy, float deceleration, float acceleration) - { - Projectile.ai[1] += frequncy; - - Projectile.velocity *= MathHelper.Lerp(deceleration, acceleration, (float)Math.Abs(Math.Sin(Projectile.ai[1]))); - } - - private void LurchForwardOnTimer(float slowGateValue, float fastGateValue, float minVelocity, float maxVelocity, float deceleration, float acceleration) - { - Projectile.ai[1] += 1f; - - if (Projectile.ai[1] <= slowGateValue) - { - if (Projectile.velocity.Length() > minVelocity) - Projectile.velocity *= deceleration; - } - else if (Projectile.ai[1] < slowGateValue + fastGateValue) - { - if (Projectile.velocity.Length() < maxVelocity) - Projectile.velocity *= acceleration; - } - else - Projectile.ai[1] = 0f; - } - - private void OscillationMotion(float frequncy, bool useSin) - { - Projectile.ai[1] += frequncy; - - float oscillation = useSin ? (float)Math.Sin(Projectile.ai[1]) : (float)Math.Cos(Projectile.ai[1]); - - if (start) - { - velocity = Projectile.velocity; - start = false; - } - else if (oscillation == 0f) - { - Player target = Main.player[Player.FindClosest(Projectile.Center, 1, 1)]; - Vector2 vector = target.Center + target.velocity * 20f - Projectile.Center; - vector.Normalize(); - vector *= velocity.Length(); - Projectile.velocity = vector; - } - else - { - float amplitude = velocity.Length(); - - Projectile.velocity.Normalize(); - Projectile.velocity *= amplitude * oscillation; - } - } - - public override Color? GetAlpha(Color lightColor) - { - switch ((int)Projectile.ai[0]) - { - // No AI - case -1: - - return new Color(0, 100, 255, Projectile.alpha); - - // Rotate around a point, spread outward and move - case 0: - case 1: - - return new Color(0, 100, 255, Projectile.alpha); - - // Lurch forward - case 2: - - return new Color(255, 200, 0, Projectile.alpha); - - // Wavy motion - case 3: - case 4: - - return new Color(0, 255, 200, Projectile.alpha); - - // Speed up then slow down on a timer - case 5: - case 16: - - return new Color(0, 255, 100, Projectile.alpha); - - // Split into 4 projectiles that can use any of the first 6 AIs - case 6: - - return new Color(200, 0, 255, Projectile.alpha); - - // Split into 8 projectiles that can use either of the first 2 AIs - case 7: - - return new Color(255, 0, 150, Projectile.alpha); - - // Split into 3 wavy projectiles multiple times - case 8: - - return new Color(200, 0, 0, Projectile.alpha); - - // idk yet - case 9: - case 10: - - return new Color(255, 255, 0, Projectile.alpha); - - // Homing - case 11: - - return new Color(150, 0, 200, Projectile.alpha); - - // Rotate around a moving point and spread outward then inward in an oval pattern - case 12: - case 13: - - return new Color(0, 100, 255, Projectile.alpha); - - // Spread out then drift inward after some time and then drift outward - case 14: - case 15: - - return new Color(0, 100, 255, Projectile.alpha); - } - - return null; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 200); - //target.AddBuff(ModContent.BuffType(), 300, true); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs deleted file mode 100644 index 685c26d719..0000000000 --- a/Projectiles/Boss/DoGDeath.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DoGDeath : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - - public float TelegraphDelay - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } - - public Vector2 OldVelocity; - public const float TelegraphTotalTime = 35f; - public const float TelegraphFadeTime = 5f; - public const float TelegraphWidth = 2400f; - public const float FadeTime = 20f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; - } - - public override void SetDefaults() - { - Projectile.Calamity().DealsDefenseDamage = true; - Projectile.width = 10; - Projectile.height = 10; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.Opacity = 0f; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - CooldownSlot = ImmunityCooldownID.Bosses; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(OldVelocity); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - OldVelocity = reader.ReadVector2(); - } - - public override void AI() - { - // Determine the relative opacities for each player based on their distance. - // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 1f; - Projectile.netUpdate = true; - } - - // Fade in after telegraphs have faded. - if (TelegraphDelay > TelegraphTotalTime) - { - if (Projectile.timeLeft < FadeTime) - { - Projectile.Opacity = Projectile.timeLeft / FadeTime; - } - else - { - if (Projectile.Opacity < 1f) - Projectile.Opacity += 0.05f; - if (Projectile.Opacity > 1f) - Projectile.Opacity = 1f; - } - - // If an old velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> - if (OldVelocity != Vector2.Zero) - { - Projectile.velocity = OldVelocity; - OldVelocity = Vector2.Zero; - Projectile.netUpdate = true; - } - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - - // Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. - else if (OldVelocity == Vector2.Zero) - { - OldVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Zero; - Projectile.netUpdate = true; - Projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; - } - - TelegraphDelay++; - } - - public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime && Projectile.Opacity == 1f; - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - if (TelegraphDelay > TelegraphTotalTime && Projectile.Opacity == 1f) - target.AddBuff(ModContent.BuffType(), 120); - } - - public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 0) * Projectile.Opacity; - - public override bool PreDraw(ref Color lightColor) - { - if (TelegraphDelay >= TelegraphTotalTime) - return true; - - // for old times sake - if (Main.zenithWorld) - return false; - - Texture2D laserTelegraph = ModContent.Request("CalamityMod/ExtraTextures/LaserWallTelegraphBeam").Value; - - float yScale = 2f; - if (TelegraphDelay < TelegraphFadeTime) - yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / TelegraphFadeTime); - if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) - yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / TelegraphFadeTime); - - Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); - Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); - Vector2 scaleOuter = scaleInner * new Vector2(1f, 1.6f); - - Color colorOuter = Color.Lerp(Color.Cyan, Color.Purple, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through purple and cyan once and then flash. - Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); - - colorOuter *= 0.7f; - colorInner *= 0.7f; - - Main.EntitySpriteDraw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0); - Main.EntitySpriteDraw(laserTelegraph, Projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Boss/DoGDeath.png b/Projectiles/Boss/DoGDeath.png deleted file mode 100644 index c1e09b93b3..0000000000 Binary files a/Projectiles/Boss/DoGDeath.png and /dev/null differ diff --git a/Projectiles/Boss/DyingSun.cs b/Projectiles/Boss/DyingSun.cs deleted file mode 100644 index 90435e7abf..0000000000 --- a/Projectiles/Boss/DyingSun.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class DyingSun : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public ref float Time => ref Projectile.ai[0]; - public ref float Radius => ref Projectile.ai[1]; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; - } - - public override void SetDefaults() - { - Projectile.width = 164; - Projectile.height = 164; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 100; - Projectile.MaxUpdates = 2; - Projectile.scale = 1f; - } - - public override void AI() - { - Projectile.scale += 0.08f; - Radius = Projectile.scale * 42f; - Projectile.Opacity = Utils.GetLerpValue(8f, 42f, Projectile.timeLeft, true); - - Time++; - } - - public float SunWidthFunction(float completionRatio, Vector2 vertexPos) => Radius * Projectile.scale * (float)Math.Sin(MathHelper.Pi * completionRatio); - - public Color SunColorFunction(float completionRatio, Vector2 vertexPos) - { - Color sunColor = Main.zenithWorld ? (new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.8f) : (Main.IsItDay() ? Color.Yellow : Color.Cyan); - return Color.Lerp(sunColor, Color.White, (float)Math.Sin(MathHelper.Pi * completionRatio) * 0.5f + 0.3f) * Projectile.Opacity; - } - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:Flame"].UseSaturation(0.45f); - GameShaders.Misc["CalamityMod:Flame"].UseImage1("Images/Misc/Perlin"); - - List rotationPoints = new List(); - List drawPoints = new List(); - - for (float offsetAngle = -MathHelper.PiOver2; offsetAngle <= MathHelper.PiOver2; offsetAngle += MathHelper.Pi / 80f) - { - rotationPoints.Clear(); - drawPoints.Clear(); - - float adjustedAngle = offsetAngle + MathHelper.Pi * -0.2f; - Vector2 offsetDirection = adjustedAngle.ToRotationVector2(); - for (int i = 0; i < 16; i++) - { - rotationPoints.Add(adjustedAngle); - drawPoints.Add(Vector2.Lerp(Projectile.Center - offsetDirection * Radius / 2f, Projectile.Center + offsetDirection * Radius / 2f, i / 16f)); - } - PrimitiveRenderer.RenderTrail(drawPoints, new(SunWidthFunction, SunColorFunction, shader: GameShaders.Misc["CalamityMod:Flame"]), 24); - } - return false; - } - } -} diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs deleted file mode 100644 index 7e8efe47f6..0000000000 --- a/Projectiles/Boss/SkyFlare.cs +++ /dev/null @@ -1,126 +0,0 @@ -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class SkyFlare : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public int blowTimer = 0; - - public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 5; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.hostile = true; - Projectile.penetrate = 1; - CooldownSlot = ImmunityCooldownID.Bosses; - } - - public override void AI() - { - Projectile.velocity *= 0.9995f; - int addStuff = Main.rand.Next(5); - blowTimer += addStuff; - if (blowTimer >= 900) - { - Projectile.Kill(); - } - Projectile.frameCounter++; - if (Projectile.frameCounter > 5) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 4) - { - Projectile.frame = 0; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, Projectile.alpha); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; - int y6 = framing * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void OnKill(int timeLeft) - { - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(FlareSound, Projectile.Center); - int dustAmt = 36; - for (int i = 0; i < dustAmt; i++) - { - Vector2 dustRotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - dustRotate = dustRotate.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 dustDirection = dustRotate - Projectile.Center; - int flareDust = Dust.NewDust(dustRotate + dustDirection, 0, 0, DustID.CopperCoin, dustDirection.X * 2f, dustDirection.Y * 2f, 100, default, 1.4f); - Main.dust[flareDust].noGravity = true; - Main.dust[flareDust].noLight = true; - Main.dust[flareDust].velocity = dustDirection; - } - if (Projectile.owner == Main.myPlayer) - { - int projTileX = (int)(Projectile.Center.Y / 16f); - int projTileY = (int)(Projectile.Center.X / 16f); - if (projTileY < 10) - { - projTileY = 10; - } - if (projTileY > Main.maxTilesX - 10) - { - projTileY = Main.maxTilesX - 10; - } - if (projTileX < 10) - { - projTileX = 10; - } - if (projTileX > Main.maxTilesY - 110) - { - projTileX = Main.maxTilesY - 110; - } - for (int j = projTileX; j < projTileX + 100; j++) - { - Tile tile = Main.tile[projTileY, j]; - if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) - { - projTileX = j; - break; - } - } - int tornadoType = Main.rand.Next(6); - if (tornadoType < 5) - { - int nadoDamage = Main.expertMode ? 180 : 300; //720 - int nadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), nadoDamage, 4f, Main.myPlayer, 16f, 15f + (revenge ? 4f : 0f)); - Main.projectile[nadoSpawn].netUpdate = true; - } - else - { - int nadoDamage = Main.expertMode ? 230 : 400; //920 - int nadoSpawn = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), nadoDamage, 4f, Main.myPlayer, 16f, 16f + (revenge ? 4f : 0f)); - Main.projectile[nadoSpawn].netUpdate = true; - } - } - } - } -} diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 0856f46a52..6263e74b06 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Boss public class SkyFlareRevenge : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/Boss/SkyFlare"; public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Custom/Yharon/YharonInfernado"); diff --git a/Projectiles/Boss/SkyFlare.png b/Projectiles/Boss/SkyFlareRevenge.png similarity index 100% rename from Projectiles/Boss/SkyFlare.png rename to Projectiles/Boss/SkyFlareRevenge.png diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index f69127303d..18a0c13172 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; using CalamityMod.Items.Armor.Daedalus; using CalamityMod.Items.Armor.Reaver; +using CalamityMod.Items.Fishing; using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; @@ -34,6 +35,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.VanillaProjectileOverrides; +using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Mechanic; using CalamityMod.Tiles.Abyss; @@ -58,6 +60,7 @@ using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech; + namespace CalamityMod.Projectiles { public partial class CalamityGlobalProjectile : GlobalProjectile @@ -340,7 +343,8 @@ namespace CalamityMod.Projectiles void ApplyGrapeBeer() { grapeBeer = true; - conditionalHomingRange = 300; + var ivDripPlayer = Main.player[projectile.owner].GetModPlayer(); + conditionalHomingRange = ivDripPlayer.HasAlcohol(AlcoholType.GrapeBeer) ? 800 : 300; if (projectile.timeLeft > 300 * projectile.MaxUpdates) projectile.timeLeft = 300 * projectile.MaxUpdates; //Calamity adds a hybrid iframe system when both local and static are set to true, so this works fine for both global and static projectiles. @@ -2953,6 +2957,9 @@ namespace CalamityMod.Projectiles { var owner = Main.player[projectile.owner]; var cplayer = owner.Calamity(); + owner.Fishing_GetBait(out Item baitItem); + bool reelingIn = projectile.ai[0] == 1; + bool lineSnapped = projectile.ai[0] == 2; //Make sure Victide Snail actually fishes when using a minigame rod foreach (var item in Main.ActiveProjectiles) @@ -3082,6 +3089,7 @@ namespace CalamityMod.Projectiles //localAI[1] - The timer for fish to try and bite the hook. When it exceeds 660, it resets to 0. //If ai[1] is not 0, this is set to the item ID of the hooked item/NPC //If hooking an NPC, this is set to the NPC ID but negative. Still need to find how this gets treated upon reeling in. + switch (owner.Calamity().SelectedFishingMinigame) { case CalamityPlayer.FishingMinigames.WulfrumBobber: @@ -3357,7 +3365,6 @@ namespace CalamityMod.Projectiles if (cplayer.mouseRight && projectile.ai[1] == 0 && owner.miscCounter % 10 == 0) { owner.lifeRegenCount -= 600; // -5 health per 10 ticks - owner.Fishing_GetBait(out Item baitItem); // Diminishing returns on bait power beyond 75 int baitPower = baitItem?.bait ?? 0; @@ -3728,10 +3735,60 @@ namespace CalamityMod.Projectiles } } + + bool alreadyJunk = projectile.ai[1] == ItemID.OldShoe || projectile.ai[1] == ItemID.FishingSeaweed || projectile.ai[1] == ItemID.TinCan; + // When using rage bait, gives a chance that your items turn to junk + if (baitItem?.type == ModContent.ItemType() && reelingIn && !alreadyJunk && Main.rand.NextBool(RageBait.junkChance.Item1, RageBait.junkChance.Item2) && projectile.localAI[1] != 0) + { + var junk = Main.rand.Next(3) switch + { + 0 => ItemID.OldShoe, + 1 => ItemID.FishingSeaweed, + _ => ItemID.TinCan, + }; + + SoundStyle epicFail = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(epicFail with { Volume = 0.9f, Pitch = 0.3f }, projectile.Center); + if (CalamityWorld.revenge) + owner.Calamity().rage += 25; + + for (int i = 0; i < 12; i++) + { + Particle spray = new CustomSpark(projectile.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10), -Vector2.UnitY * Main.rand.NextFloat(3, 8), "CalamityMod/Particles/BloomCircle", true, Main.rand.Next(18, 24) * 5, Main.rand.NextFloat(0.3f, 0.5f), Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0, 0.7f)) * 0.3f, new Vector2(0.8f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spray); + + if (i % 2 == 0) + { + Particle rage = new CustomSpark(owner.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10) + -Vector2.UnitY * 7.5f, -Vector2.UnitY * Main.rand.NextFloat(0.5f, 2f), "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(12, 18) * 4, Main.rand.NextFloat(0.3f, 0.5f), Color.Lerp(Color.Crimson, Color.Red, Main.rand.NextFloat(0, 0.7f)) * 0.7f, new Vector2(0.7f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(rage); + } + } + + projectile.ai[1] = junk; + return false; + } + + bool pulledNPC = Main.rand.NextBool(TrustyOldRod.enemyChance.Item1, TrustyOldRod.enemyChance.Item2); + if (owner.HeldItem.type == ModContent.ItemType() && reelingIn && projectile.ai[1] != 0 && projectile.localAI[1] != 0 && pulledNPC) + { + // Remove any item you would have fished up + projectile.ai[1] = 0; + // Get rarity of pull + int rarity = 0; + int roll = Main.rand.Next(1, 100 + 1); + if (roll == 1) rarity = 3; // UltraRare (1/100) + else if (roll <= 21) rarity = 2; // Rare ~(1/5) + else rarity = 1; // Common ~(4/5) + + TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(owner, projectile.whoAmI, rarity, projectile.lavaWet, projectile.honeyWet); + projectile.ai[0] = 2; // snap line + return false; + } + return false; } #endregion - + #region AI public override void AI(Projectile projectile) { @@ -4326,10 +4383,10 @@ namespace CalamityMod.Projectiles grapeBeerHomingPower = 0.015f; } - HomingTarget = grapeBeerHomingTarget = target.whoAmI; + HomingTarget = grapeBeerHomingTarget = target.whoAmI; Vector2 targetDirection = projectile.SafeDirectionTo(target.Center); - float trackingSpeed = grapeBeerHomingPower;// Vector2.Dot(targetDirection, projectile.velocity.SafeNormalize(Vector2.UnitX)) > 0.835f ? 0.01325f : 0f; // Delicate values, please test changes you make to them + float trackingSpeed = grapeBeerHomingPower; var currVelocity = projectile.velocity.Length(); if (currVelocity < 8) @@ -4623,28 +4680,29 @@ namespace CalamityMod.Projectiles } // Old Fashioned buffs (or debuffs) apply if the player has Old Fashioned - // IV Drip on the Rocks inherits the same logic as Old Fashioned if (modPlayer.oldFashioned && buffedByOldFashioned.HasValue) modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; - if (modPlayer.ivDrip && buffedByOldFashioned.HasValue) - modifiers.SourceDamage *= buffedByOldFashioned.Value ? IVDripOnTheRocks.DamageBoostMultiplier : IVDripOnTheRocks.DamageReductionMultiplier; - if (modPlayer.rum && projectile.DamageType.CountsAsClass(DamageClass.Summon)) + var dripPlayer = player.GetModPlayer(); + if (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) && buffedByOldFashioned.HasValue) + modifiers.SourceDamage *= buffedByOldFashioned.Value ? OldFashioned.DamageBoostMultiplier : OldFashioned.DamageReductionMultiplier; + + if ((modPlayer.rum || dripPlayer.HasAlcohol(AlcoholType.Rum)) && projectile.DamageType.CountsAsClass(DamageClass.Summon)) { if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type]) - { - modifiers.SourceDamage *= Rum.MinionBoost; - } + modifiers.SourceDamage *= (modPlayer.rum ? Rum.MinionBoost : 1f) * (dripPlayer.HasAlcohol(AlcoholType.Rum) ? Rum.MinionBoost : 1f); else - modifiers.SourceDamage *= Rum.NonMinionBoost; + modifiers.SourceDamage *= (modPlayer.rum ? Rum.NonMinionBoost : 1f) * (dripPlayer.HasAlcohol(AlcoholType.Rum) ? Rum.NonMinionBoost : 1f); } - if (modPlayer.moscowMule || modPlayer.bloodyMary) + + if (modPlayer.moscowMule || modPlayer.bloodyMary || dripPlayer.HasAlcohol(AlcoholType.MoscowMule) || dripPlayer.HasAlcohol(AlcoholType.BloodyMary)) { if (projectile.DamageType == DamageClass.Summon || (PierceResistNPC.exemptProjectiles.Contains(projectile.type) || (PierceResistNPC.singleHitboxExemptProjectiles.ContainsKey(projectile.type) && PierceResistNPC.singleHitboxExemptProjectiles[projectile.type]))) { - modifiers.SourceDamage *= ((modPlayer.moscowMule ? 0.7f : 1f) * (modPlayer.bloodyMary ? 0.33f : 1f)); + modifiers.SourceDamage *= ((modPlayer.moscowMule ? MoscowMule.PierceDamageMultiplier : 1f) * (modPlayer.bloodyMary ? BloodyMary.PierceDamageMultiplier : 1f) * (dripPlayer.HasAlcohol(AlcoholType.MoscowMule) ? MoscowMule.PierceDamageMultiplier : 1f) * (dripPlayer.HasAlcohol(AlcoholType.BloodyMary) ? BloodyMary.PierceDamageMultiplier : 1f)); } } + 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 @@ -4798,7 +4856,8 @@ namespace CalamityMod.Projectiles { var player = Main.player[projectile.owner]; float burnRatio = (-player.statMana / 100) * ChaosStone.DamageMultPer100Mana; - target.Calamity().manaBurn += damageDone * burnRatio * (player.Calamity().oldFashioned ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().ivDrip ? IVDripOnTheRocks.DamageBoostMultiplier : 1) * (player.Calamity().vodka ? 1+Vodka.DebuffBoost : 1); + var dripPlayer = player.GetModPlayer(); + target.Calamity().manaBurn += damageDone * burnRatio * (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) ? OldFashioned.DamageBoostMultiplier : 1) * (dripPlayer.HasAlcohol(AlcoholType.OldFashioned) ? OldFashioned.DamageBoostMultiplier : 1) * (player.Calamity().vodka ? 1+Vodka.DebuffBoost : 1); target.Calamity().playerManaBurnIntensity = -player.statMana / (float)player.statManaMax2; if (Main.netMode != NetmodeID.SinglePlayer) ManaBurnSyncPacket.Send(target); diff --git a/Projectiles/DraedonsArsenal/AugerHoldout.cs b/Projectiles/DraedonsArsenal/AugerHoldout.cs index 0322389e2f..d8740597d0 100644 --- a/Projectiles/DraedonsArsenal/AugerHoldout.cs +++ b/Projectiles/DraedonsArsenal/AugerHoldout.cs @@ -78,6 +78,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (!Owner.CantUseHoldout(false)) Projectile.timeLeft = 5; + Projectile.scale = MathHelper.Lerp(Projectile.scale, Owner.GetMeleeScale(), 0.3f / Projectile.MaxUpdates); + Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()); Positioning(toMouse); @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (attackTimer > fireRate && makeHitbox) { - Projectile magnetZone = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner, 0, 0, 0); + Projectile magnetZone = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner, Projectile.scale, 0, 0); SoundStyle pull = new("CalamityMod/Sounds/Item/AugerPull"); SoundEngine.PlaySound(pull with { Volume = 0.9f, Pitch = 0 }, Owner.ClampedMouseWorld()); @@ -213,7 +215,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Owner.SetScreenshake(5f); damage = (int)(damage * 2.5f); } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(scaleFx, 4), toMouse * 25, ModContent.ProjectileType(), damage, 0, Projectile.owner, 0, swingCount, Owner.Calamity().buffedAuger ? 5 : 0); + Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(scaleFx, 4), toMouse * 25, ModContent.ProjectileType(), damage, 0, Projectile.owner, 0, swingCount, Owner.Calamity().buffedAuger ? 5 : 0); + slash.localAI[0] = Projectile.scale; makeHitbox = false; } } @@ -232,7 +235,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Texture2D blade = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Vector2 vel = Projectile.rotation.ToRotationVector2(); float randSize = Main.rand.NextFloat(0.8f, 1f); Color drawColor = Projectile.GetAlpha(lightColor); @@ -261,9 +264,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } Vector2 placeAdjust = (drawRotation + MathHelper.PiOver2).ToRotationVector2() * 2.5f; - Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); // The holdout + // Spesifically doesn't scale with melee size, but the actual energy blade does + Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, drawColor, drawRotation, rotationPoint, 1, flipSprite); // The holdout - Main.EntitySpriteDraw(glow, drawPosition + placeAdjust, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); // The glow + Main.EntitySpriteDraw(glow, drawPosition + placeAdjust, null, Color.White, drawRotation, rotationPoint, 1, flipSprite); // The glow return false; } diff --git a/Projectiles/DraedonsArsenal/AugerPull.cs b/Projectiles/DraedonsArsenal/AugerPull.cs index 4abb72e134..a4d042d200 100644 --- a/Projectiles/DraedonsArsenal/AugerPull.cs +++ b/Projectiles/DraedonsArsenal/AugerPull.cs @@ -32,13 +32,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { + Projectile.scale = Projectile.ai[0]; if (strongTimer == 0) { - Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 1.1f, 0.7f, 30); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 1.1f * Projectile.scale, 0.7f * Projectile.scale, 30); GeneralParticleHandler.SpawnParticle(bolt2); for (int i = 0; i < 20; i++) { - Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(10f, 15.5f); + Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(10f, 15.5f) * Projectile.scale; Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel2.SafeNormalize(Vector2.UnitX) * 360, ModContent.DustType(), -dustVel2 * 1.5f, 0, default, Main.rand.NextFloat(1.2f, 1.8f)); dust2.noGravity = true; dust2.fadeIn = 0.3f; @@ -47,7 +48,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < Main.maxNPCs; i++) { NPC target = Main.npc[i]; - if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650) + if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650 * Projectile.scale) { Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); target.velocity = moveDir; @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f); + Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f) * Projectile.scale; Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel.SafeNormalize(Vector2.UnitX) * 120, Effects.ArsenalEffects.ArsenalGaussDust, -dustVel, 0, default, Main.rand.NextFloat(0.5f, 1f)); dust.noGravity = true; dust.fadeIn = 0.05f; @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal NPC target = Main.npc[i]; if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1)) { - if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 300) + if (Vector2.Distance(target.Center, Projectile.Center) > 15 * Projectile.scale && Vector2.Distance(target.Center, Projectile.Center) < 300 * Projectile.scale) { Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); target.velocity = Vector2.Lerp(target.velocity, moveDir * 5, 0.12f); @@ -100,8 +101,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowSquareParticleBig").Value; Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * (strong ? 0.5f : 0.3f) * shrinkFade; - Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink, SpriteEffects.None, 0); - Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2), SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2) * Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/DraedonsArsenal/AugerSlash.cs b/Projectiles/DraedonsArsenal/AugerSlash.cs index 8d57ef5c26..4010a6be88 100644 --- a/Projectiles/DraedonsArsenal/AugerSlash.cs +++ b/Projectiles/DraedonsArsenal/AugerSlash.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { Player Owner = Main.player[Projectile.owner]; + Projectile.scale = Projectile.localAI[0]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); fade = (float)Math.Pow(Utils.GetLerpValue(lifetime * 0.1f, lifetime * 0.5f, Projectile.timeLeft, true), 4); if (Projectile.velocity.Length() > 0.1f) @@ -48,15 +49,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float rotScaling = 1 - Math.Abs(rot); Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(rot) * (70 / scaleFx + 80 * (float)Math.Pow(rotScaling, 1.5f) * Main.rand.NextFloat(0.85f, 1f)) * scaleFx; Vector2 finalDustVel = (vel * (float)Math.Pow(rotScaling, 1.5f) + (vel.RotatedBy(-MathHelper.PiOver2 * rot) * 1.5f)) * 0.03f; - Dust s = Dust.NewDustPerfect(Projectile.Center + vel - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 45 * scaleFx, ModContent.DustType(), finalDustVel / scaleFx); - s.scale = scale * scaleFx; + Dust s = Dust.NewDustPerfect(Projectile.Center + (vel - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 45 * scaleFx) * Projectile.scale, ModContent.DustType(), finalDustVel / scaleFx); + s.scale = scale * scaleFx * Projectile.scale; s.noGravity = true; s.color = Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, Math.Max(0, swingDirScale - 0.35f)); - s.fadeIn = 0.1f + swingDirScale; + s.fadeIn = 0.1f + swingDirScale * Projectile.scale; } } - Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, 0.3f).ToVector3() * 0.7f); + Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, 0.3f).ToVector3() * 0.7f * Projectile.scale); time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float length = 135 * scale; float size = 135 * scale; float _ = float.NaN; - bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _); + bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length * Projectile.scale, size * Projectile.scale, ref _); return (hit); } public override bool PreDraw(ref Color lightColor) @@ -154,7 +155,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float sizeLerp = (float)Math.Pow((Utils.GetLerpValue(lifetime, lifetime * 0.2f, time, true)), 5f); Vector2 squash = new Vector2(1 + lerp * 0.5f, 1.25f - lerp * 1.1f) * 0.08f * sizeLerp; Vector2 rotationPoint = new Vector2(proj.Width * 0.85f, proj.Height / 2); - Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 105; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 105 * Projectile.scale; SpriteEffects spfx = (Projectile.ai[1] != 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); if (Projectile.direction == -1) diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs index 66bc8fecce..688343a936 100644 --- a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs @@ -336,15 +336,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float fade = 1; float reformMult = Utils.GetLerpValue(1, 0, Projectile.Opacity) * 3.5f; Texture2D tex = pullPin ? ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenade").Value : ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseGrenadeNoPin").Value; + Vector2 baseDrawPos = Projectile.Center - Main.screenPosition + + ((!flung || catching) ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); for (int i = 0; i < 15; i++) { Color auraColor = col with { A = 0 } * 0.25f * fade * fxScale; Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 2 * Math.Max(fxScale, reformMult); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(tex, baseDrawPos + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fade * Projectile.Opacity, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, baseDrawPos, null, lightColor * fade * Projectile.Opacity, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White * fade * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseGrenadeGlow").Value, baseDrawPos, null, Color.White * fade * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index 8c637f4aeb..25879d7ed9 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Enemy } Projectile.velocity = Vector2.Zero; Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) + if (Projectile.localAI[1] == (Projectile.ai[1] == 1f ? 15f : 60f) && Projectile.owner == Main.myPlayer) { int projectileDamage = Projectile.ai[0] != 0f ? (int)Projectile.ai[0] : Main.masterMode ? 21 : Main.expertMode ? 25 : 40; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 3f, Projectile.owner, 0f, Projectile.ai[1]); diff --git a/Projectiles/Magic/OmicronWingman.cs b/Projectiles/Magic/OmicronWingman.cs index 6e2173aa5c..2d0d52dad9 100644 --- a/Projectiles/Magic/OmicronWingman.cs +++ b/Projectiles/Magic/OmicronWingman.cs @@ -250,7 +250,7 @@ namespace CalamityMod.Projectiles.Magic texture = ModContent.Request("CalamityMod/Projectiles/Magic/OmicronWingmanAlt").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; diff --git a/Projectiles/Magic/WingmanHoldout.cs b/Projectiles/Magic/WingmanHoldout.cs index 9b83bbff90..91908a5fc2 100644 --- a/Projectiles/Magic/WingmanHoldout.cs +++ b/Projectiles/Magic/WingmanHoldout.cs @@ -265,7 +265,7 @@ namespace CalamityMod.Projectiles.Magic else texture = ModContent.Request("CalamityMod/Items/Weapons/Magic/WingmanAlt").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; diff --git a/Projectiles/Melee/BalefulHarvesterHoldout.cs b/Projectiles/Melee/BalefulHarvesterHoldout.cs index 19382f94d0..7f505a7c99 100644 --- a/Projectiles/Melee/BalefulHarvesterHoldout.cs +++ b/Projectiles/Melee/BalefulHarvesterHoldout.cs @@ -19,10 +19,11 @@ namespace CalamityMod.Projectiles.Melee public override int AssignedItemID => ModContent.ItemType(); public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/BalefulHarvester"; - public override float HitboxOutset => 90; - public override Vector2 HitboxSize => new Vector2(140, 140); + public int size = 106; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 96); public Vector2 mousePos; public Vector2 aimVel; @@ -44,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -161,8 +161,8 @@ namespace CalamityMod.Projectiles.Melee if (CanHit) { Vector2 sparkVel = Vector2.UnitY.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * (3.5f * Owner.direction); - Vector2 sparkPos = Owner.Center + Vector2.UnitX.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Main.rand.Next(80, 140); - CustomSprite critSpark = new(sparkPos, sparkVel, 15, "CalamityMod/Particles/CritSpark", 1f, Color.Orange, frameCount: 4, frame: Main.rand.Next(4)); + Vector2 sparkPos = Owner.Center + Vector2.UnitX.RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Main.rand.Next(80, 140) * Projectile.scale; + CustomSprite critSpark = new(sparkPos, sparkVel, 15, "CalamityMod/Particles/CritSpark", 1f * Projectile.scale, Color.Orange, frameCount: 4, frame: Main.rand.Next(4)); GeneralParticleHandler.SpawnParticle(critSpark); } } @@ -220,16 +220,16 @@ namespace CalamityMod.Projectiles.Melee Rectangle vanillaSmearFrame = vanillaSmear.Frame(1, 4, 0, 0); Asset smear = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); float smearOpacity = CalamityUtils.Convert01To010(time / timeMax); - Main.EntitySpriteDraw(vanillaSmear.Value, Projectile.Center - Main.screenPosition, vanillaSmearFrame, new Color(193, 83, 43) * smearOpacity * 0.75f, FinalRotation - MathHelper.PiOver2, vanillaSmearFrame.Size() / 2f, 1.25f, SpriteEffects.None); - Main.EntitySpriteDraw(smear.Value, Projectile.Center - Main.screenPosition, null, new Color(247, 115, 0) * smearOpacity, FinalRotation, smear.Size() / 2f, 1.8f, SpriteEffects.None); + Main.EntitySpriteDraw(vanillaSmear.Value, Projectile.Center - Main.screenPosition, vanillaSmearFrame, new Color(193, 83, 43) * smearOpacity * 0.75f, FinalRotation - MathHelper.PiOver2, vanillaSmearFrame.Size() / 2f, 1.25f * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(smear.Value, Projectile.Center - Main.screenPosition, null, new Color(247, 115, 0) * smearOpacity, FinalRotation, smear.Size() / 2f, 1.8f * Projectile.scale, SpriteEffects.None); if (smearOpacity > 0.65f) { Vector2 sparklePos = Projectile.Center - Main.screenPosition - (Vector2.UnitY.RotatedBy(FinalRotation + MathHelper.PiOver4 * Owner.direction) * 120f); Asset bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); - Main.EntitySpriteDraw(bloom.Value, sparklePos, null, Color.White * 0.75f, 0f, bloom.Size() / 2f, 0.2f, SpriteEffects.None); + Main.EntitySpriteDraw(bloom.Value, sparklePos, null, Color.White * 0.75f, 0f, bloom.Size() / 2f, 0.2f * Projectile.scale, SpriteEffects.None); Asset sparkle = ModContent.Request("CalamityMod/Particles/FullStar"); - Main.EntitySpriteDraw(sparkle.Value, sparklePos, null, Color.Orange, 0f, sparkle.Size() / 2f, 2f, SpriteEffects.None); + Main.EntitySpriteDraw(sparkle.Value, sparklePos, null, Color.Orange, 0f, sparkle.Size() / 2f, 2f * Projectile.scale, SpriteEffects.None); } } Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs index c79686bd1b..0b18cbdea0 100644 --- a/Projectiles/Melee/BasherHoldout.cs +++ b/Projectiles/Melee/BasherHoldout.cs @@ -264,7 +264,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearThin").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Vector2 vel = Projectile.rotation.ToRotationVector2(); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + ((Owner.direction == -1) ? MathHelper.Pi - MathHelper.PiOver4 : MathHelper.PiOver4); diff --git a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs index 500a311afe..9b7ff2326a 100644 --- a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs +++ b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs @@ -89,6 +89,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (time == 0) + Projectile.scale = Owner.GetMeleeScale(); if ((CurrentState & State.HasSpawned) == 0) { Projectile.timeLeft = Lifetime + ChargeupTime; @@ -99,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee { foreach (var target in Main.ActiveNPCs) { - if ((CurrentState & State.LeftTarget) == 0 && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1), target.getRect())) + if ((CurrentState & State.LeftTarget) == 0 && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1) * Projectile.scale, target.getRect())) { SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 3 }, Projectile.Center); @@ -166,7 +168,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.Center = Owner.MountedCenter + toMouse * 12f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; CurrentState |= State.Thrown; time = 0; @@ -242,17 +244,18 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { Dust dust = Dust.NewDustPerfect( - Projectile.Center + safeVel.RotatedBy((CurrentState & State.LeftTarget) != 0 ? Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45) : 0) * ((CurrentState & State.LeftTarget) != 0 ? 45 : 60), - ModContent.DustType(), + Projectile.Center + safeVel.RotatedBy((CurrentState & State.LeftTarget) != 0 ? Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45) : 0) * ((CurrentState & State.LeftTarget) != 0 ? 45 : 60) * Projectile.scale, + ModContent.DustType(), dustVel, 0, default, - ((CurrentState & State.LeftTarget) != 0 ? 1.5f : 1) * Main.rand.NextFloat(0.8f, 0.9f)); + ((CurrentState & State.LeftTarget) != 0 ? 1.5f : 1) * Main.rand.NextFloat(0.8f, 0.9f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Red : Color.Crimson; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; + dust.fadeIn = Projectile.scale - 1; } } if (Main.rand.NextBool(5)) @@ -263,7 +266,7 @@ namespace CalamityMod.Projectiles.Melee texture: "CalamityMod/Particles/DemonSigilParticle", affectedByGravity: false, lifetime: 17, - scale: Main.rand.NextFloat(0.2f, 0.3f), + scale: Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, color: Color.Lerp(Color.Crimson, Color.Red, Main.rand.NextFloat(0, 0.7f)) * 0.6f, stretch: new Vector2(1f, 1f), extraRotation: Main.rand.NextFloat(-1f, 1f)); @@ -297,13 +300,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Red : Color.Crimson; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } @@ -318,7 +322,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -45f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -45f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -394,7 +398,7 @@ namespace CalamityMod.Projectiles.Melee // After exiting a target, the hitbox is larger public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - => (Projectile.numHits <= 0 || (CurrentState & State.LeftTarget) != 0) && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1), targetHitbox); + => (Projectile.numHits <= 0 || (CurrentState & State.LeftTarget) != 0) && CircularHitboxCollision(Projectile.Center, Projectile.width / ((CurrentState & State.LeftTarget) != 0 ? 0.5f : 1) * Projectile.scale, targetHitbox); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs index 8205cb5f9a..28d47d91e0 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -150,13 +150,11 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer != Owner.whoAmI) return; - // Get lifted up + if (PogoCooldown <= 0) { SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); // Sizzle Shred += 62; // Augment the shred speed - if (Owner.velocity.Y > 0) - Owner.velocity.Y = -2f; // Get "stuck" into the enemy partly // 17APR2024: Ozzatron: Broken Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash. // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. diff --git a/Projectiles/Melee/BurningHolyBlast.cs b/Projectiles/Melee/BurningHolyBlast.cs index bf2e0d5981..5837114826 100644 --- a/Projectiles/Melee/BurningHolyBlast.cs +++ b/Projectiles/Melee/BurningHolyBlast.cs @@ -35,6 +35,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.damage = 1; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0], targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0] * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 61dafb5b13..2499c312b7 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -31,7 +31,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 180; Projectile.ignoreWater = true; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Player Owner = Main.player[Projectile.owner]; + float scale = Projectile.scale = Owner.GetMeleeScale(); + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { int randomToSubtract = Main.rand.Next(1, 4); diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index 08ff873084..31284e82c0 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -20,12 +20,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/CometQuasher"; - public override float HitboxOutset => 90; - - public override Vector2 HitboxSize => new Vector2(110, 110); + public int size = 94; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(-4, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-5, 96); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -45,7 +44,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Comet Quasher's projectile spawning @@ -159,20 +157,20 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 4; i++) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - Vector2 particlePos2 = Owner.Center + (new Vector2(Main.rand.Next(80, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + Vector2 particlePos2 = Owner.Center + (new Vector2(Main.rand.Next(80, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (i % 2 == 0) { - Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); } else { - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos2, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 23, Main.rand.NextFloat(0.3f, 0.7f), 0.75f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos2, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 23, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, 0.75f, 0, true)); } } - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(120, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(120 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.AliceBlue : Color.DodgerBlue; @@ -221,7 +219,8 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, Main.rand.Next(3), 4); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, Main.rand.Next(3), 4); + meteor.scale = Projectile.scale; spawnBoom = false; } } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index 6627821de0..c5ed0d8f22 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Melee { if (time % 11 == 0) { - GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); + GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20) * Projectile.scale - Projectile.velocity * 2, -Projectile.velocity * 2, false, 11, 0.025f * Projectile.scale, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); GeneralParticleHandler.SpawnParticle(orb); } if (time % 4 == 0) - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 6, Main.rand.NextFloat(0.4f, 0.9f), 0.65f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 6, Main.rand.NextFloat(0.4f, 0.9f) * Projectile.scale, 0.65f, 0, true)); } if (Main.rand.NextBool(13)) { @@ -120,7 +120,8 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[2] > 0) { Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } if (Projectile.owner == Main.myPlayer) @@ -132,13 +133,16 @@ namespace CalamityMod.Projectiles.Melee } for (int i = 0; i < 13; i++) { - Particle spark3 = new GlowOrbParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 9), false, 20, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(5) ? Color.AliceBlue : Color.DodgerBlue, true, false, false); + Particle spark3 = new GlowOrbParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 9), false, 20, Main.rand.NextFloat(0.5f, 1f) * Projectile.scale, Main.rand.NextBool(5) ? Color.AliceBlue : Color.DodgerBlue, true, false, false); GeneralParticleHandler.SpawnParticle(spark3); } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); + if (!CalamityClientConfig.Instance.Photosensitivity) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * Projectile.scale, 1f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * Projectile.scale, 0.3f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index 093afc45b2..acb46b317d 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -29,15 +29,14 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation"; - public float hitboxMult = 1.3f; public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); public SlotId SoundSlot; - public override float HitboxOutset => 335; - - public override Vector2 HitboxSize => new Vector2(395, 395) * hitboxMult; + public int size = 118 + 285; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 285); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-3, 118); + public override float AdditionalScale => 0.15f; public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -78,7 +77,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction @@ -284,8 +282,8 @@ namespace CalamityMod.Projectiles.Melee float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; float randRot = Main.rand.NextFloat(-30, 30); Vector2 dustVel = -Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)).RotatedByRandom(0.3f) * Main.rand.NextFloat(7, 17) - Owner.velocity * 0.8f; - Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f)); + Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10 * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f)); } if (lastHitTarget != null && lastHitTarget.life > 0 && lastHitTarget.active) { @@ -348,16 +346,17 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 8; i++) { float randRot = Main.rand.NextFloat(-20, -100); - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(520 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-20, -100); Vector2 dustVel = (new Vector2(0, 11 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f), Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f)); + Vector2 placement = Owner.Center + (new Vector2(520, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f) * Projectile.scale, Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f)); } } } @@ -480,27 +479,29 @@ namespace CalamityMod.Projectiles.Melee if (true) { Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomLineAngled"); - int draws = 30; + int draws = 60; for (int i = 0; i < draws; i++) { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 25 + i * 6); + float newSine = 0.3f + (0.7f - sine * 0.25f) * Utils.Remap(i, 0, draws, 0.8f, 0.6f); Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); - Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (willDie ? deathFade : 1); - Vector2 drawOffset = -offsetDir * 10 * deathFade * i; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(18, 18), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.02f) * 0.06f, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + float jitter = Utils.Remap(i, 0, draws / 2, 10, 0f) * deathFade; + Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (Utils.Remap(jitter, 0, 10, 1, 3.5f)) * (willDie ? deathFade : 1); + Vector2 drawOffset = -offsetDir * 5 * deathFade * i * Projectile.scale; + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 30 * Projectile.scale - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(jitter, jitter), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation.ToRotationVector2().RotatedByRandom(jitter * 0.085f).ToRotation() + RotationOffset + r, new Vector2(FlipAsSword ? tex2.Width() : 0, tex2.Height()), Vector2.One * (1f - i * 0.01f) * 0.06f * Projectile.scale * newSine * Utils.Remap(jitter, 0, 10, 1, 0.3f), spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } } for (int i = 0; i < 20; i++) { Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : 1); - Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 7 * (willDie ? (1 - deathFade) * 3 : 2); - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(7, 7), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 2 * (willDie ? (1 - deathFade) * 3 : 2); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(4, 4), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } if ((useAnim > 0 || DrawUnconditionally)) { - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.9f * hitboxMult, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.2f * hitboxMult, SpriteEffects.None); - + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.3f, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.75f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } diff --git a/Projectiles/Melee/DevilsDevastationThrownBlade.cs b/Projectiles/Melee/DevilsDevastationThrownBlade.cs index 2daec84626..abc143e1bb 100644 --- a/Projectiles/Melee/DevilsDevastationThrownBlade.cs +++ b/Projectiles/Melee/DevilsDevastationThrownBlade.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); Projectile.localAI[1] = toMouse.ToRotation(); Projectile.netUpdate = true; + Projectile.scale = Owner.GetMeleeScale(); } } @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 30f; + Projectile.Center = Owner.MountedCenter + toMouse * 30f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; thrown = true; time = 0; @@ -211,32 +212,28 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; if (!exitedTarget) { - Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f * Projectile.scale, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); GeneralParticleHandler.SpawnParticle(spark2); } float rot = Projectile.rotation + (MathHelper.TwoPi * i); Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * Projectile.direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); if (exitedTarget && i == 0) { - //Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 60, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); - //dust.noGravity = true; - //dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; - - - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * Projectile.scale).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); dust2.noGravity = (dust2.type == 278 ? false : true); - dust2.scale = dust2.type == 278 ? 0.75f : 0.9f; + dust2.scale = (dust2.type == 278 ? 0.75f : 0.9f) * Projectile.scale; dust2.color = Main.rand.NextBool() ? Color.BlueViolet : clr; dust2.velocity = (vel * 2).RotatedByRandom(0.4f); + dust2.fadeIn = (dust2.type == 278 ? 0 : Projectile.scale - 1); } } if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -274,13 +271,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : clr; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void ThrowAnimation(float chargeProgress) @@ -294,7 +292,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -80f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -80f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -391,7 +389,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/DevilsDevastation").Value; @@ -409,9 +407,8 @@ namespace CalamityMod.Projectiles.Melee Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f), Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f * Projectile.Opacity, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f) * Projectile.scale, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f * Projectile.Opacity, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f * Projectile.scale, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 40ea618ffa..d0ed429bd5 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -31,15 +31,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = lifeTime; Projectile.DamageType = DamageClass.Melee; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * Projectile.scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { if (Projectile.ai[0] == 0f) { - Projectile.ai[0] = Main.rand.NextFloat(40f, 70f); + Projectile.ai[0] = Main.rand.NextFloat(20f, 40f); Projectile.ai[1] = Main.rand.NextFloat(35f, 55f); } - target = Projectile.Center.ClosestNPCAt(1200f); + if (target != null && !target.CanBeChasedBy()) + target = null; + if (target is null) + target = GetTargetInRange(1200f); Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -62,6 +69,29 @@ namespace CalamityMod.Projectiles.Melee } } + + NPC GetTargetInRange(float range) + { + var player = Main.player[Projectile.owner]; + NPC gotTarget = null; + int currentHP = -1; + float distance = range; + foreach (var npc in Main.ActiveNPCs) + { + if (Projectile.localNPCImmunity[npc.whoAmI] > 0) + continue; + var myDistance = npc.Distance(Projectile.Center); + + if (npc.CanBeChasedBy() && ((myDistance < range && currentHP < npc.life) || (myDistance < distance && currentHP <= npc.life))) + { + distance = myDistance; + currentHP = npc.life; + gotTarget = npc; + } + } + return gotTarget; + + } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(ref Color lightColor) @@ -76,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(80); + Projectile.ExpandHitboxBy(80 * Projectile.scale); for (int d = 0; d < 5; d++) { int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); @@ -145,6 +175,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.Damage(); } + public override bool? CanHitNPC(NPC target) + { + if (this.target != null && target.whoAmI != this.target.whoAmI) + return false; + return base.CanHitNPC(target); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 1d0d877dfa..71926dabb9 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -29,13 +29,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.hide = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; + Projectile.localNPCHitCooldown = -1; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void AI() { Player player = Main.player[Projectile.owner]; float spinCycleTime = 50f; + Projectile.scale = 0.85f * player.GetMeleeScale(); // If the player is dead, destroy the projectile if (player.dead || !player.channel) @@ -69,6 +71,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.Pi; Projectile.netUpdate = true; } + + if (Projectile.ai[0] % 5 == 0) + { + Projectile.numHits = 0; + Projectile.ResetLocalNPCHitImmunity(); + } SpawnDust(player, direction); PositionAndRotation(player); VisibilityAndLight(); @@ -142,9 +150,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (target.Calamity().IsArmored()) + Projectile.numHits--; //don't pierce falloff on targets it can't really damage target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(target.Center); } @@ -159,14 +168,12 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); - modPlayer.dragonRageHits++; - if (modPlayer.dragonRageHits >= 10 && modPlayer.dragonRageCooldown <= 0) + if (modPlayer.dragonRageCooldown <= 0) { SpawnFireballs(); - modPlayer.dragonRageHits = 0; } - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (1 - (0.25f * Projectile.numHits))*0.25f) , Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[proj].DamageType = DamageClass.Melee; } } @@ -182,13 +189,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 velocity = new Vector2(0f, speed); velocity = velocity.RotatedBy(angleStep * i * Main.rand.NextFloat(0.9f, 1.1f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); + Projectile fire = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 3f, Projectile.owner); + fire.scale = Projectile.scale; } - Main.player[Projectile.owner].Calamity().dragonRageCooldown = 60; + Main.player[Projectile.owner].Calamity().dragonRageCooldown = 120; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.SourceDamage *= 1 - (0.25f * Projectile.numHits); Player player = Main.player[Projectile.owner]; Rectangle myRect = Projectile.Hitbox; if (Projectile.owner == Main.myPlayer) @@ -237,12 +246,14 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { + Vector2 newSize = new Point(projHitbox.Width, projHitbox.Height).ToVector2() * Projectile.scale; + projHitbox = new Rectangle(projHitbox.X - (int)((newSize.X - projHitbox.Width) / 2f), projHitbox.Y - (int)((newSize.Y - projHitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); if (projHitbox.Intersects(targetHitbox)) { return true; } float spinning = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); - float staffRadiusHit = 110f; + float staffRadiusHit = 110f * Projectile.scale; float useless = 0f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref useless)) { diff --git a/Projectiles/Melee/DragoonBigBolt.cs b/Projectiles/Melee/DragoonBigBolt.cs index baf5c2aef5..1fd4fb8a29 100644 --- a/Projectiles/Melee/DragoonBigBolt.cs +++ b/Projectiles/Melee/DragoonBigBolt.cs @@ -52,21 +52,21 @@ namespace CalamityMod.Projectiles.Melee if (time < 120) { float velMult = (Projectile.ai[1] == 0.5f ? 0.2f : 3 * sizeMult); - Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); + Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult * Projectile.scale, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); GeneralParticleHandler.SpawnParticle(spark3); sizeMult *= 0.97f; } - Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(35)) { - Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(10)) { - Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor, new Vector2(1, 4), true, true); + Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult * Projectile.scale, usedColor, new Vector2(1, 4), true, true); GeneralParticleHandler.SpawnParticle(spark2); } if (time % 5 == 0) @@ -80,9 +80,9 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 1.48f, 15); + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * Projectile.scale, 1.48f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.925f, 15); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * Projectile.scale, 0.925f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float size = 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1); + float size = 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1) * Projectile.scale; Player Owner = Main.player[Projectile.owner]; if (time <= 1 && Projectile.ai[1] != 0.5f) { diff --git a/Projectiles/Melee/DragoonSmallBolt.cs b/Projectiles/Melee/DragoonSmallBolt.cs index d230a95b11..66e1f1a513 100644 --- a/Projectiles/Melee/DragoonSmallBolt.cs +++ b/Projectiles/Melee/DragoonSmallBolt.cs @@ -43,12 +43,12 @@ namespace CalamityMod.Projectiles.Melee Vector2 pos = Projectile.Center; if (Projectile.timeLeft % 3 == 0) { - Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(35)) { - Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (time % 5 == 0) @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Melee if (time <= 1) { float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, 25, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, 25 * Projectile.scale, ref _); } else - return CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox); + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 25 * Projectile.scale, targetHitbox); } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Melee/EarthBoom.cs b/Projectiles/Melee/EarthBoom.cs index b71021e706..b0080b8a33 100644 --- a/Projectiles/Melee/EarthBoom.cs +++ b/Projectiles/Melee/EarthBoom.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = Projectile.height = 500; + Projectile.width = Projectile.height = 620; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -26,6 +26,6 @@ namespace CalamityMod.Projectiles.Melee { } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index c51b91ec44..c91ce030e4 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; @@ -22,11 +23,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; - public override float HitboxOutset => 135; - public override Vector2 HitboxSize => new Vector2(288, 288) * (1 + bladeFade * 1.2f); + public int size = 186 + 30; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size) * (1 + bladeFade * 1.25f); + public override Vector2 SpriteOrigin => new(0, size - 30); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 186f); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -52,7 +54,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning @@ -195,22 +196,21 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f), mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f) * Projectile.scale, mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); } for (int i = 0; i < 6; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(270 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(270 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (Main.rand.NextBool(3)) { - Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f), mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f) * Projectile.scale, mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); GeneralParticleHandler.SpawnParticle(sparker); } else { - GeneralParticleHandler.SpawnParticle(new CustomSpark(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), mainColor * 0.65f, new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); - //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, mainColor, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, Main.rand.NextFloat(-0.1f, 0.1f), true)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f) * Projectile.scale, mainColor * 0.65f, new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); } } } @@ -237,10 +237,10 @@ namespace CalamityMod.Projectiles.Melee float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale, Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f) * Projectile.scale, 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale, DustID.FireworksRGB, dustVel); dust2.scale = Main.rand.NextFloat(0.65f, 1.05f); dust2.noGravity = true; dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); @@ -294,7 +294,8 @@ namespace CalamityMod.Projectiles.Melee else spawnSpot = chosenTarget.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, chosenTarget == null ? 0 : chosenTarget.whoAmI, 2); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, chosenTarget == null ? 0 : chosenTarget.whoAmI, 2); + meteor.scale = Projectile.scale; } spawnBoom = false; @@ -349,7 +350,6 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. - float spriteMult = 1.13f; if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) { Asset tex = ModContent.Request(Texture); @@ -370,26 +370,27 @@ namespace CalamityMod.Projectiles.Melee { if (swingCount % 2 != 0) { - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.89f, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.89f, SpriteEffects.FlipVertically); } else - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f * 1.6f / 4, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.423f, SpriteEffects.None); } Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); - int draws = 24; + int draws = 45; for (int i = 0; i < draws; i++) { bool swordTip = i > draws * 0.73f; - float swordTipScale = swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1; + float swordTipScale = (swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1); Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); Color bladeColor = Color.Lerp(Color.MediumTurquoise, Color.Lerp(Color.LimeGreen, Color.OrangeRed, (i * 0.8f) / draws), i / (draws * 0.6f)); - Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.4f * bladeFade; - Vector2 drawOffset = -offsetDir * 9 * i * bladeFade; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale, 1f) * (0.75f * swordTipScale) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.3f * bladeFade; + Vector2 drawOffset = -offsetDir * 5 * i * bladeFade * Projectile.scale; + float bladeHiltMult = (MathHelper.Lerp(1.55f, 1, 1 - MathF.Pow(Utils.GetLerpValue(i > draws * 0.08f ? draws * 0.55f : 0, draws * 0.04f, i, true), 5))); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 * Projectile.scale - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale * MathF.Pow(bladeHiltMult, 0.6f), 0.5f / bladeHiltMult) * (0.75f * swordTipScale) * 0.9f * bladeFade * bladeHiltMult * Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/EarthMeteor.cs b/Projectiles/Melee/EarthMeteor.cs index 8acfbb5dd5..3b5754c090 100644 --- a/Projectiles/Melee/EarthMeteor.cs +++ b/Projectiles/Melee/EarthMeteor.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); NPC targeted = Projectile.ai[1] == 0 ? Owner.ClampedMouseWorld().ClosestNPCAt(1000) : Main.npc[(int)Projectile.ai[1]]; - Projectile.scale = 1.2f; randomColor = Main.rand.Next(3) switch { 0 => Color.OrangeRed, @@ -90,7 +89,8 @@ namespace CalamityMod.Projectiles.Melee else spawnSpot = targeted.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } if (time == fallTime) { @@ -120,26 +120,29 @@ namespace CalamityMod.Projectiles.Melee // Spawn in a helix-style pattern float sine = (float)Math.Sin(Projectile.timeLeft * 0.475f / MathHelper.Pi); - Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (16f + 34 * fadeIn); + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (16f + 34 * fadeIn) * Projectile.scale; if (targetDist < 1400f && time % 2 == 0) { - CustomSpark orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); + CustomSpark orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, (0.3f + (0.4f * fadeIn)) * Projectile.scale, mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb); - CustomSpark orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); + CustomSpark orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, (0.3f + (0.4f * fadeIn)) * Projectile.scale, mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb2); } } else { - float randSize = Main.rand.NextFloat(0.8f, 1.2f); - for (int i = 0; i < 2; i++) + float randSize = Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale; + if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.8f * randSize, 0f, 3); - GeneralParticleHandler.SpawnParticle(bloom); + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.8f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.65f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom3); } - Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.65f * randSize, 0f, 3); - GeneralParticleHandler.SpawnParticle(bloom3); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; time++; @@ -149,10 +152,12 @@ namespace CalamityMod.Projectiles.Melee Asset tex = ModContent.Request("CalamityMod/Particles/VerticalSmearRagged"); if (time <= fallTime) return false; - - for (int i = 0; i < 10; i++) + if (!CalamityClientConfig.Instance.Photosensitivity) { - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (i - 110), null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * new Vector2(0.4f - i * 0.05f, 1.3f + i * 0.1f) * 0.4f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + for (int i = 0; i < 10; i++) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (i - 110), null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * new Vector2(0.4f - i * 0.05f, 1.3f + i * 0.1f) * 0.4f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } } return false; @@ -169,7 +174,8 @@ namespace CalamityMod.Projectiles.Melee { Player Owner = Main.player[Projectile.owner]; Owner.SetScreenshake(4.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + Projectile boom = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + boom.scale = Projectile.scale; for (int i = 0; i < 15; i++) { randomColor = Main.rand.Next(3) switch @@ -183,29 +189,30 @@ namespace CalamityMod.Projectiles.Melee dust2.noGravity = false; dust2.color = Color.Lerp(Color.White, randomColor, 0.5f); - Particle sparker = new CustomSpark(target.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f), randomColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + Particle sparker = new CustomSpark(target.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f) * Projectile.scale, randomColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); GeneralParticleHandler.SpawnParticle(sparker); } - - for (int i = 0; i < 3; i++) - { - string tex = "CalamityMod/Particles/ShatteredExplosion"; - Particle bolt1 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 12, 0.5f - i * 0.08f, Color.OrangeRed * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt1); - Particle bolt2 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 10, 0.4f - i * 0.08f, Color.MediumTurquoise * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 8, 0.35f - i * 0.08f, Color.LawnGreen * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt3); - } SoundStyle fire2 = new("CalamityMod/Sounds/Item/EarthMeteor"); SoundEngine.PlaySound(fire2 with { Volume = 0.9f }, target.Center); if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f, 3f, 18, true); + for (int i = 0; i < 3; i++) + { + string tex = "CalamityMod/Particles/ShatteredExplosion"; + Particle bolt1 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 12, (0.5f - i * 0.08f) * Projectile.scale, Color.OrangeRed * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt1); + Particle bolt2 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 10, (0.4f - i * 0.08f) * Projectile.scale, Color.MediumTurquoise * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 8, (0.35f - i * 0.08f) * Projectile.scale, Color.LawnGreen * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt3); + + } + + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f * Projectile.scale, 3f * Projectile.scale, 18, true); GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 2f, 18, true); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f * Projectile.scale, 2f * Projectile.scale, 18, true); GeneralParticleHandler.SpawnParticle(blastRing2); } } diff --git a/Projectiles/Melee/EvilSmasherProjectile.cs b/Projectiles/Melee/EvilSmasherProjectile.cs index 93f0a4c02a..5af5c7e264 100644 --- a/Projectiles/Melee/EvilSmasherProjectile.cs +++ b/Projectiles/Melee/EvilSmasherProjectile.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee public override int OffsetDistance => 50; public override int CooldownTime { get; set; } public override bool AlternateSwings => false; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => false; public override SoundStyle? UseSound => SoundID.DD2_MonkStaffSwing with {Volume = 1f}; bool hasSmashedTile = false; diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs index 279b825edd..f51c6b8198 100644 --- a/Projectiles/Melee/ExaltedOathbladeHoldout.cs +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -25,13 +25,13 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/ExaltedOathblade"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 70; - - public override Vector2 HitboxSize => new Vector2(155, 155) * hitboxMult; + public int size = 88 + 20; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 20); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override float AdditionalScale => 0.15f; - public override Vector2 SpriteOrigin => new(-3, 88); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -60,7 +60,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; @@ -218,14 +217,15 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(143 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); + Vector2 placement = Owner.Center + (new Vector2(143 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f) * Projectile.scale, Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); } } } @@ -336,7 +336,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.35f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.455f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs index 2e35aee3ab..b50aac643e 100644 --- a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs @@ -67,6 +67,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (time == 0) + Projectile.scale = Owner.GetMeleeScale(); float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.spriteDirection = Projectile.direction; @@ -153,20 +155,21 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; if (!exitedTarget) { - Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 75, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 9, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1, 1f), true, false, 0, false, 1.0f, 0.2f); + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 75 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 9, 0.2f * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1, 1f), true, false, 0, false, 1.0f, 0.2f); GeneralParticleHandler.SpawnParticle(spark); } if (exitedTarget && i == 0 && Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45 * Projectile.scale, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } } if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -196,13 +199,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void throwAnimation() @@ -215,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -65f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -65f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -338,7 +342,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.25f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.25f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExaltedOathblade").Value; @@ -356,8 +360,8 @@ namespace CalamityMod.Projectiles.Melee Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.BlueViolet with { A = 0 } * 0.45f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.8f, 1.15f), SpriteEffects.None); - Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.95f, SpriteEffects.None); + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.BlueViolet with { A = 0 } * 0.45f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.8f, 1.15f) * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.95f * Projectile.scale, SpriteEffects.None); } Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index ba2800c800..c3f9e30adc 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/ForbiddenOathblade"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 60; - - public override Vector2 HitboxSize => new Vector2(120, 120) * hitboxMult; + public int size = 74 + 10; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 10); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override float AdditionalScale => 0.15f; - public override Vector2 SpriteOrigin => new(-3, 74); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -62,7 +62,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction @@ -274,13 +273,14 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(113 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 placement = Owner.Center + (new Vector2(113 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); } } @@ -383,7 +383,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.29f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.377f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs index 3f80950563..87501574ab 100644 --- a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs @@ -80,6 +80,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Projectile.owner) { Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.scale = Owner.GetMeleeScale(); Projectile.localAI[1] = toMouse.ToRotation(); Projectile.netUpdate = true; } @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.Center = Owner.MountedCenter + toMouse * 12f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; thrown = true; time = 0; @@ -197,16 +198,17 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(90 * (i == 0 ? 1 : -1))).RotatedByRandom(0.1f) * Main.rand.NextFloat(3, 4); if (!exitedTarget && Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60 * Projectile.scale, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 50; + dust.fadeIn = Projectile.scale - 1; } if (exitedTarget && i == 0) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, DustID.FireworksRGB, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45 * Projectile.scale, DustID.FireworksRGB, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; } @@ -214,7 +216,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -252,13 +254,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void throwAnimation(float chargeProgress) @@ -272,7 +275,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -395,7 +398,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ForbiddenOathblade").Value; diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index e1f52ba954..3a9fdc0eeb 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -256,7 +256,7 @@ namespace CalamityMod.Projectiles.Melee float distanceToTiles = -100; bool canBeLaunched = false; - bool lowEnoughToExecute = target.life <= Projectile.damage * 15; + bool lowEnoughToExecute = target.life <= Projectile.damage * 5; bool jared = target.type == ModContent.NPCType(); Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); Vector2 launchVel = lowEnoughToExecute ? toMouse : Utils.DirectionTo(Owner.Center, target.Center); @@ -274,7 +274,7 @@ namespace CalamityMod.Projectiles.Melee SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); } - int heal = (int)(MathHelper.Clamp(18 - Projectile.numHits * 13, 1, 20)); + int heal = Projectile.numHits == 0 ? 14 : 0; if (Projectile.numHits < 10) { Owner.Calamity().grandDadHealPool += heal; @@ -366,7 +366,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; Texture2D swoosh = ModContent.Request("CalamityMod/Particles/CircularSmearLarge").Value; - Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); Vector2 vel = Projectile.rotation.ToRotationVector2(); Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + ((Owner.direction == -1) ? MathHelper.Pi - MathHelper.PiOver4 : MathHelper.PiOver4); diff --git a/Projectiles/Melee/GrandGuardianBoom.cs b/Projectiles/Melee/GrandGuardianBoom.cs index 271653a439..e3f7991409 100644 --- a/Projectiles/Melee/GrandGuardianBoom.cs +++ b/Projectiles/Melee/GrandGuardianBoom.cs @@ -28,23 +28,24 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + Projectile.scale = Projectile.ai[0]; if (mainColor == Color.White) { mainColor = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; - Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.45f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f, 35); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.45f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * Projectile.scale, 35); GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, (mainColor == Color.Cyan ? Color.Orchid : Color.Cyan) * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.26f, 15); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, (mainColor == Color.Cyan ? Color.Orchid : Color.Cyan) * 0.65f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.26f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(bolt3); for (int i = 0; i < 25; i++) { Vector2 dustVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f) * 1; - Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 9, Main.rand.NextBool(4) ? 264 : 66, dustVel * 4, 0, default, Main.rand.NextFloat(0.8f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 9 * Projectile.scale, Main.rand.NextBool(4) ? 264 : 66, dustVel * 4, 0, default, Main.rand.NextFloat(0.8f, 1.4f)); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Lerp(mainColor, Color.White, 0.5f) : mainColor; bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Projectile.Center + dustVel * 9, dustVel * 4, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.6f, 0.8f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Projectile.Center + dustVel * 9 * Projectile.scale, dustVel * 4, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.6f, 0.8f) * Projectile.scale, 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); } } @@ -55,6 +56,6 @@ namespace CalamityMod.Projectiles.Melee } time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 6ab245f9cd..49e9347310 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian"; - public override float HitboxOutset => 112; - - public override Vector2 HitboxSize => new Vector2(180, 180); + public int size = 130 + 15; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 15); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(-3, 130); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -47,7 +47,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Guardian has no projectiles @@ -151,8 +150,8 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 4; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.5f, 1f) * Projectile.scale, Main.rand.NextBool(4) ? Color.DarkOrchid : Color.DodgerBlue)); } } else @@ -171,10 +170,10 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(198, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(198 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f) * Projectile.scale, 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; @@ -198,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.5f, Projectile.owner, Projectile.scale); spawnBoom = false; } diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 7a185698b5..7b5e9eb869 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/Hellkite"; public override float HitboxOutset => 100; - public override Vector2 HitboxSize => new Vector2(185, 185) * Projectile.scale; + public override Vector2 HitboxSize => new Vector2(185, 185); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); public override Vector2 SpriteOrigin => new(-3, 124); @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee { CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles @@ -119,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction == -1 ? true : false; Vector2 bladePos = new Vector2(60, 0); - Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Projectile.scale; if (Projectile.ai[2] == 5) { @@ -157,7 +156,7 @@ namespace CalamityMod.Projectiles.Melee } if (chargeTimer == chargeTimerMax) { - particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)) * Projectile.scale; SoundEngine.PlaySound(Hellkite.FullChargeSound with { Volume = 0.9f, PitchVariance = 0.2f }, Projectile.Center); chargedSwing = true; useAnim = storedUseAnim / 3; @@ -165,7 +164,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 20; i++) { - Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(3) ? Color.Red : Color.OrangeRed); + Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f) * Projectile.scale, Main.rand.NextBool(3) ? Color.Red : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark2); Dust dust2 = Dust.NewDustPerfect(particlePos, DustID.RainbowMk2, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f)); dust2.scale = Main.rand.NextFloat(0.65f, 1.15f) * fadeIn; @@ -212,7 +211,6 @@ namespace CalamityMod.Projectiles.Melee postSwing = false; if (AnimationProgress == 0) { - Projectile.scale = 1; Animation = 0; doSwing = false; chargeTimer = 0; @@ -248,13 +246,13 @@ namespace CalamityMod.Projectiles.Melee CanHit = true; Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (chargedSwing) { for (int i = 0; i < 3; i++) { particleVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction) * Main.rand.NextFloat(0.3f, 1f)).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; GeneralParticleHandler.SpawnParticle(new AltSparkParticle(particlePos, -particleVel.RotatedByRandom(0.4f), false, 24, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.OrangeRed : Color.DarkRed)); GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.4f), Main.rand.NextBool(4) ? Color.Red : Color.DarkRed, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f)); GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.4f) * 2, Main.rand.NextBool(4) ? Color.Crimson : Color.Red, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, 0, true)); @@ -287,13 +285,13 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-10, -45); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GeneralParticleHandler.SpawnParticle(new PointParticle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), false, Main.rand.Next(15, 18 + 1), Main.rand.NextFloat(0.7f, 1.2f), (Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed) * 0.8f)); + GeneralParticleHandler.SpawnParticle(new PointParticle(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), false, Main.rand.Next(15, 18 + 1), Main.rand.NextFloat(0.7f, 1.2f), (Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed) * 0.8f)); } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.3f, 0.9f)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.3f, 0.9f)); dust2.scale = Main.rand.NextFloat(0.65f, 0.95f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; @@ -305,7 +303,7 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.1f, 0.5f)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index 959a2e1553..3b7847423b 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -25,12 +25,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/HolyCollider"; - public override float HitboxOutset => 100; - - public override Vector2 HitboxSize => new Vector2(200, 200) * Projectile.scale; + public int size = 146; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(0, 146); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = false; @@ -61,7 +60,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Holy Collider's projectile spawning @@ -121,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee else Owner.direction = 1; FlipAsSword = Owner.direction == -1 ? true : false; - Vector2 bladePos = new Vector2(76, 0); + Vector2 bladePos = new Vector2(76 * Projectile.scale, 0); Vector2 particlePos = Owner.Center + (bladePos).RotatedBy(FinalRotation + MathHelper.ToRadians(-45) - 0.1f * (FlipAsSword ? 1 : -1) * -Projectile.ai[1]); if (Projectile.ai[2] == 5) @@ -137,14 +135,15 @@ namespace CalamityMod.Projectiles.Melee if (chargeTimer < chargeTimerMax && !chargedSwing) chargeTimer++; - Vector2 particleVel = (Owner.Center - particlePos).SafeNormalize(Vector2.UnitX) * -9; + Vector2 particleVel = (Owner.Center - particlePos).SafeNormalize(Vector2.UnitX) * -9 * Projectile.scale; - Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), particleVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1)); - dust2.scale = Main.rand.NextFloat(0.95f, 1.45f) * fadeIn; + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), particleVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.5f, 1.4f)); + dust2.scale = Main.rand.NextFloat(1.45f, 1.95f) * fadeIn * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale * 1.5f; - Particle spark3 = new LineParticle(particlePos, particleVel.RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.9f), false, 18, Main.rand.NextFloat(0.5f, 0.8f) * fadeIn, Main.rand.NextBool(3) ? mainColor2 : mainColor1); + Particle spark3 = new LineParticle(particlePos, particleVel.RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.6f), false, 18, Main.rand.NextFloat(0.5f, 0.8f) * fadeIn * Projectile.scale, Main.rand.NextBool(3) ? mainColor2 : mainColor1); GeneralParticleHandler.SpawnParticle(spark3); if (SoundEngine.TryGetActiveSound(AudSlot, out var ChargeSound) && ChargeSound.IsPlaying) @@ -172,7 +171,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 20; i++) { - Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(3) ? mainColor2 : mainColor1); + Particle spark2 = new LineParticle(particlePos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 30, Main.rand.NextFloat(0.3f, 0.8f) * Projectile.scale, Main.rand.NextBool(3) ? mainColor2 : mainColor1); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -216,7 +215,6 @@ namespace CalamityMod.Projectiles.Melee postSwing = false; if (AnimationProgress == 0) { - Projectile.scale = 1; Animation = 0; doSwing = false; chargeTimer = 0; @@ -251,28 +249,29 @@ namespace CalamityMod.Projectiles.Melee } playSwingSound = false; } - if ( time > (int)(timeMax * (chargedSwing ? 0.1f : 0.3f)) && time < (int)(timeMax * (chargedSwing ? 0.95f : 0.85f))) + if (time > (int)(timeMax * (chargedSwing ? 0.1f : 0.3f)) && time < (int)(timeMax * (chargedSwing ? 0.95f : 0.85f))) { CanHit = true; Vector2 particleVel = new Vector2(0, 2 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170) * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); if (!chargedSwing) { for (int i = 0; i < 3; i++) { particleVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction) * Main.rand.NextFloat(0.3f, 1f)).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170) * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); if (i < 2) { - Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), -particleVel.RotatedByRandom(0.3f)); - dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + Dust dust2 = Dust.NewDustPerfect(particlePos, ModContent.DustType(), -particleVel.RotatedByRandom(0.3f)); + dust2.scale = Main.rand.NextFloat(0.95f, 1.45f) * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale - 1; } else { - Particle spark = new CustomSpark(particlePos, (-particleVel * 0.2f).RotatedByRandom(0.3f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.9f, 1.1f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + Particle spark = new CustomSpark(particlePos, (-particleVel * 0.2f).RotatedByRandom(0.3f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.9f, 1.1f) * Projectile.scale, Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); GeneralParticleHandler.SpawnParticle(spark); } } @@ -299,10 +298,10 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-10, -45); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), (Main.rand.NextBool(4) ? Color.DarkGoldenrod : Color.Goldenrod), new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f) * Projectile.scale, (Main.rand.NextBool(4) ? Color.DarkGoldenrod : Color.Goldenrod), new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); if (i % 3 == 0) { - Particle spark = new CustomSpark(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + Particle spark = new CustomSpark(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)).RotatedByRandom(0.4f)), -dustVel * Main.rand.NextFloat(0.4f, 0.7f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f) * Projectile.scale, Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); GeneralParticleHandler.SpawnParticle(spark); } } @@ -310,10 +309,11 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 35 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.3f, 0.9f)); - dust2.scale = Main.rand.NextFloat(0.95f, 1.45f); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.2f, 0.6f)); + dust2.scale = Main.rand.NextFloat(1.35f, 1.85f) * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale * 0.3f; } } else @@ -322,10 +322,11 @@ namespace CalamityMod.Projectiles.Melee { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = -(new Vector2(0, 25 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.15f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.5f)); - dust2.scale = Main.rand.NextFloat(0.75f, 0.9f); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.15f)), ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + dust2.scale = Main.rand.NextFloat(0.75f, 0.9f) * Projectile.scale; dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? mainColor2 : mainColor1; + dust2.fadeIn = Projectile.scale - 1; } } @@ -340,12 +341,13 @@ namespace CalamityMod.Projectiles.Melee projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()); bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) || isProviProj; - if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) + if (Vector2.Distance(Owner.Center + (new Vector2(60 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 * Projectile.scale + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) { if (isProviProj) { Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projectile.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f, ModContent.ProjectileType(), (int)((Projectile.damage * 0.1) + projectile.damage), Projectile.knockBack, Projectile.owner, 0, 15, 5); - Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + proj.localAI[0] = Projectile.scale; + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f * Projectile.scale, 11); GeneralParticleHandler.SpawnParticle(orb2); if (projectile.type == ModContent.ProjectileType()) projectile.active = false; @@ -366,13 +368,13 @@ namespace CalamityMod.Projectiles.Melee { Projectile projectile = Main.projectile[x]; bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10); - if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 && isAFireball) + if (Vector2.Distance(Owner.Center + (new Vector2(60 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 * Projectile.scale + Math.Max(projectile.width, projectile.height) && isAFireball) { Vector2 launch = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f; projectile.velocity += launch; projectile.timeLeft = 300; projectile.owner = Owner.whoAmI; - Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f * Projectile.scale, 11); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -411,6 +413,7 @@ namespace CalamityMod.Projectiles.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile fadedFire = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -11).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.01), Projectile.knockBack, Projectile.owner, 10, target.whoAmI); fadedFire.timeLeft = Main.rand.Next(40, 55 + 1); + fadedFire.localAI[0] = Projectile.scale; } } } @@ -427,12 +430,13 @@ namespace CalamityMod.Projectiles.Melee Dust chargefull = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 4f; - Particle pulse = new CustomSpark(target.Center, vel, "CalamityMod/Particles/BloomCircle", false, 12, 1.2f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, shrinkSpeed: 0.95f); + Particle pulse = new CustomSpark(target.Center, vel, "CalamityMod/Particles/BloomCircle", false, 12, 1.2f * Projectile.scale, Color.Orange, new Vector2(3.2f, 0.9f), true, true, shrinkSpeed: 0.95f); GeneralParticleHandler.SpawnParticle(pulse); } for (int i = 0; i < 4; i++) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -35).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -35).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0); + proj.localAI[0] = Projectile.scale; } } } @@ -454,7 +458,6 @@ namespace CalamityMod.Projectiles.Melee { Asset tex = ModContent.Request(Texture); Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/HolyColliderGlow"); - Asset shineTex = ModContent.Request("CalamityMod/Particles/Sparkle"); bool flipAsSword = (swingCount % 2 == 0 ? !FlipAsSword : FlipAsSword); float r = flipAsSword ? MathHelper.ToRadians(90) : 0f; Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 85a8a361da..3fb9c19dba 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -18,11 +18,11 @@ namespace CalamityMod.Projectiles.Melee public bool setStats = true; public static int statMax = 8; public int setStatTimer = statMax; + public ref float scale => ref Projectile.localAI[0]; public ref float time => ref Projectile.ai[1]; public override void SetStaticDefaults() { Main.projFrames[Type] = 4; - ProjectileID.Sets.CultistIsResistantTo[Type] = true; } public override void SetDefaults() @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee Dust chargefull = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; - Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.08f, Color.Orange, new Vector2(3.2f, 0.9f), true, true, 0.9f); + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.08f * scale, Color.Orange, new Vector2(3.2f, 0.9f), true, true, 0.9f); GeneralParticleHandler.SpawnParticle(pulse); } } @@ -100,20 +100,21 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(80, 80), ModContent.DustType(), (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(80, 80) * scale, ModContent.DustType(), (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 1f)); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(1.85f, 2.45f); + dust.scale = Main.rand.NextFloat(1.85f, 2.45f) * scale; dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Goldenrod; dust.noLightEmittence = true; + dust.fadeIn = scale - 1; } if (Main.rand.NextBool()) { - Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 11, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); + Particle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80) * scale, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), false, 11, 0.9f * scale, Main.rand.NextBool() ? Color.Goldenrod : Color.Orange); GeneralParticleHandler.SpawnParticle(spark); } else { - Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); + Particle spark = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(80, 80) * scale, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 27, Main.rand.NextFloat(1.15f, 1.3f) * scale, Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.1f, 0.2f)); GeneralParticleHandler.SpawnParticle(spark); } @@ -123,11 +124,12 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(5)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(0, -7)).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (new Vector2(0, -7)).RotatedByRandom(0.2) * Main.rand.NextFloat(0.2f, 1f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.85f, 1.45f) * Projectile.scale; dust.color = Color.Goldenrod; dust.noLightEmittence = true; + dust.fadeIn = scale - 1; } if (Projectile.velocity.Length() > 8) @@ -147,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee time++; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, isLaunched ? 100 : 20, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (isLaunched ? 100 : 20) * scale, targetHitbox); public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); @@ -163,25 +165,29 @@ namespace CalamityMod.Projectiles.Melee SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); SoundEngine.PlaySound(sound with { Volume = 1f }, Projectile.Center); - for (int g = 0; g < 3; g++) + if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.8f * (g + 1), 1.7f, 18, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.2f * (g + 1), 1.3f, 18, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - } - for (int i = 0; i < 5; i++) - { - Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.OrangeRed, Color.Orange, i * 0.2f), i == 4 ? "CalamityMod/Particles/ShatteredExplosion" : "CalamityMod/Particles/FlameExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.11f + i * 0.05f, 18); - GeneralParticleHandler.SpawnParticle(orb1); + for (int g = 0; g < 3; g++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.8f * (g + 1) * scale, 1.7f * scale, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2.2f * (g + 1) * scale, 1.3f * scale, 18, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + for (int i = 0; i < 5; i++) + { + Particle orb1 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.OrangeRed, Color.Orange, i * 0.2f), i == 4 ? "CalamityMod/Particles/ShatteredExplosion" : "CalamityMod/Particles/FlameExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, (0.11f + i * 0.05f) * scale, 18); + GeneralParticleHandler.SpawnParticle(orb1); + } } for (int i = 0; i < 25; i++) { - Particle spark = new SparkParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f, Main.rand.NextBool() ? Color.Goldenrod : Color.OrangeRed); + Particle spark = new SparkParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 1f), true, 55, 0.85f * scale, Main.rand.NextBool() ? Color.Goldenrod : Color.OrangeRed); GeneralParticleHandler.SpawnParticle(spark); } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.47), Projectile.knockBack, Projectile.owner, 1.8f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.47), Projectile.knockBack, Projectile.owner, 1.8f); + blast.scale = scale; } } public override bool PreDraw(ref Color lightColor) @@ -196,8 +202,8 @@ namespace CalamityMod.Projectiles.Melee // The back glow float power = !setStats ? 2.4f : 0.6f; float randSize = Main.rand.NextFloat(0.8f, 1.1f); - Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * power * Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * power * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.Goldenrod with { A = 0 }, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.65f * randSize * power * Projectile.scale * scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bloomTexture, drawPos, null, Color.White with { A = 0 } * 0.65f, Projectile.rotation, bloomTexture.Size() * 0.5f, 0.45f * randSize * power * Projectile.scale * scale, SpriteEffects.None, 0); Texture2D usedTex = (!setStats ? bigTexture : smallTexture); Rectangle frame = usedTex.Frame(1, 4, 0, Projectile.frame); @@ -206,7 +212,7 @@ namespace CalamityMod.Projectiles.Melee float drawRotation = Projectile.rotation; if (setStatTimer == statMax || !setStats) - Main.EntitySpriteDraw(usedTex, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(usedTex, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale * scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 6f80d0ed85..4d4580b19f 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 137; - Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 137; + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 137 * Projectile.ai[1]; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 137 * Projectile.ai[1]; if (time == 0) { @@ -52,7 +52,8 @@ namespace CalamityMod.Projectiles.Melee // Spawn 2 if (time % 85 == 0 && time > 10) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 3f, Projectile.owner, 0f); + Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 3f, Projectile.owner, 0f); + star.scale = Projectile.ai[1]; } } else @@ -68,30 +69,31 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.timeLeft % 4 == 0) { - SparkParticle spark = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(185f)), false, 15, 1f, mainColor * 0.25f); + SparkParticle spark = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(185f)), false, 15, 1f * Projectile.ai[1], mainColor * 0.25f); GeneralParticleHandler.SpawnParticle(spark); } if (Projectile.timeLeft % 4 == 0) { - SparkParticle spark = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-185f)), false, 15, 1f, mainColor * 0.25f); + SparkParticle spark = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-185f)), false, 15, 1f * Projectile.ai[1], mainColor * 0.25f); GeneralParticleHandler.SpawnParticle(spark); } } if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) * Projectile.ai[1] - Projectile.velocity * 2 * Projectile.ai[1], ModContent.DustType()); + trailDust.scale = (Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f)) * Projectile.ai[1]; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; trailDust.noGravity = true; + trailDust.fadeIn = Projectile.ai[1] - 1; } if (Main.rand.NextBool(12)) { - GlowOrbParticle orb = new GlowOrbParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GlowOrbParticle orb = new GlowOrbParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f) * Projectile.ai[1], mainColor, true, true); GeneralParticleHandler.SpawnParticle(orb); - GlowOrbParticle orb2 = new GlowOrbParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GlowOrbParticle orb2 = new GlowOrbParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f) * Projectile.ai[1], mainColor, true, true); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -103,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = ModContent.Request(Texture).Value; float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); for (int i = 0; i < 5; i++) - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * i, null, mainColor with { A = 0 } * fadeOut * 0.6f, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade) + 0.01f * i, 1 + (0.45f * waveFade) - 0.06f * i) * Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * i, null, mainColor with { A = 0 } * fadeOut * 0.6f, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade) + 0.01f * i, 1 + (0.45f * waveFade) - 0.06f * i) * Projectile.scale * Projectile.ai[1], SpriteEffects.None, 0); return false; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -113,6 +115,6 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.damage < 1) Projectile.damage = 1; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize * Projectile.ai[1], targetHitbox); } } diff --git a/Projectiles/Melee/LightspeedDashHitbox.cs b/Projectiles/Melee/LightspeedDashHitbox.cs index 546b3f3247..fd26bc727a 100644 --- a/Projectiles/Melee/LightspeedDashHitbox.cs +++ b/Projectiles/Melee/LightspeedDashHitbox.cs @@ -28,7 +28,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { // Go where the player is going diff --git a/Projectiles/Melee/LightspeedHoldout.cs b/Projectiles/Melee/LightspeedHoldout.cs index 074be3fa64..4560a28a28 100644 --- a/Projectiles/Melee/LightspeedHoldout.cs +++ b/Projectiles/Melee/LightspeedHoldout.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Projectiles.Melee public Vector2 innateOffset = new(23f, -0.1f); public Vector2 handPos; public float bladeRot = 0; + public float baseScale = 1; // Primary public int primaryStabfireRate => 2; @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.TwoPi * 0.75f; } - Projectile.Center = handPos; + Projectile.Center = handPos + toMouse * Projectile.scale; Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; @@ -173,8 +174,8 @@ namespace CalamityMod.Projectiles.Melee { var player = Main.player[Projectile.owner]; var modPlayer = player.GetModPlayer(); - - Projectile.scale = 0.6f; + baseScale = MathHelper.Lerp(baseScale, player.GetMeleeScale(), 0.3f / Projectile.MaxUpdates); + Projectile.scale = baseScale; if (!Owner.channel && DashState == 0) { @@ -225,18 +226,18 @@ namespace CalamityMod.Projectiles.Melee Vector2 stabDir = toMouse.RotatedBy(offset); Vector2 stabOrigin = Projectile.Center; - Vector2 stabTip = stabOrigin + stabDir * 62f; + Vector2 stabTip = stabOrigin + stabDir * 62f * Projectile.scale; for (int i = 0; i < 4; i++) { - Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f); + Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f) * Projectile.scale; Vector2 vel = stabDir * Main.rand.NextFloat(5f, 19f); - Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false); + Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Projectile.scale * Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false); GeneralParticleHandler.SpawnParticle(spark); } - Particle afterImage = new CustomSpark(Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(), new("CalamityMod/Items/Weapons/Melee/Lightspeed"), false, Main.rand.Next(5,9), Projectile.scale * Main.rand.NextFloat(0.9f, 1.02f), Color.White * Main.rand.NextFloat(0.66f, 0.825f), new Vector2(1, 1), true, false, flipHorizontal: Owner.direction == -1 ? true : false); + Particle afterImage = new CustomSpark(Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(), new("CalamityMod/Items/Weapons/Melee/Lightspeed"), false, Main.rand.Next(5,9), 0.6f * Main.rand.NextFloat(0.9f, 1.02f), Color.White * Main.rand.NextFloat(0.66f, 0.825f), new Vector2(1, 1), true, false, flipHorizontal: Owner.direction == -1 ? true : false); GeneralParticleHandler.SpawnParticle(afterImage); // Make blade randomly vibrate @@ -260,7 +261,8 @@ namespace CalamityMod.Projectiles.Melee } // Spawn the hitbox - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + toMouse * 20 * (float)Math.Pow(Projectile.scale, 4), toMouse * 25, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.MountedCenter + toMouse * 20 * Projectile.scale, toMouse, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + attack.scale = Projectile.scale; } private void UseSecondary() @@ -276,7 +278,7 @@ namespace CalamityMod.Projectiles.Melee Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; - Projectile.scale = 0.6f; + Projectile.scale = baseScale * 0.6f; if (!firstSecondaryIteration) { @@ -354,7 +356,8 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < Owner.hurtCooldowns.Length; k++) Owner.hurtCooldowns[k] = Owner.immuneTime; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + Projectile dash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.MountedCenter, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + dash.scale = Projectile.scale; } } @@ -369,7 +372,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= DashAcceleration; - Projectile.scale = MathHelper.Lerp(1f, 0.4f, MathF.Pow(1f - DashTimer / DashDuration, 5)); + Projectile.scale = baseScale * MathHelper.Lerp(1f, 0.4f, MathF.Pow(1f - DashTimer / DashDuration, 5)); Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; @@ -403,7 +406,7 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects spriteEffects = Owner.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; lightColor = Color.White; // Fullbright - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, origin, 0.6f, spriteEffects, 0); DrawPierceTrail(); @@ -443,7 +446,7 @@ namespace CalamityMod.Projectiles.Melee { DashState = 0; DashTimer = 0; - Projectile.scale = 0.6f; + Projectile.scale = baseScale * 0.6f; } } } diff --git a/Projectiles/Melee/LightspeedM1Hitbox.cs b/Projectiles/Melee/LightspeedM1Hitbox.cs index 3e27b0a648..aad114d70e 100644 --- a/Projectiles/Melee/LightspeedM1Hitbox.cs +++ b/Projectiles/Melee/LightspeedM1Hitbox.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 84; - Projectile.height = 64; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -31,7 +31,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 4; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = float.NaN; + float hitboxSize = Projectile.width * Projectile.scale; + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10; + Vector2 start = (Projectile.timeLeft == 6 ? Main.player[Projectile.owner].Center : Projectile.Center - vel); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, Projectile.Center + vel, hitboxSize * Projectile.scale, ref _); + } public override void AI() { Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2()); @@ -39,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = toMouse.ToRotation(); Projectile.rotation = rotation; - Projectile.velocity = toMouse * 34; + Projectile.velocity = toMouse * 34 * Projectile.scale; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/LucreciaBolt.cs b/Projectiles/Melee/LucreciaBolt.cs index 44d4c3f279..7c08cf0be9 100644 --- a/Projectiles/Melee/LucreciaBolt.cs +++ b/Projectiles/Melee/LucreciaBolt.cs @@ -46,7 +46,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.ai[2]; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { // Little bit of ambient lighting as it travels @@ -54,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.velocity *= 1.01f; - Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true) * Projectile.ai[2]; if (Projectile.FinalExtraUpdate()) Time++; @@ -103,7 +107,9 @@ namespace CalamityMod.Projectiles.Melee public float TrailWidth(float completionRatio, Vector2 vertexPos) { - float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))); + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completionRatio * 6); + float newSine = 0.7f - sine * 0.3f; + float width = newSine * (completionRatio < 0.4f ? 1 - MathF.Pow(Utils.GetLerpValue(0.4f, 0f, completionRatio, true), 3) : Utils.GetLerpValue(1f, 0.4f, completionRatio, true)) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))) * MathF.Pow(Projectile.ai[2], 0.4f); width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); @@ -123,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee return baseColor * Projectile.Opacity; } - public float MiniTrailWidth(float completionRatio, Vector2 vertexPos) => TrailWidth(completionRatio, vertexPos) * 5.5f; + public float MiniTrailWidth(float completionRatio, Vector2 vertexPos) => TrailWidth(completionRatio, vertexPos) * 5.5f * Projectile.ai[2]; public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/LucreciaDNATrailCreator.cs b/Projectiles/Melee/LucreciaDNATrailCreator.cs index 09f3bb6b96..6c44e8285d 100644 --- a/Projectiles/Melee/LucreciaDNATrailCreator.cs +++ b/Projectiles/Melee/LucreciaDNATrailCreator.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player owner = Main.player[Projectile.owner]; @@ -70,9 +74,9 @@ namespace CalamityMod.Projectiles.Melee middleStreakTimer = 6; // Spawn the main trail - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f * Projectile.scale, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f * Projectile.scale, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); GeneralParticleHandler.SpawnParticle(spark2); } @@ -83,8 +87,8 @@ namespace CalamityMod.Projectiles.Melee Vector2 purpleTrailOrigin = Projectile.Center + offsetLeft; Vector2 blueTrailOrigin = Projectile.Center + offsetRight; - Particle purpleLightEmission = new SquishyLightParticle(purpleTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f), Color.MediumPurple, Main.rand.Next(18, 46), 1, 1.5f); - Particle blueLightEmission = new SquishyLightParticle(blueTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f), Color.CornflowerBlue, Main.rand.Next(18, 46), 1, 1.5f); + Particle purpleLightEmission = new SquishyLightParticle(purpleTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f) * Projectile.scale, Color.MediumPurple, Main.rand.Next(18, 46), 1, 1.5f); + Particle blueLightEmission = new SquishyLightParticle(blueTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f) * Projectile.scale, Color.CornflowerBlue, Main.rand.Next(18, 46), 1, 1.5f); GeneralParticleHandler.SpawnParticle(blueLightEmission); GeneralParticleHandler.SpawnParticle(purpleLightEmission); @@ -100,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee private float WidthFunction(float completionRatio, Vector2 vertexPos) { - return MathHelper.Lerp(12f, 0f, completionRatio); + return MathHelper.Lerp(12f * Projectile.scale, 0f, completionRatio); } @@ -126,8 +130,8 @@ namespace CalamityMod.Projectiles.Melee trailShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); // Use the separate color functions for each trail - PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_,_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); - PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_,_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_,_) => Projectile.Size, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_,_) => Projectile.Size, pixelate: false, shader: trailShader)); return false; } } diff --git a/Projectiles/Melee/LucreciaHoldout.cs b/Projectiles/Melee/LucreciaHoldout.cs index 222b21699d..b30430df04 100644 --- a/Projectiles/Melee/LucreciaHoldout.cs +++ b/Projectiles/Melee/LucreciaHoldout.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee public class LucreciaHoldout : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override bool useMeleeSize => false; public override int swingWidth => 310; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override int CooldownTime { get; set; } public override int swingTime { get; set; } public override bool AlternateSwings { get => base.AlternateSwings; set => base.AlternateSwings = value; } - public override float lineCollisionLength => 225; + public override float lineCollisionLength => 155; public bool helixFired = false; public bool gotEnergyThisSwing = false; @@ -50,7 +50,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.noEnchantmentVisuals = true; Projectile.Opacity = 0.2f; // Starting point, fades in quickly upon startup Projectile.width = Projectile.height = 54; - Projectile.scale = 1.25f; } public override void Spawn() @@ -107,6 +106,7 @@ namespace CalamityMod.Projectiles.Melee { Player player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); + baseScale = MathHelper.Lerp(baseScale, player.GetMeleeScale() + 0.25f, 0.3f / Projectile.MaxUpdates); if (IsAlternateThrust) { @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (timer % 8 == 0) { Vector2 pos = player.MountedCenter + Projectile.rotation.ToRotationVector2() * 60f; - Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f); + Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f * Projectile.scale, 12, 0.3f, 1.2f); GeneralParticleHandler.SpawnParticle(sparkle); } Particle smear = new CircularSmearVFX(player.MountedCenter, Color.CornflowerBlue * 0.35f, Projectile.rotation, Projectile.scale * 1.25f); @@ -185,8 +185,10 @@ namespace CalamityMod.Projectiles.Melee if (!trailFXTriggered) { if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 7, Projectile.knockBack, Projectile.owner, 0f, 0f); - + { + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 7, Projectile.knockBack, Projectile.owner, 0f, 0f); + attack.scale = baseScale; + } SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash"); SoundEngine.PlaySound(swish with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); @@ -203,7 +205,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 particleOrigin = Projectile.Center; Vector2 particleSpeed = fireDirection.RotatedByRandom(MathHelper.ToRadians(46f)) * Main.rand.NextFloat(20f, 37f); - Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f), Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); + Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f) * Projectile.scale, Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); GeneralParticleHandler.SpawnParticle(sparks); } particlesSpawned = true; @@ -240,14 +242,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 shootDir = player.MountedCenter.DirectionTo(mousePosition) * 10f; int dir = -Math.Sign(mousePosition.X); float scale = lineCollisionLength / 550f; - Particle swipe = new CustomSpark(player.MountedCenter - shootDir * 4, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), scale, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); + Particle swipe = new CustomSpark(player.MountedCenter - shootDir * 4 * Projectile.scale, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), scale * Projectile.scale, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); var fireDirection = Vector2.Normalize(mousePosition - player.MountedCenter); var helixSpeed = 12f; var helixVelocity = fireDirection * helixSpeed; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.MountedCenter + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), player.MountedCenter + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + attack.ai[2] = Projectile.scale; + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltFire"); SoundEngine.PlaySound(projectile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); } diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index b10a3a2a49..03e7ec6d95 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -20,12 +20,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/MajesticGuard"; - public override float HitboxOutset => 105; - - public override Vector2 HitboxSize => new Vector2(140, 140); + public int size = 100 + 10; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 10); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-5, 100); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -46,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Majestic Guard has no projectiles @@ -148,8 +146,8 @@ namespace CalamityMod.Projectiles.Melee CanHit = true; Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod)); } else CanHit = false; @@ -166,7 +164,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 2; i++) { - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Silver : Color.Gold; diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index 72d110327a..f0ed376d31 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override Vector2 SpriteOrigin => new(0, 20); public override int AssignedItemID => ModContent.ItemType(); + public override bool IgnoreAutoScale => true; public float ClawOpenness = MathHelper.ToRadians(80); public float BubbleSize = 0f; @@ -39,6 +40,8 @@ namespace CalamityMod.Projectiles.Melee } public override void ResetStyle() { + if (Projectile.scale < 0.8f && m2KillTimer <= 0) + Projectile.active = false; if (AnimationCooldown) { if (NumberOfAnimations % 5 <= BlastChargeUses) @@ -137,6 +140,7 @@ namespace CalamityMod.Projectiles.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 2f, Owner.whoAmI); slash.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); + slash.localAI[0] = Owner.GetMeleeScale(); } SlashTimer++; diff --git a/Projectiles/Melee/MantisClawSlash.cs b/Projectiles/Melee/MantisClawSlash.cs index a0783efbce..a89a09ccf7 100644 --- a/Projectiles/Melee/MantisClawSlash.cs +++ b/Projectiles/Melee/MantisClawSlash.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Particles/SlashSmear"; + public float maxScale = 0; private const int TimerCap = 20; Color startColor; Color endColor; @@ -35,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnSpawn(IEntitySource source) { Projectile.scale = 0f; + Projectile.ai[2] = Main.rand.NextFloat(0.5f, 1.25f); if (Main.rand.NextBool(2)) dir = -1; @@ -53,14 +56,21 @@ namespace CalamityMod.Projectiles.Melee startColor = ColorList[Main.rand.Next(ColorList.Count)]; endColor = ColorList[Main.rand.Next(ColorList.Count)]; } - - public override void ModifyDamageHitbox(ref Rectangle hitbox) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - hitbox = new Rectangle((int)Projectile.Center.X - 65, (int)Projectile.Center.Y - 65, 130, 130); + int size = 60; + int scale = (int)(size * Math.Max(Projectile.ai[2], 1)); + Vector2 position = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * size / 2; + return CalamityUtils.CircularHitboxCollision(position, scale, targetHitbox); } public override void AI() { + if (maxScale == 0) + { + maxScale = Projectile.localAI[0]; + Projectile.ai[2] *= maxScale; + } Projectile.velocity *= 0.9f; if (Projectile.timeLeft > (TimerCap / 2)) @@ -88,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0; i < 1; i += 0.33f) { Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.Lerp(startColor, endColor, Projectile.ai[1] / TimerCap).MultiplyRGBA(new Color(255, 255, 255, 0f)), - Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Projectile.scale, dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); + Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Math.Min(Projectile.scale, maxScale), dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); } return false; } diff --git a/Projectiles/Melee/MawOfInfinityHoldout.cs b/Projectiles/Melee/MawOfInfinityHoldout.cs index cf7bf97d01..48323eefee 100644 --- a/Projectiles/Melee/MawOfInfinityHoldout.cs +++ b/Projectiles/Melee/MawOfInfinityHoldout.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class MawOfInfinityHoldout : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override bool useMeleeSize => true; public override int swingWidth => 270; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Melee/MirrorBladeProjectile.cs b/Projectiles/Melee/MirrorBladeProjectile.cs index 56cca4d246..fad5e53fa5 100644 --- a/Projectiles/Melee/MirrorBladeProjectile.cs +++ b/Projectiles/Melee/MirrorBladeProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override bool AlternateSwings => false; public bool SpawnShards = true; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override int swingTime { get; set; } = 8; diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 276bc0972a..4f5895fc64 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -71,38 +72,69 @@ namespace CalamityMod.Projectiles.Melee } return base.CanHitNPC(target); } - public override void AI() + + void SpawnLogic() { - player.Calamity().mouseWorldListener = true; - if (!hasSpawned) + Projectile.netUpdate = true; + //This is used when spawned by Evolution. + //Set here instead of on spawn so it all syncs in MP + if (Projectile.ai[0] != 0) { - Projectile.netUpdate = true; - if (Projectile.ai[0] != 0) + //Setting AP so high guarantees we get the full dmg of the projectile + //We also want to guarantee the proj doesn't crit ever + Projectile.ArmorPenetration = 1000; + Projectile.DamageType = DamageClass.Generic; + Projectile.CritChance = 0; + + //When not holding Mirror Blade, shards launch instantly + if (Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType()) { - //This is used when spawned by Evolution. - //Setting AP so high guarantees we get the full dmg of the projectile. - Projectile.ArmorPenetration = 1000; + shardShield = 10; hasSpawned = true; shardShield = 0; isShard = false; Projectile.timeLeft = 1200; Projectile.velocity = Projectile.DirectionTo(player.Center) * -20f; - Projectile.DamageType = DamageClass.Generic; - Projectile.CritChance = 0; return; } - shardNum = player.ownedProjectileCounts[Projectile.type]; - hasSpawned = true; - shardNum = 0; - foreach (var proj in Main.projectile) + //When holding Mirror Blade, the shards orbit the player like the blade shards. + //Evoultion shards insert themselves at the *end* of the shard list. This means they will launch themselves before any Mirror Blade shards are launched + //This is done because Evolution shards don't get the 2/3x dmg from shattering the mirror shield, so they're less valuable to be stored. + else { - if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) + + shardNum = player.ownedProjectileCounts[Projectile.type]; + hasSpawned = true; + shardNum = 0; + foreach (var proj in Main.projectile) { - (proj.ModProjectile as MirrorBlast).shardNum++; - proj.netUpdate = true; + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner && proj.ModProjectile().shardNum > -1) + { + shardNum++; + } } + return; } } + + //If not from The Evolution, run normal spawn logic + shardNum = player.ownedProjectileCounts[Projectile.type]; + hasSpawned = true; + shardNum = 0; + foreach (var proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) + { + (proj.ModProjectile as MirrorBlast).shardNum++; + proj.netUpdate = true; + } + } + } + public override void AI() + { + player.Calamity().mouseWorldListener = true; + if (!hasSpawned) + SpawnLogic(); if (isShield) { if (shardNum > 10 || Projectile.timeLeft < 2) diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 9db51e148c..79ca99264c 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -59,9 +59,10 @@ namespace CalamityMod.Projectiles.Melee { if (time == 0) { + Projectile.scale = Owner.GetMeleeScale(); if (Main.zenithWorld) { - Projectile.scale = 2; + Projectile.scale *= 2; Projectile.damage = (int)(Projectile.damage * 2); } Projectile.frame = Main.zenithWorld ? 6 : 10; @@ -93,15 +94,6 @@ namespace CalamityMod.Projectiles.Melee else Slashing = false; - if (Projectile.frame == 5 && Projectile.frameCounter % 3 == 0) - { - Projectile.damage = (int)(Projectile.damage * 2); - } - if (Projectile.frame == 7 && Projectile.frameCounter % 3 == 0) - { - Projectile.damage = (int)(Projectile.damage * 0.5f); - } - //Frames and crap Projectile.frameCounter++; if (Projectile.frameCounter % 3 == 0) @@ -179,6 +171,11 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Main.player[Projectile.owner].Center, lineEnd, lineWidth, ref _); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Slash3) + modifiers.SourceDamage *= 2f; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (target.Organic()) @@ -229,6 +226,6 @@ namespace CalamityMod.Projectiles.Melee } public override Color? GetAlpha(Color lightColor) => new Color(100, 0, 0, 0); - public override bool? CanDamage() => Slashing == false ? false : null; + public override bool? CanDamage() => Slashing ? null : false; } } diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index cf3264b909..71afbafc72 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -22,13 +22,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordClaymore"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 60; - - public override Vector2 HitboxSize => new Vector2(105, 105) * hitboxMult; + public int size = 76; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-3, 70); + public override float AdditionalScale => 0.2f; public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -50,7 +49,6 @@ namespace CalamityMod.Projectiles.Melee { CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; // Needs to be slightly bigger for viablility Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; @@ -167,14 +165,15 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(95 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Orange :Color.OrangeRed; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(95 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed)); } } } @@ -247,8 +246,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - //Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Orange with { A = 0 } * (float)Math.Pow(fadeIn, 20) * 0.2f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(-Projectile.ai[1] * 95 * fadeIn) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.33f * hitboxMult, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.25f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.325f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index 2e76546ddc..4c2405c290 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using Microsoft.Xna.Framework; @@ -30,11 +31,17 @@ namespace CalamityMod.Projectiles.Melee Projectile.ContinuouslyUpdateDamageStats = true; Projectile.ownerHitCheck = true; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 3; + Projectile.idStaticNPCHitCooldown = 5; + } + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + float scale = Owner.GetMeleeScale(); + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); } - public override void AI() { + Projectile.scale = Owner.GetMeleeScale(); Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 3; if (Projectile.frame >= Main.projFrames[Type]) @@ -51,16 +58,8 @@ namespace CalamityMod.Projectiles.Melee // Rotation and directioning. Projectile.rotation = Owner.gravDir == -1f ? MathHelper.Pi : 0f; - Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - - // Sprite and player directioning. - Projectile.spriteDirection = Projectile.direction * (int)(Owner.gravDir); - if (Projectile.direction == 1) - Projectile.Left = Owner.MountedCenter; - else - Projectile.Right = Owner.MountedCenter; - Projectile.position.X += (Projectile.spriteDirection == 1 ? -92f : 96f) * Owner.gravDir; - Projectile.position.Y -= 80f * Owner.gravDir; + Projectile.direction = Projectile.spriteDirection = MathF.Sign(Owner.Center.DirectionTo(Owner.ClampedMouseWorld()).X); + Projectile.Center = Owner.MountedCenter + new Vector2(Projectile.width * 0.1f * Projectile.scale * Projectile.direction, -Projectile.height * 0.5f * Projectile.scale); Owner.ChangeDir(Projectile.direction); // Prevents the projectile from dying diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index c184e5faaf..96fa3fea63 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player player = Main.player[Projectile.owner]; @@ -46,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); if (Projectile.timeLeft % 12 == 0 && targetDist < 1400f) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f * Projectile.scale, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); } time++; diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs index c75a37a4ae..14f1a81d43 100644 --- a/Projectiles/Melee/OrderbringerWaveProj.cs +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.Melee public float hitboxSize = 10; public Color mainColor; public float fade = 1; - public float damageMult = 1; public float fadeOut = 1; public override void SetDefaults() { @@ -36,8 +35,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190; - Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190; + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190 * Projectile.ai[1]; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190 * Projectile.ai[1]; Player player = Main.player[Projectile.owner]; mainColor = player.Calamity().lightRGB; @@ -66,26 +65,26 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f)* Projectile.ai[1] - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25 * Projectile.ai[1], ModContent.DustType()); + trailDust.scale = (Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f)) * Projectile.ai[1]; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); trailDust.color = mainColor; trailDust.noGravity = true; - trailDust.fadeIn = 2f; + trailDust.fadeIn = 2f * Projectile.ai[1]; } if (time % 9 == 0 && time < 200) { - Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f * Projectile.ai[1], mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f * Projectile.ai[1], mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(12)) { - Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f) * Projectile.ai[1], mainColor); GeneralParticleHandler.SpawnParticle(orb3); - Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f) * Projectile.ai[1], mainColor); GeneralParticleHandler.SpawnParticle(orb4); } } @@ -99,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee float waveFade = (float)Math.Pow(Utils.GetLerpValue(0, 250, Projectile.timeLeft, true), 2); float waveFade2 = (float)Math.Pow(Utils.GetLerpValue(0, 80, Projectile.timeLeft, true), 2); for (int i = 1; i < 15; i++) // Weird for loop because of squash code - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f * Projectile.ai[1], SpriteEffects.None, 0); return false; } @@ -107,12 +106,6 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 300); } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // Deal more damage on pierce - modifiers.SourceDamage *= damageMult; - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize * Projectile.ai[1], targetHitbox); } } diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index 2208750278..e50e1eeff4 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public Player Owner => Main.player[Projectile.owner]; public const float ZeroChargeDamageRatio = 0.36f; - public const float ToothDamageRatio = 0.1666667f; + public const float ToothDamageRatio = 0.5f; public const int ToothShootRate = 5; // One chainsaw tooth is emitted every this many frames. public const int ChargeUpTime = 150; public ref float Time => ref Projectile.ai[0]; @@ -63,6 +63,7 @@ namespace CalamityMod.Projectiles.Melee // Recalculate damage every frame for balance reasons, as this is a long-lasting holdout. // This is important because you could start using it while benefitting from Auric Tesla standstill bonus, for example. Projectile.damage = Owner.HeldItem is null ? 0 : Owner.GetWeaponDamage(Owner.HeldItem); + Projectile.scale = Owner.GetMeleeScale(); DetermineDamage(); PlayChainsawSounds(); @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.Pi; // Positioning close to the player's arm. - Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; + Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f * Projectile.scale; // Update the position a tiny bit every frame at random to make it look like the saw is vibrating. // It is reset on the next frame. @@ -191,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { - Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 35f; + Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 35f * Projectile.scale; // Spawn the dust a little bit on the chainsaw. X variance is less than Y variance to ensure that dust does not // spawn too far from the blade. @@ -235,7 +236,8 @@ namespace CalamityMod.Projectiles.Melee shootReach = 72f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + Projectile prismTooth = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + prismTooth.scale = Projectile.scale; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -243,9 +245,9 @@ namespace CalamityMod.Projectiles.Melee // Collision is done as a line to bypass the fact that hitboxes cannot rotate and that // this projectile is notably flat in terms of sprite shape. float _ = 0f; - float width = Projectile.scale * 36f; + float width = Projectile.scale * 36f * Projectile.scale; Vector2 start = Projectile.Center; - Vector2 end = Projectile.Center + Projectile.velocity * 70f; + Vector2 end = Projectile.Center + Projectile.velocity * 70f * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index 4f12c74fe9..21b08711b2 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override bool drawSwordTrail => false; public override bool AlternateSwings => false; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override int swingTime { get; set; } = 8; diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index 686133e319..43171a0be7 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/SkytideDragoon"; - public override float HitboxOutset => 245; - - public override Vector2 HitboxSize => new Vector2(40, 40); // long thin hitbox for a spear is done in collision, the X here determines hitbox width + public int size = 140; + public override float HitboxOutset => size * 1.45f; + public override Vector2 HitboxSize => new Vector2(30, 30); // Has custom collision + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 135); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; mousePos = Owner.Calamity().mouseWorld; @@ -151,18 +150,19 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); - Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f); - Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f)); + Vector2 pos = Owner.Center + (new Vector2(160 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(1f, 4f); + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f) * Projectile.scale); dust.noGravity = true; dust.color = color; + dust.fadeIn = Projectile.scale - 1; - Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f), color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); + Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f) * Projectile.scale, color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); GeneralParticleHandler.SpawnParticle(spark2); if (i % 2 == 0) { - Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, color * 0.75f, new Vector2(1f, 1)); + Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f * Projectile.scale, color * 0.75f, new Vector2(1f, 1)); GeneralParticleHandler.SpawnParticle(orb); } } @@ -222,7 +222,8 @@ namespace CalamityMod.Projectiles.Melee SoundStyle sound = new("CalamityMod/Sounds/Item/SkytideBolt"); SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 0.5f); - proj.timeLeft = 45; + proj.timeLeft = (int)(45 / Projectile.scale); + proj.scale = Projectile.scale; swingCount = 0; attackPower = 6; } @@ -233,7 +234,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit"); SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2 * Projectile.scale, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f); + proj.scale = Projectile.scale; swingCount = -1; attackPower = 0; } @@ -243,7 +245,8 @@ namespace CalamityMod.Projectiles.Melee { float rot = (0.1f * attackPower * i / 6f); Vector2 vel = rot.ToRotationVector2().RotatedBy(aimVel.ToRotation()) * -7; - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2 * Projectile.scale, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + proj.scale = Projectile.scale; } attackPower--; } @@ -267,12 +270,17 @@ namespace CalamityMod.Projectiles.Melee { Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); float bonus = (1 - (7 / (attackPower + 1))) * 0.3f; - Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); + Vector2 pos = Owner.Center + (new Vector2(160 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.ToRadians(-45)).RotatedByRandom(0.5f) * Main.rand.NextFloat(6f, 10f); - Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? 278 : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); - dust.noGravity = !(dust.type == 278); + Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? DustID.FireworksRGB : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); + dust.noGravity = dust.type != DustID.FireworksRGB; dust.color = color; dust.scale += bonus; + if (dust.type != DustID.FireworksRGB) + { + dust.scale *= Projectile.scale; + dust.fadeIn = Projectile.scale - 1; + } } } } @@ -285,7 +293,7 @@ namespace CalamityMod.Projectiles.Melee { // Perform an AABB line collision check to check the whole spear. float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset, HitboxSize.X * Projectile.scale, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + ((Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset) * Projectile.scale, HitboxSize.X * Projectile.scale, ref _); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -342,15 +350,15 @@ namespace CalamityMod.Projectiles.Melee { // While not super visible here, this hitbox extention effect looks great and I'll use it on stuff like Terra Lance later Color tipColor = Color.Lerp(color2, color1, (i + 4) / 6) with { A = 0 } * 0.3f * fadeIn; - Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f); - Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); + Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f) * Projectile.scale; + Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130 * Projectile.scale, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); } for (int i = 0; i < 6; i++) { // the electric orb at the tip Color orbColor = Color.Lerp(Color.Lerp(color2, color1, (i + 2) / 6), Color.White, i / 6) with { A = 0 } * 0.5f; - Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2; - Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 180 + tipOutset, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); + Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2 * Projectile.scale; + Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 188 * Projectile.scale + tipOutset * Projectile.scale, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); } } return false; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 5f67f8f6be..1293a2915c 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class GildedProboscisProj : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => false; public override bool useMeleeSize => false; public override int swingWidth => 360; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs index b370747d9f..ba2e6a8a1b 100644 --- a/Projectiles/Melee/StarofJudgement.cs +++ b/Projectiles/Melee/StarofJudgement.cs @@ -21,6 +21,11 @@ namespace CalamityMod.Projectiles.Melee ProjectileID.Sets.TrailCacheLength[Type] = 12; ProjectileID.Sets.TrailingMode[Type] = 2; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void SetDefaults() { Projectile.width = 44; @@ -40,7 +45,8 @@ namespace CalamityMod.Projectiles.Melee if (time == 0) { mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); + if (Projectile.numHits == 0) + Projectile.scale *= (Projectile.ai[2] == 1 ? 0.75f : 0.5f); if (Projectile.ai[2] == 1) { Projectile.localNPCHitCooldown = -1; @@ -60,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = Projectile.velocity.RotatedBy(0.085f * Projectile.ai[1]); if (time % 2 == 0) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f) * Projectile.scale, true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } } @@ -70,10 +76,11 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.scale = Main.rand.NextFloat(0.9f, 1.05f) * Projectile.scale; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; trailDust.noGravity = true; + trailDust.fadeIn = Projectile.scale - 1; } } diff --git a/Projectiles/Melee/StarofOrder.cs b/Projectiles/Melee/StarofOrder.cs index 958b843c75..8a794b9401 100644 --- a/Projectiles/Melee/StarofOrder.cs +++ b/Projectiles/Melee/StarofOrder.cs @@ -35,14 +35,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 7; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player player = Main.player[Projectile.owner]; mainColor = player.Calamity().lightRGB; - if (time == 0) + if (time == 0 && Projectile.numHits == 0) { - Projectile.scale = Main.rand.NextFloat(0.65f, 0.8f); + Projectile.scale *= Main.rand.NextFloat(0.65f, 0.8f); } float sine = (float)Math.Sin(time * 0.575f * Projectile.scale / MathHelper.Pi); @@ -59,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee } if (time % 2 == 0 && Projectile.numHits < 1) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f) * Projectile.scale, true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } @@ -107,10 +111,10 @@ namespace CalamityMod.Projectiles.Melee { Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2, ModContent.DustType(), velocity * 8); - dust.scale = 3.5f; + dust.scale = 3.5f * Projectile.scale; dust.color = mainColor; dust.noGravity = true; - dust.fadeIn = 6f; + dust.fadeIn = 6f * Projectile.scale; } } } diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index d06ba14221..75277743b9 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -22,12 +22,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarStriker"; - public override float HitboxOutset => 90; - - public override Vector2 HitboxSize => new Vector2(130, 130); + public int size = 118; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(0, 118); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -47,7 +46,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Stellar Striker's projectile spawning @@ -161,24 +159,24 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - Particle orb = new CustomPulse(particlePos, -particleVel * Main.rand.NextFloat(1.1f, 3.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/Sparkle", new Vector2(2f, 1f), particleVel.ToRotation(), Main.rand.NextFloat(0.4f, 1.1f), 0.2f, 23); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + Particle orb = new CustomPulse(particlePos, -particleVel * Main.rand.NextFloat(1.1f, 3.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/Sparkle", new Vector2(2f, 1f), particleVel.ToRotation(), Main.rand.NextFloat(0.4f, 1.1f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Particle spark2 = new GlowSparkParticle(Owner.Center + (new Vector2(140, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.4f)), -dustVel, false, 20, Main.rand.NextFloat(0.007f, 0.012f), Color.Turquoise, new Vector2(1.3f, 0.5f), true, false, Main.rand.NextFloat(0.5f, 0.7f)); + Particle spark2 = new GlowSparkParticle(Owner.Center + (new Vector2(140 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.4f)), -dustVel, false, 20, Main.rand.NextFloat(0.007f, 0.012f) * Projectile.scale, Color.Turquoise, new Vector2(1.3f, 0.5f), true, false, Main.rand.NextFloat(0.5f, 0.7f)); GeneralParticleHandler.SpawnParticle(spark2); } } else if (Main.rand.NextBool(3)) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; - Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 23, Main.rand.NextFloat(0.2f, 0.6f), 0.65f, 0, true)); @@ -220,7 +218,8 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + meteor.scale = Projectile.scale; spawnBoom = false; } diff --git a/Projectiles/Melee/StellarStrikerMeteor.cs b/Projectiles/Melee/StellarStrikerMeteor.cs index 0cfc50fec9..e187bb142b 100644 --- a/Projectiles/Melee/StellarStrikerMeteor.cs +++ b/Projectiles/Melee/StellarStrikerMeteor.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -67,28 +68,25 @@ namespace CalamityMod.Projectiles.Melee if (targetDist < 1400f) { - if (time % 11 == 0) - { - GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); - GeneralParticleHandler.SpawnParticle(orb); - } if (time % 4 == 0) { - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 6, Main.rand.NextFloat(0.3f, 0.7f), 0.65f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 6, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, 0.65f, 0, true)); } } - if (time % 2 == 0) - { - // Spawn in a helix-style pattern - float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); - Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * wavePower; + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * wavePower; - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset * direction, DustID.RainbowMk2, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.3f)); - dust.scale = Main.rand.NextFloat(0.85f, 0.95f); - dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; - } + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 2, ModContent.DustType(), (Projectile.timeLeft % 2 == 0 ? -Projectile.velocity * 2 : offset * direction * 0.5f)); + dust.scale = Main.rand.NextFloat(1.15f, 1.25f) * Projectile.scale; + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + dust.fadeIn = Projectile.scale * 1.25f; + dust.noLight = true; + dust.noLightEmittence = true; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; time++; @@ -97,7 +95,8 @@ namespace CalamityMod.Projectiles.Melee { spawnMet = false; Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } } @@ -106,6 +105,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1, tex); + CalamityUtils.DrawProjectileWithBackglow(Projectile, Color.Turquoise with { A = 0 }, lightColor, 4 * Projectile.scale); return false; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee } for (int i = 0; i < 6; i++) { - Particle spark3 = new SparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 14), false, 20, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(5) ? Color.PaleTurquoise : Color.Turquoise); + Particle spark3 = new SparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 14), false, 20, Main.rand.NextFloat(0.3f, 0.8f) * Projectile.scale, Main.rand.NextBool(5) ? Color.PaleTurquoise : Color.Turquoise); GeneralParticleHandler.SpawnParticle(spark3); } for (int i = 0; i < 18; i++) @@ -149,10 +149,13 @@ namespace CalamityMod.Projectiles.Melee c.noGravity = true; c.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); + if (!CalamityClientConfig.Instance.Photosensitivity) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * Projectile.scale, 1f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * Projectile.scale, 0.3f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index b62d82e9dd..f418a91a2b 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -28,7 +28,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.timeLeft = 300; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Player Owner = Main.player[Projectile.owner]; + float scale = Projectile.scale; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { Projectile.frameCounter++; @@ -95,9 +101,9 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item21, Projectile.position); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X -= (float)(Projectile.width / 2); - Projectile.position.Y -= (float)(Projectile.height / 2); + Projectile.width *= (int)(2 * Projectile.scale); Projectile.height *= (int)(2 * Projectile.scale); + Projectile.position.X -= (float)(Projectile.width / (int)(2 * Projectile.scale)); + Projectile.position.Y -= (float)(Projectile.height / (int)(2 * Projectile.scale)); for (int i = 0; i < 2; i++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index e52c6e5d7f..6a4b295669 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Projectiles.Melee float rotationSpeed = -0.7853982f; Vector2 actualPosition = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 rotationPoint = Vector2.Zero; + Projectile.scale = player.GetMeleeScale(); if (player.dead) { @@ -141,6 +142,7 @@ namespace CalamityMod.Projectiles.Melee var source = Projectile.GetSource_FromThis(); Projectile bubble = CalamityUtils.ProjectileBarrage(source, Projectile.Center, player.Center, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack * 0.5f, Projectile.owner, true); bubble.ai[1] = Main.rand.NextFloat() + 0.5f; + bubble.scale = Projectile.scale; } } } @@ -161,7 +163,7 @@ namespace CalamityMod.Projectiles.Melee } float f = Projectile.rotation - 0.7853982f * (float)Math.Sign(Projectile.velocity.X); float rotationFactor = 0f; - float collisionRadius = 110f; + float collisionRadius = 110f * Projectile.scale; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -collisionRadius, Projectile.Center + f.ToRotationVector2() * collisionRadius, 23f * Projectile.scale, ref rotationFactor)) { return true; diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index 104bca3d8a..7e4b87d2cd 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 1; - Projectile.scale = 1.2f; } public override void AI() diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index 6b82d56b3d..15b24a242b 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -62,6 +62,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (EndLag == 0) //Initialization { EndLag = (float)Math.Max(Owner.HeldItem.useTime - MaxTime, 1); @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation Projectile.Center = Owner.MountedCenter + OffsetFromPlayer; - Projectile.scale = 1f + (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.2f; //SWAGGER + Projectile.scale = Owner.GetMeleeScale() * 1f + (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.2f; //SWAGGER //Make the owner look like theyre holding the sword bla bla Owner.heldProj = Projectile.whoAmI; @@ -222,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee Rectangle frame = new Rectangle(0, (smearTex.Height / 3) * frameCount, smearTex.Width, smearTex.Height / 3); float opacity = 1 - (float)Math.Pow(LifetimeCompletion / 0.6f, 0.5f); - Main.spriteBatch.Draw(smearTex, Projectile.Center + Projectile.velocity * 67f - Main.screenPosition, frame, Color.White * opacity, Projectile.rotation, frame.Size() / 2f, 0.9f, 0, 0); + Main.spriteBatch.Draw(smearTex, Projectile.Center + Projectile.velocity * 67f * Projectile.scale - Main.screenPosition, frame, Color.White * opacity, Projectile.rotation, frame.Size() / 2f, 0.9f * Projectile.scale, 0, 0); } return false; } diff --git a/Projectiles/Pets/DesertScourgeBabyBody.png b/Projectiles/Pets/DesertScourgeBabyBody.png deleted file mode 100644 index a79304c9bf..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyBody.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyBody2.png b/Projectiles/Pets/DesertScourgeBabyBody2.png deleted file mode 100644 index ad1ed7cc10..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyBody2.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyBody3.png b/Projectiles/Pets/DesertScourgeBabyBody3.png deleted file mode 100644 index 308ac4e880..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyBody3.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyHead.png b/Projectiles/Pets/DesertScourgeBabyHead.png deleted file mode 100644 index b9d4646498..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyHead.png and /dev/null differ diff --git a/Projectiles/Pets/DesertScourgeBabyTail.png b/Projectiles/Pets/DesertScourgeBabyTail.png deleted file mode 100644 index 55d51f6c73..0000000000 Binary files a/Projectiles/Pets/DesertScourgeBabyTail.png and /dev/null differ diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index bb2953d0f9..f49e952770 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -117,6 +117,9 @@ namespace CalamityMod.Projectiles.Ranged } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (falling) + modifiers.SourceDamage *= 0.75f; + if (Projectile.numHits > 1 && falling) Projectile.damage = (int)(Projectile.damage * 0.5f); if (Projectile.damage < 1) diff --git a/Projectiles/Ranged/OmniGrenade.cs b/Projectiles/Ranged/OmniGrenade.cs index b6f1f8979b..3433fc25f1 100644 --- a/Projectiles/Ranged/OmniGrenade.cs +++ b/Projectiles/Ranged/OmniGrenade.cs @@ -88,9 +88,9 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) { modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 200f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 150f; - else modifiers.SourceDamage.Flat += 100f; + if (Main.masterMode) modifiers.SourceDamage.Flat += 240f; + else if (Main.expertMode) modifiers.SourceDamage.Flat += 180f; + else modifiers.SourceDamage.Flat += 120f; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/OmniGunHoldout.cs b/Projectiles/Ranged/OmniGunHoldout.cs index 8a36f1a7e2..6a5c6f65a4 100644 --- a/Projectiles/Ranged/OmniGunHoldout.cs +++ b/Projectiles/Ranged/OmniGunHoldout.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Ranged Owner.velocity += -Projectile.velocity * 7f; for (int i = 0; i < 8; i++) - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 1.5f), ModContent.ProjectileType(), (int)(Projectile.damage * 2.6f), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 1.5f), ModContent.ProjectileType(), (int)(Projectile.damage * 3f), Projectile.knockBack, Projectile.owner); shotCounter++; if (shotCounter > 11) framesBetweenShots = 30; diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index 876f0a59a8..9a9a0820d6 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public Color FogColor = Color.Orchid; public float FogRotation = 0; public int boomTime = PristineFury.boomTime; + public int fullDamageHitCooldown = 0; public bool Ignited = false; @@ -34,8 +35,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 230; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.ArmorPenetration = 30; } public override void AI() @@ -46,12 +48,14 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.ai[2] == boomTime) { - // Xyk: "This is probably too much lol" - // Yeah I'd say 7x base damage is a bit much - // Xyk: Follow up, the inital damage is nerfed AND it has a "cooldown" 7x should now be fine... - Projectile.damage *= (int)7; + Projectile.damage = (int)(Projectile.damage * 7.2f); FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat()); + Projectile.localNPCHitCooldown = -1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + fullDamageHitCooldown = 0; + SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); SoundEngine.PlaySound(ignite with { Volume = 0.4f, Pitch = Main.rand.NextFloat(0.5f, 0.6f) }, Projectile.Center); } @@ -78,6 +82,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= Main.rand.NextFloat(0.95f, 0.99f); Projectile.Opacity = Utils.GetLerpValue(280f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); + if (fullDamageHitCooldown > 0) + fullDamageHitCooldown--; + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. if (Main.dedServ) return; @@ -120,8 +127,15 @@ namespace CalamityMod.Projectiles.Ranged public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.Opacity < 0.3f ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * ScaleFactor * 0.5f, targetHitbox); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (fullDamageHitCooldown == 0 && !target.Calamity().IsArmored()) // Deal full damage + { + fullDamageHitCooldown = Projectile.localNPCHitCooldown; + } + else // Deal partial damage + modifiers.SourceDamage *= 0.06f; + if (Ignited) { diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index 45cb58ae7e..9f43df61b9 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -428,15 +428,16 @@ namespace CalamityMod.Projectiles.Rogue Color glowColor = Color.Lerp(mainColor, Color.Red, Utils.GetLerpValue(60, 18, (stealthPenaltyTimer >= 18 ? stealthPenaltyTimer : 60))); float fade = Utils.GetLerpValue(0, 300, Projectile.timeLeft, true); Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 baseDrawPos = Projectile.Center - Main.screenPosition + (!flung ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); for (int i = 0; i < 25; i++) { Color auraColor = glowColor with { A = 0 } * 0.35f * fade; Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * (hasReachedFullCharge ? 7 : 3f) * Projectile.Opacity; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(4, 4), null, auraColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None); + Main.EntitySpriteDraw(tex, baseDrawPos + drawOffset + Main.rand.NextVector2Circular(4, 4), null, auraColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None); } - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fade, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, baseDrawPos, null, lightColor * fade, Projectile.rotation, tex.Size() / 2f, Projectile.scale, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value, Projectile.Center - Main.screenPosition, null, glowColor * Projectile.Opacity * fade, Projectile.rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value, baseDrawPos, null, glowColor * Projectile.Opacity * fade, Projectile.rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/DoomsdayDeviceGlow2").Value.Size() * 0.5f, 1f, (!flung ? Owner.direction : Projectile.direction) != 1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); return false; } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) diff --git a/Projectiles/Rogue/DuststormInABottleHoldout.cs b/Projectiles/Rogue/DuststormInABottleHoldout.cs index c4a3b37fcc..194a525056 100644 --- a/Projectiles/Rogue/DuststormInABottleHoldout.cs +++ b/Projectiles/Rogue/DuststormInABottleHoldout.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => true; public override bool useMeleeSize => false; public override int swingWidth => 180; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Rogue/ElephantKillerElephant.cs b/Projectiles/Rogue/ElephantKillerElephant.cs new file mode 100644 index 0000000000..b090fd4479 --- /dev/null +++ b/Projectiles/Rogue/ElephantKillerElephant.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.Weapons.Rogue; +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.Rogue +{ + public class ElephantKillerElephant : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public SlotId soundSlot; + public float rumble = 0; + public float displace = 0; + public ref float holeSize => ref Projectile.localAI[1]; + public ref float time => ref Projectile.ai[0]; + public Color clr = Color.CornflowerBlue; + public static Asset ElephantTexture { get; private set; } + public override void Load() + { + if (Main.dedServ) + return; + + ElephantTexture = Terraria.GameContent.TextureAssets.Projectile[Type]; + } + public override void SetDefaults() + { + Projectile.scale = 2f; + Projectile.width = 135; + Projectile.height = 90; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 4600; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + Projectile.extraUpdates = 3; + Projectile.tileCollide = false; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.CornflowerBlue, + Color.SkyBlue + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + clr = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), Color.White, 0.7f); + + if (time == 0) + { + Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); + } + float sine = MathF.Sin((time * 0.05f) / MathHelper.Pi); + if (time < 70) + { + Projectile.velocity *= 0.93f; + } + else + { + Projectile.extraUpdates = 1; + Projectile.velocity = Vector2.Zero; + Projectile.Center += Vector2.UnitY * sine * 0.1f; + } + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.spriteDirection == -1 ? MathHelper.Pi : 0, 0.04f); + + if (time == 90) + { + soundSlot = SoundEngine.PlaySound(ElephantKiller.ElephantSound with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center); + rumble = 30; + } + + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying) + sound.Position = Projectile.Center; + + Projectile.Opacity = 1 - MathF.Pow(Utils.GetLerpValue(230, 0, Projectile.timeLeft, true), 6); + rumble = MathHelper.Lerp(rumble, 0, 0.03f); + time += Utils.Remap(Projectile.Opacity, 1, 0, 1, 10); + holeSize = MathHelper.Lerp(holeSize, 0, 0.04f); + + Lighting.AddLight(Projectile.Center, clr.ToVector3() * 1.2f * Projectile.Opacity * MathF.Pow(Utils.GetLerpValue(0, 35, time, true), 3)); + } + public override bool? CanDamage() + { + return false; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 generalDrawPos = Projectile.Center + Main.rand.NextVector2Circular(rumble, rumble) + Vector2.UnitY * 25; + + SpriteEffects spriteFx = SpriteEffects.FlipHorizontally; + if (Projectile.spriteDirection == -1) + spriteFx |= SpriteEffects.FlipVertically; + + float deathFade = 1 - Projectile.Opacity; + float lerp = MathF.Pow(Utils.GetLerpValue(0, 35, time, true), 3); + float scale = (0.5f + 0.5f * lerp); + + float lerpFade = (1 - MathF.Pow(Utils.GetLerpValue(1f, 0, deathFade, true), 5)); + int frameDivis = 2; + int framesY = tex.Height / frameDivis; + int framesX = tex.Width / frameDivis; + float directionRot = Projectile.rotation; + Color usedColor = clr; + for (int i = 1; i <= framesY; i++) + { + + float sine = MathF.Sin((time * 0.15f + i * frameDivis) / MathHelper.Pi); + float frameLerp = Utils.GetLerpValue(framesY, 1, i, true); + float frameFade = Math.Max(MathF.Pow(frameLerp, 4), deathFade); + float colorFade = MathF.Pow(1 - frameLerp, 1.5f); + + float rate = Main.GlobalTimeWrappedHourly * 4 + i * 0.03f; + List eColors = new List() + { + Color.CornflowerBlue, + Color.SkyBlue + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + + for (int x = 1; x <= framesX; x++) + { + Rectangle frame = tex.Frame(framesX, framesY, framesX - x, framesY - i); + + Vector2 xPos = Vector2.UnitX.RotatedBy(Projectile.spriteDirection == -1 ? directionRot + MathHelper.Pi : directionRot) * frame.Width * x * 2 * Projectile.spriteDirection; + + Vector2 frameMovement = generalDrawPos + (xPos + -Vector2.UnitY.RotatedBy(directionRot) * framesY * (Projectile.spriteDirection == 1 ? -2 * frameDivis : 0f) + -Vector2.UnitY.RotatedBy(directionRot) * frame.Height * 2 * i * Projectile.spriteDirection) * scale + + Vector2.UnitX.RotatedBy(directionRot) * (25 + (295 * Utils.GetLerpValue(tex.Height / 2, 0, Math.Abs(tex.Height / 2 - i), true) * lerpFade)) * sine * frameFade; + + Vector2 pixelPlace = frameMovement; + + Vector2 holePlace = new Vector2(Projectile.ai[1], Projectile.ai[2]) + (Projectile.spriteDirection * tex.Size()); + float distFromHole = pixelPlace.Distance(holePlace); + Vector2 holeAdjust = pixelPlace.DirectionFrom(holePlace) * MathHelper.Lerp(0, 25, MathF.Pow(Utils.GetLerpValue(80, 0, distFromHole, true), 2f)) * holeSize; + + Vector2 linePlace = holePlace + Projectile.localAI[0].ToRotationVector2() * distFromHole; + Vector2 lineAdjust = pixelPlace.DirectionFrom(linePlace) * MathHelper.Lerp(0, 25, MathF.Pow(Utils.GetLerpValue(80, 0, pixelPlace.Distance(linePlace), true), 2f)) * (holeSize / (8 - 7 * MathF.Pow(Utils.GetLerpValue(420, 0, distFromHole, true), 1.5f))); + + Main.EntitySpriteDraw(tex, frameMovement + holeAdjust + lineAdjust - Main.screenPosition, frame, usedColor with { A = 0 } * (colorFade) * Projectile.Opacity, Projectile.rotation, tex.Size() / 2, Projectile.scale * scale, spriteFx, 0); + } + } + + return false; + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying) + sound?.Stop(); + } + } +} diff --git a/Projectiles/Rogue/ElephantKillerElephant.png b/Projectiles/Rogue/ElephantKillerElephant.png new file mode 100644 index 0000000000..f4f89409e5 Binary files /dev/null and b/Projectiles/Rogue/ElephantKillerElephant.png differ diff --git a/Projectiles/Rogue/ElephantKillerFlash.png b/Projectiles/Rogue/ElephantKillerFlash.png new file mode 100644 index 0000000000..2143f03e60 Binary files /dev/null and b/Projectiles/Rogue/ElephantKillerFlash.png differ diff --git a/Projectiles/Rogue/ElephantKillerThrown.cs b/Projectiles/Rogue/ElephantKillerThrown.cs new file mode 100644 index 0000000000..9fd937049e --- /dev/null +++ b/Projectiles/Rogue/ElephantKillerThrown.cs @@ -0,0 +1,756 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Graphic.PixelationSystem; +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; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ElephantKillerThrown : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public new string LocalizationCategory => "Projectiles.Rogue"; + public Player Owner => Main.player[Projectile.owner]; + public ref float time => ref Projectile.ai[0]; + public ref float rightClicking => ref Projectile.ai[1]; + public int initialDirection = 0; + public float throwSpeed = 0; // The speed at which the gun is thrown and returns + public int animationTimeMax = 0; + public int returnTime = 0; + public float holdoutOffset = 0; // Placement adjustments used for "recoil" + public bool tryShooting = true; // Used in the holding mode, is used in inverse for stealth strikes + public bool soundToss = true; + public bool soundCatch = true; + public bool resetIframes = true; + + public bool spinFxOn = false; // Fades in spin effects if on, otherwise fades them out + public float spinFx = 0; + public bool doingFireAnimation = false; + public bool hasFiredBulletEver = false; + public int firingEffectDisableTimer = 0; // Timer to track the firing animation and disable it when completed + public int disableTimerMax = 4; + public bool resetAll = false; + public bool shouldDie = false; + public Vector2 aimedTargetPos; + + public float recoilRotation = 0; // Rotation adjustments used for "recoil" + public int recoilLifetime = 0; + public int recoilLifetimeMax = 30; + + public float shineProgress = 0; + public float shineOpacity = 0; + public bool shineSound = true; + + public float rumble = 0; // Shake effect for stealth strikes and thrown impacts + public int hitStop = 0; // A few frames where the projectile pauses on impact + public int tileHits = 0; + public bool setReturnTime = false; + + public List<(NPC, float, bool)> hitNPCs = new List<(NPC, float, bool)>(); + public static Asset Gun { get; private set; } + public static Asset GunFlash { get; private set; } + public static Asset Smear { get; private set; } + public static Asset Bloom { get; private set; } + public static Asset BloomLine { get; private set; } + public static Asset Shine { get; private set; } + + public override void Load() + { + if (Main.dedServ) + return; + + Gun = ModContent.Request("CalamityMod/Items/Weapons/Rogue/ElephantKiller"); + GunFlash = ModContent.Request("CalamityMod/Projectiles/Rogue/ElephantKillerFlash"); + Smear = ModContent.Request("CalamityMod/Particles/CircularSmearLarge"); + Bloom = ModContent.Request("CalamityMod/Particles/BrightFlash"); + BloomLine = ModContent.Request("CalamityMod/Particles/BloomLineFade"); + Shine = ModContent.Request("CalamityMod/Particles/FullStar"); + } + public override void SetDefaults() + { + Projectile.width = 30; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + Projectile.noEnchantmentVisuals = true; + } + public enum gunState + { + NotThrown, + Thrown, + Returning, + Shooting, + Rebounding, + Stealth + } + public gunState mode; + public override bool ShouldUpdatePosition() + { + return !(mode == gunState.NotThrown || mode == gunState.Stealth || doingFireAnimation || hitStop > 0); + } + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (mode == gunState.NotThrown || mode == gunState.Stealth || doingFireAnimation || hitStop > 0) + return false; + + return null; + } + public void Thrown(Vector2 toMouse, int returnTime, int animationTimeMax) + { + if (mode == gunState.Thrown || mode == gunState.Returning) + { + if (time < animationTimeMax * 1.65f) + { + Owner.ChangeDir(MathF.Sign(toMouse.X)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi * 1.5f + toMouse.ToRotation()); + } + if (!doingFireAnimation) + Projectile.rotation += 0.55f * initialDirection; + + if (time > returnTime && mode != gunState.Returning) + { + mode = gunState.Returning; + } + } + + if (mode == gunState.Returning) + { + if (setReturnTime) + { time = returnTime; setReturnTime = false; } + if (time > returnTime * 1.2f && resetIframes) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + resetIframes = false; + Projectile.tileCollide = false; + } + // Aim back at the player + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.Center.DirectionTo(Owner.Center) * throwSpeed, 0.03f * (1 + 2 * Utils.GetLerpValue(returnTime, returnTime * 2, time))); + + bool afterHit = (Projectile.numHits > 0 || tileHits > 0); + + if (afterHit && time > returnTime && !hasFiredBulletEver) + Projectile.velocity *= 0.93f; + + if (afterHit && time > returnTime * 1.4f && (!hasFiredBulletEver || (hasFiredBulletEver && doingFireAnimation))) + { + NPC attemptTarget = !hasFiredBulletEver ? Projectile.Center.ClosestNPCAt(1000, true) : null; + if (aimedTargetPos == Vector2.Zero && attemptTarget != null) + aimedTargetPos = attemptTarget.Center; + + Vector2 shootVel = aimedTargetPos == Vector2.Zero ? Projectile.rotation.ToRotationVector2() : Projectile.Center.DirectionTo(aimedTargetPos); + if (aimedTargetPos != Vector2.Zero) + { + if (!hasFiredBulletEver) + { + Projectile.extraUpdates = 0; + spinFxOn = false; + disableTimerMax = (int)(disableTimerMax * 1.5f); + FireShot(shootVel); + } + spinFx = 0; + Projectile.rotation = shootVel.ToRotation(); + Projectile.Center += -shootVel * holdoutOffset * 2.3f; + Projectile.velocity = -shootVel * 20; + time--; + } + } + else + { + if (Projectile.extraUpdates == 0) + { + spinFxOn = true; + Projectile.extraUpdates = 1; + } + } + + if ((Projectile.Center - Owner.MountedCenter).Length() < 24f && time > returnTime * 1.5f) + { + Projectile.Kill(); + } + } + } + public void Held(Vector2 toMouse, int returnTime, int animationTimeMax) + { + if (mode == gunState.NotThrown || mode == gunState.Stealth) // The throw animation + { + float throwAnimLerp = Utils.GetLerpValue(0, animationTimeMax, time); + float dudFireEndPoint = 0.4f; float throwStartPoint = 0.5f; float throwCutPoint = 0.75f; float maxRotation = -MathHelper.PiOver2; float startRotation = MathHelper.PiOver2; + + Owner.ChangeDir(MathF.Sign(toMouse.X)); + initialDirection = MathF.Sign(toMouse.X); + Owner.heldProj = Projectile.whoAmI; + if (recoilLifetime < recoilLifetimeMax - 7) + Owner.itemTime = Owner.itemAnimation = 5; + if (mode == gunState.Stealth) + { + Owner.itemTime = Owner.itemAnimation = 5; + if (!tryShooting) + rumble = MathHelper.Lerp(rumble, 11, 0.08f); + } + + // The attempted fire at the start of the use animation + if (throwAnimLerp >= dudFireEndPoint / 2 && ((mode != gunState.Stealth && tryShooting) || (mode == gunState.Stealth && !tryShooting))) + { + float roundedStealth = MathF.Round(Owner.Calamity().rogueStealth, 2); + float stealthAmount = MathF.Round(Owner.Calamity().rogueStealthMax * ElephantKiller.stealthCostToShoot, 2); + bool fires = mode == gunState.Stealth || (Owner.Calamity().rogueStealthMax > 0 && rightClicking == 1 && roundedStealth >= stealthAmount); + if (fires) + { + if (mode == gunState.Stealth) + { + Owner.Calamity().ConsumeStealthByAttacking(); + recoilLifetime++; + } + else + { + Owner.Calamity().rogueStealth -= MathF.Round(stealthAmount, 2); + } + CheckStealth(); + FireShot(toMouse, true, ElephantKiller.stealthShotDamageMult, mode == gunState.Stealth); + } + else + { + holdoutOffset = 8; + } + SoundEngine.PlaySound(ElephantKiller.ShotFail with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + tryShooting = mode == gunState.Stealth; + } + if (throwAnimLerp >= dudFireEndPoint) + { + if (recoilLifetime < recoilLifetimeMax && mode == gunState.Stealth && recoilLifetime > 0) + time--; + else if (hasFiredBulletEver) + { + if (mode == gunState.Stealth) + { Projectile.Kill(); return; } + if (Owner.Calamity().mouseRight) + { Reset(); return; } + else + shouldDie = true; + } + } + + if (throwAnimLerp >= throwStartPoint && soundToss) + { + SoundEngine.PlaySound(ElephantKiller.Throw with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.3f, -0.2f) }, Projectile.Center); + spinFx = 0.5f; + spinFxOn = true; + soundToss = false; + } + if (throwAnimLerp >= throwCutPoint && soundCatch) + { + soundCatch = false; + spinFxOn = false; + SoundEngine.PlaySound(ElephantKiller.Catch with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + } + + float prepThrowLerp = Utils.Remap(throwAnimLerp, dudFireEndPoint, throwStartPoint, 0, 1); + float aim = MathHelper.PiOver2 + MathHelper.PiOver4 * (prepThrowLerp < 0.5f ? (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 0, prepThrowLerp, true), 1f)) : (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 1, prepThrowLerp, true), 2.5f))); + float pullbackLerp = CalamityUtils.EaseInOutExp(Utils.Remap(throwAnimLerp, throwStartPoint, throwCutPoint, 0, 1), 2, 4); float pullback = MathHelper.Lerp(startRotation, maxRotation, pullbackLerp); + float throwForward = MathHelper.Lerp(startRotation, maxRotation, 1 - MathF.Pow(Utils.Remap(throwAnimLerp, throwCutPoint, 1, 0, 1), mode == gunState.Stealth ? 5 : 8.5f)); + + float baseRotation = (recoilLifetime > 0 ? MathHelper.PiOver2 : (throwAnimLerp > throwStartPoint ? throwAnimLerp > throwCutPoint ? throwForward : pullback : aim)) + recoilRotation; + float finalRotation = toMouse.ToRotation() + baseRotation * Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0); + float armRotation = finalRotation; + + float jumpLerp = Utils.Remap(throwAnimLerp, throwStartPoint, throwCutPoint, 0, 1); + float jumpMult = (jumpLerp < 0.5f ? (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 0, jumpLerp, true), 6)) : (1 - MathF.Pow(Utils.GetLerpValue(0.5f, 1, jumpLerp, true), 6))); + if (jumpMult == 0) + spinFx = 0; + Vector2 jump = Vector2.UnitY * -90 * (jumpMult); + Projectile.Center = jump + Owner.MountedCenter + (Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * (-31f + holdoutOffset) * Owner.gravDir + Vector2.UnitY.RotatedBy(armRotation + MathHelper.PiOver2 * initialDirection) * 3.5f) * Projectile.scale; + + float rotMult = 1.25f; + if (throwAnimLerp <= throwCutPoint && throwAnimLerp >= throwStartPoint) + Projectile.rotation -= 0.85f * initialDirection * (jumpMult); + else + Projectile.rotation = (toMouse.ToRotation() + -MathHelper.PiOver2 + ((baseRotation - MathHelper.PiOver2) * rotMult + MathHelper.PiOver2) * Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0)) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + if (mode == gunState.Stealth) + { + float shineLerp = Utils.Remap(throwAnimLerp, 0, dudFireEndPoint, 0, 1); + shineProgress = CalamityUtils.EaseInOutExp(shineLerp, 6, 6); + shineOpacity = soundToss ? (1 - MathF.Pow(shineLerp, 3)) : 0; + if (shineProgress > 0 && shineSound) + { + SoundEngine.PlaySound(ElephantKiller.Shine with { Volume = 0.6f, Pitch = 0f }, Projectile.Center); + shineSound = false; + } + } + + if (throwAnimLerp > 1) + { + if (mode == gunState.Stealth) + { + time = 0; + tryShooting = false; + return; + } + mode = gunState.Thrown; + Projectile.Center = Owner.MountedCenter; + Projectile.extraUpdates = 1; + spinFxOn = true; + Projectile.tileCollide = true; + Projectile.velocity = toMouse * throwSpeed; + SoundEngine.PlaySound(ElephantKiller.Throw with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + } + } + } + public void Reset() + { + resetAll = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + mode = gunState.NotThrown; + Projectile.extraUpdates = 0; + Projectile.numHits = 0; + doingFireAnimation = false; + hasFiredBulletEver = false; + firingEffectDisableTimer = 0; + throwSpeed = 0; + holdoutOffset = 0; + tryShooting = true; + soundToss = true; + resetIframes = true; + Owner.itemTime = Owner.itemAnimation = 0; + time = 0; + } + public override void AI() + { + if (hitStop > 0) + { + Projectile.timeLeft++; hitStop--; + if (hitStop == 0) { Projectile.extraUpdates = 2; } + Projectile.rotation += 0.75f * initialDirection; + return; + + } + + if (Owner.Calamity().mouseRight || rightClicking == 1) + rightClicking = 1; + else + rightClicking = 0; + if (time == 0) // On spawn + { + if (!Owner.Calamity().heldElephantKillerLastFrame) + Owner.Calamity().rogueStealth = 0; + + resetAll = false; + bool canStealth = Owner.Calamity().StealthStrikeAvailable(); + if (canStealth) + Projectile.Calamity().stealthStrike = true; + mode = (canStealth && rightClicking == 0) ? gunState.Stealth : gunState.NotThrown; + throwSpeed = Owner.HeldItem.shootSpeed * Owner.Calamity().rogueVelocity; + animationTimeMax = (int)((Owner.HeldItem.useAnimation * 2) / Owner.GetTotalAttackSpeed()); + returnTime = 30 + animationTimeMax; + } + if (doingFireAnimation && firingEffectDisableTimer < disableTimerMax) + { + firingEffectDisableTimer++; + spinFx = 0; + Lighting.AddLight(Projectile.Center, Color.Khaki.ToVector3() * 0.9f); + } + if (firingEffectDisableTimer >= disableTimerMax) + { + doingFireAnimation = false; + if (mode == gunState.Stealth) + recoilRotation = 0.001f; + else + recoilRotation = -MathHelper.PiOver4 / 2; + firingEffectDisableTimer = 0; + } + + Vector2 toMouse = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld); + + Held(toMouse, returnTime, animationTimeMax); + + Thrown(toMouse, returnTime, animationTimeMax); + + if (resetAll) + return; + + if (Projectile.soundDelay <= 0 && spinFx > 0.3f) // Spin sounds + { + SoundEngine.PlaySound(ElephantKiller.Woosh with { Volume = 0.3f, MaxInstances = -1, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + Projectile.soundDelay = 4 * Projectile.MaxUpdates; + } + + holdoutOffset = MathHelper.Lerp(holdoutOffset, 0, 0.185f); + if (recoilRotation != 0) + recoilRotation = MathHelper.Lerp(recoilRotation, mode == gunState.Stealth ? (-MathHelper.PiOver4 * (1.3f + 0.03f * recoilLifetime)) : 0, 0.245f); + if (!doingFireAnimation) + spinFx = MathHelper.Lerp(spinFx, spinFxOn ? 1 : 0, 0.28f); + Projectile.scale = MathHelper.Lerp(Projectile.scale, shouldDie ? 0 : 1, 0.28f); + if (recoilLifetime > 0) + rumble = MathHelper.Lerp(rumble, 0, 0.06f); + if (shouldDie) + { + if (Projectile.scale <= 0.05f) + { Projectile.Kill(); return; } + time--; + } + if (tileHits >= 3) + Projectile.tileCollide = false; + + Projectile.timeLeft++; + if (recoilLifetime > 0) + recoilLifetime++; + time++; + } + public void FireShot(Vector2 velocity, bool recoil = false, float damageMult = 1, bool elephant = false) + { + holdoutOffset = 15; + Owner.SetScreenshake(3.5f + damageMult); + doingFireAnimation = true; + hasFiredBulletEver = true; + + SoundEngine.PlaySound(ElephantKiller.Shot with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) - (elephant ? 0.6f : 0), MaxInstances = 3 }, Projectile.Center); + if (elephant) + SoundEngine.PlaySound(ElephantKiller.Shot with { Volume = 0.9f, Pitch = 0.4f, MaxInstances = 3 }, Projectile.Center); + if (recoil) + Owner.velocity -= velocity * 2.25f * damageMult * (elephant ? 1.5f : 1); + + if (elephant) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.owner == Projectile.owner && projectile.active && projectile.type == ModContent.ProjectileType()) + { + projectile.timeLeft = 90; + } + } + Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, velocity * Owner.HeldItem.shootSpeed * 2, ModContent.ProjectileType(), 0, 0, Owner.whoAmI); + } + else + { + float elephantDistance = 0; + bool elephantBoosted = false; + Vector2 redirectPoint = Vector2.Zero; + Vector2 redirectVelocity = Vector2.Zero; + + // Check if you shot an elephant + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType()) + { + float _ = float.NaN; + bool elephantCollide = Collision.CheckAABBvLineCollision(projectile.Hitbox.TopLeft(), projectile.Hitbox.Size(), Projectile.Center, Projectile.Center + velocity * 2500, 10 * Projectile.scale, ref _); + if (Projectile.Hitbox.Intersects(projectile.Hitbox)) + { + elephantCollide = true; + _ = Projectile.width; + } + if (elephantCollide) + { + elephantDistance = _; + Vector2 hitPoint = Projectile.Center + velocity * _; + elephantBoosted = true; + Vector2 adjustedHitPoint = hitPoint + velocity * 15; + projectile.ai[1] = adjustedHitPoint.X; + projectile.ai[2] = adjustedHitPoint.Y; + projectile.localAI[1] = 0.5f + damageMult; + + redirectPoint = hitPoint; + NPC redirectTarget = hitPoint.ClosestNPCAt(2500, true); + redirectVelocity = redirectTarget == null ? velocity : hitPoint.DirectionTo(redirectTarget.Center); + + projectile.localAI[0] = redirectVelocity.ToRotation(); + + makeHitEffects(velocity, 2, hitPoint, projectile.whoAmI, false, 1, redirectVelocity.ToRotation()); + } + } + } + + for (int y = 0; y < (elephantBoosted ? 2 : 1); y++) + { + bool redirected = y == 1; + Vector2 lineCheckVelocity = (!redirected ? velocity : redirectVelocity); + Vector2 startPoint = (!redirected ? Projectile.Center : redirectPoint); + Vector2 endPoint = (elephantBoosted && !redirected) ? redirectPoint : (startPoint + lineCheckVelocity * 2500); + + for (int index = 0; index < Main.npc.Length; index++) + { + NPC target = Main.npc[index]; + if (!target.dontTakeDamage && target.active && target.life > 0) + { + float _ = float.NaN; + bool collides = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), startPoint, endPoint, 10 * Projectile.scale, ref _); + if (Projectile.Hitbox.Intersects(target.Hitbox)) + { + collides = true; + _ = Projectile.width; + } + if (collides) + hitNPCs.Add((target, ((!redirected ? 0 : elephantDistance) + _), redirected)); + } + } + } + bool resetHits = false; + hitNPCs = hitNPCs.OrderBy(x => x.Item2).ToList(); // Order hit NPCs by distance to hit them in order + for (int index = 0; index < hitNPCs.Count(); index++) + { + NPC target = hitNPCs.ElementAt(index).Item1; + float distance = hitNPCs.ElementAt(index).Item2; + bool isAfterElephantHit = hitNPCs.ElementAt(index).Item3; + + if (isAfterElephantHit && !resetHits) // Getting the redirect resets num hits + { resetHits = true; Projectile.numHits = 0; } + + float minMult = 0.1f; + int hitsToMinMult = 4; + float damageFalloff = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float adjustedDamageMult = damageMult * damageFalloff; + + Vector2 vel = (isAfterElephantHit ? redirectVelocity : velocity); + + Vector2 hitPoint = (isAfterElephantHit ? redirectPoint : Projectile.Center) + vel * (distance - (isAfterElephantHit ? elephantDistance : 0)); // maybe here? + + int damage = (int)((Projectile.damage / 2) * (isAfterElephantHit ? ElephantKiller.elephantBoostedShotDamageMult * adjustedDamageMult : adjustedDamageMult)); // Bullets deal half of gun damage, but always crit + Projectile bullet = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Owner.whoAmI, target.whoAmI); + bullet.DamageType = RogueDamageClass.Instance; + bullet.Calamity().stealthStrike = isAfterElephantHit; // Turn bullets shot through the Elephant into stealth strikes + + makeHitEffects(vel, adjustedDamageMult, hitPoint, elephantBoosted: isAfterElephantHit, effectMult: damageFalloff); + + Projectile.numHits++; + } + hitNPCs.Clear(); + } + } + public void makeHitEffects(Vector2 velocity, float damageMult, Vector2 hitPoint, int shotElephantID = -50, bool elephantBoosted = false, float effectMult = 1, float exitAngle = -1000) + { + bool shotElephant = shotElephantID != -50; + bool blue = (shotElephant || !ChildSafety.Disabled); + Color flashColor = (elephantBoosted || shotElephant) ? Color.CornflowerBlue : Color.Khaki; + if (elephantBoosted) + { + velocity *= 1.3f; + Owner.SetScreenshake(6f); + + for (int i = 0; i < (damageMult == ElephantKiller.stealthShotDamageMult ? 2 : 1); i++) + SoundEngine.PlaySound(ElephantKiller.BoostedShotHit with { Volume = 0.2f + 0.8f * effectMult, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) - 0.5f * (1 - effectMult), MaxInstances = -1 }, hitPoint); + } + for (int y = 0; y < ((shotElephant || elephantBoosted) ? 2 : 1); y++) + { + if (y == 1 && shotElephant) + { + velocity = exitAngle.ToRotationVector2(); + if (!elephantBoosted) + { + float lastCollisionDistance = float.NaN; + Projectile elephant = Main.projectile[shotElephantID]; + Vector2 lineStartPoint = hitPoint + velocity.SafeNormalize(Vector2.UnitX) * 600; + bool collides = Collision.CheckAABBvLineCollision(elephant.Hitbox.TopLeft(), elephant.Hitbox.Size(), lineStartPoint, hitPoint, 10 * Projectile.scale, ref lastCollisionDistance); + + hitPoint = lineStartPoint - velocity.SafeNormalize(Vector2.UnitX) * lastCollisionDistance; + } + velocity *= -1; + } + Vector2 displayHitPoint = hitPoint; + if (y == 0) + { + Particle bloom = new CustomSpark(displayHitPoint - velocity * 8, Vector2.Zero, "CalamityMod/Particles/BrightFlash", false, Main.rand.Next(7, 8 + 1), Main.rand.NextFloat(0.3f, 0.35f) * 1.5f * damageMult, flashColor, new Vector2(1f, 1f), true, true, glowOpacity: 0.7f, colorFadeSpeed: 10, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(bloom, true); + } + if (elephantBoosted && y == 0) + { + Vector2 spawnPoint = displayHitPoint - velocity.SafeNormalize(Vector2.UnitX) * 16; + float spins = Main.rand.NextFloat(0.02f, 0.06f) * (Main.rand.NextBool() ? 1 : -1); + for (int i = 0; i <= 1; i++) // twice + { + Particle bloom2 = new CustomSpark(spawnPoint, Vector2.Zero, "CalamityMod/Particles/HalfStar", false, 10, 4f * damageMult, flashColor, new Vector2(1.5f, 0.4f), true, true, glowOpacity: 0.7f, colorFadeSpeed: 10, shrinkSpeed: 1.5f, extraRotation: MathHelper.PiOver2 * i, spin: spins); + GeneralParticleHandler.SpawnParticle(bloom2, true); + } + float scale = 0.01f; + Particle pulse = new CustomPulse(spawnPoint, Vector2.Zero, flashColor, "CalamityMod/Particles/HigResThinCircle", Vector2.One, 0, damageMult * scale, 4f * damageMult * scale, 35); + GeneralParticleHandler.SpawnParticle(pulse, true); + Particle pulse2 = new CustomPulse(spawnPoint, Vector2.Zero, Color.SkyBlue, "CalamityMod/Particles/HigResThinCircle", Vector2.One, 0, damageMult * scale, 6f * damageMult * scale, 22); + GeneralParticleHandler.SpawnParticle(pulse2, true); + } + + if ((!shotElephant && y == 0) || (y == 1 && !elephantBoosted)) + { + for (int i = 0; i < (int)(12 * damageMult); i++) + { + Vector2 bloodVel = !shotElephant ? velocity : -velocity; + Color clr = blue ? (Main.rand.NextBool(3) ? Color.SkyBlue : Color.CornflowerBlue) : (Main.rand.NextBool(3) ? Color.DarkRed : Color.Maroon); + + int dustType = blue ? ModContent.DustType() : DustID.Blood; + bool spread = Main.rand.NextBool(); + Vector2 dustVel = bloodVel.RotatedBy(spread ? ((Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.2f, 0.6f)) : 0) * Main.rand.NextFloat(8.5f, 18.5f) * damageMult * (spread ? 0.6f : 1); + Dust dust = Dust.NewDustPerfect(displayHitPoint + (spread? Vector2.Zero : Main.rand.NextVector2Circular(6, 6)) * damageMult, dustType, dustVel, Main.rand.Next(10, 120), default, Main.rand.NextFloat(0.9f, 1.4f) * damageMult); + dust.noGravity = true; + if (blue) + { + dust.alpha = 200; + dust.scale *= 0.75f; + dust.fadeIn = 2.5f; + dust.color = clr; + dust.noLight = true; + dust.noLightEmittence = true; + } + float speedMult = Main.rand.NextFloat(0, 1f); + + Particle spark = new CustomSpark(displayHitPoint, bloodVel.RotateRandom((1 - speedMult) * 0.12f) * 10 * (speedMult + 0.25f) * damageMult, "CalamityMod/Particles/" + (Main.rand.NextBool() ? "FadeLine" : "GlowOrbParticle"), false, Main.rand.Next(7, 11 + 1), Main.rand.NextFloat(0.2f, 0.4f) * 2f * damageMult, clr, new Vector2(1.5f, 1f), blue, shrinkSpeed: 0.6f, colorFadeSpeed: 10, affectedByLight: !blue); + GeneralParticleHandler.SpawnParticle(spark, true); + } + } + + int effects = 4; + for (int i = -effects; i <= effects; i++) + { + if (i == 0) i++; + bool glow = MathF.Abs(i) == 2; + Color clr = shotElephant ? (Main.rand.NextBool(3, 4) ? Color.DodgerBlue : Color.CornflowerBlue) : (Main.rand.NextBool(3, 4) ? new Color(114, 112, 116) : new Color(216, 216, 216)); + Vector2 vel = -velocity.RotatedBy(MathHelper.PiOver2 * (elephantBoosted ? 0.1f : 0.4f) * (y == 1 ? 0.25f : 1) * Math.Sign(i)).RotatedByRandom(glow ? 0 : 0.35f) * Main.rand.NextFloat(5, 14); + Particle spark = new CustomSpark(displayHitPoint + vel * (glow ? 5f : 3f) * damageMult, vel * (y == 1 ? 1.5f : 1), "CalamityMod/Particles/" + (!glow ? "FadeLine" : "ForwardSmear"), false, (int)(Main.rand.Next(29, 35 + 1) * (glow ? 0.3f : 1)), + Main.rand.NextFloat(0.2f, 0.3f) * (glow ? 0.3f : 2f) * damageMult, glow ? flashColor : clr, new Vector2(glow ? 1.5f : 0.6f, 1f), glow || shotElephant, shrinkSpeed: glow ? 0.7f : 0.35f, colorFadeSpeed: 10); + GeneralParticleHandler.SpawnParticle(spark, true); + } + } + } + public void CheckStealth() + { + if (Owner.Calamity().rogueStealth > Owner.Calamity().rogueStealthMax) + Owner.Calamity().rogueStealth = Owner.Calamity().rogueStealthMax; + if (Owner.Calamity().rogueStealth < 0) + Owner.Calamity().rogueStealth = 0; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + { + if (tileHits == 0) + { + throwCollideEffects(); + Projectile.extraUpdates = 0; + setReturnTime = true; + mode = gunState.Returning; + Projectile.velocity = new Vector2(-Math.Sign(Projectile.Center.DirectionTo(target.Center).X) * Projectile.velocity.Length() / 2, -18 * Math.Sign(Projectile.Center.DirectionTo(target.Center).Y)); + } + Owner.Calamity().rogueStealth += MathF.Round(Owner.Calamity().rogueStealthMax * ElephantKiller.stealthGainOnThrowHit, 2); // Give stealth on hit + CheckStealth(); + } + } + public void throwCollideEffects() + { + hitStop = Math.Max(6 - tileHits * 2, 0); + if (hitStop >= 2) + { + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, new Color(114, 112, 116), "CalamityMod/Particles/HigResThinCircle", Vector2.One, 0, 0.04f, 0.05f, hitStop, false); + GeneralParticleHandler.SpawnParticle(pulse, true); + } + + SoundEngine.PlaySound(ElephantKiller.Hit with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) + tileHits * 0.1f, MaxInstances = -1 }, Projectile.Center); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + throwCollideEffects(); + tileHits++; + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float damageMult = MathHelper.Clamp(Utils.GetLerpValue(8, 1, Projectile.numHits), 0.4f, 1); + modifiers.SourceDamage *= damageMult; + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = doingFireAnimation ? GunFlash : Gun; + Asset smear = Smear; + Asset flash = Bloom; + Asset flashTip = BloomLine; + Asset shineTip = Shine; + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + Main.rand.NextVector2Circular(rumble, rumble) + + ((mode == gunState.NotThrown || mode == gunState.Stealth) ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); + PixelationManager.AddPixelatedDrawer((_) => // The spinnging smear when thrown + { + if (spinFx > 0.001f) + { + float scale = 0.19f; + Color dark = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).MultiplyRGB(new Color(24, 20, 37)); + Color light = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).MultiplyRGB(new Color(114, 112, 116)); + Color shine = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).MultiplyRGB(new Color(216, 216, 216)); + Main.EntitySpriteDraw(smear.Value, generalDrawPos, null, light * spinFx, Projectile.rotation * Main.rand.NextFloat(3.9f, 4.2f), smear.Size() * 0.5f, Projectile.scale * 0.55f * scale * Main.rand.NextFloat(0.95f, 1.05f), SpriteEffects.None); + Main.EntitySpriteDraw(smear.Value, generalDrawPos, null, shine * spinFx, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), smear.Size() * 0.5f, Projectile.scale * 0.45f * scale, SpriteEffects.None); + Main.EntitySpriteDraw(smear.Value, generalDrawPos, null, dark * spinFx, Projectile.rotation * Main.rand.NextFloat(0.7f, 0.8f), smear.Size() * 0.5f, Projectile.scale * 0.4f * scale * Main.rand.NextFloat(0.95f, 1.05f), SpriteEffects.None); + } + }, Enums.GeneralDrawLayer.BeforeProjectiles, BlendState.NonPremultiplied); + + Main.EntitySpriteDraw(tex.Value, generalDrawPos + Main.rand.NextVector2Circular(hitStop * 2, hitStop * 2), null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, initialDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + + if (doingFireAnimation) // The muzzle flash effect when firing + { + PixelationManager.AddPixelatedDrawer((_) => + { + float scale = (0.35f + firingEffectDisableTimer * 0.22f) * (mode == gunState.Stealth ? 2 : 1); + float flashFade = !doingFireAnimation ? 0 : MathF.Pow(Utils.GetLerpValue(disableTimerMax, 0, firingEffectDisableTimer, true), 3); + float flashMult = Utils.GetLerpValue(0, disableTimerMax, firingEffectDisableTimer, true) * 5; + + Vector2 vel = Projectile.rotation.ToRotationVector2(); + Vector2 gunTipPostion = generalDrawPos + vel * (30 + flashMult * 4.5f) - vel.RotatedBy(MathHelper.PiOver2 * initialDirection) * 5; + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(flash.Value, gunTipPostion, null, Color.Khaki with { A = 0 } * 0.8f * Utils.GetLerpValue(disableTimerMax, 0, firingEffectDisableTimer, true), Projectile.rotation, flash.Size() * 0.5f, Projectile.scale * scale * (i == 0 ? 1 : 0.75f), SpriteEffects.None); + for (int i = -1; i <= 1; i++) // 3 + { + Vector2 squash = new Vector2(0.9f * flashFade, 0.9f + 0.9f * (1 - flashFade) - Math.Abs(i) * 0.45f) * 0.15f; + Main.EntitySpriteDraw(flashTip.Value, gunTipPostion, null, Color.Khaki with { A = 0 } * (0.6f - 0.15f * flashMult), Projectile.rotation + MathHelper.PiOver2 + MathHelper.PiOver4 * i * flashFade, new Vector2(flashTip.Width() / 2, flashTip.Height()), squash * Projectile.scale * scale, SpriteEffects.None); + } + }, Enums.GeneralDrawLayer.AfterProjectiles, default); + } + if (mode == gunState.Stealth) // The shine effect that occurs before firing an elephant + { + PixelationManager.AddPixelatedDrawer((_) => + { + float scale = 0.5f + 1.3f * shineProgress; + + Vector2 vel = Projectile.rotation.ToRotationVector2(); + Vector2 gunTipPostion = generalDrawPos + vel * (MathHelper.Lerp(-15, 30, shineProgress)) - vel.RotatedBy(MathHelper.PiOver2 * initialDirection) * 9; + + for (int i = -1; i <= 1; i++) + { + Vector2 squash = new Vector2(1f - 0.7f * i * shineProgress, 1 + 0.7f * i * shineProgress) * scale; + Main.EntitySpriteDraw(shineTip.Value, gunTipPostion, null, (i == 0 ? Color.White : new Color(216, 216, 216)) with { A = 0 } * 0.8f * shineOpacity, Projectile.rotation + MathHelper.Pi * shineProgress, shineTip.Size() * 0.5f, squash * Projectile.scale * (i == 0 ? 0.5f : 1f), SpriteEffects.None); + } + }, Enums.GeneralDrawLayer.AfterEverything, default); + } + + return false; + } + } +} diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 6ea396fde9..b6b8a1e678 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -439,6 +439,8 @@ namespace CalamityMod.Projectiles.Rogue Asset glowBottom = ModContent.Request("CalamityMod/Particles/SquareRotated"); Asset woosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + Vector2 drawAdjust = -Main.screenPosition + (!flung ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); + if (hitTiles || falling || stealth) { for (int i = 0; i < 25; i++) @@ -446,7 +448,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 drawPos = Projectile.Center; Color auraColor = glowColor with { A = 0 } * 0.05f * glowUp; Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * glowUp * 2; - Main.EntitySpriteDraw(tex, drawPos - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(6, 6) * (1 - glowUp), null, auraColor with { A = 0 } * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(tex, drawPos + drawAdjust + drawOffset + Main.rand.NextVector2Circular(6, 6) * (1 - glowUp), null, auraColor with { A = 0 } * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } } if (stealth) @@ -458,19 +460,19 @@ namespace CalamityMod.Projectiles.Rogue if (i == 0 && Projectile.timeLeft > 240) { - Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.45f * throwCompletion, SpriteEffects.None, 0); - Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.41f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center + drawAdjust, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.45f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center + drawAdjust, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.41f * throwCompletion, SpriteEffects.None, 0); } for (int y = 0; y < 2; y++) - Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(glowBlade.Value, fxPos + drawAdjust, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); float softGlowUp = (float)Math.Pow(glowUp, 0.15f); for (int y = 0; y < 3; y++) - Main.EntitySpriteDraw(glowBottom.Value, fxPos - Main.screenPosition - fxVel * 0.55f, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.1f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBottom.Size() / 2f, new Vector2(1f * (y != 0 ? 0.65f : 1f) * softGlowUp, 1.7f * throwCompletion * softGlowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * (y == 2 ? 0.3f : 0.25f), SpriteEffects.None, 0); + Main.EntitySpriteDraw(glowBottom.Value, fxPos + drawAdjust - fxVel * 0.55f, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.1f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBottom.Size() / 2f, new Vector2(1f * (y != 0 ? 0.65f : 1f) * softGlowUp, 1.7f * throwCompletion * softGlowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * (y == 2 ? 0.3f : 0.25f), SpriteEffects.None, 0); } } - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White with { A = 0 }, lightColor, (2 - glowUp)) * (inSky ? 0 : 1), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, Projectile.Center + drawAdjust, null, Color.Lerp(Color.White with { A = 0 }, lightColor, (2 - glowUp)) * (inSky ? 0 : 1), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Rogue/LemonNadeHoldout.cs b/Projectiles/Rogue/LemonNadeHoldout.cs index 97d11361fc..29dc08f584 100644 --- a/Projectiles/Rogue/LemonNadeHoldout.cs +++ b/Projectiles/Rogue/LemonNadeHoldout.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/LemonNade"; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => true; public override bool useMeleeSize => false; public override int swingWidth => 180; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index c223a5504f..dbdfc2fb40 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.Rogue if (!Main.npc[(int)StuckEnemyID - 1].active) { StuckEnemyID = 0; - Projectile.velocity = -Vector2.UnitY.RotatedByRandom(0.25f) * Main.rand.NextFloat(0, 1f); Projectile.tileCollide = true; + Projectile.timeLeft = ExplodeTime; return; } Projectile.Center = Main.npc[(int)StuckEnemyID - 1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; diff --git a/Projectiles/Rogue/PumpkaboomBig.cs b/Projectiles/Rogue/PumpkaboomBig.cs index 310ecffa27..2506069200 100644 --- a/Projectiles/Rogue/PumpkaboomBig.cs +++ b/Projectiles/Rogue/PumpkaboomBig.cs @@ -384,7 +384,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot); - drawPosition = grenadePos - Main.screenPosition; + drawPosition = grenadePos - Main.screenPosition + new Vector2(0, Owner.gfxOffY); drawRotation = grenadeRot + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); } diff --git a/Projectiles/Rogue/PumpkaboomSmall.cs b/Projectiles/Rogue/PumpkaboomSmall.cs index 759714363a..0186223c96 100644 --- a/Projectiles/Rogue/PumpkaboomSmall.cs +++ b/Projectiles/Rogue/PumpkaboomSmall.cs @@ -352,7 +352,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot); - drawPosition = grenadePos - Main.screenPosition; + drawPosition = grenadePos - Main.screenPosition + new Vector2(0, Owner.gfxOffY); drawRotation = grenadeRot + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); } diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 98bd094a7b..b5fd912cb6 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -269,7 +269,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Vector2 drawPos = Projectile.Center - Main.screenPosition; + Vector2 drawPos = Projectile.Center - Main.screenPosition + (!spinning ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); Asset tex = ModContent.Request(Texture); Main.EntitySpriteDraw(tex.Value, drawPos, null, spinning ? Color.White : Color.Lerp(lightColor, Color.White, Utils.GetLerpValue(0, ChargeupTime, time, true)), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 336cacc18b..609b6cc694 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -24,20 +24,24 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 45; Projectile.width = 108; Projectile.height = 108; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; + Projectile.penetrate = 5; Projectile.tileCollide = false; Projectile.timeLeft = 300; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + if (Projectile.timeLeft == 300 && Projectile.Calamity().stealthStrike) + Projectile.penetrate = 1; + Lighting.AddLight(Projectile.Center, 0.55f, 0.25f, 0f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; @@ -52,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike && Projectile.oldPos.Length != 6) Projectile.oldPos = new Vector2[6]; - if ((ShootTimer %= 5f) == 0f && !Projectile.Calamity().stealthStrike) + if ((ShootTimer %= 4f) == 0f && !Projectile.Calamity().stealthStrike) { if (Projectile.owner == Main.myPlayer) GenerateSideBullets(2, MathHelper.ToRadians(15f)); @@ -66,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 perturbedSpeed = new Vector2(-Projectile.velocity.X / 3, -Projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotationalOffset, rotationalOffset, i / (totalBullets - 1))); for (int j = 0; j < 2; j++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.03), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.035), 0f, Projectile.owner, 0f, 0f); perturbedSpeed *= 1.05f; } } @@ -97,7 +101,7 @@ namespace CalamityMod.Projectiles.Rogue nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / pointsOnStar; Vector2 start = angle.ToRotationVector2(); Vector2 end = nextAngle.ToRotationVector2(); - int pointsOnStarSegment = 18; + int pointsOnStarSegment = 12; for (int j = 0; j < pointsOnStarSegment; j++) { Vector2 shootVelocity = Vector2.Lerp(start, end, j / (float)pointsOnStarSegment) * starSpeed; @@ -122,7 +126,9 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Projectile.ExpandHitboxBy(150); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (Projectile.numHits == 0) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (!Projectile.Calamity().stealthStrike) return; diff --git a/Projectiles/Rogue/SealedSingularityHoldout.cs b/Projectiles/Rogue/SealedSingularityHoldout.cs index 3cd095f28c..69a975c80d 100644 --- a/Projectiles/Rogue/SealedSingularityHoldout.cs +++ b/Projectiles/Rogue/SealedSingularityHoldout.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => true; public override bool useMeleeSize => false; public override int swingWidth => 180; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Rogue/SupernovaHoldout.cs b/Projectiles/Rogue/SupernovaHoldout.cs index 8236645ea8..534df7e545 100644 --- a/Projectiles/Rogue/SupernovaHoldout.cs +++ b/Projectiles/Rogue/SupernovaHoldout.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova"; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => true; public override bool useMeleeSize => false; public override int swingWidth => 180; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Summon/SarosEclipseBeam.cs b/Projectiles/Summon/SarosEclipseBeam.cs index 430ead2ec3..b9442ce2e6 100644 --- a/Projectiles/Summon/SarosEclipseBeam.cs +++ b/Projectiles/Summon/SarosEclipseBeam.cs @@ -55,6 +55,8 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.timeLeft == 5 && Owner.channel) Projectile.timeLeft++; Owner.Calamity().sarosEclipseBeamUsage += 2; + if (Owner.itemTime <= 1) + Owner.itemTime++; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Summon/Shroomling.png b/Projectiles/Summon/Shroomling.png deleted file mode 100644 index d9155ae927..0000000000 Binary files a/Projectiles/Summon/Shroomling.png and /dev/null differ diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 7e07cc5f9a..ec1669addd 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Tools; using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -19,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref float time => ref Projectile.ai[0]; - public bool orbiting => Projectile.ai[1] == 0; + public bool orbiting => (Projectile.ai[1] == 0 || (Projectile.ai[1] == 1 && burstTimer > 0)); public Player Owner => Main.player[Projectile.owner]; public Vector2 goalPosition; @@ -31,53 +33,90 @@ namespace CalamityMod.Projectiles.Typeless public float speedMult = 1; public float placementMult = 1; public float orbitRot = 0; - public bool isAttacking => (burstTimer == 0 && !orbiting && Projectile.ai[1] != -1); + public float shardNumMult = 1; + public Vector2 lastPos; + public Color bColor = Color.Sienna; + public ref float debuffMult => ref Projectile.localAI[0]; + public bool isAttacking => (burstTimer <= 0 && !orbiting && Projectile.ai[1] != -1); + public override void SetStaticDefaults() // remove this + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 3; + } public override void SetDefaults() { Projectile.width = 50; Projectile.height = 50; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 4; + Projectile.extraUpdates = 3; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 230; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; Projectile.ContinuouslyUpdateDamageStats = true; } public override void AI() { + float orbitMult = Utils.Remap(Owner.ownedProjectileCounts[ModContent.ProjectileType()], + 0, 30, 0.8f, 1.35f, false); + float attackMult = MathF.Pow(1 + (Projectile.ai[1] == 1 ? (MathF.Pow(1 - Utils.GetLerpValue(0, 280, burstTimer, true), 4)) : 0) * 5, 2); + float orbit = Projectile.ai[1] == 1 ? (1 - MathF.Pow(Utils.GetLerpValue(280, 0, burstTimer, true), 4)) : 1; + float sine = (float)Math.Sin(time * 0.03f * speedMult / MathHelper.Pi); float sine2 = (float)Math.Sin(time * (0.03f * 0.5f * speedMult) / MathHelper.Pi); - float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); + // Sine number three, surely we need a third sine. You will not regret a third sine + float angleDisplacementSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * attackMult + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); + + float rate = time * 0.004f; + List eColors = new List() + { + Color.Sienna, + Color.Peru + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2)); - float shardNumMult = Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * (Owner.Calamity().profanedSoulRelicBuff ? 2 : 1); + float goalMult = (Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * orbitMult); + shardNumMult = MathHelper.Lerp(shardNumMult, goalMult, 0.01f); - float displace = new Vector2(25, 0).RotatedBy(sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine * 0.5f).ToRotation(); + float displace = new Vector2(25, 0).RotatedBy(angleDisplacementSine * 0.5f).ToRotation(); orbitRot = Utils.AngleLerp(orbitRot, displace, 0.01f); - goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult, (125 * orbitSine - 45) * shardNumMult * placementMult)).RotatedBy(orbitRot); + goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult * orbit, (125 * orbitSine - 45) * shardNumMult * placementMult * orbit)).RotatedBy(orbitRot); Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, Color.Sienna, 0.5f).ToVector3() * 0.8f); if (Owner.Calamity().rOfResilienceCooldown > 0 && Projectile.ai[1] == 0) { - burstTimer = 120; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Projectile.type && projectile.owner == Owner.whoAmI && projectile.localAI[0] == 0) + { + projectile.localAI[0] = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, RelicOfResilience.maxPowerTime, 1, 8, true); + } + } + Owner.Calamity().rOfResilienceEffect = 0; + burstTimer = 280; Projectile.ai[1] = 1; Projectile.netUpdate = true; } - if (Owner.Calamity().rOfResilienceEffect == 0 && Projectile.ai[1] == 0) + if ((Owner.Calamity().rOfResilienceEffect == 0 || (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.baseTimeMax && Owner.HeldItem.type != ModContent.ItemType())) && Projectile.ai[1] == 0) { Projectile.ai[1] = -1; - Projectile.timeLeft = 95; Projectile.velocity = Utils.DirectionTo(Projectile.Center, goalPosition) * Main.rand.NextFloat(1f, 3f); } if (time == 0) { + lastPos = Projectile.Center; relicType = Main.rand.Next(1, 6 + 1); - speedMult = (Owner.Calamity().profanedSoulRelicBuff ? Main.rand.NextFloat(0.6f, 1.5f) : Main.rand.NextFloat(0.8f, 1.2f)); + speedMult = Main.rand.NextFloat(0.8f, 1.2f); placementMult = Main.rand.NextFloat(0.75f, 1.15f); } @@ -107,63 +146,55 @@ namespace CalamityMod.Projectiles.Typeless Projectile.Opacity = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); if (Projectile.ai[1] == -1) { + if (Projectile.timeLeft > 95) + Projectile.timeLeft = 95; Projectile.velocity *= 0.98f; } else { - if (burstTimer > 0) + if (burstTimer == 0) { - Projectile.extraUpdates = 1; - Projectile.velocity *= 0.9f; - if (Utils.Distance(Projectile.Center, Owner.Center) < 15) + Projectile.Opacity = 1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()]; + + Projectile.velocity = (((MathHelper.TwoPi / projNum) * Projectile.ai[2]).ToRotationVector2()) * 15 * speedMult * Main.rand.NextFloat(0.6f, 1.2f); + Owner.SetScreenshake(5f); + + if (Projectile.ai[2] == 1) { - behind = true; - Projectile.Center = Owner.Center; + SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); + SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); } - else + for (int i = 0; i < 3; i++) { - Projectile.Center += Utils.DirectionTo(Projectile.Center, Owner.Center) * 40f * Utils.GetLerpValue(90, 0, burstTimer); - if (time % 8 == 0) - { - Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 8), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(20, 32 + 1), Main.rand.NextFloat(0.65f, 1.1f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); - GeneralParticleHandler.SpawnParticle(spark); - } + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); + dust.noGravity = Main.rand.NextBool(); + dust.scale = Main.rand.NextFloat(1.35f, 2.8f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; } burstTimer--; - if (burstTimer == 0) - { - Projectile.Opacity = 1; - - int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()] - 4; - - Projectile.velocity = ((MathHelper.TwoPi * Projectile.ai[2] / projNum).ToRotationVector2()) * 15 * speedMult; - Owner.SetScreenshake(5f); - - if (Projectile.ai[2] == 1) - { - SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); - SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); - SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); - SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); - } - for (int i = 0; i < 3; i++) - { - Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); - GeneralParticleHandler.SpawnParticle(spark); - - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); - dust.noGravity = Main.rand.NextBool(); - dust.scale = Main.rand.NextFloat(1.35f, 2.8f); - dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; - } - } - } - else - { - Projectile.velocity *= 0.97f; } + Projectile.velocity *= 0.97f; } } + + Vector2 vel = lastPos.DirectionTo(Projectile.Center); + float trailMult = MathF.Pow(Utils.GetLerpValue(15, 60, Owner.ownedProjectileCounts[ModContent.ProjectileType()], false), 0.5f); + if (trailMult > 0 && Projectile.timeLeft > 130) + { + Particle spark = new CustomSpark(Projectile.Center, vel * 3, "CalamityMod/Particles/BloomCircle", false, 5, 0.365f * Projectile.scale * trailMult, bColor * Projectile.Opacity * MathF.Min(trailMult, 1), new Vector2(1f, 1f), true, true, colorFadeSpeed: 10, glowCenterScale: 0.6f, glowOpacity: 0.8f * Projectile.Opacity * trailMult, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(spark); + spark.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles; + } + if (isAttacking && Main.rand.NextBool(4)) { Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 8f)); @@ -171,8 +202,11 @@ namespace CalamityMod.Projectiles.Typeless dust.scale = Main.rand.NextFloat(0.55f, 1.1f) * Projectile.Opacity; dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; } - - time++; + if (Projectile.FinalExtraUpdate()) + lastPos = Projectile.Center; + if (burstTimer > 0) + burstTimer--; + time += 1f * orbitMult * attackMult; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { @@ -180,13 +214,11 @@ namespace CalamityMod.Projectiles.Typeless if (crit) modifiers.SetCrit(); - modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f); + float damageMultBase = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, RelicOfResilience.maxPowerTime, RelicOfResilience.orbitDamageMult / 2, RelicOfResilience.orbitDamageMult); + modifiers.SourceDamage *= (isAttacking ? 1 : damageMultBase); + int baseDebuffTime = 150; if (isAttacking) - target.AddBuff(ModContent.BuffType(), 520); - } - public override void OnKill(int timeLeft) - { - + target.AddBuff(ModContent.BuffType(), (int)(baseDebuffTime * debuffMult)); } public override bool PreDraw(ref Color lightColor) { @@ -200,9 +232,9 @@ namespace CalamityMod.Projectiles.Typeless _ => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6").Value }; if (isAttacking) - Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); + Projectile.DrawProjectileWithBackglow(bColor with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); else - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -213,7 +245,7 @@ namespace CalamityMod.Projectiles.Typeless else overPlayers.Add(index); } - public override bool? CanDamage() => (Projectile.ai[1] == -1 || burstTimer > 0) ? false : null; + public override bool? CanDamage() => (Projectile.ai[1] == -1) ? false : null; public override void SendExtraAI(BinaryWriter writer) { diff --git a/Projectiles/Typeless/EmpyreanGlob.cs b/Projectiles/Typeless/EmpyreanGlob.cs deleted file mode 100644 index 56e03ac2c9..0000000000 --- a/Projectiles/Typeless/EmpyreanGlob.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class EmpyreanGlob : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 200; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - int ourpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, 0f, 0f, 100, default, 1f); - Main.dust[ourpleDust].noGravity = true; - Main.dust[ourpleDust].velocity *= 0f; - } - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 8f, 20f); - } - } -} diff --git a/Projectiles/Typeless/EmpyreanGlob.png b/Projectiles/Typeless/EmpyreanGlob.png deleted file mode 100644 index 1c0aafc145..0000000000 Binary files a/Projectiles/Typeless/EmpyreanGlob.png and /dev/null differ diff --git a/Projectiles/Typeless/Gunshot.cs b/Projectiles/Typeless/Gunshot.cs new file mode 100644 index 0000000000..d285b5d0c3 --- /dev/null +++ b/Projectiles/Typeless/Gunshot.cs @@ -0,0 +1,17 @@ +using CalamityMod.Utilities; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class Gunshot : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.ApplyScalingForcedCrit(Projectile); + } + + } +} diff --git a/Projectiles/Typeless/RelicGuard.cs b/Projectiles/Typeless/RelicGuard.cs index f12b5ee889..a80392ccd3 100644 --- a/Projectiles/Typeless/RelicGuard.cs +++ b/Projectiles/Typeless/RelicGuard.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -23,6 +24,10 @@ namespace CalamityMod.Projectiles.Typeless public float rot2 = 0; public Vector2 aimVel; public float xLerp = 0; + public bool fullPower = false; + public bool maxPower = false; + public Vector2 goalPos; + public float chargeScaling = 1; public override void SetDefaults() { Projectile.width = Projectile.height = 1; @@ -36,6 +41,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { float sine = (float)Math.Sin(time * 0.13f / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.13f / 2 / MathHelper.Pi); float rate = Main.GlobalTimeWrappedHourly * 2; List eColors = new List() { @@ -49,22 +55,41 @@ namespace CalamityMod.Projectiles.Typeless bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); xLerp = MathHelper.Lerp(xLerp, (30 + 10 * sine) * Math.Sign(aimVel.X), 0.05f); - Projectile.Center = Owner.MountedCenter + new Vector2(xLerp, -25 + 12 * sine); + Vector2 startPos = new Vector2(xLerp, -25 + 12 * sine); + Vector2 endPos = new Vector2(40 * sine, -125 + 40 * sine2); + goalPos = Vector2.Lerp(goalPos, fullPower ? endPos : startPos, 0.03f); + Projectile.Center = Owner.MountedCenter + goalPos; Owner.direction = Math.Sign(aimVel.X); - if (Owner.HeldItem.type == ModContent.ItemType()) + if (!Owner.dead && (Owner.HeldItem.type == ModContent.ItemType() || (Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.baseTimeMax))) Projectile.timeLeft++; else + { Projectile.Kill(); - if (Owner.dead) - Projectile.Kill(); + return; + } + + if ((!fullPower && Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.baseTimeMax) || (Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.maxPowerTime && !maxPower)) + { + if (fullPower) + maxPower = true; + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit"); + SoundEngine.PlaySound(sound with { Volume = 0.85f, Pitch = maxPower ? 0.8f : 0.6f }, Projectile.Center); + fullPower = true; + } + else if (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.baseTimeMax) + fullPower = false; + if (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.maxPowerTime) + maxPower = false; + + chargeScaling = MathHelper.Lerp(chargeScaling, maxPower ? 1.4f : fullPower ? 1.2f : 1, 0.02f); // Emit some light Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; - if (time % 2 == 0 && false) + if (time % 2 == 0 && maxPower) { Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); @@ -79,10 +104,12 @@ namespace CalamityMod.Projectiles.Typeless float adjustedRot = aimVel.ToRotation(); Projectile.rotation = Utils.AngleLerp(Projectile.rotation, adjustedRot + (MathHelper.ToRadians(90)), 0.05f); - float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); - + if (!fullPower || Owner.HeldItem.type == ModContent.ItemType()) + { + float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); + } time++; } public override bool PreDraw(ref Color lightColor) @@ -91,14 +118,16 @@ namespace CalamityMod.Projectiles.Typeless Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Color drawColor = bColor; float CDScale = Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + float overPowerScale = Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, Owner.Calamity().rOfResilienceEffect, true); + float bScale2 = 0.35f * (chargeScaling + overPowerScale * 0.5f); - for (int i = 0; i < 2; i++) + Vector2 drawPos = Projectile.Center + new Vector2(0, Owner.gfxOffY); + for (int i = 0; i < (maxPower ? 6 : fullPower ? 4 : 2); i++) { - float bScale2 = 0.55f; - Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * CDScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, drawPos - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, MathHelper.PiOver4 * (i % 2 == 0 ? 1 : -1), bTexture.Size() * 0.5f, new Vector2(1 - 0.4f * overPowerScale * (1 + i * 0.3f), 1 + 0.7f * overPowerScale * (1 + i * 0.3f)) * bScale2 * rot2 * CDScale, SpriteEffects.None, 0); } - Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale * bScale2, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, xPos: drawPos.X, yPos: drawPos.Y); return false; } public override bool? CanDamage() => false; diff --git a/Projectiles/Typeless/TransformerAura.cs b/Projectiles/Typeless/TransformerAura.cs index ded29e11c5..695a1caa17 100644 --- a/Projectiles/Typeless/TransformerAura.cs +++ b/Projectiles/Typeless/TransformerAura.cs @@ -90,19 +90,20 @@ namespace CalamityMod.Projectiles.Typeless Texture2D b2Texture = ModContent.Request("CalamityMod/Particles/Light").Value; Color drawColor = bColor; float deathLerp = (float)Math.Pow(Utils.GetLerpValue(10, 300, Projectile.timeLeft), 2); + Vector2 baseDrawPos = Owner.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); float bScale2 = 0.95f; - Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * deathLerp, 0, bTexture.Size() * 0.5f, (bScale2 * rot2 * Projectile.scale * deathLerp) + 2.5f * (fullChargeMult - 1), SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, baseDrawPos, null, drawColor with { A = 0 } * deathLerp, 0, bTexture.Size() * 0.5f, (bScale2 * rot2 * Projectile.scale * deathLerp) + 2.5f * (fullChargeMult - 1), SpriteEffects.None, 0); - Main.EntitySpriteDraw(b2Texture, Owner.Center - Main.screenPosition, null, new Color(30, 30, 30) * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 1.2f * rot2, SpriteEffects.None, 0); - Main.EntitySpriteDraw(b2Texture, Owner.Center - Main.screenPosition, null, Color.Black * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 0.8f * rot2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(b2Texture, baseDrawPos, null, new Color(30, 30, 30) * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 1.2f * rot2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(b2Texture, baseDrawPos, null, Color.Black * deathLerp, Main.rand.NextFloat(-2, 2), b2Texture.Size() * 0.5f, bScale2 * Projectile.scale * deathLerp * 0.8f * rot2, SpriteEffects.None, 0); for (int i = 0; i < 2; i++) { float subsine = rot2; float rot = (MathHelper.TwoPi * i / 3f) + Main.GlobalTimeWrappedHourly; - Main.EntitySpriteDraw(vTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.16f * deathLerp * fullChargeMult, SpriteEffects.None, 0); - Main.EntitySpriteDraw(vTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot * 2 + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.157f * deathLerp * fullChargeMult, SpriteEffects.None, 0); + Main.EntitySpriteDraw(vTexture, baseDrawPos, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.16f * deathLerp * fullChargeMult, SpriteEffects.None, 0); + Main.EntitySpriteDraw(vTexture, baseDrawPos, null, drawColor with { A = 0 } * 0.08f * deathLerp, rot * 2 + MathHelper.ToRadians(-105), vTexture.Size() * 0.5f, new Vector2(1f, 0.96f) * 0.157f * deathLerp * fullChargeMult, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Typeless/TransformerBlob.cs b/Projectiles/Typeless/TransformerBlob.cs index c9fa8c8bdc..0c0ec12e24 100644 --- a/Projectiles/Typeless/TransformerBlob.cs +++ b/Projectiles/Typeless/TransformerBlob.cs @@ -269,22 +269,25 @@ namespace CalamityMod.Projectiles.Typeless Rectangle frame = orbTexture.Frame(1, 16, 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; + Vector2 baseDrawPos = Projectile.Center - Main.screenPosition + + (poweredTimer != 0 ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); + if (powered) { Color auraColor = cl1 with { A = 0 } * poweredLerp * visualMult; for (int i = 0; i < 2; i++) { float bScale2 = 0.25f; - Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, cl2 with { A = 0 } * Utils.GetLerpValue(poweredTimerMax, 180, poweredTimer, true) * visualMult, Projectile.rotation, bTexture.Size() * 0.5f, Vector2.Lerp(new Vector2(0.6f, 1.4f), Vector2.One, MathHelper.Min(Utils.GetLerpValue(8, 15, Projectile.frame, true), Utils.GetLerpValue(8, 0, Projectile.frame, true))) * bScale2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, baseDrawPos, null, cl2 with { A = 0 } * Utils.GetLerpValue(poweredTimerMax, 180, poweredTimer, true) * visualMult, Projectile.rotation, bTexture.Size() * 0.5f, Vector2.Lerp(new Vector2(0.6f, 1.4f), Vector2.One, MathHelper.Min(Utils.GetLerpValue(8, 15, Projectile.frame, true), Utils.GetLerpValue(8, 0, Projectile.frame, true))) * bScale2 * Projectile.scale, SpriteEffects.None, 0); } } - Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition, frame, Color.White * visualMult, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(orbTexture, baseDrawPos, frame, Color.White * visualMult, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); for (int i = 0; i < 10; i++) { Color auraColor = cl1 with { A = 0 } * (powered ? (float)Math.Pow(Utils.GetLerpValue(poweredTimerMax, 20, poweredTimer, true), 3) : sine) * 0.6f * visualMult; Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 4; - Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition + drawOffset, frame, auraColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(orbTexture, baseDrawPos + drawOffset, frame, auraColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); } return false; } diff --git a/Projectiles/Typeless/TrustyOldBobber.cs b/Projectiles/Typeless/TrustyOldBobber.cs new file mode 100644 index 0000000000..fb1077d924 --- /dev/null +++ b/Projectiles/Typeless/TrustyOldBobber.cs @@ -0,0 +1,17 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class TrustyOldBobber : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.aiStyle = ProjAIStyleID.Bobber; + Projectile.bobber = true; + } + } +} diff --git a/Projectiles/Typeless/TrustyOldBobber.png b/Projectiles/Typeless/TrustyOldBobber.png new file mode 100644 index 0000000000..996e575a18 Binary files /dev/null and b/Projectiles/Typeless/TrustyOldBobber.png differ diff --git a/Projectiles/Typeless/WarbannerLight.cs b/Projectiles/Typeless/WarbannerLight.cs index e2909c78cb..49db4bfa84 100644 --- a/Projectiles/Typeless/WarbannerLight.cs +++ b/Projectiles/Typeless/WarbannerLight.cs @@ -74,15 +74,16 @@ namespace CalamityMod.Projectiles.Typeless Texture2D rTexture = ModContent.Request("CalamityMod/Particles/ShatteredExplosion").Value; Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Color drawColor = bColor; + Vector2 baseDrawPos = Owner.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); for (int i = 0; i < 5; i++) { float bScale2 = 0.75f; - Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, baseDrawPos, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * Projectile.scale, SpriteEffects.None, 0); } - Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2 * Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, baseDrawPos, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, baseDrawPos, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2 * Projectile.scale, SpriteEffects.None, 0); return false; } public override bool? CanDamage() => false; diff --git a/Projectiles/Typeless/XykWings.cs b/Projectiles/Typeless/XykWings.cs index 2cf9792eb1..e261415dfa 100644 --- a/Projectiles/Typeless/XykWings.cs +++ b/Projectiles/Typeless/XykWings.cs @@ -292,27 +292,27 @@ namespace CalamityMod.Projectiles.Typeless 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; - + Vector2 baseDrawPos = -Main.screenPosition + new Vector2(0, Owner.gfxOffY); 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); + Main.EntitySpriteDraw(glow, expectedWingPosition1 + baseDrawPos, 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 + baseDrawPos, 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, expectedWingPosition1 + baseDrawPos + 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, expectedWingPosition2 + baseDrawPos + 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, expectedWingPosition1 + baseDrawPos, 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); + Main.EntitySpriteDraw(tex, expectedWingPosition2 + baseDrawPos, 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() diff --git a/Sounds/Item/ElephantKillerBoostedShotHit.ogg b/Sounds/Item/ElephantKillerBoostedShotHit.ogg new file mode 100644 index 0000000000..87430b68b4 Binary files /dev/null and b/Sounds/Item/ElephantKillerBoostedShotHit.ogg differ diff --git a/Sounds/Item/ElephantKillerCatch.ogg b/Sounds/Item/ElephantKillerCatch.ogg new file mode 100644 index 0000000000..f34720ab13 Binary files /dev/null and b/Sounds/Item/ElephantKillerCatch.ogg differ diff --git a/Sounds/Item/ElephantKillerElephant.ogg b/Sounds/Item/ElephantKillerElephant.ogg new file mode 100644 index 0000000000..7871a03329 Binary files /dev/null and b/Sounds/Item/ElephantKillerElephant.ogg differ diff --git a/Sounds/Item/ElephantKillerHit.ogg b/Sounds/Item/ElephantKillerHit.ogg new file mode 100644 index 0000000000..3d6ffc7fd0 Binary files /dev/null and b/Sounds/Item/ElephantKillerHit.ogg differ diff --git a/Sounds/Item/ElephantKillerShine.ogg b/Sounds/Item/ElephantKillerShine.ogg new file mode 100644 index 0000000000..36407eaa87 Binary files /dev/null and b/Sounds/Item/ElephantKillerShine.ogg differ diff --git a/Sounds/Item/ElephantKillerShot.ogg b/Sounds/Item/ElephantKillerShot.ogg new file mode 100644 index 0000000000..8844b50f92 Binary files /dev/null and b/Sounds/Item/ElephantKillerShot.ogg differ diff --git a/Sounds/Item/ElephantKillerShotFail.ogg b/Sounds/Item/ElephantKillerShotFail.ogg new file mode 100644 index 0000000000..c52804336c Binary files /dev/null and b/Sounds/Item/ElephantKillerShotFail.ogg differ diff --git a/Sounds/Item/ElephantKillerThrow.ogg b/Sounds/Item/ElephantKillerThrow.ogg new file mode 100644 index 0000000000..562f022019 Binary files /dev/null and b/Sounds/Item/ElephantKillerThrow.ogg differ diff --git a/Sounds/Item/ElephantKillerWoosh.ogg b/Sounds/Item/ElephantKillerWoosh.ogg new file mode 100644 index 0000000000..2c8a5c2fda Binary files /dev/null and b/Sounds/Item/ElephantKillerWoosh.ogg differ diff --git a/Systems/Collections/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs index b6d5a71376..43746c5ce6 100644 --- a/Systems/Collections/CalamityNPCSets.cs +++ b/Systems/Collections/CalamityNPCSets.cs @@ -105,19 +105,10 @@ namespace CalamityMod.Systems.Collections /// If for an NPC type, then that NPC will have its contact damage set to 0.
/// Defaults to . ///
- public static bool[] DealsZeroContactDamage = Factory.CreateBoolSet(NPCID.Harpy, NPCID.Salamander, NPCID.Salamander2, NPCID.Salamander3, NPCID.Salamander4, NPCID.Salamander5, - NPCID.Salamander6, NPCID.Salamander7, NPCID.Salamander8, NPCID.Salamander9, NPCID.GiantCursedSkull, NPCID.FungiBulb, NPCID.GiantFungiBulb, NPCID.IcyMerman, - NPCID.AngryNimbus, NPCID.SandElemental, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, NPCID.CultistArcherBlue, NPCID.DesertDjinn, NPCID.DiabolistRed, NPCID.DiabolistWhite, - NPCID.Gastropod, NPCID.IceElemental, NPCID.IchorSticker, NPCID.Necromancer, NPCID.NecromancerArmored, NPCID.RaggedCaster, NPCID.RaggedCasterOpenCoat, NPCID.RuneWizard, - NPCID.SkeletonArcher, NPCID.SkeletonCommando, NPCID.SkeletonSniper, NPCID.TacticalSkeleton, NPCID.Clown, NPCID.GoblinArcher, NPCID.GoblinSorcerer, NPCID.GoblinSummoner, - NPCID.PirateCrossbower, NPCID.PirateDeadeye, NPCID.PirateCaptain, NPCID.SnowmanGangsta, NPCID.SnowBalla, NPCID.DrManFly, NPCID.Eyezor, NPCID.Nailhead, NPCID.BrainScrambler, - NPCID.GigaZapper, NPCID.RayGunner, NPCID.ScutlixRider, NPCID.MartianWalker, NPCID.MartianTurret, NPCID.ElfCopter, NPCID.ElfArcher, NPCID.NebulaBrain, NPCID.NebulaSoldier, - NPCID.StardustCellSmall, NPCID.StardustJellyfishBig, NPCID.StardustSoldier, NPCID.StardustSpiderBig, NPCID.VortexHornetQueen, NPCID.VortexRifleman, NPCID.VortexSoldier, + public static bool[] DealsZeroContactDamage = Factory.CreateBoolSet(NPCID.AngryNimbus, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, NPCID.DesertDjinn, NPCID.DiabolistRed, NPCID.DiabolistWhite, + NPCID.Necromancer, NPCID.NecromancerArmored, NPCID.RaggedCaster, NPCID.RaggedCasterOpenCoat, NPCID.RuneWizard, NPCID.GoblinSorcerer, NPCID.GoblinSummoner, NPCID.NebulaBrain, NPCID.PirateShipCannon, NPCID.MartianSaucer, NPCID.MartianSaucerCannon, NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.Probe, NPCID.CultistBoss, NPCID.GolemHead, - NPCID.GolemHeadFree, NPCID.MoonLordFreeEye, NPCID.BloodSquid, NPCID.PlanterasHook, NPCID.Dandelion, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2OgreT2, - NPCID.DD2OgreT3, NPCID.DD2GoblinBomberT1, NPCID.DD2GoblinBomberT2, NPCID.DD2GoblinBomberT3, NPCID.DD2JavelinstT1, NPCID.DD2JavelinstT2, NPCID.DD2JavelinstT3, - NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldFlyerT2, NPCID.DD2KoboldFlyerT3, NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, NPCID.DD2LightningBugT3, NPCID.MourningWood, NPCID.Pumpking, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.AncientDoom); + NPCID.GolemHeadFree, NPCID.MoonLordFreeEye, NPCID.BloodSquid, NPCID.PlanterasHook, NPCID.MourningWood, NPCID.Pumpking, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.AncientDoom); /// /// If for an NPC type, then that NPC will have its damage reduced by 25% if the world is in Hardmode.
diff --git a/Systems/Mechanic/TrustyOldRodEnemySystem.cs b/Systems/Mechanic/TrustyOldRodEnemySystem.cs new file mode 100644 index 0000000000..63b2c5b925 --- /dev/null +++ b/Systems/Mechanic/TrustyOldRodEnemySystem.cs @@ -0,0 +1,692 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.Deconstructors; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DraedonLabThings; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Other; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Walls.DraedonStructures; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public sealed class TrustyOldRodEnemySystem : ModSystem + { + // Spawning for Trusty Old Rod NPCs, each biome has spawns of different rarity and sometimes style + // Some spawns change with progression + public static void SpawnTrustyOldRodNPC(Player owner, int bobberWhoAmI, int rarity = 1, bool Lava = false, bool Honey = false) + { + Projectile bobber = Main.projectile[bobberWhoAmI]; + bool common = rarity == 1; + bool rare = rarity == 2; + bool ultraRare = rarity == 3; + bool hardmode = Main.hardMode; + bool postML = NPC.downedMoonlord; + int fallbackNPC = NPCID.Ghost; // If all biome checks fail, spawn a ghost + + bool night = !Main.dayTime; + bool rain = Main.raining; + bool underground = owner.ZoneDirtLayerHeight || owner.ZoneRockLayerHeight; + // 1/3 chance to use preHM spawnpool in hardmode + bool useHardmode = hardmode && Main.rand.NextBool(2, 3); + + // ReduceEnemyDrops is used for some reels that pull crazy numbers of enemies by making 1/3rd of them not drop loot + List<(int npc, int spawnCount, bool reduceEnemyDrops)> npcIDsCommon = new List<(int npc, int spawnCount, bool reduceEnemyDrops)>(); + List<(int npc, int spawnCount, bool reduceEnemyDrops)> npcIDsRare = new List<(int npc, int spawnCount, bool reduceEnemyDrops)>(); + List<(int npc, int spawnCount, bool reduceEnemyDrops)> npcIDsUltraRare = new List<(int npc, int spawnCount, bool reduceEnemyDrops)>(); + + Tile backWall = Framing.GetTileSafely((int)(owner.Center.X / 16), (int)(owner.Center.Y / 16)); + + #region GetSpawns + + if (!Honey && !Lava) + { + if (Main.bloodMoon && !underground) + { + // 5 Dripplers + if (common) { npcIDsCommon.Add((NPCID.Drippler, 5, false)); } // Common NPC/s + // 10 Blood Zombies + else if (rare) { npcIDsRare.Add((NPCID.BloodZombie, 10, false)); } // Rare NPC/s + // 1 Ravager + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + if (Main.eclipse && !underground) // Eclipse takes priority over surface spawns + { + // 1/3 chance to use the pre Plant pool instead + bool postPlant = NPC.downedPlantBoss && Main.rand.NextBool(2, 3); + bool downedMechs = NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3; + // 5 Creatures from the Eclipse, some tierlocked + int pickCommonEclipse = Main.rand.Next((downedMechs ? 0 : 1), (NPC.downedPlantBoss ? 7 : 3)) switch + { + 0 => NPCID.Reaper, // Only available post 3 mechs + + 1 => NPCID.CreatureFromTheDeep, + 2 => NPCID.ThePossessed, + + 3 => NPCID.DeadlySphere, // Only available post Plant + 4 => NPCID.DrManFly, + 5 => NPCID.Psycho, + _ => NPCID.Butcher + }; + + if (common) { npcIDsCommon.Add((pickCommonEclipse, 5, false)); } // Common NPC/s + // 8 Nailheads post Plant, otherwise 8 Vampires + else if (rare) { npcIDsRare.Add((postPlant ? NPCID.Nailhead : NPCID.Vampire, 8, false)); } // Rare NPC/s + // 5 Eyezors, 5 Mothrons post Plant + else if (ultraRare) { npcIDsUltraRare.Add((postPlant ? NPCID.Mothron : NPCID.Eyezor, 5, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneForest) + { + bool wulfrum = !night && Main.rand.NextBool(3); + int tooManyZombies = Main.rand.Next(15) switch + { + 0 => NPCID.Zombie, + 1 => NPCID.BaldZombie, + 2 => NPCID.PincushionZombie, + 3 => NPCID.SlimedZombie, + 4 => NPCID.SwampZombie, + 5 => NPCID.TwiggyZombie, + 6 => NPCID.FemaleZombie, + 7 => NPCID.TorchZombie, + 8 => NPCID.ArmedZombie, + 9 => NPCID.ArmedZombiePincussion, + 10 => NPCID.ArmedZombieSlimed, + 11 => NPCID.ArmedZombieSwamp, + 12 => NPCID.ArmedZombieTwiggy, + 13 => NPCID.ArmedZombieCenx, + _ => NPCID.ArmedTorchZombie, + }; + + // All spawns are in groups of 2 + // hardmode: Wraith or Wandering Eye, or Purple Slime if daytime + // nonHM pool: Zombie or Raincoat Zombie if raining, either Blue Slime or Green Slime if daytime or 1/3 chance for either Wulfrum Rover or Wulfrom Drone + int pickCommonForest = useHardmode ? (night ? Main.rand.NextBool() ? NPCID.Wraith : NPCID.WanderingEye : NPCID.PurpleSlime) : + (wulfrum ? Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() : + night ? rain ? NPCID.ZombieRaincoat : tooManyZombies : + Main.rand.NextBool() ? NPCID.BlueSlime : NPCID.GreenSlime); + // If hardmode and night, 1 Mimic. + // nonHM pool: 1/3 chance for 1 Wulfrum Amplifier, else if raining 1 Fearless Goldfish Warrior, otherwise 8 Zombies if night or 3 Clad Crabs if daytime + int pickRareForest = useHardmode && night ? NPCID.Mimic : + (wulfrum ? ModContent.NPCType() : rain ? ModContent.NPCType() : + night ? tooManyZombies : ModContent.NPCType()); + int pickRareForestEnemyCount = useHardmode && night ? 1 : + (night && !rain && !wulfrum) ? 8 : wulfrum || rain ? 1 : 3; + // if hardmode, 20 Mimics at night or 20 Pinkys at daytime + // nonHM pool: Eye of Cthulhu if night or King Slime if daytime, 5 if hardmode and 15 if postML + int pickUltraRareForest = useHardmode ? night ? NPCID.Mimic : NPCID.Pinky : + (night ? NPCID.EyeofCthulhu : NPCID.KingSlime); + + if (common) { npcIDsCommon.Add((pickCommonForest, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareForest, pickRareForestEnemyCount, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareForest, useHardmode ? 20 : 1, useHardmode)); } // Ultra Rare NPC/s + } + if (owner.ZoneCorrupt) + { + if (underground && hardmode) // if preHM, use the surface pool for underground + { + // 1 World Feeder + if (common) { npcIDsCommon.Add((NPCID.SeekerHead, 1, false)); } // Common NPC/s + // 3 Cursed Hammers + else if (rare) { npcIDsRare.Add((NPCID.CursedHammer, 3, false)); } // Rare NPC/s + // 20 Corrupt Mimics + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.BigMimicCorruption, 20, true)); } // Ultra Rare NPC/s + } + else + { + // 1 Devourer or 3 Corruptors if hardmode + if (common) { npcIDsCommon.Add((useHardmode ? NPCID.Corruptor : NPCID.DevourerHead, useHardmode ? 3 : 1, false)); } // Common NPC/s + // 8 Eater of Souls or 8 Slimers if hardmode + else if (rare) { npcIDsRare.Add((useHardmode ? NPCID.Slimer : NPCID.EaterofSouls, 8, false)); } // Rare NPC/s + // 1 Hive Mind + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, true)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneCrimson) + { + if (underground && hardmode) // if preHM, use the surface pool for underground + { + // 2 Ichor Stickers + if (common) { npcIDsCommon.Add((NPCID.IchorSticker, 2, false)); } // Common NPC/s + // 3 Crimson Axes + else if (rare) { npcIDsRare.Add((NPCID.CrimsonAxe, 3, false)); } // Rare NPC/s + // 20 Crimson Mimics + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.BigMimicCrimson, 20, true)); } // Ultra Rare NPC/s + } + else + { + // 3 Crimeras or 3 Herplings if hardmode + if (common) { npcIDsCommon.Add((useHardmode ? NPCID.Herpling : NPCID.Crimera, 3, false)); } // Common NPC/s + // 8 Face Monsters or 8 Crimslimes if hardmode + else if (rare) { npcIDsRare.Add((useHardmode ? NPCID.Crimslime : NPCID.FaceMonster, 8, false)); } // Rare NPC/s + // 1 Perforator Hive + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, true)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneHallow) + { + if (underground) + { + // 2 Chaos Elementals + if (common) { npcIDsCommon.Add((NPCID.ChaosElemental, 2, false)); } // Common NPC/s + // 3 Enchanted Swords + else if (rare) { npcIDsRare.Add((NPCID.EnchantedSword, 3, false)); } // Rare NPC/s + // 20 Hallowed Mimics + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.BigMimicHallow, 20, true)); } // Ultra Rare NPC/s + } + else + { + bool profaned = postML && Main.rand.NextBool(4); + // 3 Pixies at daytime, 3 Gastropods at night + if (common) { npcIDsCommon.Add((profaned ? ModContent.NPCType() : night ? NPCID.Gastropod : NPCID.Pixie, profaned ? 5 : 3, false)); } // Common NPC/s + // 3 Unicorns or 3 Rainbow Slimes if raining + else if (rare) { npcIDsRare.Add((profaned ? ModContent.NPCType() : rain ? NPCID.RainbowSlime : NPCID.Unicorn, 3, false)); } // Rare NPC/s + // 1 Queen Slime or 2/3 for 1 Empress if post Plant + else if (ultraRare) { npcIDsUltraRare.Add((profaned ? ModContent.NPCType() : NPC.downedPlantBoss && Main.rand.NextBool(2, 3) ? NPCID.HallowBoss : NPCID.QueenSlimeBoss, 1, false)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneSnow) + { + if (underground) + { + bool flinx = Main.rand.NextBool(3); + int pigron = owner.ZoneHallow ? NPCID.PigronHallow : owner.ZoneCrimson ? NPCID.PigronCrimson : owner.ZoneCorrupt ? NPCID.PigronCorruption : 0; + // 2 Undead Vikings, if hardmode 2 Ice Claspers or 2 Ice Tortoises. 2 Pigrons if also in Hallow/Corruption/Crimson + int pickRareUGSnow = (pigron != 0 && hardmode) ? pigron : (useHardmode ? (Main.rand.NextBool() ? ModContent.NPCType() : NPCID.IceTortoise) : NPCID.UndeadViking); + + // 3 Ice Bat or 1/3 for 2 Snow Flinx + if (common) { npcIDsCommon.Add((flinx ? NPCID.SnowFlinx : NPCID.IceBat, flinx ? 2 : 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareUGSnow, 2, false)); } // Rare NPC/s + // 3 Ice Mimics if hardmode, otherwise 50 Ice bats + else if (ultraRare) { npcIDsUltraRare.Add((!hardmode ? NPCID.IceBat : NPCID.IceMimic, !hardmode ? 50 : 3, !hardmode)); } // Ultra Rare NPC/s + } + else + { + // If hardmode 2 Ice Elementals if night or 2 Aurora Spirits if day, otherwise 2 Frozen Zombies if night or 2 Ice Slimes if day + int pickCommonSnow = useHardmode ? (night ? NPCID.IceElemental : ModContent.NPCType()) : night ? NPCID.ZombieEskimo : NPCID.IceSlime; + // If hardmode and blizzard 1 Ice Golem, otherwise 3 Cryons if hardmode or 3 Rimehounds in preHM + int pickRareSnow = hardmode && rain ? NPCID.IceGolem : useHardmode ? ModContent.NPCType() : ModContent.NPCType(); + + if (common) { npcIDsCommon.Add((pickCommonSnow, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareSnow, (hardmode && rain) ? 1 : 3, false)); } // Rare NPC/s + // 50 Snow Flinx preHM, 1 Cryogen in harmdode + else if (ultraRare) { npcIDsUltraRare.Add((useHardmode ? ModContent.NPCType() : NPCID.SnowFlinx, useHardmode ? 1 : 50, (!postML && !useHardmode))); } // Ultra Rare NPC/s + } + } + if (owner.ZoneUndergroundDesert) + { + bool golferCheck = !NPC.savedGolfer && !NPC.AnyNPCs(NPCID.GolferRescue); + int ghoul = owner.ZoneHallow ? NPCID.DesertGhoulHallow : owner.ZoneCrimson ? NPCID.DesertGhoulCrimson : owner.ZoneCorrupt ? NPCID.DesertGhoulCorruption : NPCID.DesertGhoul; + + // 1/4 for 10 Antlion Larva, otherwise either 2 Antlion Swarmers, 2 Antlion Chargers, or 2 Stormlions + bool larva = Main.rand.NextBool(4); + int pickCommonUGDesert = larva ? NPCID.LarvaeAntlion : Main.rand.Next(3) switch + { + 0 => NPCID.GiantWalkingAntlion, + 1 => NPCID.GiantFlyingAntlion, + _ => ModContent.NPCType() + }; + // Golfer if he hasn't been saved, either 2 Ghouls (sub-biome dependant) or 2 Lamias (sub-biome dependant) if hardmode, otherwise Tomb Crawler + int pickRareUGDesert = golferCheck ? NPCID.GolferRescue : !useHardmode ? NPCID.TombCrawlerHead : + Main.rand.NextBool() ? ghoul : ((owner.ZoneCorrupt || owner.ZoneCrimson) ? NPCID.DesertLamiaDark : NPCID.DesertLamiaLight); + + if (common) { npcIDsCommon.Add((pickCommonUGDesert, larva ? 10 : 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareUGDesert, golferCheck || !useHardmode ? 1 : 2, false)); } // Rare NPC/s + // 1 Desert Scourge + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneDesert) + { + bool sandstorm = Sandstorm.Happening; + int mummy = owner.ZoneHallow ? NPCID.LightMummy : owner.ZoneCrimson ? NPCID.BloodMummy : owner.ZoneCorrupt ? NPCID.DarkMummy : NPCID.Mummy; + int sandShark = owner.Calamity().ZoneAstral ? ModContent.NPCType() : owner.ZoneHallow ? NPCID.SandsharkHallow : owner.ZoneCrimson ? NPCID.SandsharkCrimson : owner.ZoneCorrupt ? NPCID.SandsharkCorrupt : NPCID.SandShark; + // 2 Sand Sharks if hardmode sandstorm (sub-biome dependant), otherwise 2 Angry Tumblers. + // If no sandstorm 2 Mummys (sub-biome dependant) in hardmode, otherwise 2 Vultures (Hadarians if in Astral) + int pickCommonDesert = sandstorm ? (useHardmode ? sandShark : NPCID.Tumbleweed) : + useHardmode ? mummy : owner.Calamity().ZoneAstral ? ModContent.NPCType() : NPCID.Vulture; + // Sand Elemental if hardmode sandstorm, otherwise 5 Angry Tumblers. If no sandstorm 5 Antlion Chargers or 5 Antlion Swarmers + int pickRareDesert = sandstorm ? (hardmode ? NPCID.SandElemental : NPCID.Tumbleweed) : + Main.rand.NextBool() ? NPCID.WalkingAntlion : NPCID.FlyingAntlion; + + if (common) { npcIDsCommon.Add((pickCommonDesert, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareDesert, sandstorm && hardmode ? 1 : 5, false)); } // Rare NPC/s + // 3 Cnidrions or 3 Great Sand Sharks if post Plant + else if (ultraRare) { npcIDsUltraRare.Add((NPC.downedPlantBoss ? ModContent.NPCType() : ModContent.NPCType(), 3, false)); } // Ultra Rare NPC/s + } + if (owner.ZoneBeach && !owner.Calamity().ZoneSulphur) + { + // 2 Squid, Sea Snails, or Sharks. Can also be Mantis Shrimp post Plant + int pickRareOcean = Main.rand.Next(3 + (hardmode ? 1 : 0)) switch + { + 0 => NPCID.Squid, + 1 => NPCID.SeaSnail, + 2 => NPCID.Shark, + _ => ModContent.NPCType() + }; + // 2 Pink Jellyfish or Crabs + if (common) { npcIDsCommon.Add((Main.rand.NextBool() ? NPCID.PinkJellyfish : NPCID.Crab, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareOcean, 2, false)); } // Rare NPC/s + // 1 Anahita + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else if (owner.Calamity().ZoneSulphur) + { + bool acidRain = AcidRainEvent.AcidRainEventIsOngoing; + bool tier3 = DownedBossSystem.downedPolterghast; + bool tier2 = tier3 || DownedBossSystem.downedAquaticScourge; + // In Acid Rain 1/3 for 3 Gamma Slimes if tier 3, else pulls from the tier 2 enemy list and then tier 1. + // If no Acid Rain, spawns 3 Trashers, Gnashers, or Aquatic Urchins + int pickCommonSulphor = Main.rand.Next(3) switch + { + 0 => acidRain ? (tier3 ? ModContent.NPCType() : tier2 ? ModContent.NPCType() : ModContent.NPCType()) : ModContent.NPCType(), + 1 => acidRain ? (tier2 ? ModContent.NPCType() : ModContent.NPCType()) : ModContent.NPCType(), + _ => acidRain ? (tier2 ? ModContent.NPCType() : ModContent.NPCType()) : ModContent.NPCType(), + }; + // 50% chance to use an abyss pool instead for rare pulls (when not acid rain) + bool abyssSpawns = Main.rand.NextBool(); + // In Acid Rain if tier 3 pulls 1 Mauler or Nuclear Terror. If tier 2, pulls 1 Cragmaw Mire, or Acid Eel if tier 1 + // If no Acid Rain either Anthozoan Crab or Belching Coral if post Aquatic Scourge, otherwise either Viperfish or Giant Squid + int pickRareSulphor = acidRain ? (tier3 ? Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() : + tier2 ? ModContent.NPCType() : ModContent.NPCType()) : + (tier2 ? Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType() : ModContent.NPCType()); + // Post Polter 1/3 chance for Reaper Shark or Eidolon Wyrm, else 1/2 chance for 3 Devil Fish or 3 Chaotic Puffer, else 3 Viperfish or 3 Cuttlefish + bool bigAbyssSpawn = Main.rand.NextBool(3); + int pickRareSulphorAbyss = tier3 && bigAbyssSpawn ? (Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()) : + tier2 && Main.rand.NextBool() ? (Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()) : + (Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()); + + bool spawnSingular = (acidRain && (tier2 || tier3)) || (bigAbyssSpawn && abyssSpawns); + if (common) { npcIDsCommon.Add((pickCommonSulphor, 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add(((abyssSpawns && !acidRain) ? pickRareSulphorAbyss : pickRareSulphor, spawnSingular ? 1 : 3, false)); } // Rare NPC/s + // Primordial Wyrm + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + if (owner.ZoneDungeon) + { + bool postPlantDungeon = NPC.downedPlantBoss && Main.rand.NextBool(3, 4); + bool tileWall = backWall.WallType == WallID.PinkDungeonTileUnsafe || backWall.WallType == WallID.GreenDungeonTileUnsafe || backWall.WallType == WallID.BlueDungeonTileUnsafe; + bool slabWall = backWall.WallType == WallID.PinkDungeonSlabUnsafe || backWall.WallType == WallID.GreenDungeonSlabUnsafe || backWall.WallType == WallID.BlueDungeonSlabUnsafe; + bool brickWall = backWall.WallType == WallID.PinkDungeonUnsafe || backWall.WallType == WallID.GreenDungeonUnsafe || backWall.WallType == WallID.BlueDungeonUnsafe; + + int tooManyAngryBones = Main.rand.Next(4) switch + { + 0 => NPCID.AngryBones, + 1 => NPCID.AngryBonesBig, + 2 => NPCID.AngryBonesBigMuscle, + _ => NPCID.AngryBonesBigHelmet, + }; + int tooManyBlueBones = Main.rand.Next(4) switch + { + 0 => NPCID.BlueArmoredBones, + 1 => NPCID.BlueArmoredBonesMace, + 2 => NPCID.BlueArmoredBonesNoPants, + _ => NPCID.BlueArmoredBonesSword, + }; + int tooManyHellBones = Main.rand.Next(4) switch + { + 0 => NPCID.HellArmoredBones, + 1 => NPCID.HellArmoredBonesMace, + 2 => NPCID.HellArmoredBonesSpikeShield, + _ => NPCID.HellArmoredBonesSword, + }; + int tooManyRustyBones = Main.rand.Next(4) switch + { + 0 => NPCID.RustyArmoredBonesAxe, + 1 => NPCID.RustyArmoredBonesFlail, + 2 => NPCID.RustyArmoredBonesSword, + _ => NPCID.RustyArmoredBonesSwordNoArmor, + }; + + // 3 of the basic "Bones" type enemy for the dungeon wall type. 3 Angry bones pre Plant (or if somehow another wall type) + int pickCommonDungeon = !postPlantDungeon ? tooManyAngryBones : + brickWall ? tooManyBlueBones : tileWall ? tooManyHellBones : slabWall ? tooManyRustyBones : tooManyAngryBones; + // 2 Dark Casters or Cursed Skulls, if post Plant instead get either a 2 "Skeleton Mages" or 2 "Skeleton Rangers" based on background wall + bool getMage = Main.rand.NextBool(); + int pickRareDungeon = !postPlantDungeon ? (Main.rand.NextBool() ? NPCID.DarkCaster : NPCID.CursedSkull) : !getMage ? (tileWall ? NPCID.TacticalSkeleton : slabWall ? NPCID.SkeletonSniper : brickWall ? NPCID.SkeletonCommando : tooManyAngryBones) : + (tileWall ? Main.rand.NextBool() ? NPCID.DiabolistWhite : NPCID.DiabolistRed : + slabWall ? Main.rand.NextBool() ? NPCID.RaggedCaster : NPCID.RaggedCasterOpenCoat : + brickWall ? Main.rand.NextBool() ? NPCID.Necromancer : NPCID.NecromancerArmored : tooManyAngryBones); + // 10 Dungeon Slimes pre Plant, 1 Cultist post Plant, 1 Polterghast postML + int pickUltraRareDungeon = postML ? ModContent.NPCType() : postPlantDungeon ? NPCID.CultistBoss : NPCID.DungeonSlime; + + if (common) { npcIDsCommon.Add((pickCommonDungeon, 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareDungeon, 2, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareDungeon, (postML || postPlantDungeon) ? 1 : 10, false)); } // Ultra Rare NPC/s + } + if (owner.ZoneSkyHeight) + { + bool probe = NPC.downedGolemBoss && Main.rand.NextBool(10); + bool shuttle = hardmode && Main.rand.NextBool(4); + // 1/10 to be Martian Probe post Golem, otherwise if hardmode a 1/4 to be 3 Shockstorm Shuttles, otherwise 1 Wyvern or 1 Cloud Elemental if it's also raining. 7 Harpys if preHM + int pickRareSky = probe ? NPCID.MartianProbe : hardmode ? Main.raining ? ModContent.NPCType() : + shuttle ? ModContent.NPCType() : NPCID.WyvernHead : NPCID.Harpy; + + // 1/4 to be 3 Harpys, otherwise 3 Sunskaters + if (common) { npcIDsCommon.Add((Main.rand.NextBool(4) ? NPCID.Harpy : ModContent.NPCType(), 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareSky, ((hardmode && !shuttle) || (hardmode && Main.raining) || probe) ? 1 : shuttle ? 3 : 7, false)); } // Rare NPC/s + // 100 Sunskaters + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 100, true)); } // Ultra Rare NPC/s + } + if (backWall.WallType == WallID.SpiderUnsafe && underground) // Spider caves (Priority over Caverns and Mushroom and Granite/Marble) + { + bool stylistCheck = !NPC.savedStylist && !NPC.AnyNPCs(NPCID.WebbedStylist); + // Astralachnea/Blood Crawlers always take the place of normal spiders if in Astral/Crimson + int pickASpider = owner.Calamity().ZoneAstral ? ModContent.NPCType() : owner.ZoneCrimson ? NPCID.BloodCrawler : useHardmode ? NPCID.BlackRecluse : NPCID.WallCreeper; + // 2 Wall Creepers/Black Recluses (HM) + if (common) { npcIDsCommon.Add((pickASpider, 2, false)); }// Common NPC/s + // Stylist if she hasn't been saved, otherwise 10 Wall Creepers/Black Recluses (HM) + else if (rare) { npcIDsRare.Add((stylistCheck ? NPCID.WebbedStylist : pickASpider, stylistCheck ? 1 : 10, false)); } // Rare NPC/s + // 100 Wall Creepers/Black Recluses (HM), always Black Recluses in hardmode + else if (ultraRare) { npcIDsUltraRare.Add((owner.Calamity().ZoneAstral ? ModContent.NPCType() : hardmode ? NPCID.BlackRecluse : NPCID.WallCreeper, 100, true)); } // Ultra Rare NPC/s + } + if (owner.ZoneGlowshroom) // (Priority over Caverns and Granite/Marble) + { + // 3 Spore Bats + if (common) { npcIDsCommon.Add((NPCID.SporeBat, 3, false)); } // Common NPC/s + // 1/10 for 2 Truffle Worms, 9/10 for 2 Anomura Fungus + else if (rare) { npcIDsRare.Add(Main.rand.NextBool(10) ? (NPCID.TruffleWorm, 2, false) : (NPCID.AnomuraFungus, 2, false)); } // Rare NPC/s + // 1 Crabulon + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneGranite || owner.ZoneMarble) // (Priority over Caverns) + { + if (owner.ZoneGranite) + { + // 3 Granite Elementals + if (common) { npcIDsCommon.Add((NPCID.GraniteFlyer, 3, false)); } // Common NPC/s + // 4 Granite Golems + else if (rare) { npcIDsRare.Add((NPCID.GraniteGolem, 4, false)); } // Rare NPC/s + // 25 Diamond Crawlers + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 25, true)); } // Ultra Rare NPC/s + } + if (owner.ZoneMarble) + { + // 2 Hoplites + if (common) { npcIDsCommon.Add((NPCID.GreekSkeleton, 2, false)); } // Common NPC/s + // 15 Hoplites, in hardmode 2 Medusas instead + else if (rare) { npcIDsRare.Add(useHardmode ? (NPCID.Medusa, 2, false) : (NPCID.GreekSkeleton, 15, true)); } // Rare NPC/s + // 25 Diamond Crawlers + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 25, true)); } // Ultra Rare NPC/s + } + } + else if (owner.ZoneNormalCaverns) + { + bool goblinCheck = NPC.downedGoblins && !NPC.savedGoblin && !NPC.AnyNPCs(NPCID.BoundGoblin); + bool wizardCheck = hardmode && !NPC.savedWizard && !NPC.AnyNPCs(NPCID.BoundWizard); + int tooManyLizards = Main.rand.Next(9) switch + { + 0 => NPCID.Salamander, + 1 => NPCID.Salamander2, + 2 => NPCID.Salamander3, + 3 => NPCID.Salamander4, + 4 => NPCID.Salamander5, + 5 => NPCID.Salamander6, + 6 => NPCID.Salamander7, + 7 => NPCID.Salamander8, + _ => NPCID.Salamander9 + }; + int tooManySkeletons = Main.rand.Next(8) switch + { + 0 => NPCID.Skeleton, + 1 => NPCID.HeadacheSkeleton, + 2 => NPCID.MisassembledSkeleton, + 3 => NPCID.PantlessSkeleton, + 4 => NPCID.BoneThrowingSkeleton, + 5 => NPCID.BoneThrowingSkeleton2, + 6 => NPCID.BoneThrowingSkeleton3, + _ => NPCID.BoneThrowingSkeleton4 + }; + // 2/3 for 3 Cave Bats (3 Giant Bats in HM), otherwise a singular Shelly, Crawdad, Salamander, or Skeleton + bool bats = Main.rand.NextBool(2, 3); + int pickCommonCaverns = Main.rand.Next(4) switch + { + 0 => Main.rand.NextBool() ? NPCID.GiantShelly : NPCID.GiantShelly2, + 1 => tooManyLizards, // One of the 9 Salamander variants + 2 => Main.rand.NextBool() ? NPCID.Crawdad : NPCID.Crawdad2, + _ => tooManySkeletons, // One of the many Skeletons (does not include the small/big variants, but does include bone throwing variants) + }; + // Gobin if he hasn't been saved and the invasion has been cleared or Wizard if hardmode, + // otherwise an Undead Miner, Tim, or Nymph (Most often Undead Miner (70%), otherwise can be a Tim or Nymph (15% each)) + int randNum = Main.rand.Next(1, 100 + 1); + int pickRareCaverns = (randNum > 30 ? NPCID.UndeadMiner : randNum <= 15 ? NPCID.Nymph : NPCID.Tim); + // 15 Mother Slimes, or if harmode either 35 Armored or Archer Skeletons, 2/3 chance postML for 35 Overloaded Soldiers + int pickUltraRareCaverns = postML && Main.rand.NextBool(2, 3) ? ModContent.NPCType() : hardmode ? Main.rand.NextBool() ? NPCID.ArmoredSkeleton : NPCID.SkeletonArcher : NPCID.MotherSlime; + + if (common) { npcIDsCommon.Add((bats ? (useHardmode ? NPCID.GiantBat : NPCID.CaveBat) : pickCommonCaverns, bats ? 3 : 1, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((goblinCheck ? NPCID.BoundGoblin : wizardCheck ? NPCID.BoundWizard : pickRareCaverns, 1, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareCaverns, (!hardmode && !postML) ? 15 : 35, true)); } // Ultra Rare NPC/s + + } + else if (owner.ZoneNormalUnderground) + { + // Giant Worm or Digger if hardmode + if (common) { npcIDsCommon.Add((useHardmode ? NPCID.DiggerHead : NPCID.GiantWormHead, 1, true)); } // Common NPC/s + // 1/2 for 7 Red Slimes, otherwise 7 Yellow Slimes, 7 Toxic Sludge instead in Hardmode + else if (rare) { npcIDsRare.Add((useHardmode ? NPCID.ToxicSludge : Main.rand.NextBool() ? NPCID.RedSlime : NPCID.YellowSlime, 7, false)); } // Rare NPC/s + // 1/3 for 50 Green Jellyfish, otherwise 50 Blue Jellyfish + else if (ultraRare) { npcIDsUltraRare.Add((Main.rand.NextBool(3) ? NPCID.GreenJellyfish : NPCID.BlueJellyfish, 50, true)); } // Ultra Rare NPC/s + } + if (owner.ZoneLihzhardTemple) // (Priority over Jungle) + { + // 3 Lihzahrds + if (common) { npcIDsCommon.Add((NPCID.Lihzahrd, 3, false)); } // Common NPC/s + // 5 Flying Snakes or Bohldohrs + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? NPCID.FlyingSnake : ModContent.NPCType(), 5, false)); } // Rare NPC/s + // 1 Golem + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.Golem, 1, false)); } // Ultra Rare NPC/s + } + else if (owner.ZoneJungle) + { + bool plagueSpawns = NPC.downedGolemBoss && Main.rand.NextBool(2, 3); + // Underground Jungle + if (underground) + { + int tooManyHornets = Main.rand.Next(6) switch + { + 0 => NPCID.Hornet, + 1 => NPCID.HornetFatty, + 2 => NPCID.HornetHoney, + 3 => NPCID.HornetLeafy, + 4 => NPCID.HornetSpikey, + _ => NPCID.HornetStingy, + }; + bool hornets = Main.rand.NextBool(4); + // 2 Giant Tortoises or Jungle Creeper if hardmode, 2 Jungle Slimes if not. Chance to be 2 Plagueshells if plague + int pickCommonUGJungle = plagueSpawns ? ModContent.NPCType() : useHardmode ? Main.rand.NextBool() ? NPCID.GiantTortoise : NPCID.JungleCreeper : NPCID.JungleSlime; + // 1/4 chance to be 22 Hornets (Moss Hornets if hardmode, chance for Plague Chargers if plague), otherwise a Moth in hardmode or 5 Spiked Jungle slimes if not + int pickRareUGJungle = hornets ? (plagueSpawns ? ModContent.NPCType() : useHardmode ? NPCID.MossHornet : tooManyHornets) : useHardmode ? NPCID.Moth : NPCID.SpikedJungleSlime; + // Plantera, or chance for PBG if plague + int pickUltraRareUGJungle = plagueSpawns ? ModContent.NPCType() : NPCID.Plantera; + if (common) { npcIDsCommon.Add((pickCommonUGJungle, 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareUGJungle, hornets ? 22 : useHardmode ? 1 : 5, hornets)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareUGJungle, 1, false)); } // Ultra Rare NPC/s + } + else // Surface Jungle + { + // 3 Jungle Bats or Giant Flying Foxes if hardmode, sometimes Melters if plague + int pickCommonJungle = plagueSpawns ? ModContent.NPCType() : useHardmode ? NPCID.GiantFlyingFox : NPCID.JungleBat; + // 10 Piranhas or Arapaimas if hardmode, 50% chance to be 3 Derplings instead or Virulings if plague + bool noFish = Main.rand.NextBool(); + int pickRareJungle = plagueSpawns && noFish ? ModContent.NPCType() : useHardmode ? noFish ? NPCID.Derpling : NPCID.Arapaima : NPCID.Piranha; + // 50 Jungle Bats or Giant Flying Foxes if hardmode, or Draconic Swarmers if postML + int pickUltraRareJungle = postML ? ModContent.NPCType() : hardmode ? NPCID.GiantFlyingFox : NPCID.JungleBat; + if (common) { npcIDsCommon.Add((pickCommonJungle, 3, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareJungle, useHardmode ? 3 : 10, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareJungle, 50, true)); } // Ultra Rare NPC/s + } + } + if (owner.ZoneGraveyard) + { + // 2 Maggot Zombies + if (common) { npcIDsCommon.Add((NPCID.MaggotZombie, 2, false)); } // Common NPC/s + // Either 3 Rotdogs or 3 Bucket Zombies + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 3, false)); } // Rare NPC/s + // Either 2 Grooms or 2 Brides + else if (ultraRare) { npcIDsUltraRare.Add((Main.rand.NextBool() ? NPCID.TheBride : NPCID.TheGroom, 2, false)); } // Ultra Rare NPC/s + } + if (owner.Calamity().ZoneAstral) + { + if (underground) + { + bool glomers = Main.rand.NextBool(4); + // 2 Stellar Culex or 1/4 for 15 Glomerlings + if (common) { npcIDsCommon.Add((glomers ? ModContent.NPCType() : ModContent.NPCType(), glomers ? 15 : 2, false)); } // Common NPC/s + // Either 5 Astralachnea or 5 Astraglomerates + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 5, false)); } // Rare NPC/s + // 1 Astrum Aureus + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + else + { + // Either 2 Aries or 2 Nova + if (common) { npcIDsCommon.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 2, false)); } // Common NPC/s + // Either 3 Atlas or 3 Mantis + else if (rare) { npcIDsRare.Add((Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), 3, false)); } // Rare NPC/s + // 1 Astrum Deus + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + } + if (owner.Calamity().ZoneSunkenSea) + { + bool clams = Main.rand.NextBool(3); + bool downedDS = DownedBossSystem.downedDesertScourge; + // 2 Ghost Bells + if (common) { npcIDsCommon.Add((ModContent.NPCType(), 2, false)); } // Common NPC/s + // 1/3 for 8 Clams, otherwise 3 Prism Backs + else if (rare) { npcIDsRare.Add((clams ? ModContent.NPCType() : ModContent.NPCType(), clams ? 8 : 3, false)); } // Rare NPC/s + // postDS 3 Giant Clams or 10 postML, otherwise 50 Sea Floaties + else if (ultraRare) { npcIDsUltraRare.Add((downedDS ? ModContent.NPCType() : ModContent.NPCType(), downedDS ? postML ? 10 : 3 : 50, !downedDS)); } // Ultra Rare NPC/s + } + // Arsenal Labs + if ((backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType()) && + BiomeTileCounterSystem.ArsenalLabTiles > 150) + { + // 5 Broken Nanodroids + if (common) { npcIDsCommon.Add((ModContent.NPCType(), 5, false)); } // Common NPC/s + // 1 Androomba + else if (rare) { npcIDsRare.Add((ModContent.NPCType(), 1, false)); } // Rare NPC/s + // The Burrower + else if (ultraRare) { npcIDsUltraRare.Add((ModContent.NPCType(), 1, false)); } // Ultra Rare NPC/s + } + } + else if (Honey) + { + // 15 Small Bees + if (common) { npcIDsCommon.Add((NPCID.BeeSmall, 15, false)); } // Common NPC/s + // 25 Bees + else if (rare) { npcIDsRare.Add((NPCID.Bee, 25, false)); } // Rare NPC/s + // 1 Queen Bee + else if (ultraRare) { npcIDsUltraRare.Add((NPCID.QueenBee, 1, false)); } // Ultra Rare NPC/s + } + else if (Lava) + { + if (owner.Calamity().ZoneCalamity) + { + if (common) { npcIDsCommon.Add((ModContent.NPCType(), 2, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((ModContent.NPCType(), 7, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((useHardmode ? ModContent.NPCType() : ModContent.NPCType(), 50, true)); } // Ultra Rare NPC/s + } + else + { + // If not in hell, underworld enemies are replaced with some Heat Spirits (Common: 2, Rare: 10, UltraRare: 50) + bool notInHell = !owner.ZoneUnderworldHeight; + bool profaned = postML && Main.rand.NextBool(4); + int nonHellEnemy = ModContent.NPCType(); + bool snake = Main.rand.NextBool(4); + // 5 Hellbats or Lavabats if hardmode, 25% chance to be one Bone Serpent instead, or chance for Impious Immolator + int pickCommonHell = notInHell ? nonHellEnemy : profaned ? ModContent.NPCType() : snake ? NPCID.BoneSerpentHead : (useHardmode ? NPCID.Lavabat : NPCID.Hellbat); + // 3 Demons or Red Devils if hardmode, or chance for Scorn Eater + int pickRareHell = notInHell ? nonHellEnemy : profaned ? ModContent.NPCType() : (useHardmode ? NPCID.RedDevil : NPCID.Demon); + // Wall of Flesh, or chance for Providence if postML + int pickUltraRareHell = notInHell ? nonHellEnemy : profaned ? ModContent.NPCType() : NPCID.WallofFlesh; + if (common) { npcIDsCommon.Add((pickCommonHell, notInHell ? 2 : snake ? 1 : 5, false)); } // Common NPC/s + else if (rare) { npcIDsRare.Add((pickRareHell, notInHell ? 10 : 3, false)); } // Rare NPC/s + else if (ultraRare) { npcIDsUltraRare.Add((pickUltraRareHell, notInHell ? 50 : 1, notInHell)); } // Ultra Rare NPC/s + } + } + #endregion + + #region NPC spawn + // Spawn the npc/s + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npcIDsCommon.Count + npcIDsRare.Count + npcIDsUltraRare.Count == 0) + { + npcIDsCommon.Add((fallbackNPC, 1, false)); + common = true; + } + // Get a random NPC type and count from the list of npcs within the rarity + (int, int, bool) finalNPCstats = common ? npcIDsCommon.ElementAt(Main.rand.Next(0, npcIDsCommon.Count)) : + rare ? npcIDsRare.ElementAt(Main.rand.Next(0, npcIDsRare.Count)) : + npcIDsUltraRare.ElementAt(Main.rand.Next(0, npcIDsUltraRare.Count)); + // Spawn the actual NPC/s + for (int i = 0; i < finalNPCstats.Item2; i++) + { + float baseSpeed = 2.5f; + NPC catched = Main.npc[(int)NPC.NewNPC(owner.GetSource_FromThis(), (int)bobber.Center.X, (int)bobber.Center.Y, finalNPCstats.Item1)]; + // If there's more than one, send in random directions, otherwise pull them upwards + catched.velocity = Vector2.UnitY * -baseSpeed + (finalNPCstats.Item2 == 1 ? Vector2.Zero : -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(baseSpeed / 2, baseSpeed * 2 * MathF.Pow(finalNPCstats.Item2, 0.5f))); + catched.Calamity().preventDrops = (finalNPCstats.Item3 ? Main.rand.NextBool(3) : false); + } + + } + float scale = (common ? 1 : rare ? 2.5f : 6); + for (int i = 0; i < (int)(12 * scale); i++) + { + Color liquidColor = Lava ? Color.OrangeRed : Honey ? Color.Gold : Color.DodgerBlue; + if (i % 4 == 0) + { + Particle sprayParticle = new CustomSpark(bobber.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10) * scale, -Vector2.UnitY.RotatedByRandom(0.2f * MathF.Pow(scale, 1)) * Main.rand.NextFloat(1, 7) * scale, "CalamityMod/Particles/BloomCircle", true, (int)(Main.rand.Next(18, 24) * 5 * scale), Main.rand.NextFloat(0.3f, 0.5f) * scale, Color.Lerp(Color.Gray, liquidColor, Main.rand.NextFloat(0.5f, 1f)) * 0.4f, new Vector2(0.8f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(sprayParticle); + } + + Vector2 sprayPos = bobber.Center + Vector2.UnitX * Main.rand.NextFloat(-10, 10) * scale; + Dust spray = Dust.NewDustPerfect(sprayPos, ModContent.DustType()); + spray.noGravity = false; + spray.scale = Main.rand.NextFloat(1.3f, 1.5f) * scale; + spray.velocity = -Vector2.UnitY.RotatedByRandom(0.2f * MathF.Pow(scale, 1)) * Main.rand.NextFloat(5, 14) * scale; + spray.color = Color.Lerp(Color.Gray, liquidColor, Main.rand.NextFloat(0.3f, 0.8f)) * 0.2f; + spray.noLight = true; + spray.noLightEmittence = true; + spray.fadeIn = 2 + scale; + } + owner.SetScreenshake(2f * scale); + SoundStyle epicFail = new("CalamityMod/Sounds/Item/WaterSplash", 2); + SoundEngine.PlaySound(epicFail with { Volume = 0.4f + 0.1f * scale, Pitch = 0.2f - 0.1f * scale }, bobber.Center); + bobber.velocity += -Vector2.UnitY * (common ? 10 : rare ? 20 : 45); + #endregion + } + } +} diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 5399d037a4..0ccd7c76dc 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -12,6 +12,7 @@ using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.WorldBuilding; using static CalamityMod.World.CalamityWorld; @@ -19,10 +20,28 @@ namespace CalamityMod.Systems { public class WorldgenManagementSystem : ModSystem { + #region StructurePosStoring + public static Point DungeonArchivePos = Point.Zero; + + public override void SaveWorldData(TagCompound tag) + { + tag["DungeonArchivePos"] = DungeonArchivePos; + } + + public override void LoadWorldData(TagCompound tag) + { + if (tag.ContainsKey("DungeonArchivePos")) + DungeonArchivePos = tag.Get("DungeonArchivePos"); + else + DungeonArchivePos = Point.Zero; + } + #endregion + #region PreWorldGen public override void PreWorldGen() { Abyss.TotalPlacedIslandsSoFar = 0; + DungeonArchivePos = Point.Zero; //roxShrinePlaced = false; // This will only be applied at world-gen time to new worlds. diff --git a/Tiles/BloodOrangePlant.cs b/Tiles/BloodOrangePlant.cs deleted file mode 100644 index 6810ed1226..0000000000 --- a/Tiles/BloodOrangePlant.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.PermanentBoosters; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class BloodOrangePlant : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileObsidianKill[Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.addTile(Type); - - DustType = DustID.Torch; - - AddMapEntry(new Color(250, 142, 4)); - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); - } - - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) - { - offsetY = 2; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 4; - } - } -} diff --git a/Tiles/BloodOrangePlant.png b/Tiles/BloodOrangePlant.png deleted file mode 100644 index c954393284..0000000000 Binary files a/Tiles/BloodOrangePlant.png and /dev/null differ diff --git a/Tiles/Furniture/GluttonyBlender.cs b/Tiles/Furniture/GluttonyBlender.cs new file mode 100644 index 0000000000..d3b7f5c828 --- /dev/null +++ b/Tiles/Furniture/GluttonyBlender.cs @@ -0,0 +1,253 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class GluttonyBlenderTile : ModTile + { + public const int Width = 2; + public const int Height = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.CoordinateHeights = [16, 16, 18]; + ModTileEntity entity = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(entity.Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(128, 128, 128), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) => false; + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + if (TileEntity.TryGet(new(i, j), out var entity)) + { + frameXOffset = 36 * entity.CurrentFrame; + } + } + + public override void MouseOver(int i, int j) + { + Player p = Main.LocalPlayer; + // You shouldn't be able to put the slop back into the blender + if (BuffID.Sets.IsWellFed[p.HeldItem.buffType] && p.HeldItem.type != ModContent.ItemType()) + { + p.noThrow = 2; + p.cursorItemIconEnabled = true; + p.cursorItemIconID = p.HeldItem.type; + } + } + } + + public class GluttonyBlenderTE : ModTileEntity + { + public Vector2 BlenderTop => Position.ToWorldCoordinates(8 * GluttonyBlenderTile.Width, 0f); + public int CurrentFrame = 0; + private ushort FrameCounter = 0; + private const ushort TotalAnimFrames = 6; + + public override bool IsTileValidForEntity(int x, int y) + { + Tile tile = Main.tile[x, y]; + return tile.HasTile && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; + } + + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, GluttonyBlenderTile.Width, GluttonyBlenderTile.Height); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + return Place(i, j); + } + + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + public override void NetSend(BinaryWriter writer) + { + writer.Write(CurrentFrame); + writer.Write(FrameCounter); + } + public override void NetReceive(BinaryReader reader) + { + CurrentFrame = reader.ReadInt32(); + FrameCounter = reader.ReadUInt16(); + } + + public override void Update() + { + bool blenderAnim = Main.projectile.Any(i => i.active && i.type == ModContent.ProjectileType() && + i.ai[1] >= GluttonyBlenderAnimation.TimeToReachBlender && Vector2.DistanceSquared(BlenderTop, i.Center) < 256f); + if (blenderAnim) + { + if (CurrentFrame < 1) + CurrentFrame = 1; + FrameCounter++; + if (FrameCounter >= 4) + { + FrameCounter = 0; + CurrentFrame++; + if (CurrentFrame > TotalAnimFrames) + CurrentFrame = 1; + + if (Main.dedServ) + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + } + else + { + if (CurrentFrame > 0) + { + CurrentFrame = 0; + FrameCounter = 0; + + if (Main.dedServ) + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + } + } + } + + public class GluttonyBlenderGlobalItem : GlobalItem + { + public override bool InstancePerEntity => true; + + internal bool FromGluttonyBlender = false; + + public override bool CanUseItem(Item item, Player player) + { + // Exit early if anyone of the following are true: + // * Running on client that is not the local player + // * The item is not a food, is not consumable, or is Quality Slop (you cannot feed the slop back into the blender) + // * The Gluttony Blender tile entity doesn't exist for some reason + // * The player isn't within the tile's interaction range + if (Main.LocalPlayer.whoAmI != player.whoAmI) + return true; + if (!BuffID.Sets.IsWellFed[item.buffType] || !item.consumable || item.type == ModContent.ItemType()) + return true; + + Point mouseTile = Main.MouseWorld.ToTileCoordinates(); + GluttonyBlenderTE entity = CalamityUtils.FindTileEntity(mouseTile.X, mouseTile.Y, GluttonyBlenderTile.Width, GluttonyBlenderTile.Height); + if (entity == null) + return true; + if (!player.IsInTileInteractionRange(mouseTile.X, mouseTile.Y, TileReachCheckSettings.Simple)) + return true; + + // Spawns a projectile to handle the visual animation of the food moving into the blender and the conversion to slop + // The projectile doesn't use velocity, so the top of the blender tile is passed in as the velocity + Projectile.NewProjectile(player.GetSource_TileInteraction(mouseTile.X, mouseTile.Y), player.Center, entity.BlenderTop, ModContent.ProjectileType(), + 0, 0f, player.whoAmI, item.type); + if (ItemLoader.ConsumeItem(item, player)) + { + item.stack--; + if (item.stack <= 0) + item.TurnToAir(); + } + return false; + } + + public override bool CanStackInWorld(Item destination, Item source) + { + return !destination.GetGlobalItem().FromGluttonyBlender || !destination.GetGlobalItem().FromGluttonyBlender; + } + } + + public class GluttonyBlenderAnimation : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private const int Lifetime = 120; + public const int TimeToReachBlender = 60; + private int ItemType => (int)Projectile.ai[0]; + private ref float Timer => ref Projectile.ai[1]; + private ref float ArcVelocity => ref Projectile.ai[2]; + private Vector2 Start; + private Vector2 Destination => Projectile.velocity; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.scale = 0f; + } + + public override bool ShouldUpdatePosition() => false; + public override void AI() + { + // Initialization + if (Timer == 0) + { + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Start = Projectile.Center; + ArcVelocity = Main.rand.NextFloat(2.2f, 4.4f); + } + + if (Timer < TimeToReachBlender) + { + Vector2 moveDistBeforeArc = Destination - Start; + // The second half of this applies an arcing motion as the projectile moves + Projectile.Center += (moveDistBeforeArc / (float)TimeToReachBlender) - Vector2.UnitY * (ArcVelocity - (ArcVelocity / 30f * Timer)); + Projectile.rotation = moveDistBeforeArc.X * 0.005f; + + if (Timer < 4) + Projectile.scale += 0.25f; + if (Timer >= TimeToReachBlender - 4) + Projectile.scale -= 0.25f; + } + else + { + Projectile.Center = Destination; + if (Timer == TimeToReachBlender) + SoundEngine.PlaySound(SoundID.Item22, Projectile.Center); + + Color[] dustArray = ItemID.Sets.FoodParticleColors[ItemType]; + if (dustArray == null || dustArray.Length == 0) + dustArray = ItemID.Sets.DrinkParticleColors[ItemType]; + if (dustArray != null && dustArray.Length != 0 && Main.rand.NextBool(4)) + { + Vector2 dustVel = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 5f) * 2f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FoodPiece, dustVel, 0, dustArray[Main.rand.Next(dustArray.Length)], Main.rand.NextFloat(1.3f, 1.75f)); + dust.fadeIn = 0f; + } + } + + if (Projectile.timeLeft == 1) + { + int itemDrop = Main.rand.NextBool(GluttonyBlender.OneInXChanceForGoodSlop) ? ModContent.ItemType() : ModContent.ItemType(); + int i = Item.NewItem(Projectile.GetItemSource_DropAsItem(), Projectile.Center, itemDrop); + Main.item[i].GetGlobalItem().FromGluttonyBlender = true; + } + Timer++; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Timer >= TimeToReachBlender) + return false; + + Texture2D tex = TextureAssets.Item[ItemType].Value; + Rectangle frame = tex.Frame(1, Main.itemAnimations[ItemType].FrameCount, 0, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Tiles/Furniture/GluttonyBlenderTile.png b/Tiles/Furniture/GluttonyBlenderTile.png new file mode 100644 index 0000000000..c296b47ccc Binary files /dev/null and b/Tiles/Furniture/GluttonyBlenderTile.png differ diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 0db89dd408..8d3a4e0e50 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -147,10 +147,10 @@ namespace CalamityMod // Xyk 3MARCH2026: Will be implemented better by Doze eventually if (addHeldItemScale) baseScale += (player.HeldItem.scale - 1); - if (player.HasBuff(BuffID.Tipsy)) - baseScale += 0.15f; - + baseScale += 0.25f; + if (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake)) + baseScale += 0.25f; return baseScale; } diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index a1958e2331..59fd429795 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using CalamityMod.Schematics; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -72,6 +73,8 @@ namespace CalamityMod.World if (placedArchive) { + WorldgenManagementSystem.DungeonArchivePos = new Point(i, j); + bool firstItem = false; if (dungeonArchiveColor == 0)