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/BaconOilBuff.cs b/Buffs/Alcohol/BaconOilBuff.cs new file mode 100644 index 0000000000..964aa03e37 --- /dev/null +++ b/Buffs/Alcohol/BaconOilBuff.cs @@ -0,0 +1,29 @@ +using CalamityMod.DataStructures; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Alcohol +{ + public class BaconOilBuff : ModBuff + { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 3 + }; + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + Main.persistentBuff[Type] = true; + BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().baconOil = true; + } + } +} diff --git a/Buffs/Alcohol/BaconOilBuff.png b/Buffs/Alcohol/BaconOilBuff.png new file mode 100644 index 0000000000..1873b16f5b Binary files /dev/null and b/Buffs/Alcohol/BaconOilBuff.png differ diff --git a/Buffs/Alcohol/BloodyMaryBuff.cs b/Buffs/Alcohol/BloodyMaryBuff.cs index 266bcbf377..019cca545d 100644 --- a/Buffs/Alcohol/BloodyMaryBuff.cs +++ b/Buffs/Alcohol/BloodyMaryBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class BloodyMaryBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/CaribbeanRumBuff.cs b/Buffs/Alcohol/CaribbeanRumBuff.cs index ad63c115e5..0d96b9caa4 100644 --- a/Buffs/Alcohol/CaribbeanRumBuff.cs +++ b/Buffs/Alcohol/CaribbeanRumBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class CaribbeanRumBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/CinnamonRollBuff.cs b/Buffs/Alcohol/CinnamonRollBuff.cs index 6efc2c936e..7cbbcf5b64 100644 --- a/Buffs/Alcohol/CinnamonRollBuff.cs +++ b/Buffs/Alcohol/CinnamonRollBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class CinnamonRollBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/EverclearBuff.cs b/Buffs/Alcohol/EverclearBuff.cs index fa5f3156fe..0539414a31 100644 --- a/Buffs/Alcohol/EverclearBuff.cs +++ b/Buffs/Alcohol/EverclearBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class EverclearBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 2 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/EvergreenGinBuff.cs b/Buffs/Alcohol/EvergreenGinBuff.cs index c3d27d74b9..0f7450a4d5 100644 --- a/Buffs/Alcohol/EvergreenGinBuff.cs +++ b/Buffs/Alcohol/EvergreenGinBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class EvergreenGinBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/FireballBuff.cs b/Buffs/Alcohol/FireballBuff.cs index 94ef554b0f..a2ab1d6c57 100644 --- a/Buffs/Alcohol/FireballBuff.cs +++ b/Buffs/Alcohol/FireballBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class FireballBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/GrapeBeerBuff.cs b/Buffs/Alcohol/GrapeBeerBuff.cs index 5ab4836351..84523f0ff0 100644 --- a/Buffs/Alcohol/GrapeBeerBuff.cs +++ b/Buffs/Alcohol/GrapeBeerBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class GrapeBeerBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/ManhattanBuff.cs b/Buffs/Alcohol/ManhattanBuff.cs index 71872b7153..fa326a2ba7 100644 --- a/Buffs/Alcohol/ManhattanBuff.cs +++ b/Buffs/Alcohol/ManhattanBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class ManhattanBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/MargaritaBuff.cs b/Buffs/Alcohol/MargaritaBuff.cs index d9f0855b5f..b688c577b6 100644 --- a/Buffs/Alcohol/MargaritaBuff.cs +++ b/Buffs/Alcohol/MargaritaBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class MargaritaBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/MoonshineBuff.cs b/Buffs/Alcohol/MoonshineBuff.cs index 32221e2e24..aa7e4fe2dc 100644 --- a/Buffs/Alcohol/MoonshineBuff.cs +++ b/Buffs/Alcohol/MoonshineBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class MoonshineBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/MoscowMuleBuff.cs b/Buffs/Alcohol/MoscowMuleBuff.cs index 33afd8c8a8..8156853251 100644 --- a/Buffs/Alcohol/MoscowMuleBuff.cs +++ b/Buffs/Alcohol/MoscowMuleBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class MoscowMuleBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/OldFashionedBuff.cs b/Buffs/Alcohol/OldFashionedBuff.cs index 8a31d03b48..72947fbd18 100644 --- a/Buffs/Alcohol/OldFashionedBuff.cs +++ b/Buffs/Alcohol/OldFashionedBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class OldFashionedBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/PurpleHazeBuff.cs b/Buffs/Alcohol/PurpleHazeBuff.cs index a786be25fb..28fdfdce9a 100644 --- a/Buffs/Alcohol/PurpleHazeBuff.cs +++ b/Buffs/Alcohol/PurpleHazeBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class PurpleHazeBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/RedWineBuff.cs b/Buffs/Alcohol/RedWineBuff.cs index 86acc413e4..07378c7f32 100644 --- a/Buffs/Alcohol/RedWineBuff.cs +++ b/Buffs/Alcohol/RedWineBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class RedWineBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/RumBuff.cs b/Buffs/Alcohol/RumBuff.cs index 9f98fe704c..a03fb4287e 100644 --- a/Buffs/Alcohol/RumBuff.cs +++ b/Buffs/Alcohol/RumBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class RumBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/ScrewdriverBuff.cs b/Buffs/Alcohol/ScrewdriverBuff.cs index ae2ddec1cc..67774c5422 100644 --- a/Buffs/Alcohol/ScrewdriverBuff.cs +++ b/Buffs/Alcohol/ScrewdriverBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class ScrewdriverBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/StarBeamRyeBuff.cs b/Buffs/Alcohol/StarBeamRyeBuff.cs index 71d4d85c3b..091a295d57 100644 --- a/Buffs/Alcohol/StarBeamRyeBuff.cs +++ b/Buffs/Alcohol/StarBeamRyeBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class StarBeamRyeBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/TequilaBuff.cs b/Buffs/Alcohol/TequilaBuff.cs index 1db0e76f6c..485308d587 100644 --- a/Buffs/Alcohol/TequilaBuff.cs +++ b/Buffs/Alcohol/TequilaBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class TequilaBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/TequilaSunriseBuff.cs b/Buffs/Alcohol/TequilaSunriseBuff.cs index 650b4478a4..4e585431be 100644 --- a/Buffs/Alcohol/TequilaSunriseBuff.cs +++ b/Buffs/Alcohol/TequilaSunriseBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class TequilaSunriseBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/VodkaBuff.cs b/Buffs/Alcohol/VodkaBuff.cs index 60676048bf..2e8cf72fa9 100644 --- a/Buffs/Alcohol/VodkaBuff.cs +++ b/Buffs/Alcohol/VodkaBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions.Alcohol; using Terraria; using Terraria.ModLoader; @@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol { public class VodkaBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/WhiskeyBuff.cs b/Buffs/Alcohol/WhiskeyBuff.cs index 488758eb22..4e67347944 100644 --- a/Buffs/Alcohol/WhiskeyBuff.cs +++ b/Buffs/Alcohol/WhiskeyBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class WhiskeyBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Alcohol/WhiteWineBuff.cs b/Buffs/Alcohol/WhiteWineBuff.cs index f18f1f8cef..c8baa10765 100644 --- a/Buffs/Alcohol/WhiteWineBuff.cs +++ b/Buffs/Alcohol/WhiteWineBuff.cs @@ -1,10 +1,15 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { public class WhiteWineBuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + AlcoholLevel = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/Buffs/Potions/SwinesWrathBuff.cs b/Buffs/Potions/SwinesWrathBuff.cs new file mode 100644 index 0000000000..873555d6c3 --- /dev/null +++ b/Buffs/Potions/SwinesWrathBuff.cs @@ -0,0 +1,42 @@ +using CalamityMod.DataStructures; +using CalamityMod.Items.Potions; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Potions +{ + public class SwinesWrathBuff : ModBuff + { + public static readonly SoundStyle TimerSound = new("CalamityMod/Sounds/Custom/TickingTimer"); + + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + TheConcoctionPlayer concoctionPlayer = player.GetModPlayer(); + + if (concoctionPlayer.swinesWrathCounter < 2 && concoctionPlayer.swinesWrathCounter != -1) + { + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SwinesWrath" + Main.rand.Next(1, 7 + 1)).ToNetworkText(player.name)), 1000, -1); + concoctionPlayer.swinesWrathCounter = -1; + } + + else if (concoctionPlayer.swinesWrathCounter % 60 == 59) + SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f) }, player.Center); // Gets louder as time progresses + } + } +} diff --git a/Buffs/Potions/SwinesWrathBuff.png b/Buffs/Potions/SwinesWrathBuff.png new file mode 100644 index 0000000000..53347dfda7 Binary files /dev/null and b/Buffs/Potions/SwinesWrathBuff.png differ diff --git a/Buffs/StatDebuffs/Malnourished.cs b/Buffs/StatDebuffs/Malnourished.cs new file mode 100644 index 0000000000..03b0f4e08c --- /dev/null +++ b/Buffs/StatDebuffs/Malnourished.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class Malnourished : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().malnourished = true; + } + } +} diff --git a/Buffs/StatDebuffs/Malnourished.png b/Buffs/StatDebuffs/Malnourished.png new file mode 100644 index 0000000000..8f25176a8a Binary files /dev/null and b/Buffs/StatDebuffs/Malnourished.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5c8b19da0f..387525521a 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -43,6 +43,7 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Potions.Food; using CalamityMod.Items.Tools; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.TreasureBags.MiscGrabBags; @@ -69,6 +70,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; @@ -140,6 +142,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. ///
@@ -379,9 +388,12 @@ namespace CalamityMod.CalPlayer public int hideOfDeusMeleeBoostTimer = 0; /// /// The player's alcohol level. Increased by 1 for each alcohol the player has drank, 2 for Everclear.
- /// If this value is greater than 3, the player is inflicted with Alcohol Poisoning. + /// If this value is greater than the max (normally 3), the player is inflicted with Alcohol Poisoning. ///
public int alcoholPoisonLevel = 0; + public static int alcoholPoisonMaxBase = 3; + /// The maximum alcohol level the player can reach before getting Alcohol Poisoning. + public int alcoholPoisonMax = alcoholPoisonMaxBase; public int dashTimeMod; /// /// Timer variable which tracks how long the player has spent outside of Providence's border radius, in frames.
@@ -804,6 +816,7 @@ namespace CalamityMod.CalPlayer #endregion #region Accessory + public int friendlyMinions = 0; public bool shieldOfTheHighRulerDashVelocityBoosted = false; public bool yharimsGift = false; public bool luxorsGift = false; @@ -1395,6 +1408,7 @@ namespace CalamityMod.CalPlayer public bool riptide = false; public bool hadopelagicPressure = false; public bool fishAlert = false; + public bool malnourished = false; public bool clamity = false; public bool NOU = false; public bool absorberAffliction = false; @@ -1486,6 +1500,8 @@ namespace CalamityMod.CalPlayer public bool whiteWine = false; public float whiteWineTimer = 0; public bool evergreenGin = false; + public bool baconOil = false; + public int baconOilSoundCooldown = 0; public bool tranquilityCandle = false; public bool chaosCandle = false; public bool blueCandle = false; @@ -2162,6 +2178,7 @@ namespace CalamityMod.CalPlayer externalAuricRejectionImmunity = false; alcoholPoisonLevel = 0; + alcoholPoisonMax = alcoholPoisonMaxBase; noLifeRegen = false; //Stratus Starburst amount management @@ -2251,6 +2268,7 @@ namespace CalamityMod.CalPlayer if (!pSoulArtifact) pSoulShieldDurability = 0; } + friendlyMinions = 0; pSoulShieldVisible = false; roverDrive = false; roverDriveShieldVisible = false; @@ -2695,6 +2713,7 @@ namespace CalamityMod.CalPlayer riptide = false; hadopelagicPressure = false; fishAlert = false; + malnourished = false; clamity = false; NOU = false; enraged = false; @@ -2782,6 +2801,7 @@ namespace CalamityMod.CalPlayer moscowMule = false; whiteWine = false; evergreenGin = false; + baconOil = false; tranquilityCandle = false; chaosCandle = false; @@ -3071,6 +3091,7 @@ namespace CalamityMod.CalPlayer if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0) consecutiveCaughtFish = 0; heldGaelsLastFrame = false; + heldElephantKillerLastFrame = false; partialLifeRegenCounter = 0f; gaelSwipes = 0; whitewaterHeal = 0; @@ -3179,6 +3200,7 @@ namespace CalamityMod.CalPlayer riptide = false; hadopelagicPressure = false; fishAlert = false; + malnourished = false; clamity = false; NOU = false; snowmanNoseless = false; @@ -3293,6 +3315,7 @@ namespace CalamityMod.CalPlayer moscowMule = false; whiteWine = false; evergreenGin = false; + baconOil = false; tranquilityCandle = false; chaosCandle = false; blueCandle = false; @@ -4274,12 +4297,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; @@ -4596,12 +4824,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 { @@ -4850,6 +5078,32 @@ namespace CalamityMod.CalPlayer } } } + + if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now + { + alcoholPoisonMax += TheSandwich.alcoholCapBoost; + // Gives inverted buffs from well fed + Player.statDefense -= 2; + Player.GetCritChance() -= 2; + Player.minionKB -= 0.5f; + Player.moveSpeed -= 0.05f; + // damage nerf/boost happens in PostUpdate + Player.pickSpeed += 0.05f; + + + for (int l = 0; l < Player.MaxBuffs; ++l) + { + int buffID = Player.buffType[l]; + if ((BuffDatasets.DebuffDataset[buffID] != null && BuffDatasets.DebuffDataset[buffID].AlcoholLevel > 0) || buffID == BuffID.Tipsy) + { + Player.buffTime[l]++; + } + } + + if (Player.wellFed) + Player.ClearBuff(ModContent.BuffType()); + } + if (moonshine) Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1 + Moonshine.MaxLifePercentBoost)); ForceVariousEffects(); @@ -4882,7 +5136,7 @@ namespace CalamityMod.CalPlayer #region PostUpdateEquips public override void PostUpdateEquips() { - + var dripPlayer = Player.GetModPlayer(); var item = Player.HeldItem; if (!(item.IsAir || item.damage <= 0)) { @@ -4891,11 +5145,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) @@ -4905,11 +5161,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 { @@ -4922,10 +5179,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 { @@ -4938,10 +5196,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 { @@ -4954,10 +5213,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 { @@ -4978,6 +5239,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. @@ -5114,7 +5379,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; } @@ -5133,6 +5398,9 @@ namespace CalamityMod.CalPlayer } } + if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now + Player.GetDamage() += -0.05f + TheSandwich.statBoost * alcoholPoisonLevel; + // Relic of Convergence defense cut if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && Player.HeldItem.type == ModContent.ItemType()) Player.statDefense *= RelicOfConvergence.DefenseMultiplier; @@ -5264,6 +5532,92 @@ namespace CalamityMod.CalPlayer } #endregion + 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 * stackScale; + float minMoveSpeed = 3 * stackScale; // Minimum move speed to be at if the player can bounce + float hitboxSizeMult = 0.45f; + + bool onPlatform = false; + if (Player.velocity.Y > 0 && !Player.controlDown) + { + for (int i = 4; i < 8; i++) + { + Point bottom = (Player.Bottom + Vector2.UnitY * i).ToTileCoordinates(); + if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType]) + { + onPlatform = true; + } + } + } + + 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 * stackScale; + float decceleration = -0.025f / speedMult; + 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; + bool makeSound = false; + if (hitSide) + { + Player.velocity.X = -Player.velocity.X * bounceReduction; + Player.oldVelocity.X = -Player.oldVelocity.X * bounceReduction; + makeSound = true; + } + if ((hitDown || hitUp)) + { + if (Player.controlUp) + bounceReduction = 1.3f; + Player.velocity.Y = -Player.velocity.Y * bounceReduction; + Player.oldVelocity.Y = -Player.oldVelocity.Y * bounceReduction; + if (hitDown) + { + Player.RefreshMovementAbilities(true); + } + makeSound = true; + } + int soundCDMax = 150; + if (makeSound && baconOilSoundCooldown < soundCDMax) + { + if (baconOilSoundCooldown < soundCDMax) + baconOilSoundCooldown += 30; + 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); + } + + bool playerMoving = Player.controlLeft || Player.controlRight; + bool playerMovingInDirection = (Player.controlLeft && Player.oldVelocity.X < 0) || (Player.controlRight && Player.oldVelocity.X > 0); + if (((Player.oldVelocity.X > 0 && Player.velocity.X > 0) || (Player.oldVelocity.X < 0 && Player.velocity.X < 0))) + Player.velocity.X = MathHelper.Clamp(Player.velocity.X + maxMoveSpeed * MathF.Sign(Player.oldVelocity.X) * + ((playerMovingInDirection || !playerMoving) ? Player.dashDelay == -1 ? decceleration : // If dashing, deccelerate to prevent infinite dash + // If not moving or holding in move direction, accelerate to max speed, otherwise deccelerate + acceleration : decceleration), -maxMoveSpeed, maxMoveSpeed); + + bool raining = Player.Center.Y < Main.worldSurface * 16.0 && Main.raining; + if ((Player.wet || raining) && Player.velocity.Y > -maxMoveSpeed) + { + Player.velocity.Y -= riseSpeed; // Cover yourself in oil (go up in liquid) + } + + + Vector2 lerpedVel = Vector2.Lerp(Player.velocity, Player.oldVelocity, slipPower); + Player.velocity = new Vector2(lerpedVel.X, Player.velocity.Y); + } + if (baconOilSoundCooldown > 0) + baconOilSoundCooldown = (int)MathHelper.Lerp(baconOilSoundCooldown, 0, 0.027f); + Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it } #endregion @@ -5295,7 +5649,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. } } @@ -5307,6 +5662,8 @@ namespace CalamityMod.CalPlayer if (moscowMule) knockback += MoscowMule.KnockbackBoost; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.MoscowMule)) + knockback += MoscowMule.KnockbackBoost; if (titanHeartMantle && rogue) knockback += TitanHeartMantle.RogueKnockbackBoost; @@ -5485,7 +5842,7 @@ namespace CalamityMod.CalPlayer { if (bladeArmEnchant) return false; - if (purpleHaze) + if (purpleHaze || Player.GetModPlayer().HasAlcohol(AlcoholType.PurpleHaze)) { if (item.CountsAsClass() && StealthStrikeAvailable()) { @@ -6018,6 +6375,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 @@ -6084,7 +6445,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 ecd1322d37..bb3bc4f9b9 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -2889,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 6f769e1c50..ed58cd05ea 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer.Dashes; using CalamityMod.DataStructures; @@ -12,9 +13,7 @@ using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; @@ -191,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 (CalamityBuffSets.AlcoholStrength.TryGetValue(buff, out int level)) - alcoholPoisonLevel += level; + 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) { @@ -213,7 +229,7 @@ namespace CalamityMod.CalPlayer Player.fishingSkill += 5; } - if (alcoholPoisonLevel > 3) + if (alcoholPoisonLevel > alcoholPoisonMax) { // Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning. Player.nebulaLevelLife = 0; @@ -268,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; @@ -341,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 @@ -558,12 +587,7 @@ namespace CalamityMod.CalPlayer if (community) { int regenBoost = 1 + (int)(TheCommunity.CalculatePower() * TheCommunity.RegenMultiplier); - bool lesserEffect = false; - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = Player.buffType[l]; - lesserEffect = CalamityBuffSets.AlcoholStrength.TryGetValue(hasBuff, out var a); - } + bool lesserEffect = Player.buffType.Any(i => BuffDatasets.DebuffDataset[i] is not null && BuffDatasets.DebuffDataset[i].AlcoholLevel > 0); if (Player.lifeRegen < 0) Player.lifeRegen += lesserEffect ? 1 : regenBoost; } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index e7846913a8..bc1d161524 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -45,6 +45,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 +240,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 +273,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 +580,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 +1302,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; @@ -1721,6 +1758,16 @@ namespace CalamityMod.CalPlayer if (rOfResilienceCooldown > 0) rOfResilienceCooldown--; + if (Player.Calamity().friendlyMinions > 0) + { + int numOfPigs = Player.ownedProjectileCounts[ModContent.ProjectileType()]; + if (numOfPigs < Player.Calamity().friendlyMinions) + { + int pigDamage = 7; + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(0, -16).RotatedByRandom(MathHelper.Pi), ModContent.ProjectileType(), pigDamage, 0f, Player.whoAmI, 0, numOfPigs + 1); + } + } + if (transformer && Player.Calamity().transformerCooldown == 0 && transformerDelay == 0) // The code for this acursed thing took much... MUCH, too long to make { float zoneSize = 150; @@ -3347,7 +3394,7 @@ namespace CalamityMod.CalPlayer #region Other Buff Effects private void OtherBuffEffects() { - + var dripPlayer = Player.GetModPlayer(); if (gravityNormalizer) { Player.buffImmune[BuffID.VortexDebuff] = true; @@ -3535,30 +3582,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; @@ -3570,7 +3637,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) @@ -3580,9 +3652,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) { @@ -4724,6 +4796,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/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs index ae5320365e..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 { @@ -113,11 +177,10 @@ namespace CalamityMod.DataStructures public bool GearCanModifyDebuff = true; /// - /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR /// How much alcohol this counts as. /// Default is 0, most alcohol is 1, and Everclear is 2 /// - public float AlcoholLevel = 0f; + public int AlcoholLevel = 0; /// /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR diff --git a/Gores/OmniARCasing.png b/Gores/OmniARCasing.png new file mode 100644 index 0000000000..03a5f79ee8 Binary files /dev/null and b/Gores/OmniARCasing.png differ diff --git a/Gores/OmniGrenadeShell.png b/Gores/OmniGrenadeShell.png new file mode 100644 index 0000000000..9da004d0c8 Binary files /dev/null and b/Gores/OmniGrenadeShell.png differ diff --git a/Gores/OmniShotgunShell.png b/Gores/OmniShotgunShell.png new file mode 100644 index 0000000000..5dd01912ff Binary files /dev/null and b/Gores/OmniShotgunShell.png differ diff --git a/Gores/OmniSniperCasing.png b/Gores/OmniSniperCasing.png new file mode 100644 index 0000000000..b3390c138d Binary files /dev/null and b/Gores/OmniSniperCasing.png differ diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 79d59de031..324678faa4 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -774,5 +774,81 @@ namespace CalamityMod.ILEditing } } #endregion + + #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))) + { + 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))) + { + LogFailure("Tweaking Pygmy Staff aggro distance logic", "Could not locate the minion range variable."); + return; + } + 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) => + { + if (!pygmy) + return distance; + + NPC npc = Main.npc[npcIndex]; + Player player = Main.player[projectile.owner]; + 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))) + { + 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); // 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) => + { + 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))) + { + 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); // 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) => + { + if (!pygmy) + return distance; + + NPC npc = Main.npc[npcIndex]; + float finalDistance = npc.Hitbox.ClosestPointInRect(projectile.Center).Distance(projectile.Hitbox.ClosestPointInRect(npc.Center)); + return finalDistance; + }); + } + #endregion } } diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 91b569a05b..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; 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..d5dfbd4fd0 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) @@ -937,6 +939,8 @@ 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; + if (item.CountsAsClass() && (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake))) + scale += 0.15f; } 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/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/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/Placeables/Furniture/TheMonument.cs b/Items/Placeables/Furniture/TheMonument.cs new file mode 100644 index 0000000000..4f57836dea --- /dev/null +++ b/Items/Placeables/Furniture/TheMonument.cs @@ -0,0 +1,43 @@ +using CalamityMod.NPCs; +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class TheMonument : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public const float MonumentTaxIncrease = 0.5f; + public const float MonumentHappinessReduction = 0.15f; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 40; + Item.height = 50; + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(gold: 5); + } + + public override void Load() + { + On_Player.CollectTaxes += AddMonumentTaxes; + } + + private static void AddMonumentTaxes(On_Player.orig_CollectTaxes orig, Player self) + { + orig(self); + + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.homeless && !NPCID.Sets.IsTownPet[n.type] && NPC.TypeToDefaultHeadIndex(n.type) > 0 && n.GetGlobalNPC().AffectedByTheMonument) + self.taxMoney += (int)(CalamityGlobalTownNPC.TotalTaxesPerNPC * MonumentTaxIncrease); + } + if (self.taxMoney > CalamityGlobalTownNPC.TaxesToCollectLimit) + self.taxMoney = CalamityGlobalTownNPC.TaxesToCollectLimit; + } + } +} diff --git a/Items/Placeables/Furniture/TheMonument.png b/Items/Placeables/Furniture/TheMonument.png new file mode 100644 index 0000000000..ba34a00847 Binary files /dev/null and b/Items/Placeables/Furniture/TheMonument.png differ diff --git a/Items/Potions/Alcohol/BaconOil.cs b/Items/Potions/Alcohol/BaconOil.cs new file mode 100644 index 0000000000..d2f2d2a620 --- /dev/null +++ b/Items/Potions/Alcohol/BaconOil.cs @@ -0,0 +1,41 @@ +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Alcohol +{ + 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; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(204, 90, 73), + new Color(168, 37, 37), + new Color(120, 28, 28) + }; + } + + public override void SetDefaults() + { + Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; + } + } +} diff --git a/Items/Potions/Alcohol/BaconOil.png b/Items/Potions/Alcohol/BaconOil.png new file mode 100644 index 0000000000..0c9a1f686a Binary files /dev/null and b/Items/Potions/Alcohol/BaconOil.png differ diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 6dd7d3f933..84c40f44c0 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,10 +10,26 @@ 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; diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index ea3de081cf..91ab6bf46d 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,23 @@ 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; diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 990fcb4353..b9a062f753 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,4 +1,6 @@ -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; @@ -9,10 +11,19 @@ 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; diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 3089c42d4d..a34636e51d 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +10,7 @@ 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,7 +18,15 @@ 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; diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index e1b4a1fa07..45ee686743 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,13 +10,25 @@ 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() { diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index 8fcea00497..c80f132c63 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,25 @@ 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; diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 231f2c2d19..d7aa12f70d 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,6 +1,6 @@ -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.ID; @@ -9,15 +9,24 @@ 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; diff --git a/Items/Potions/Alcohol/Manhattan.cs b/Items/Potions/Alcohol/Manhattan.cs index b2b338a0b3..f3612f9e03 100644 --- a/Items/Potions/Alcohol/Manhattan.cs +++ b/Items/Potions/Alcohol/Manhattan.cs @@ -1,4 +1,6 @@ -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; @@ -9,14 +11,24 @@ 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; diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 4df44ae8fb..36d2e06d81 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +10,7 @@ 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,7 +18,22 @@ 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; diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index fd89995259..1cb08c989b 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,13 +10,21 @@ 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; diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 69406883aa..e841647987 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,4 +1,6 @@ -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; @@ -9,13 +11,21 @@ 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; diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index 802234bc9d..9c77435041 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,22 @@ 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; diff --git a/Items/Potions/Alcohol/PurpleHaze.cs b/Items/Potions/Alcohol/PurpleHaze.cs index 4c7792e387..a1849e3e89 100644 --- a/Items/Potions/Alcohol/PurpleHaze.cs +++ b/Items/Potions/Alcohol/PurpleHaze.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -9,15 +11,23 @@ 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; diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index f0314cc7f1..d516456873 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,4 +1,6 @@ -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; @@ -9,14 +11,23 @@ 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; diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index e1b83237a8..b06697e83f 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,22 @@ 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; diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 65c071fa43..08f48048e5 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,4 +1,6 @@ -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; @@ -9,14 +11,25 @@ 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; diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index bbc2dc0f21..b0f4a4318f 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,14 +10,22 @@ 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; diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index b9d4df742e..b60410fe92 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Tequila : ModItem, ILocalizedModType + public class Tequila : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,7 +18,17 @@ 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; diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 2e04f06f82..072e2739b0 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,4 +1,6 @@ -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; @@ -9,13 +11,21 @@ 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; diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index ca404e6e3c..d1be7fd4f0 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,4 +1,6 @@ -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; @@ -9,14 +11,28 @@ 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; diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 8affbb3282..04ec8d970e 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -8,16 +10,27 @@ 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; diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 32890d06ad..ff03363812 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,4 +1,6 @@ -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; @@ -10,14 +12,22 @@ 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; diff --git a/Items/Potions/Food/TheSandwich.cs b/Items/Potions/Food/TheSandwich.cs new file mode 100644 index 0000000000..f99710a8c7 --- /dev/null +++ b/Items/Potions/Food/TheSandwich.cs @@ -0,0 +1,42 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class TheSandwich : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public static int alcoholCapBoost = 2; + public static float statBoost = 0.05f; // The player starts with negative stat boosts, so it is a bit less than you'd expect + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(statBoost.ToPercent()); + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(132, 171, 87), + new Color(174, 91, 107), + new Color(218, 176, 133) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(70, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(10)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + public override void UseAnimation(Player player) + { + player.ClearBuff(BuffID.WellFed); + player.ClearBuff(BuffID.WellFed2); + player.ClearBuff(BuffID.WellFed3); + } + } +} diff --git a/Items/Potions/Food/TheSandwich.png b/Items/Potions/Food/TheSandwich.png new file mode 100644 index 0000000000..63404497ee Binary files /dev/null and b/Items/Potions/Food/TheSandwich.png differ diff --git a/Items/Potions/TheConcoction.cs b/Items/Potions/TheConcoction.cs new file mode 100644 index 0000000000..0c9ebf0c0c --- /dev/null +++ b/Items/Potions/TheConcoction.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class TheConcoction : ModItem, ILocalizedModType + { + private static int hoverTimer = 0; + private static bool wasHovering = false; + public new string LocalizationCategory => "Items.Potions"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 30; + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] + { + new Color(255, 190, 250), + new Color(255, 225, 183), + new Color(246, 34, 79) + }; + } + + public override void SetDefaults() + { + Item.DefaultToHealingPotion(50, 56, 500); + Item.value = Item.sellPrice(silver: 60); + Item.rare = ItemRarityID.Green; + } + + + public override void OnConsumeItem(Player player) + { + TheConcoctionPlayer cocPlayer = player.GetModPlayer(); + cocPlayer.swinesWrathCounter = 1200; // Creates a 10 second delay before the buff is visible (triggers at 600) + } + + + public override void UpdateInventory(Player player) + { + wasHovering = Main.HoverItem?.type == Type; + } + + // Display different text for the first 10 frames of hovering over the item's tooltip. + public override void ModifyTooltips(List tooltips) + { + bool isHovering = Main.HoverItem?.type == Type; + + if (isHovering && !wasHovering) + hoverTimer = 0; + if (isHovering) + hoverTimer++; + + if (hoverTimer <= 10 && hoverTimer > 0) + { + TooltipLine healLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "HealLife"); + healLine?.Text = this.GetLocalization("EasterEggText").Value; + } + } + } + + public class TheConcoctionPlayer : ModPlayer + { + public int swinesWrathCounter = -1; + + public override void PostUpdate() + { + if (swinesWrathCounter > 0) + { + swinesWrathCounter--; + + if (swinesWrathCounter <= 600 && !Player.HasBuff()) // When there is 10 seconds left + { + Player.AddBuff(ModContent.BuffType(), 600); + + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/SwinesWrathProc"), Player.Center); + } + } + } + } +} diff --git a/Items/Potions/TheConcoction.png b/Items/Potions/TheConcoction.png new file mode 100644 index 0000000000..1a78543c8e Binary files /dev/null and b/Items/Potions/TheConcoction.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/AggressiveVoucher.png b/Items/Tools/AggressiveVoucher.png new file mode 100644 index 0000000000..a76f8ad580 Binary files /dev/null and b/Items/Tools/AggressiveVoucher.png differ diff --git a/Items/Tools/CombatVoucher.png b/Items/Tools/CombatVoucher.png new file mode 100644 index 0000000000..039206c49d Binary files /dev/null and b/Items/Tools/CombatVoucher.png 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/HurriedVoucher.png b/Items/Tools/HurriedVoucher.png new file mode 100644 index 0000000000..92ec38b48c Binary files /dev/null and b/Items/Tools/HurriedVoucher.png differ diff --git a/Items/Tools/OddVoucher.png b/Items/Tools/OddVoucher.png new file mode 100644 index 0000000000..d406dc4c13 Binary files /dev/null and b/Items/Tools/OddVoucher.png differ diff --git a/Items/Tools/TheGift.cs b/Items/Tools/TheGift.cs new file mode 100644 index 0000000000..f0a6018f58 --- /dev/null +++ b/Items/Tools/TheGift.cs @@ -0,0 +1,153 @@ +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public class TheGift : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + public static readonly SoundStyle BadBuzzer = new SoundStyle("CalamityMod/Sounds/Custom/BadGiftBuzzer") with { Volume = 0.85f }; + public override void SetDefaults() + { + Item.width = Item.height = 20; + Item.maxStack = Item.CommonMaxStack; + Item.useTime = Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.noMelee = true; + Item.UseSound = SoundID.Item1; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + } + + public override void Load() + { + On_ShopHelper.ProcessMood += TheGiftHappiness; + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + // Controls actually applying the effect to an NPC + // None of this should work in Remix because Remix disables happiness + if (Item.noGrabDelay <= 0 && !Main.remixWorld) + { + foreach (NPC n in Main.ActiveNPCs) + { + // Don't run this code for NPCs that aren't affected by happiness + // Also don't run this if The Gift has already been used on this NPC; they all will hold grudges against you :) + if (!n.isLikeATownNPC || NPCID.Sets.NoTownNPCHappiness[n.type] || NPCID.Sets.IsTownPet[n.type] || n.GetGlobalNPC().TheGiftStatus.HasValue) + continue; + + if (Item.Hitbox.Intersects(n.Hitbox)) + { + bool positive = Main.rand.NextBool(); + Color c = positive ? Color.Green : Color.Red; + SoundEngine.PlaySound(positive ? SoundID.ResearchComplete : BadBuzzer, n.Center); + n.GetGlobalNPC().TheGiftStatus = positive; + n.GetGlobalNPC().TheGiftReset = 0.0; + + // Visual effect to demonstrate that something happened + for (int i = 0; i < 6; i++) + { + Vector2 spawnPos = n.Center + Main.rand.NextVector2Circular(30f, 30f); + HealingPlus s = new(spawnPos, 0.5f, (spawnPos - n.Center).SafeNormalize(Vector2.Zero) * 0.65f, c, c * 0.2f, 25) + { + Rotation = positive ? 0f : MathHelper.PiOver4 + }; + GeneralParticleHandler.SpawnParticle(s); + } + for (int j = 0; j < 4; j++) + { + Vector2 spawnPos = n.Center + Main.rand.NextVector2Circular(50f, 50f); + Vector2 arrVel = -Vector2.UnitY * 0.6f * positive.ToDirectionInt(); + StatChangeArrow arr = new(spawnPos, arrVel, -MathHelper.PiOver2 * positive.ToDirectionInt(), c, c * 0.1f, 0.7f, 40); + GeneralParticleHandler.SpawnParticle(arr); + } + + Item.active = false; + Item.type = ItemID.None; + Item.stack = 0; + if (Main.dedServ) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, Item.whoAmI); + // Make sure it can't apply to multiple NPCs at once + break; + } + } + } + } + + // Also contains logic for The Monument, so I can make sure these apply in the correct order + private static void TheGiftHappiness(On_ShopHelper.orig_ProcessMood orig, ShopHelper self, Player player, NPC npc) + { + orig(self, player, npc); + + // Immediately exit early if it's Remix world, or if it's an NPC that should not be affected by happiness + if (Main.remixWorld || NPCID.Sets.NoTownNPCHappiness[npc.type] || NPCID.Sets.IsTownPet[npc.type]) + return; + + var gtnpc = npc.GetGlobalNPC(); + // The Monument lowers happiness by a fixed amount. This is not applied to the Tax Collector. + if (npc.type != NPCID.TaxCollector && gtnpc.SearchForTheMonument(npc)) + { + float oldHappiness = self._currentPriceAdjustment; + self._currentPriceAdjustment += TheMonument.MonumentHappinessReduction; + self.LimitAndRoundMultiplier(self._currentPriceAdjustment); + string dialogueKey; + if (npc.type < NPCID.Count) + { + dialogueKey = $"Mods.CalamityMod.Vanilla.TownNPCMood.{NPCID.Search.GetName(npc.type)}.Monument"; + // Zoologist has separate dialogue when transformed + if (npc.type == NPCID.BestiaryGirl && npc.ShouldBestiaryGirlBeLycantrope()) + dialogueKey += "Transformed"; + } + else + { + var modNPC = NPCLoader.GetNPC(npc.type); + dialogueKey = $"Mods.{modNPC.Mod.Name}.NPCs.{modNPC.Name}.TownNPCMood.Monument"; + } + + // If the NPC is content, it should override that text because they are no longer content + if (oldHappiness == 1f) + self._currentHappiness = Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue("Vanilla.TownNPCMood.DefaultMonument") + " "; + else + self._currentHappiness += Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue("Vanilla.TownNPCMood.DefaultMonument") + " "; + } + + // The Gift sets happiness to a fixed either extremely high or extremely low value, depending on its random state. + bool? gift = gtnpc.TheGiftStatus; + if (gift.HasValue) + { + if (gift.Value) + self._currentPriceAdjustment = 0.5f; + else + self._currentPriceAdjustment = 1.75f; + + string locKey = gift.Value ? "GiftPositive" : "GiftNegative"; + string dialogueKey; + if (npc.type < NPCID.Count) + { + dialogueKey = $"Mods.CalamityMod.Vanilla.TownNPCMood.{NPCID.Search.GetName(npc.type)}.{locKey}"; + // Zoologist has separate dialogue when transformed + if (npc.type == NPCID.BestiaryGirl && npc.ShouldBestiaryGirlBeLycantrope()) + dialogueKey += "Transformed"; + } + else + { + var modNPC = NPCLoader.GetNPC(npc.type); + dialogueKey = $"Mods.{modNPC.Mod.Name}.NPCs.{modNPC.Name}.TownNPCMood.{locKey}"; + } + // Yes, it's intentional that this completely overrides all other happiness report dialogue + self._currentHappiness = Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue($"Vanilla.TownNPCMood.Default{locKey}") + " "; + } + } + } +} diff --git a/Items/Tools/TheGift.png b/Items/Tools/TheGift.png new file mode 100644 index 0000000000..c3a8480e60 Binary files /dev/null and b/Items/Tools/TheGift.png differ diff --git a/Items/Tools/TinkerersVoucher.cs b/Items/Tools/TinkerersVoucher.cs new file mode 100644 index 0000000000..27802ea587 --- /dev/null +++ b/Items/Tools/TinkerersVoucher.cs @@ -0,0 +1,395 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Prefixes; +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Tools +{ + public static class VoucherReforgeSystem + { + public static int ForcedPrefix = -1; + public static bool RollWon = false; + } + + public class VoucherGlobalItem : GlobalItem + { + public override void PreReforge(Item item) + { + Player player = Main.LocalPlayer; + bool isAccessory = item.accessory; + + VoucherReforgeSystem.ForcedPrefix = -1; + + for (int i = 0; i < player.inventory.Length; i++) + { + Item invItem = player.inventory[i]; + + if (invItem.ModItem is VoucherItem voucher) + { + if (voucher.IsUsableVoucher(player, item, isAccessory)) + { + VoucherReforgeSystem.ForcedPrefix = voucher.GetPrefixForItem(player, item, isAccessory); + + invItem.stack--; + if (invItem.stack <= 0) + invItem.TurnToAir(); + + if (Main.netMode != NetmodeID.Server) + { + if (VoucherReforgeSystem.RollWon) + { + for (int dustCount = 0; dustCount < 8; dustCount++) + { + // Light dust and sparks + Vector2 sparkVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3f, 12f); + Vector2 dustVel = (sparkVel).SafeNormalize(Vector2.UnitY).RotatedBy(Main.rand.Next(100)) * Main.rand.NextFloat(1f, 15f); + Vector2 fxPos = player.Center + sparkVel; + Color fxColor = Color.Lerp(Color.MediumAquamarine, Color.MediumSeaGreen, Main.rand.NextFloat(1f)); + + Particle fx = new CustomSpark(fxPos, sparkVel, "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(30, 60)), Main.rand.NextFloat(1.3f, 1.8f), fxColor, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: Main.rand.NextFloat(0.1f, 0.3f)); + GeneralParticleHandler.SpawnParticle(fx); + + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.8f, 1.6f)); + dust.noGravity = true; + dust.color = fxColor; + + + // Crit sparkles + Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(1f, 25f); + Color color = Main.rand.NextBool() ? Color.LightBlue : Color.LightSkyBlue; + + Particle sparkle = new CritSpark(player.MountedCenter, velocity, color, bloom: Color.Cyan, scale: 1f, lifeTime: Main.rand.Next(15, 60)); + GeneralParticleHandler.SpawnParticle(sparkle); + } + + SoundEngine.PlaySound(SoundID.Item4, player.position); + } + else + { + for (int d = 0; d < 10; d++) + { + for (int smokeCount = 0; smokeCount < 3; smokeCount++) + { + Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3f, 12f); + Color smokeStart = Main.rand.NextBool() ? Color.Gray : Color.LightGray; + Color smokeEnd = Color.DimGray; + float smokeSize = Main.rand.NextFloat(0.9f, 2f); + + Particle smoke = new SmallSmokeParticle(player.MountedCenter, velocity, smokeStart, smokeEnd, smokeSize, Main.rand.Next(90, 140)); + GeneralParticleHandler.SpawnParticle(smoke); + } + + Particle skull = new DesertProwlerSkullParticle(player.Center, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), Main.rand.NextBool() ? Color.LightGray : Color.Silver, Color.Gray, Main.rand.NextFloat(0.15f, 0.5f), Main.rand.Next(100, 190)); + GeneralParticleHandler.SpawnParticle(skull); + } + + SoundEngine.PlaySound(SoundID.Item16, player.position); + } + } + break; + } + } + } + } + } + + public abstract class VoucherItem : ModItem + { + #region CyclePrefixes + protected virtual int[] prefixChoices => Array.Empty(); + protected int chosenPrefix = 0; + public override void ModifyTooltips(List tooltips) + { + string selected = GetSelectedPrefixName(); + string all = GetAllPrefixNames(); + + foreach (var line in tooltips) + { + if (line.Mod == "Terraria" && line.Name.StartsWith("Tooltip")) + { + line.Text = line.Text + .Replace("{0}", selected) + .Replace("{1}", all); + } + } + } + + public string GetAllPrefixNames() + { + var pool = prefixChoices; + if (pool.Length == 0) + return null; + + List names = new(); + + foreach (int p in pool) + { + if (p >= 0 && p < Lang.prefix.Length && Lang.prefix[p] != null) + names.Add(Lang.prefix[p].Value); + } + + return string.Join(", ", names); + } + + public string GetSelectedPrefixName() + { + var pool = prefixChoices; + if (pool.Length == 0) + return null; + + int p = pool[chosenPrefix]; + + if (p >= 0 && p < Lang.prefix.Length && Lang.prefix[p] != null) + return Lang.prefix[p].Value; + + return null; + } + #endregion + + public bool IsUsableVoucher(Player player, Item itemBeingReforged, bool isAccessory) + { + return Item.favorited && CanApply(player, itemBeingReforged, isAccessory); + } + + public override bool CanRightClick() => Main.keyState.PressingShift(); + + public override void RightClick(Player player) + { + if (prefixChoices.Length == 0) + return; + + chosenPrefix++; + if (chosenPrefix >= prefixChoices.Length) + chosenPrefix = 0; + + Item.NetStateChanged(); + } + + public override bool ConsumeItem(Player player) => false; + + public override void NetSend(BinaryWriter writer) + { + writer.Write(chosenPrefix); + } + + public override void NetReceive(BinaryReader reader) + { + chosenPrefix = reader.ReadInt32(); + } + + public virtual bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return true; + } + + public virtual int GetPrefixForItem(Player player, Item itemBeingReforged, bool isAccessory) + { + if (prefixChoices.Length == 0) + return -1; + + if (isAccessory) + { + if (Main.rand.NextBool()) + { + VoucherReforgeSystem.RollWon = true; + return prefixChoices[chosenPrefix]; + } + else + { + VoucherReforgeSystem.RollWon = false; + return ModContent.PrefixType(); + } + } + + VoucherReforgeSystem.RollWon = true; + return prefixChoices[chosenPrefix]; + } + } + + public class CombatVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return !isAccessory; + } + + public override int GetPrefixForItem(Player player, Item itemBeingReforged, bool isAccessory) + { + int prefix = -1; + var category = itemBeingReforged.GetPrefixCategories(); + + if (!category.Any()) + return -1; + + if ((itemBeingReforged).knockBack == 0f) // Weapons which do not apply knockback universally have demonic as their best reforge + prefix = PrefixID.Demonic; + + else if (itemBeingReforged.CountsAsClass() && itemBeingReforged.type != ModContent.ItemType()) + { + bool weirdMelee = !category.Contains(PrefixCategory.Melee); // Weapons which deal melee damage but cannot recieve melee prefixes because Item.noUseGraphic is true + + if (weirdMelee || itemBeingReforged.CountsAsClass()) + prefix = PrefixID.Godly; + else + prefix = PrefixID.Legendary; + } + else if (itemBeingReforged.CountsAsClass() || itemBeingReforged.type == ModContent.ItemType()) + prefix = PrefixID.Unreal; + else if (itemBeingReforged.CountsAsClass()) + prefix = PrefixID.Mythical; + else if (itemBeingReforged.CountsAsClass()) + prefix = ModContent.PrefixType(); + else if (itemBeingReforged.CountsAsClass()) + prefix = itemBeingReforged.IsWhip() ? PrefixID.Legendary : PrefixID.Ruthless; + + else // Fallback case + prefix = PrefixID.Godly; + + if (Main.rand.NextBool()) + { + VoucherReforgeSystem.RollWon = true; + return prefix; + } + else + { + VoucherReforgeSystem.RollWon = false; + return ModContent.PrefixType(); + } + } + } + + public class AggressiveVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Jagged, + PrefixID.Angry, + PrefixID.Spiked, + PrefixID.Menacing, + PrefixID.Precise, + PrefixID.Lucky + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } + + public class UnbreakableVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Hard, + PrefixID.Armored, + PrefixID.Guarding, + PrefixID.Warding, + ModContent.PrefixType(), + ModContent.PrefixType() + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } + + public class HurriedVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Brisk, + PrefixID.Fleeting, + PrefixID.Hasty, + PrefixID.Quick + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } + + public class OddVoucher : VoucherItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + protected override int[] prefixChoices => new int[] + { + PrefixID.Arcane, + PrefixID.Wild, + PrefixID.Rash, + PrefixID.Intrepid, + PrefixID.Violent, + ModContent.PrefixType() + }; + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.maxStack = Item.CommonMaxStack; + } + + public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory) + { + return isAccessory; + } + } +} diff --git a/Items/Tools/UnbreakableVoucher.png b/Items/Tools/UnbreakableVoucher.png new file mode 100644 index 0000000000..bab18aaed6 Binary files /dev/null and b/Items/Tools/UnbreakableVoucher.png differ 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/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/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/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 3fc0e1639a..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, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f, 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 new file mode 100644 index 0000000000..8711433e00 --- /dev/null +++ b/Items/Weapons/Ranged/OmniGun.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class OmniGun : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public static int AmmoSavedPercent = 66; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); + public override void SetDefaults() + { + Item.width = 118; + Item.height = 32; + Item.damage = 57; + Item.DamageType = DamageClass.Ranged; + Item.useAnimation = Item.useTime = 6; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5f; + Item.UseSound = null; + Item.noUseGraphic = true; + Item.channel = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.Bullet; + + 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; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/OmniGun.png b/Items/Weapons/Ranged/OmniGun.png new file mode 100644 index 0000000000..34664bc2ae Binary files /dev/null and b/Items/Weapons/Ranged/OmniGun.png differ 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.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index dcccac4abe..609ec4d37f 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -8,6 +8,11 @@ AlcoholPoisoning: { Description: You drank too much and you are now dying } +BaconOilBuff: { + DisplayName: Bacon Oil + Description: Oh gosh you spilled it all over yourself! +} + BloodyMaryBuff: { DisplayName: Bloody Mary Description: Increased enemy spawn rates, reduced piercing weapon effectiveness @@ -737,6 +742,11 @@ SulphurskinBuff: { Description: The sulphuric waters have a lesser effect on you } +SwinesWrathBuff: { + DisplayName: Swine's Wrath + Description: Divine essence is rejecting your body +} + WeaponImbueBrimstone: { DisplayName: Weapon Imbue: Brimstone Description: Melee, Whip, and Rogue attacks ignite enemies with brimstone flames @@ -1758,6 +1768,15 @@ ForbiddenStealthSummonTagBuff: { Description: If you're seeing this, something went horribly wrong } +Malnourished: { + DisplayName: Malnourished + Description: + ''' + Minor reductions to all stats + Your liver feels stronger! + ''' +} + SeaKingsAssurance: { DisplayName: Sea King's Assurance Description: If you're seeing this, something assuredly went horribly wrong diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 492d117468..cee9d11302 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 15%, 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.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 19a52e2df7..c166d29508 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -995,6 +995,15 @@ ThaumaticChair: { Tooltip: One of Chloe's finest creations } +TheMonument: { + DisplayName: The Monument + Tooltip: + ''' + A monument celebrating the accomplishments of capitalism + Funded by the taxes of nearby Town NPCs, though they may not be too happy about that + ''' +} + ThermalTorch: { DisplayName: Thermal Torch Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 61bc96f190..6064fba5d9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -157,6 +157,12 @@ SupremeManaPotion: { Tooltip: "" } +TheConcoction: { + DisplayName: The Concoction + EasterEggText: Removes 500 life + Tooltip: "" +} + ZenPotion: { DisplayName: Zen Potion Tooltip: Vastly decreases enemy spawn rate @@ -167,6 +173,22 @@ ZergPotion: { Tooltip: Vastly increases enemy spawn rate } +BaconOil: { + DisplayName: Bacon Oil + Tooltip: + ''' + Provides "good" mobility that scales with your damage stat boosts + 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: { DisplayName: Bloody Mary Tooltip: @@ -175,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: { @@ -185,6 +213,11 @@ CaribbeanRum: { Reduces your gravity by {1}% {$Common.AlcoholWarning} ''' + DripEffect: + ''' + Increases move speed by {0}% + Reduces your gravity by {1}% + ''' } CinnamonRoll: { @@ -195,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 ''' } @@ -215,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: { @@ -225,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: { @@ -235,6 +275,11 @@ Fireball: { {1}% decreased Sickness debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Heat debuff damage + {1}% decreased Sickness debuff damage + ''' } GrapeBeer: { @@ -246,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: { @@ -256,6 +308,11 @@ Manhattan: { {1}% decreased Water debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Cold debuff damage + {1}% decreased Water debuff damage + ''' } Margarita: { @@ -266,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: { @@ -277,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: { @@ -287,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: { @@ -307,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: { @@ -317,6 +405,11 @@ RedWine: { {1}% reduced flight time {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased vertical speed + {1}% reduced flight time + ''' } Rum: { @@ -327,6 +420,11 @@ Rum: { {1}% decreased minion damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased non-minion summon damage + {1}% decreased minion damage + ''' } Screwdriver: { @@ -337,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: { @@ -347,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: { @@ -357,6 +465,11 @@ Tequila: { {1}% decreased Cold debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Electric debuff damage + {1}% decreased Cold debuff damage + ''' } TequilaSunrise: { @@ -367,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: { @@ -377,6 +504,11 @@ Vodka: { {1}% decreased elemental debuff damage {$Common.AlcoholWarning} ''' + DripEffect: + ''' + {0}% increased Typeless debuff damage + {1}% decreased elemental debuff damage + ''' } Whiskey: { @@ -389,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: { @@ -399,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 @@ -448,3 +593,16 @@ ShroomBowl: { 'He has been grounded' ''' } + +TheSandwich: { + DisplayName: The Sandwich + Tooltip: + ''' + A sandwich made of the finest bread, cheese, and fish in the land! + Minor reductions to all stats + {0}% increased damage for every alcohol you are affected by + Allows you to drink 2 more alcohols than normal + Alcohol effects will not expire while under the effects of The Sandwich + 'Might actually taste good if it was the only thing you'd ever eaten...' + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 935171ee91..6399fb7ce9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -13,6 +13,18 @@ AerialHamaxe: { Tooltip: "" } +AggressiveVoucher: { + DisplayName: Aggressive Voucher + Tooltip: + ''' + Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge + This effect only applies when reforging accessories + Targeted Reforge: {0} + Selectable Reforges: {1} + [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] + ''' +} + AntiCystOintment: { DisplayName: Anti-Cyst Ointment Tooltip: @@ -141,6 +153,15 @@ BrokenWaterFilter: { ''' } +CombatVoucher: { + DisplayName: Combat Voucher + Tooltip: + ''' + Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge + This effect only applies when reforging weapons + ''' +} + Cosmolight: { DisplayName: Cosmolight Tooltip: @@ -205,6 +226,18 @@ GreatbayPickaxe: { Tooltip: Can mine Demonite, Crimtane, Meteorite, Sea Prisms and Sea Prism Crystals } +HurriedVoucher: { + DisplayName: Hurried Voucher + Tooltip: + ''' + Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge + This effect only applies when reforging accessories + Targeted Reforge: {0} + Selectable Reforges: {1} + [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] + ''' +} + InfernaCutter: { DisplayName: Inferna Cutter Tooltip: @@ -268,6 +301,18 @@ NormalityRelocator: { ''' } +OddVoucher: { + DisplayName: Odd Voucher + Tooltip: + ''' + Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge + This effect only applies when reforging accessories + Targeted Reforge: {0} + Selectable Reforges: {1} + [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] + ''' +} + ReefclawHamaxe: { DisplayName: Reefclaw Hamaxe Tooltip: "" @@ -358,6 +403,17 @@ TectonicTruncator: { Tooltip: "" } +TheGift: { + DisplayName: The Gift + Tooltip: + ''' + Drop this fine gift on one of your Town NPCs as a token of appreciation + May make them either love you or hate you, you'll never know until they open it! + Effect will last for 24 hours + [c/F54278:'There's no return policy, better be responsible'] + ''' +} + TorrentialTear: { DisplayName: Torrential Tear Tooltip: @@ -368,6 +424,18 @@ TorrentialTear: { ''' } +UnbreakableVoucher: { + DisplayName: Unbreakable Voucher + Tooltip: + ''' + Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge + This effect only applies when reforging accessories + Targeted Reforge: {0} + Selectable Reforges: {1} + [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] + ''' +} + VoodooDemonVoodooDoll: { DisplayName: Voodoo Demon Voodoo Doll Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 410a5c6147..c126f312f4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -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.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index ea08fee912..aac6009be7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -840,6 +840,20 @@ Onyxia: { ''' } +OmniGun: { + DisplayName: The Omnigun + Tooltip: + ''' + A multipurpose weapon with several modes which are used in sequence + The first shot is a sniper round which gains damage over time and always critically strikes + The second shot is a burst of 10 standard bullets + The third shot is a devastating point blank spread + The fourth shot is a dangerous but powerful grenade which destroys everything, including you + 'What kind of gun is it?' + 'Yes' + ''' +} + OpalStriker: { DisplayName: Opal Striker Tooltip: 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.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index e7a73eee94..18db798bd8 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -352,6 +352,9 @@ Archmage: { DislikeNPC: I dislike {NPCName}'s blatant disregard of magic. I cannot blame his functions, but he is quite ignorant. LikeNPC_Princess: "{NPCName} has some very quaint spells. I'm quite impressed, for someone of her age." Princess_LovesNPC: "{NPCName} makes the best ice cream I've ever tasted, it's so good!" + Monument: What a hideous statue! I always advocated for artistic community projects, but this... you really should have better quality control over what gets into your town! + GiftPositive: '''"How culture shaped magic" by Medomaion of Stratia?! I thought this book was lost centuries ago! How did you find it, and how did you...?! Well, no matter! This is the perfect gift, thank you!''' + GiftNegative: Could you please explain what your last gift was? You made an attempt on my life by trying to freeze me!? You better have a good explanation about how a snowstorm made its way inside that box! } } @@ -432,6 +435,9 @@ Bandit: { DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods. LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute! Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!" + Monument: Yo, if your pockets ever feel lighter, that's not me, alright? You brought this on yourself buddy. + GiftPositive: Heeeey, my man! How's it goin'? I really 'preciate your gift, I have no idea how you got your hands on that kind of lockpicker's kit, but you'd catch me dead before I asked any questions! + GiftNegative: Hey man, what the hell is up with that gift?! I'm the most wanted in seven different city-states, do you got any idea how much a warrant on my name messes up my work?! You better do something to clean that mess before they have me walking to the gallows! } } @@ -475,6 +481,9 @@ BrimstoneWitch: { DislikeNPC: Such a racket! All {NPCName} does is make noise, day in and day out! I can't stand her! LikeNPC_Princess: What a strangely pleasant kid {NPCName} is to be around. Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!" + Monument: That monument is ugly as sin. + GiftPositive: Hey, uh... thanks for the gift, really. I never thought you'd ever give me anything, for obvious reasons. But... thanks, really. It's lovely. + GiftNegative: What the hell was that gift? You know what, I don't even want to think about it. Screw you. } } @@ -558,6 +567,9 @@ SeaKing: { HateNPC: "{NPCName} is just a child, but his attitude towards marine life is unacceptable! Absolutely unacceptable!" LikeNPC_Princess: That child, {NPCName}. She is an innocent soul. Let us hope the horrors of war never reach her. Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!" + Monument: Take that horrible statue out of my sight! It is a disgrace to art, and to so unabashedly extort your people...! I expected much more of you. + GiftPositive: It was quite the delight to see that you gifted me custom-made shoes. Few people seem to realize that "walking" tends to leave my tail quite sore. Thank you, sincerely! + GiftNegative: A dead fish?! You gifted me a dead fish?! You managed to cross every line with that "gift"! Leave, I don't want to see you any longer. } } diff --git a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson index e8127c2e3e..cefd97c27c 100644 --- a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson @@ -2,13 +2,16 @@ Accessory: { Silent.DisplayName: Silent Invigorating.DisplayName: Invigorating Dauntless.DisplayName: Dauntless + Friendly.DisplayName: Friendly // New modifier effects (this is only positive) StealthGenTooltip: +{0}% stealth generation LifeRegenTooltip: +{0} HP/s life regen MaxLifeBoostTooltip: +{0} max life + FriendlyTooltip: +{0} Minion } Weapon: { + Horrible.DisplayName: Horrible Atrocious.DisplayName: Atrocious Blunt.DisplayName: Blunt Feathered.DisplayName: Feathered 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.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 11c64b5d92..c1aea2de59 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -267,3 +267,6 @@ WaterSpout.DisplayName: Spout WildfireBloomFire.DisplayName: Wildfire Fire WildfireBloomFlare.DisplayName: Wildfire Flare WulfrumScrapBullet.DisplayName: High Speed Scrap +OmniSniperShot.DisplayName: Omni Sniper Shot +OmniGrenade.DisplayName: Omni Grenade +OmniShotgunShot.DisplayName: Omni Shotgun Shot 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 51297508f0..7580267697 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 @@ -76,6 +75,7 @@ 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 @@ -107,6 +107,7 @@ PauldronDash.DisplayName: Pauldron Dash PauldronExplosion.DisplayName: Pauldron Explosion PearlAuraShard.DisplayName: Prism Shard PlaguePulse.DisplayName: Plague Pulse +Pigion.DisplayName: Pigion PinkPearlFalling.DisplayName: Pink Pearl PoisonousSeawater.DisplayName: Seawater PolypSandBallFalling.DisplayName: Polyp Sand Ball @@ -152,6 +153,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.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index a5f4d7807f..edb137e714 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -107,6 +107,13 @@ SulphurMeter: "{0} bathed too long in acidic waters." SulphuricPoisoning1: "{0} was melted by the toxic waste." SulphuricPoisoning2: "{0} ingested too many caustic chemicals." SulphuricPoisoning3: "{0} couldn't handle the industrial backwash." +SwinesWrath1: "{0} was not ready to bask in divinity." +SwinesWrath2: "{0} now resides in Pigatory." +SwinesWrath3: "{0} was ground into a fine dust—a fibrous powder, by the wrath of Swine." +SwinesWrath4: "{0} should be careful what they wish for." +SwinesWrath5: "{0} had the last of their health swinedled out from under their nose." +SwinesWrath6: "{0} did not read the label on The Concoction." +SwinesWrath7: "{0}'s life was hogged to the bone." ThornBlossom: "{0} was violently pricked by a flower." UltracosmicMaelstrom1: "{0} was sublimated by [ceffect/dog:Ultracosmic Maelstrom]." UltracosmicMaelstrom2: "{0} got cut down to size by [ceffect/dog:Ultracosmic Maelstrom]." diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 592bd025bc..b7856e8b22 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -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,182 @@ 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. + +TownNPCMood: { + // Default dialogues if, for example, a modded NPC does not have a dialogue line registered + DefaultMonument: I hate The Monument. + DefaultGiftPositive: I love The Gift. + DefaultGiftNegative: I hate The Gift. + + Angler: { + Monument: That monument is sooooooo ugly! I think it needs some chopped fish thrown allllll over it! + GiftPositive: Hey! I don't know how you got a hold of all that squishy gross stuff in that gift, but it might be the best prank material I've ever seen! He he he! + GiftNegative: Are you stupid?! I would NEVER fall for such a laaaaame gift prank like that! You better catch a lot of awesome fish to make up! + } + + ArmsDealer: { + Monument: Was anyone really itchin' to have a big ol' statue in my firing ground? Because I wasn't! + GiftPositive: That new ammo belt was just the gift I've been lookin' for, buddy! Let's test it out together later! + GiftNegative: Do you know what you're doin' by pullin' a bomb in a box prank on me? I can kill you in over seven hundred ways, and that's just with my guns! + } + + BestiaryGirl: { + Monument: This monument is like, totally giving me the creeps, bro! + MonumentTransformed: Rrr... BIG ROCK. BAD! NO!! + GiftPositive: Hey!! You're like, suuuper rad and all for gifting me that cute little bunny! Now umm... I need to think of a name for it! + GiftPositiveTransformed: LOVE. GOOD GIFT. CUTE! + GiftNegative: Eek!! Did you really, like, gift me a dead bunny? I really totally hate when people think that's funny! + GiftNegativeTransformed: Grahh!! HATE. CRUEL. GIFT. WATCH YOURSELF!! + } + + Clothier: { + Monument: I think I am becoming too old to understand this... "modern art". + GiftPositive: There was a simple bell in that gift, but its ring was simply extraordinary. Perhaps this means I truly believe... + GiftNegative: Can we get serious now? No one warned me! No one said "You are about to receive the most wretched gift in history". No one could train for that! + } + + Cyborg: { + Monument: Analysis of nearby monument: Provides zero positive qualities to all lifeforms nearby. + GiftPositive: Gift content scan revealed extremely pure silicon for use in upgraded processors. It appears I appreciate that. + GiftNegative: Gift content scan revealed attempt to trigger malfunction in my systems. Translation: I hate this. + } + + DD2Bartender: { + Monument: Had a lot of customers lately complaining about that big monument outside. I gotta say, they're right. + GiftPositive: The pint in that gift of yours reminded me of what I serve back in Etheria! Ahh, I really miss it... but that was quite thoughtful of you. + GiftNegative: What vile concoction of a drink was that? One sip of it and I had to wipe down the bar again! Were you conspiring with the Kobolds?! + } + + Demolitionist: { + Monument: You know, there is a use for that monument - it'll make for a good demolition test for my biggest dynamite yet! + GiftPositive: Hey, is that a shipment of ale? That's the only thing us dwarves love more than blowing things up! You're da' bomb! + GiftNegative: ARGH! You see yourself as a joker, giving me a water gun? That's an affront to my craft in two ways! Now I'm itching to turn you into a firework! + } + + Dryad: { + Monument: I don't like that monument. I can sense its ugly stain on nature. + GiftPositive: I have no need for material goods as a nature spirit... but I can at least sense your gift was given out of genuine compassion. + GiftNegative: It would be unwise for you to tread near me after "gifting" me an oozing mass of corruption. I question whether you are committed to purifying the world... + } + + DyeTrader: { + Monument: Oh no no, that dull monument cannot be. Its mere presence is sucking the color and vibrancy out of life itself! + GiftPositive: What an extraordinary batch of rare flowers there was in that gift, friend! I must thank you for your help, browse my colors at reduced coin in exchange! + GiftNegative: You think you can pull such a drab gift prank on me, I don't think so! I want no business of yours after that attack on my precious palettes! + } + + GoblinTinkerer: { + Monument: You know, even the barbaric goblin camp I was once part of never considered the concept of a useless monument that just funnels funds. + GiftPositive: What a fascinating welding-cutting combo tool in that gift! I would love to reverse-engineer and tinker it for my own research. + GiftNegative: When I reached into your unassuming gift, my hands were lacerated by a handful of spiky balls! I'm afraid I will have to hike my prices to cover the medical costs. + } + + Golfer: { + Monument: This must be mockery. I don't want a monument of greed erected so close to my home. + GiftPositive: I don't know where you found that wedge, but it's been a real lifesaver in the sand. Thanks for helping my game! + GiftNegative: Tell me something. Why did the shoddy driver in that gift splinter all over the place after one swing? Golf is a delicate sport, and this really hurts! + } + + Guide: { + Monument: I quite dislike that monument you have over there. How could one have such little humbleness! + GiftPositive: A thoughtful gift in this world is always a welcome sight. I greatly appreciate it! + GiftNegative: Apologies, I'm currently in shock over your decision to gift me my own voodoo doll. If only I could curse you! + } + + Mechanic: { + Monument: Any more money I have to fork over for this monument and I'm going to have to start charging an electric bill! I would hate to do that. + GiftPositive: Thanks to your gift of signal extenders, I can connect more of this world than ever! That extra burst of motivation is just what I need to finish wiring up this town! + GiftNegative: What compelled you to be so reckless as to gift me an EMP device? Everyone is yelling at me like it's MY fault! Well, now it will be YOUR problem to pay it off when you buy all your wire. + } + + Merchant: { + Monument: That awful monument is driving away my business! + GiftPositive: What a lovely gift of exotic wares you gave me, friend! Please peruse my shop at clearance rates. + GiftNegative: Why offer a "gift" of rubbish Angel Statues? I tire of your jokes, so if you want business, it'll be extra. + } + + Nurse: { + Monument: Eww, who would put such an ugly rock in this town? + GiftPositive: Hey! Thanks for that gift from earlier. You ever need face reconstruction, you know who to call. + GiftNegative: YOU, I hope you understand that gifting the ONLY DOCTOR HERE some snake oil is how to make me never want to treat you! + } + + Painter: { + Monument: That statue certainly is thought provoking. I'm awestruck by how bleak, dull, and hopeless it makes its environs feel. + GiftPositive: How did ya know exactly the paint color I have been looking for? My newest mural greatly appreciates dat! + GiftNegative: You must be sick and cruel, because that water bomb prank of yours washed all over my latest work! Aye, you oughta be covered in red, and not paint! + } + + PartyGirl: { + Monument: Yeeesh, we're gonna have an ugly statue of big money around? That like, totally kills the party mood around here. + GiftPositive: PARTY GIFTS? FOR ME? Oh just you wait, I'm gonna throw the BIGGEST party this town has ever seen, forever and always! + GiftNegative: I knew you were trouble when you walked in that suspicious looking box! It's too late now to say sorry! + } + + Pirate: { + Monument: Arr, ye landlubbers have filthy tastes in decoration! That statue be askin' to be washed away! + GiftPositive: HAR HAR! Ye bring me the best bottle o' rum I ever taste in me life! Nothin' more for me to say, sea dog! + GiftNegative: Arr, ye scallywag! Ye be askin' to be sent to Davy Jones' locker with that foul concoction ye gave me earlier! + } + + Princess: { + Monument: Um... my people have been frequently complaining about that monument. May I request it be taken down, please? + GiftPositive: I do appreciate your thoughtfulness with this gift, my loyal subject! It's always so wonderful to see the many fantastic things inside one! + GiftNegative: Um... may I ask what you were implying with the contents of that gift? Perhaps I shouldn't worry so, but I do find myself concerned... + } + + SantaClaus: { + Monument: Is this what the holiday season means to people now? Naughty, you are! + GiftPositive: Ho ho ho! What an unusual feeling for someone to be gifting me something at this time of year! You'd be great taking up the mantle! + GiftNegative: What a horrible gift you thought you could give me. You will get no presents this year! + } + + Steampunker: { + Monument: Oi, that bloody big rock you got outside is a monumental mistake! Decommission it this very instant! + GiftPositive: Ahh, what a deeply inspiring jetpack engine! The breakthroughs in steampunk technology from this will be exquisite! Consider this sale a return of generosity. + GiftNegative: When I opened your gift, a sudden blast of cold air condensed all of my steam! Were it not for my backup systems, my machines would be unusable! You bloody better watch yourself! + } + + Stylist: { + Monument: That statue has been the talk of the town! ...As in, everyone cannot stand the gross thing. + GiftPositive: Thanks hun, that gift of new exotic hair dyes was just what I was missin' in my life! I know just who else could use some of this style too! + GiftNegative: What were you pullin' on me with a fireball in a gift box? That could've singed me bald, and I could never be a stylist without hair! NEVER! + } + + TaxCollector: { + Monument: Bah! You shouldn't be seeing this message, plebian! + GiftPositive: What a steal, getting a gift full of the only thing worth a damn in this world -- money! + GiftNegative: Bah! You think you're a jester with that lump of coal? Get out of my sight! + } + + Truffle: { + Monument: Your kind have very strange decorative tastes, such as that monument nearby. + GiftPositive: I love them, my new gifted shroomble companions. It's great to see more of our kind around here! + GiftNegative: A little pig jumped out of that gift you gave me earlier, and tried to eat my face! Perhaps I can't trust you either. + } + + WitchDoctor: { + Monument: A vile disruption of nature, that monument is. My soul is wracked with contempt for this unsightly edifice. + GiftPositive: A kind offering to my people, this gift is. May you be blessed by kindred spirits in trying times. + GiftNegative: Sacrilegious defilement against my arts - I speak of your false gift. May your woes be many, and your days few. + } + + Wizard: { + Monument: If I was your age, I would've blasted that loathsome monument with a giant fireball! Alas, I can't recall the spell. + GiftPositive: An authentic tome of wisdom from the Archmage himself? What a prized possession!! ...uh, who is the Archmage again? + GiftNegative: Do you take me for a fool to place a hex on that gift? How about I place a hex on your wallet, and all of your money disappears when you buy from me!! + } +} 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 0d477e9611..409ca846b9 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -22,6 +22,7 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Rogue; using CalamityMod.Systems.Collections; +using CalamityMod.Tiles.Furniture; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -31,6 +32,7 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs @@ -70,6 +72,18 @@ namespace CalamityMod.NPCs public int shopAlertAnimTimer = 0; /// public int shopAlertAnimFrame = 0; + /// + /// Controls how this Town NPC is being affected by The Gift.
+ /// If true, happiness is overriden with an extremely high value. If false, happiness is overriden with an extremely low value. If null, uses vanilla happiness. + ///
+ public bool? TheGiftStatus = null; + /// + /// Timer to track when to reset the effects of The Gift, which occurs after 24 hours.
+ /// When The Gift is applied, this is set to 0 then starts counting up. + ///
+ public double TheGiftReset = -1.0; + + public bool AffectedByTheMonument = false; public override bool InstancePerEntity => true; @@ -85,6 +99,9 @@ namespace CalamityMod.NPCs myClone.setNewName = setNewName; myClone.shopAlertAnimTimer = shopAlertAnimTimer; myClone.shopAlertAnimFrame = shopAlertAnimFrame; + myClone.TheGiftStatus = TheGiftStatus; + myClone.TheGiftReset = TheGiftReset; + myClone.AffectedByTheMonument = AffectedByTheMonument; return myClone; } @@ -805,8 +822,52 @@ namespace CalamityMod.NPCs public override bool PreAI(NPC npc) { SetPatreonTownNPCName(npc, Mod); + + // Reset The Gift after 24 hours + if (TheGiftReset >= 0.0) + { + TheGiftReset += Main.dayRate; + if (TheGiftReset >= Main.dayLength + Main.nightLength) + { + TheGiftReset = -1.0; + TheGiftStatus = null; + } + } + + // Search for The Monument, for the purposes of assigning higher taxes + AffectedByTheMonument = false; + SearchForTheMonument(npc); + return true; } + + public bool SearchForTheMonument(NPC npc) + { + Point tileCenter = npc.Center.ToTileCoordinates(); + Rectangle searchArea = new((int)(tileCenter.X - Main.buffScanAreaWidth / 2), (int)(tileCenter.Y - Main.buffScanAreaHeight / 2), Main.buffScanAreaWidth, Main.buffScanAreaHeight); + searchArea = WorldUtils.ClampToWorld(searchArea); + for (int i = searchArea.Left; i < searchArea.Right; i++) + { + for (int j = searchArea.Top; j < searchArea.Bottom; j++) + { + if (!searchArea.Contains(i, j)) + continue; + + Tile tile = Main.tile[i, j]; + if (tile == null) + continue; + if (!tile.HasTile) + continue; + + if (tile.TileType == TileType()) + { + AffectedByTheMonument = true; + return true; + } + } + } + return false; + } #endregion #region PreDraw @@ -960,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) @@ -977,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) @@ -1032,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/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/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/Particles/HealingPlus.cs b/Particles/HealingPlus.cs index 4a4de6232b..fbb88cf9f1 100644 --- a/Particles/HealingPlus.cs +++ b/Particles/HealingPlus.cs @@ -12,11 +12,8 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Player Owner; public Color StartColor; public Color EndColor; - public Vector2 OverridePosition; - public float Opacity; public HealingPlus(Vector2 position, float scale, Vector2 velocity, Color colorStart, Color colorEnd, int lifetime) { @@ -34,20 +31,15 @@ namespace CalamityMod.Particles { Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion); Lighting.AddLight(Position, Color.ToVector3() * 0.2f); - Opacity -= 0.5f; } public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(Texture).Value; - Vector2 Size = new Vector2(Scale); + Vector2 origin = new Vector2(tex.Width, tex.Height) * 0.5f; - Vector2 origin = new Vector2(tex.Width, tex.Height); - - Vector2 PositionAdjust = new Vector2(-16, -40); - - spriteBatch.Draw(tex, Position - Main.screenPosition - PositionAdjust, null, Color, Rotation, origin, Size, SpriteEffects.None, 0); + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, origin, Size, SpriteEffects.None, 0); } } diff --git a/Prefixes/AccessoryPrefix.cs b/Prefixes/AccessoryPrefix.cs index 5a2128f08a..ba8fadb9d6 100644 --- a/Prefixes/AccessoryPrefix.cs +++ b/Prefixes/AccessoryPrefix.cs @@ -61,4 +61,33 @@ namespace CalamityMod.Prefixes return 20; } } + + public class Friendly : ModPrefix, ILocalizedModType + { + public new string LocalizationCategory => "Prefixes.Accessory"; + public override PrefixCategory Category => PrefixCategory.Accessory; + + public override void ApplyAccessoryEffects(Player player) + { + // give Minion + player.Calamity().friendlyMinions++; + } + public override void ModifyValue(ref float valueMult) + { + valueMult = 2.5f; + } + public override float RollChance(Item item) => 0; // Is manually applied by an item, can't be rerolled normally + public override bool CanRoll(Item item) + { + return true; + } + public LocalizedText FriendlyTooltip => CalamityUtils.GetText($"{LocalizationCategory}.FriendlyTooltip"); + public override IEnumerable GetTooltipLines(Item item) + { + yield return new TooltipLine(Mod, "CalamityMod:PrefixFriendly", FriendlyTooltip.Format(1)) + { + IsModifier = true + }; + } + } } diff --git a/Prefixes/HorribleWeaponPrefix.cs b/Prefixes/HorribleWeaponPrefix.cs new file mode 100644 index 0000000000..bb77ea8798 --- /dev/null +++ b/Prefixes/HorribleWeaponPrefix.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using CalamityMod.Items; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Prefixes +{ + + public class Horrible : HorribleWeaponPrefix + { + public override float damageMult => 0.50f; + public override float sizeMult => 3f; + } + public abstract class HorribleWeaponPrefix : ModPrefix, ILocalizedModType + { + public new string LocalizationCategory => "Prefixes.Weapon"; + + // Stats + public virtual float damageMult => 1f; + public virtual float sizeMult => 1f; + + public override PrefixCategory Category => PrefixCategory.AnyWeapon; + public override float RollChance(Item item) => 0; // Is manually applied by an item, can't be rerolled normally + public override bool CanRoll(Item item) + { + return item.DamageType != null && item.DamageType != DamageClass.Default; + } + // Applying normal weapon stats + public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus) + { + damageMult = this.damageMult; + scaleMult = this.sizeMult; + } + public override void ModifyValue(ref float valueMult) + { + valueMult = 2.5f; + } + } +} diff --git a/Prefixes/ReforgeChange.cs b/Prefixes/ReforgeChange.cs index 5a42927f66..45b15fdb4b 100644 --- a/Prefixes/ReforgeChange.cs +++ b/Prefixes/ReforgeChange.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Packets; @@ -29,6 +30,14 @@ namespace CalamityMod.Prefixes public override int ChoosePrefix(Item item, UnifiedRandom rand) { + // Voucher override + if (VoucherReforgeSystem.ForcedPrefix != -1) + { + int forced = VoucherReforgeSystem.ForcedPrefix; + VoucherReforgeSystem.ForcedPrefix = -1; + return forced; + } + if (storedPrefix == -1 && item.CountsAsClass() && (item.maxStack == 1 || item.AllowReforgeForStackableItem)) { // Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla 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/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..90e440f997 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -31,7 +31,11 @@ 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) @@ -76,7 +80,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); diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 1d0d877dfa..b848ac0059 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Projectiles.Melee { Player player = Main.player[Projectile.owner]; float spinCycleTime = 50f; + Projectile.scale = player.GetMeleeScale(); // If the player is dead, destroy the projectile if (player.dead || !player.channel) @@ -182,7 +183,8 @@ 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 / 8, Projectile.knockBack / 3f, Projectile.owner); + fire.scale = Projectile.scale; } Main.player[Projectile.owner].Calamity().dragonRageCooldown = 60; } @@ -237,12 +239,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/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 c89e800233..b30430df04 100644 --- a/Projectiles/Melee/LucreciaHoldout.cs +++ b/Projectiles/Melee/LucreciaHoldout.cs @@ -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/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/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/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 new file mode 100644 index 0000000000..3433fc25f1 --- /dev/null +++ b/Projectiles/Ranged/OmniGrenade.cs @@ -0,0 +1,107 @@ +using System.Runtime.CompilerServices; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +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.Ranged +{ + public class OmniGrenade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.timeLeft = 1800; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + if (Projectile.velocity.Y < 25f) + Projectile.velocity.Y += 0.3f; + int fire = Dust.NewDust(Projectile.position, Projectile.width, (int)(Projectile.height * 0.1f), DustID.Torch, 0f, 0f, 100, default); + Main.dust[fire].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[fire].scale = 0.3f; + Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + + Projectile.rotation = Projectile.velocity.ToRotation(); + } + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 7f }, Projectile.Center); + Projectile.ExpandHitboxBy(250); + Projectile.Damage(); + Player Owner = Main.player[Projectile.owner]; + Owner.SetScreenshake(3f); + for (int i = 0; i < 2; i++) + { + Particle center = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 11, 0.95f, Color.OrangeRed * 0.8f, new Vector2(1f, 1f), true, true, glowOpacity: 0.9f); + GeneralParticleHandler.SpawnParticle(center); + } + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.15f, 21, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.07f, 21); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.1f, 21, true); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/RoarPulse", new Vector2(1f, 1f), 0, 0.01f, 0.4f, 15, true); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/SmallBloomRing", new Vector2(1f, 1f), 0, 0.01f, 4f, 15, true, 0.8f); + GeneralParticleHandler.SpawnParticle(pulse2); + for (int i = 0; i < 12; i++) + { + Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * MathHelper.Lerp(10, 30, Main.rand.NextFloat()); + SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, Main.rand.Next(10, 15), Main.rand.NextFloat(1f, 1.2f), Main.rand.NextBool() ? Color.OrangeRed : Color.Red); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 1; i < 21; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(9f, 14f); + Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); + spark.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Gold; + } + for (int j = 0; j < 25; j++) + { + int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); + Main.dust[dust2].noGravity = true; + Main.dust[dust2].velocity *= 5f; + dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); + Main.dust[dust2].velocity *= 2f; + } + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + modifiers.SourceDamage *= 0f; + 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) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 position = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + + Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/OmniGrenade.png b/Projectiles/Ranged/OmniGrenade.png new file mode 100644 index 0000000000..408648ebb0 Binary files /dev/null and b/Projectiles/Ranged/OmniGrenade.png differ diff --git a/Projectiles/Ranged/OmniGunHoldout.cs b/Projectiles/Ranged/OmniGunHoldout.cs new file mode 100644 index 0000000000..6a5c6f65a4 --- /dev/null +++ b/Projectiles/Ranged/OmniGunHoldout.cs @@ -0,0 +1,230 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +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.Ranged +{ + public class OmniGunHoldout : BaseGunHoldoutProjectile + { + + public static Asset MuzzleFlash; + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -1f; + public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 51); + public override float RecoilResolveSpeed => CurrentRecoilResolveSpeed; + + public float CurrentRecoilResolveSpeed = 0; + public int Time = 0; + public int shotCounter = 0; + public int framesBetweenShots = 0; + private float flashVariant; + public override void Load() + { + MuzzleFlash = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandMuzzleFlash", AssetRequestMode.ImmediateLoad); + } + + public override void KillHoldoutLogic() + { + //If the player is dead, kill the holdout. + if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + //Pause to give the effect of reloading + if (Time == 20) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); + } + if (Time >= 70) + { + if (framesBetweenShots == 0) + { + //Here we detect which ammo the bullets will use + Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _); + #region Sniper Shot + if (shotCounter == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Visuals and Sounds + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/GunShotBig") with { Volume = 1f, Pitch = -0.1f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/GunShotHeavy") with { Volume = 0.35f, Pitch = -0.15f }, Projectile.Center); + + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniSniperCasing"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + // "Smoke" ring + Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18); + GeneralParticleHandler.SpawnParticle(shootPulse); + #endregion + OffsetLengthFromArm -= 20f; + CurrentRecoilResolveSpeed = 0.14f; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), (int)(Projectile.damage * 6f), Projectile.knockBack, Projectile.owner); + shotCounter++; + framesBetweenShots = 40; + } + #endregion + #region AR Burst + if (shotCounter >= 1 && shotCounter <= 10 && framesBetweenShots == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmallAlt"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = 0.1f}, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniARCasing"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + // Direct smoke + for (int i = 0; i < 2; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + #endregion + framesBetweenShots = 8; + OffsetLengthFromArm -= 3f; + CurrentRecoilResolveSpeed = 0.3f; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + shotCounter++; + if (shotCounter > 10) + framesBetweenShots = 30; + } + #endregion + #region Shotgun Blast + if (shotCounter == 11 && framesBetweenShots == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Visuals and Sounds + SoundStyle FireSound = new("CalamityMod/Sounds/Item/Hydra"); + SoundEngine.PlaySound(FireSound with { Volume = 0.7f }, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniShotgunShell"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + // Direct smoke + for (int i = 0; i < 16; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + // "Smoke" ring + Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18); + GeneralParticleHandler.SpawnParticle(shootPulse); + #endregion + framesBetweenShots = 8; + OffsetLengthFromArm -= 20f; + CurrentRecoilResolveSpeed = 0.12f; + + // Propel the owner backward + 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 * 3f), Projectile.knockBack, Projectile.owner); + shotCounter++; + if (shotCounter > 11) + framesBetweenShots = 30; + } + #endregion + #region Grenade + if (shotCounter == 12 && framesBetweenShots == 0) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30; + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/LauncherHeavyShot"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, PitchVariance = 0.1f }, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = "OmniGrenadeShell"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } + for (int i = 0; i <= 13; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 0.4f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = Color.White; + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.5f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.52f, 0.72f); + dust2.color = Color.Lerp(Color.Orange, Color.Gold, Main.rand.NextFloat(0f, 1f)); + } + ; + #endregion + OffsetLengthFromArm -= 24f; + CurrentRecoilResolveSpeed = 0.15f; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 9f), Projectile.knockBack, Projectile.owner); + Time = 0; + shotCounter = 0; + } + #endregion + } + if (framesBetweenShots > 0) + framesBetweenShots--; + } + Time++; + } + public override bool PreDraw(ref Color lightColor) + { + if (Time < 2) + return false; + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float scale = Projectile.scale * Owner.gravDir; + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + // Flash + if (Time == 70 || shotCounter == 11 && framesBetweenShots == 0) + { + Texture2D flashTex = MuzzleFlash.Value; + int flashFrameY = (int)flashVariant; + Vector2 flashPos = GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.4f - Main.screenPosition; + Rectangle flashFrame = flashTex.Frame(verticalFrames: 3, frameY: flashFrameY); + Main.EntitySpriteDraw(flashTex, flashPos, flashFrame, Color.White, drawRotation, flashFrame.Size() * 0.5f, scale * 0.8f, flipSprite); + } + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, scale, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Ranged/OmniShotgunShot.cs b/Projectiles/Ranged/OmniShotgunShot.cs new file mode 100644 index 0000000000..814c889888 --- /dev/null +++ b/Projectiles/Ranged/OmniShotgunShot.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OmniShotgunShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Ranged; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.BulletHighVelocity; + Projectile.extraUpdates = 3; + Projectile.penetrate = 1; + Projectile.timeLeft = 15; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + return false; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + Projectile.ExpandHitboxBy(32); + for (int d = 0; d < 2; d++) + { + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + } + for (int d = 0; d < 10; d++) + { + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 2.5f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; + } + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + } +} diff --git a/Projectiles/Ranged/OmniShotgunShot.png b/Projectiles/Ranged/OmniShotgunShot.png new file mode 100644 index 0000000000..bc8355e36c Binary files /dev/null and b/Projectiles/Ranged/OmniShotgunShot.png differ diff --git a/Projectiles/Ranged/OmniSniperShot.cs b/Projectiles/Ranged/OmniSniperShot.cs new file mode 100644 index 0000000000..6d7b7f76f1 --- /dev/null +++ b/Projectiles/Ranged/OmniSniperShot.cs @@ -0,0 +1,110 @@ +using CalamityMod.Particles; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class OmniSniperShot : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public const int DoubleDamageTime = 90; + public static int Lifetime = 600; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 6; + Projectile.light = 0.5f; + Projectile.alpha = 255; + Projectile.extraUpdates = 7; + Projectile.scale = 1.18f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.BulletHighVelocity; + Projectile.penetrate = 5; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.damage += Projectile.originalDamage / DoubleDamageTime; + if (Projectile.timeLeft == Lifetime - 2) + { + for (int i = 0; i <= 4; i++) //Dragon's Breath shot particles my beloved + { + Vector2 sparkVelocity = Projectile.velocity * 0.5f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.4f, 0.95f); + SparkParticle spark1 = new SparkParticle(Projectile.Center, sparkvelocity1, false, 6, sparkScale1, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(1.1f, 3.1f); + SparkParticle spark2 = new SparkParticle(Projectile.Center, sparkvelocity2, false, 6, sparkScale2, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + if (Projectile.timeLeft < Lifetime - 3 && Projectile.timeLeft > Lifetime - 150) + { + SparkParticle spark = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 9, 1.2f, Color.Coral * 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + return true; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 6; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); + dust.noGravity = true; + dust.fadeIn = 0.5f; + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + //Always critically strikes + modifiers.SetCrit(); + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold); + GeneralParticleHandler.SpawnParticle(spark2); + } + + for (int i = 0; i <= 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f)); + dust.noGravity = true; + dust.fadeIn = 0.5f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + return false; + } + } +} diff --git a/Projectiles/Ranged/OmniSniperShot.png b/Projectiles/Ranged/OmniSniperShot.png new file mode 100644 index 0000000000..5961f68208 Binary files /dev/null and b/Projectiles/Ranged/OmniSniperShot.png differ 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/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/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/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/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/Pigion.cs b/Projectiles/Typeless/Pigion.cs new file mode 100644 index 0000000000..fb6b6dc040 --- /dev/null +++ b/Projectiles/Typeless/Pigion.cs @@ -0,0 +1,349 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +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 +{ + public class Pigion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color cl1 = Color.Gold; + public Color cl2 = Color.Goldenrod; + public int hopTimer = 0; + public static int hopMax = 100; + public bool hitGround = false; + public bool hitWall = false; + public Vector2 lastUnmodVel; + public Vector2 mousePos; + public int thrownTimer = 0; // Timer set when grabbed, fades out faster at low velocity, allowing gravity to take effect sooner + public static int thrownTimerMax = 300; + public static int lowestSpeed = 4; + public static int highestSpeed = 20; + public bool deadPig = false; // if Pigion hit a wall at high enough speed to explode + public ref float time => ref Projectile.ai[0]; + public ref float minionNumber => ref Projectile.ai[1]; + public bool pigGrabbed => Projectile.ai[2] == 5; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 42; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + } + public void Frames() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 6 * Projectile.MaxUpdates) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= 2) + Projectile.frame = 0; + } + public override void AI() + { + mousePos = Owner.ClampedMouseWorld(); + if (time == 0) + { + time = Main.rand.Next(1, 800 + 1); + Projectile.spriteDirection = Main.rand.NextBool() ? -1 : 1; + lastUnmodVel = Projectile.velocity; + } + + Frames(); + + // Make an idle sound + if (Main.rand.NextBool(280) && Projectile.soundDelay == 0) + { + SoundStyle oink = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(oink with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.3f, 0.5f), MaxInstances = 5 }, Projectile.Center); + Projectile.soundDelay = 180; + } + + // Teleport back to player if too far away + if (Projectile.Center.Distance(Owner.Center) > 1500) + { + Projectile.velocity = new Vector2(0, -16).RotatedByRandom(MathHelper.Pi / 2); + Projectile.Center = Owner.Center; + } + + // Check if being clicked and no other Pigions are being clicked + if (Owner.controlUseItem && Projectile.Center.Distance(mousePos) <= 60 && !pigGrabbed && Projectile.ai[2] == 0) + SetGrab(true); + + // Push away enemies it touches based on the Pigions velocity + Vector2 toNPC = Vector2.Zero; + NPC npc = Projectile.Center.ClosestNPCAt(300, false); + if (npc != null && !pigGrabbed && Projectile.Hitbox.Intersects(npc.Hitbox)) + { + toNPC = Projectile.Center.DirectionTo(npc.Center); + npc.MoveNPC(Utils.DirectionTo(Projectile.Center, npc.Center), Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed * 1.5f, 4, 30), true); + } + + float hitboxSizeMult = 0.45f; + bool touchingWall = Collision.SolidCollision(Vector2.Lerp(Projectile.TopLeft, Projectile.Left, 0.15f) + Vector2.UnitX * Projectile.velocity.X, 1, (int)(Projectile.height * hitboxSizeMult)) || Collision.SolidCollision(Vector2.Lerp(Projectile.TopRight, Projectile.Right, 0.15f) + Vector2.UnitX * Projectile.velocity.X, 1, (int)(Projectile.height * hitboxSizeMult)); + if (touchingWall) + { + FlipDirection(-Projectile.spriteDirection); + Projectile.velocity.X += Projectile.spriteDirection; + } + if (!pigGrabbed) // Check if hitting tiles or enemies, and if so rebound the Pigion or kill them + Slam(touchingWall, hitboxSizeMult, toNPC); + else + thrownTimer = thrownTimerMax; + lastUnmodVel = Projectile.velocity; + + Movement(); + + thrownTimer -= 1 + (int)(20 * (Utils.GetLerpValue(highestSpeed, lowestSpeed * 2, Projectile.velocity.Length(), true))); + if (thrownTimer < 0) + thrownTimer = 0; + hopTimer--; + time++; + Projectile.timeLeft++; + if (moddedOwner.friendlyMinions < minionNumber || Owner.dead || deadPig) + { + Projectile.Kill(); + return; + } + } + public void Slam(bool touchingWall, float hitboxSizeMult, Vector2 touchNPCVel) + { + bool onPlatform = false; + float thrownMult = Utils.Remap(thrownTimer, 0, thrownTimerMax, 0.6f, 1f); + if (Projectile.velocity.Y > 0) // If moving down, check for platforms + { + for (int i = 4; i < 8; i++) + { + Point bottom = (Projectile.Bottom + Vector2.UnitY * i).ToTileCoordinates(); + if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType]) + { + onPlatform = true; + } + } + } + float velX = MathF.Abs(lastUnmodVel.X); + float velY = MathF.Abs(lastUnmodVel.Y); + bool hitNPC = touchNPCVel != Vector2.Zero; + bool hitDownWall = (Collision.SolidCollision(Projectile.Bottom + Vector2.UnitY * Projectile.velocity.Y, (int)(Projectile.width * hitboxSizeMult), 1) || onPlatform); + bool hitUpWall = Collision.SolidCollision(Projectile.Top + Vector2.UnitY * Projectile.velocity.Y, (int)(Projectile.width * hitboxSizeMult), 1); + bool hitDown = velY > lowestSpeed && hitDownWall; + bool hitUp = velY > lowestSpeed && hitUpWall; + bool hitSide = velX > lowestSpeed && touchingWall; + bool hardHit = Projectile.velocity.Length() >= highestSpeed * 1.5f; // The velocity a Pigion must be going to explode on impact + float volumeMult = Utils.GetLerpValue(lowestSpeed - 2, highestSpeed, Projectile.velocity.Length(), true); // Sounds are quieter at low velocity + + bool hitAnything = false; + if (hitDown || hitUp) + { + if (!hitGround) + { + hitAnything = true; + if (hardHit) + { + deadPig = true; + return; + } + Projectile.velocity.Y = -lastUnmodVel.Y * thrownMult; + MakeDustAndSound(volumeMult); + hitGround = true; + } + } + else + hitGround = false; + + if (hitSide) + { + hitAnything = true; + if (!hitWall) + { + if (hardHit) + { + deadPig = true; + return; + } + Projectile.velocity.X = -lastUnmodVel.X * thrownMult; + MakeDustAndSound(volumeMult); + hitWall = true; + } + } + else + hitWall = false; + + if (hitNPC && Projectile.velocity.Length() >= lowestSpeed) + { + hitAnything = true; + if (hardHit) + { + deadPig = true; + return; + } + Vector2 npcBounceVel = -lastUnmodVel * thrownMult; + Projectile.Center += npcBounceVel; + Projectile.velocity = npcBounceVel; + MakeDustAndSound(volumeMult); + } + + if (hitAnything) + { + FlipDirection(MathF.Sign(Projectile.velocity.X)); + } + } + public void MakeDustAndSound(float volumeMult) + { + SoundStyle splat = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3); + SoundEngine.PlaySound(splat with { Volume = 0.8f * volumeMult, Pitch = Main.rand.NextFloat(0.3f, 0.4f) - volumeMult * 0.3f }, Projectile.Center); + + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float power = 0.2f + Utils.GetLerpValue(0, 40, Projectile.velocity.Length()); + for (int i = 0; i < (int)(12 * power); i++) + { + float variance = Main.rand.NextFloat(-0.8f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), + vel.RotatedBy(variance).RotatedByRandom(MathF.Abs(variance) / 3) * Main.rand.NextFloat(15.0f, 18.0f) * MathF.Pow((1 - MathF.Abs(variance)), 2), 0, default, power * Main.rand.NextFloat(2.3f, 3.2f) - MathF.Abs(variance)); + dust.noGravity = Main.rand.NextBool(2, 3); + dust.color = Main.rand.NextBool() ? cl1 : cl2; + dust.customData = new Vector2(0.8f, 1.1f); + dust.fadeIn = 3.5f * power; + } + } + public void FlipDirection(int newDirection) + { + Projectile.spriteDirection = newDirection; + time = 1; + } + public void SetGrab(bool isGrabbed) => Projectile.ai[2] = (isGrabbed ? 5 : 0); + public void Movement() + { + // Flip movement direction every once in a while + if (time % 900 == 0) + FlipDirection(-Projectile.spriteDirection); + + // Slowing down over time + if (thrownTimer <= thrownTimerMax / 2) + Projectile.velocity.X *= 0.97f; + + // Move Pigion to mouse if grabbed, otherwise ungrab them if player isn't holding M1 anymore + if (pigGrabbed) + { + FlipDirection(MathF.Sign(Projectile.Center.DirectionTo(mousePos).X)); + Vector2 goalVel = (mousePos - Projectile.Center) / (18); + Projectile.velocity = goalVel; + } + if (!Owner.controlUseItem) + SetGrab(false); + + // Falling + if (Projectile.velocity.Y < 14 && thrownTimer <= thrownTimerMax / 2) + Projectile.velocity.Y += 0.3f * Utils.GetLerpValue(100, 0, hopTimer, true); + + int walkRate = 90; // Walk along slowly + if (!pigGrabbed && time % walkRate == 0) + { + Projectile.velocity.X += 1 * Projectile.spriteDirection; + } + + // lil hops when near other Pigions + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + bool validPig = projectile.active && projectile.type == Projectile.type && projectile != Projectile; + float distance = Vector2.Distance(Projectile.Center, projectile.Center); + if (validPig) + { + if (pigGrabbed) + projectile.ai[2] = 1; // set all other Pigions to be counted as not grabable + if (distance <= 80 && distance != 0 && hopTimer <= 0 && thrownTimer == 0) + { + int directionOfJump = -MathF.Sign(Projectile.Center.DirectionTo(projectile.Center).X); + Projectile.velocity += new Vector2(Main.rand.NextFloat(-2.5f, -4) * directionOfJump, -2); + FlipDirection(-directionOfJump); + hopTimer = 100; + } + } + } + + // Rotate based on velocity and direction + float goalRot = Utils.AngleLerp(0, Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0), Utils.GetLerpValue(lowestSpeed, highestSpeed, Projectile.velocity.Length(), true)); + Projectile.rotation = goalRot; + } + public override void OnKill(int timeLeft) + { + if (deadPig) // Only spawn explosion if death is from collision + { + int pigNum = Owner.ownedProjectileCounts[Projectile.type]; + int damage = (int)((pigNum * 2 + Projectile.damage) * MathF.Pow(Owner.GetBestClassDamage().ApplyTo(1), 0.4f + pigNum * 0.6f)); // Damage scales with number of pigions at 0.7 power + float blastSize = 100; + float minMultiplier = 0.1f; + int hitsToMinMult = 4; + Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage), -15, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 5; + blast.DamageType = AverageDamageClass.Instance; + blast.CritChance = 100; + } + + Owner.SetScreenshake(3); + SoundStyle die = new("CalamityMod/Sounds/Item/PigionSqueal"); + SoundEngine.PlaySound(die with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.2f, 0.4f), MaxInstances = 7 }, Projectile.Center); + SoundStyle die2 = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); + SoundEngine.PlaySound(die2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + for (int i = 0; i < 24; i++) + { + Vector2 dustVel = (Vector2.One * 6).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.8f)); + dust.noGravity = Main.rand.NextBool(2, 3); + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.color = Color.Red; + dust.noLightEmittence = true; + dust.fadeIn = -0.4f; + + if (i % 2 == 0) + { + Particle pulse1 = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1, 6), "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(20, 35 + 1), Main.rand.NextFloat(0.2f, 0.35f), Color.Red * 0.55f, new Vector2(1f, 1f), noShrink: true); + GeneralParticleHandler.SpawnParticle(pulse1); + pulse1.Pixelate = true; + } + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + return false; + } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = pigGrabbed; + return true; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, 2, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed, 1, 2), Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed, 1, 0.5f)); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, squash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + return false; + } + public override bool? CanDamage() => false; + public override bool? CanCutTiles() => false; + } +} diff --git a/Projectiles/Typeless/Pigion.png b/Projectiles/Typeless/Pigion.png new file mode 100644 index 0000000000..36858f908c Binary files /dev/null and b/Projectiles/Typeless/Pigion.png differ 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/Custom/BadGiftBuzzer.ogg b/Sounds/Custom/BadGiftBuzzer.ogg new file mode 100644 index 0000000000..16cb4134e4 Binary files /dev/null and b/Sounds/Custom/BadGiftBuzzer.ogg differ diff --git a/Sounds/Item/BaconOilBounce.ogg b/Sounds/Item/BaconOilBounce.ogg new file mode 100644 index 0000000000..542fcf680a Binary files /dev/null and b/Sounds/Item/BaconOilBounce.ogg differ 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/Sounds/Item/PigionSqueal.ogg b/Sounds/Item/PigionSqueal.ogg new file mode 100644 index 0000000000..bbea056193 Binary files /dev/null and b/Sounds/Item/PigionSqueal.ogg differ diff --git a/Sounds/Item/RocketSmall.ogg b/Sounds/Item/RocketSmall.ogg new file mode 100644 index 0000000000..0399e3bd88 Binary files /dev/null and b/Sounds/Item/RocketSmall.ogg differ diff --git a/Sounds/Item/SwinesWrathProc.ogg b/Sounds/Item/SwinesWrathProc.ogg new file mode 100644 index 0000000000..2afe99efa7 Binary files /dev/null and b/Sounds/Item/SwinesWrathProc.ogg differ diff --git a/Systems/Collections/CalamityBuffSets.cs b/Systems/Collections/CalamityBuffSets.cs index 54496b4e70..c6a3d2bdb2 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Systems.Collections BuffID.Crate, BuffID.Warmth, BuffID.SugarRush, BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); @@ -47,7 +47,7 @@ namespace CalamityMod.Systems.Collections ///
public static bool[] IsPersistentBuff = Factory.CreateBoolSet(BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold, BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); @@ -93,35 +93,5 @@ namespace CalamityMod.Systems.Collections { BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn }, { BuffType(), ProfanedSoulCrystal.SummonTag } }; - - /// - /// Associates a buff type with its alcohol poison level. Used for the Alcohol Poisoning mechanic.
- /// If a buff type is not a key in this dictionary, then it does not increase alcohol poison level. - ///
- public static Dictionary AlcoholStrength = new Dictionary - { - { BuffID.Tipsy, 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 2 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 } - }; } } 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/TheMonumentTile.cs b/Tiles/Furniture/TheMonumentTile.cs new file mode 100644 index 0000000000..79a9999633 --- /dev/null +++ b/Tiles/Furniture/TheMonumentTile.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class TheMonumentTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.Width = 7; + TileObjectData.newTile.Height = 8; + TileObjectData.newTile.Origin = new Point16(3, 7); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, TileObjectData.newTile.Width, 0); + + TileObjectData.addTile(Type); + AddMapEntry(new Color(239, 205, 54), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Gold); + return false; + } + } +} diff --git a/Tiles/Furniture/TheMonumentTile.png b/Tiles/Furniture/TheMonumentTile.png new file mode 100644 index 0000000000..79c67d6ac4 Binary files /dev/null and b/Tiles/Furniture/TheMonumentTile.png differ diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 0db89dd408..2ab3093f87 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; - + if (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake)) + baseScale += 0.15f; return baseScale; } diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 7ced2c3c3b..c44848f481 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -161,7 +161,6 @@ namespace CalamityMod projectile.tileCollide = true; } } - public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia, bool respectIFrames = false) { if (!projectile.friendly) 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)