diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 29b8c5dd69..b5accf894f 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)))); @@ -198,9 +195,6 @@ namespace CalamityMod.Balancing // 75% resist to Plaguenades. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); - // 70% resist to Stardust Dragon Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); - // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(ResistTrueMelee(0.5f)))); @@ -209,13 +203,16 @@ namespace CalamityMod.Balancing // 50% resist to Charged Blaster Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.ChargedBlasterLaser)))); - + + //45% resist to Duststorm in a Bottle + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType(), ProjectileType(), ProjectileType())))); + + // 40% resist to Stardust Dragon Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.6f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); + // 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 +251,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 +268,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..c2903d95b5 --- /dev/null +++ b/Buffs/Alcohol/BaconOilBuff.cs @@ -0,0 +1,30 @@ +using CalamityMod.DataStructures; +using CalamityMod.Systems.Collections; +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; + CalamityBuffSets.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/BloodyMaryBuff.png b/Buffs/Alcohol/BloodyMaryBuff.png index 40355f1d96..87d65d2345 100644 Binary files a/Buffs/Alcohol/BloodyMaryBuff.png and b/Buffs/Alcohol/BloodyMaryBuff.png differ diff --git a/Buffs/Alcohol/CaribbeanRumBuff.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/CaribbeanRumBuff.png b/Buffs/Alcohol/CaribbeanRumBuff.png index 3996666a07..52499ee117 100644 Binary files a/Buffs/Alcohol/CaribbeanRumBuff.png and b/Buffs/Alcohol/CaribbeanRumBuff.png differ diff --git a/Buffs/Alcohol/CinnamonRollBuff.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/CinnamonRollBuff.png b/Buffs/Alcohol/CinnamonRollBuff.png index a1a2c0ae34..2aacbc8b75 100644 Binary files a/Buffs/Alcohol/CinnamonRollBuff.png and b/Buffs/Alcohol/CinnamonRollBuff.png differ diff --git a/Buffs/Alcohol/EverclearBuff.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/EverclearBuff.png b/Buffs/Alcohol/EverclearBuff.png index 3f275ba54f..b6f4007bb3 100644 Binary files a/Buffs/Alcohol/EverclearBuff.png and b/Buffs/Alcohol/EverclearBuff.png differ diff --git a/Buffs/Alcohol/EvergreenGinBuff.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/EvergreenGinBuff.png b/Buffs/Alcohol/EvergreenGinBuff.png index f7e2133cd3..85d925b5e5 100644 Binary files a/Buffs/Alcohol/EvergreenGinBuff.png and b/Buffs/Alcohol/EvergreenGinBuff.png differ diff --git a/Buffs/Alcohol/FireballBuff.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/FireballBuff.png b/Buffs/Alcohol/FireballBuff.png index a81dcc472f..53dd87aa12 100644 Binary files a/Buffs/Alcohol/FireballBuff.png and b/Buffs/Alcohol/FireballBuff.png differ diff --git a/Buffs/Alcohol/GrapeBeerBuff.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/GrapeBeerBuff.png b/Buffs/Alcohol/GrapeBeerBuff.png index 258910c643..b073557b01 100644 Binary files a/Buffs/Alcohol/GrapeBeerBuff.png and b/Buffs/Alcohol/GrapeBeerBuff.png differ diff --git a/Buffs/Alcohol/ManhattanBuff.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/ManhattanBuff.png b/Buffs/Alcohol/ManhattanBuff.png index 8d3c026da5..5029f83753 100644 Binary files a/Buffs/Alcohol/ManhattanBuff.png and b/Buffs/Alcohol/ManhattanBuff.png differ diff --git a/Buffs/Alcohol/MargaritaBuff.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/MargaritaBuff.png b/Buffs/Alcohol/MargaritaBuff.png index 94de724886..61d01e45fd 100644 Binary files a/Buffs/Alcohol/MargaritaBuff.png and b/Buffs/Alcohol/MargaritaBuff.png differ diff --git a/Buffs/Alcohol/MoonshineBuff.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/MoonshineBuff.png b/Buffs/Alcohol/MoonshineBuff.png index 028834ea24..21fb314785 100644 Binary files a/Buffs/Alcohol/MoonshineBuff.png and b/Buffs/Alcohol/MoonshineBuff.png differ diff --git a/Buffs/Alcohol/MoscowMuleBuff.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/MoscowMuleBuff.png b/Buffs/Alcohol/MoscowMuleBuff.png index a9cf2f5a18..088da9641d 100644 Binary files a/Buffs/Alcohol/MoscowMuleBuff.png and b/Buffs/Alcohol/MoscowMuleBuff.png differ diff --git a/Buffs/Alcohol/OldFashionedBuff.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/OldFashionedBuff.png b/Buffs/Alcohol/OldFashionedBuff.png index a3ba916b88..150b908bc8 100644 Binary files a/Buffs/Alcohol/OldFashionedBuff.png and b/Buffs/Alcohol/OldFashionedBuff.png differ diff --git a/Buffs/Alcohol/PurpleHazeBuff.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/PurpleHazeBuff.png b/Buffs/Alcohol/PurpleHazeBuff.png index c7fbec83bd..a2b6ca1235 100644 Binary files a/Buffs/Alcohol/PurpleHazeBuff.png and b/Buffs/Alcohol/PurpleHazeBuff.png differ diff --git a/Buffs/Alcohol/RedWineBuff.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/RedWineBuff.png b/Buffs/Alcohol/RedWineBuff.png index 556b48d8fc..7b063a46a3 100644 Binary files a/Buffs/Alcohol/RedWineBuff.png and b/Buffs/Alcohol/RedWineBuff.png differ diff --git a/Buffs/Alcohol/RumBuff.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/RumBuff.png b/Buffs/Alcohol/RumBuff.png index e43b540c7a..a23a1e56d9 100644 Binary files a/Buffs/Alcohol/RumBuff.png and b/Buffs/Alcohol/RumBuff.png differ diff --git a/Buffs/Alcohol/ScrewdriverBuff.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/ScrewdriverBuff.png b/Buffs/Alcohol/ScrewdriverBuff.png index 4d24f45ebd..2e12c6fd40 100644 Binary files a/Buffs/Alcohol/ScrewdriverBuff.png and b/Buffs/Alcohol/ScrewdriverBuff.png differ diff --git a/Buffs/Alcohol/StarBeamRyeBuff.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/StarBeamRyeBuff.png b/Buffs/Alcohol/StarBeamRyeBuff.png index f93dc9cfec..b75b146cca 100644 Binary files a/Buffs/Alcohol/StarBeamRyeBuff.png and b/Buffs/Alcohol/StarBeamRyeBuff.png differ diff --git a/Buffs/Alcohol/TequilaBuff.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/TequilaBuff.png b/Buffs/Alcohol/TequilaBuff.png index ea4d7ed14a..570af3086f 100644 Binary files a/Buffs/Alcohol/TequilaBuff.png and b/Buffs/Alcohol/TequilaBuff.png differ diff --git a/Buffs/Alcohol/TequilaSunriseBuff.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/TequilaSunriseBuff.png b/Buffs/Alcohol/TequilaSunriseBuff.png index 9d36c9250e..269f727796 100644 Binary files a/Buffs/Alcohol/TequilaSunriseBuff.png and b/Buffs/Alcohol/TequilaSunriseBuff.png differ diff --git a/Buffs/Alcohol/Trippy.png b/Buffs/Alcohol/Trippy.png index 7efc1b9c5d..de9e29e023 100644 Binary files a/Buffs/Alcohol/Trippy.png and b/Buffs/Alcohol/Trippy.png differ 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/VodkaBuff.png b/Buffs/Alcohol/VodkaBuff.png index ba5666ddbc..ee994b6d8b 100644 Binary files a/Buffs/Alcohol/VodkaBuff.png and b/Buffs/Alcohol/VodkaBuff.png differ diff --git a/Buffs/Alcohol/WhiskeyBuff.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/WhiskeyBuff.png b/Buffs/Alcohol/WhiskeyBuff.png index fce1a5403b..53196936b8 100644 Binary files a/Buffs/Alcohol/WhiskeyBuff.png and b/Buffs/Alcohol/WhiskeyBuff.png differ diff --git a/Buffs/Alcohol/WhiteWineBuff.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/Alcohol/WhiteWineBuff.png b/Buffs/Alcohol/WhiteWineBuff.png index bfa64feecc..8d5ec47e7b 100644 Binary files a/Buffs/Alcohol/WhiteWineBuff.png and b/Buffs/Alcohol/WhiteWineBuff.png differ diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 816051bcf7..a5a4cd48d5 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -140,14 +140,16 @@ namespace CalamityMod.Buffs { // Globally remove summon tag debuff stacking, unless allowed in the SummonTag // Other mods need to add to this list because otherwise we can't tell which IsATag buff is actually for whips - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out var tag1) && !tag1.AllowsWhipStacking && buffIndex > 0) + var tag1 = CalamityBuffSets.SummonTagDebuff[type]; + if (tag1 is not null && !tag1.AllowsWhipStacking && buffIndex > 0) { for (int i = buffIndex; i >= 0; i--) { if (npc.buffTime[i] > 0) { int buffID = npc.buffType[i]; - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(buffID, out var tag2) && !tag2.AllowsWhipStacking && buffID != type) + var tag2 = CalamityBuffSets.SummonTagDebuff[buffID]; + if (tag2 is not null && !tag2.AllowsWhipStacking && buffID != type) { npc.DelBuff(i); break; diff --git a/Buffs/DamageOverTime/AstralInfectionDebuff.cs b/Buffs/DamageOverTime/AstralInfectionDebuff.cs index f2245d91aa..6374e43865 100644 --- a/Buffs/DamageOverTime/AstralInfectionDebuff.cs +++ b/Buffs/DamageOverTime/AstralInfectionDebuff.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/AuricRebuke.cs b/Buffs/DamageOverTime/AuricRebuke.cs index 939e1c5fdf..f06fd01e68 100644 --- a/Buffs/DamageOverTime/AuricRebuke.cs +++ b/Buffs/DamageOverTime/AuricRebuke.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Bane.cs b/Buffs/DamageOverTime/Bane.cs index c429af3dda..be6e0a4104 100644 --- a/Buffs/DamageOverTime/Bane.cs +++ b/Buffs/DamageOverTime/Bane.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -25,7 +26,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public static void BaneNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) { diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs index 23daa2a06f..5a9a8730ac 100644 --- a/Buffs/DamageOverTime/BanishingFire.cs +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -24,7 +25,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/BrainRot.cs b/Buffs/DamageOverTime/BrainRot.cs index c1f9a49ae2..85e4c1ff09 100644 --- a/Buffs/DamageOverTime/BrainRot.cs +++ b/Buffs/DamageOverTime/BrainRot.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/BrimstoneFlames.cs b/Buffs/DamageOverTime/BrimstoneFlames.cs index b05c42232b..ecfaa64e0c 100644 --- a/Buffs/DamageOverTime/BrimstoneFlames.cs +++ b/Buffs/DamageOverTime/BrimstoneFlames.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/BurningBlood.cs b/Buffs/DamageOverTime/BurningBlood.cs index 5f8e036feb..7988b34e5a 100644 --- a/Buffs/DamageOverTime/BurningBlood.cs +++ b/Buffs/DamageOverTime/BurningBlood.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/CrushDepth.cs b/Buffs/DamageOverTime/CrushDepth.cs index 63c9fa2ebc..b2eea3b897 100644 --- a/Buffs/DamageOverTime/CrushDepth.cs +++ b/Buffs/DamageOverTime/CrushDepth.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Daybroken.cs b/Buffs/DamageOverTime/Daybroken.cs index 947f6c2611..bde8625d72 100644 --- a/Buffs/DamageOverTime/Daybroken.cs +++ b/Buffs/DamageOverTime/Daybroken.cs @@ -4,6 +4,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = DebuffData.Daybroken; + CalamityBuffSets.DebuffDataset[Type] = DebuffData.Daybroken; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/DemonicFlames.cs b/Buffs/DamageOverTime/DemonicFlames.cs index 8e8fd369a5..2bdfd02258 100644 --- a/Buffs/DamageOverTime/DemonicFlames.cs +++ b/Buffs/DamageOverTime/DemonicFlames.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -29,7 +30,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Dragonfire.cs b/Buffs/DamageOverTime/Dragonfire.cs index bc3ff034b3..614e450322 100644 --- a/Buffs/DamageOverTime/Dragonfire.cs +++ b/Buffs/DamageOverTime/Dragonfire.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/ElementalMix.cs b/Buffs/DamageOverTime/ElementalMix.cs index d057dcd645..ee76ef1642 100644 --- a/Buffs/DamageOverTime/ElementalMix.cs +++ b/Buffs/DamageOverTime/ElementalMix.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/GodSlayerInferno.cs b/Buffs/DamageOverTime/GodSlayerInferno.cs index f7d799fafa..21a6d3c7cf 100644 --- a/Buffs/DamageOverTime/GodSlayerInferno.cs +++ b/Buffs/DamageOverTime/GodSlayerInferno.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/HadopelagicPressure.cs b/Buffs/DamageOverTime/HadopelagicPressure.cs index 6cc7804326..f014b8789e 100644 --- a/Buffs/DamageOverTime/HadopelagicPressure.cs +++ b/Buffs/DamageOverTime/HadopelagicPressure.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -70,7 +71,7 @@ namespace CalamityMod.Buffs.DamageOverTime Particle smoke = new HeavySmokeParticle(npcSize, new Vector2(2f, 2f).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 0.7f), smokeColor, 40, Main.rand.NextFloat(0.3f, 0.4f) + (0.00000013f * npc.width * npc.height), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); GeneralParticleHandler.SpawnParticle(smoke); } - Dust water = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, 360, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.4f); + Dust water = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, 390, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.4f); water.noGravity = true; water.velocity *= 0.75f; water.velocity.X = water.velocity.X * 0.75f; diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs index 49782c6cb6..2b545a3988 100644 --- a/Buffs/DamageOverTime/HeavyBleeding.cs +++ b/Buffs/DamageOverTime/HeavyBleeding.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index 84a60b5e22..1a90bca57d 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/HolyInferno.cs b/Buffs/DamageOverTime/HolyInferno.cs index eaf25ad6a1..77882f2a00 100644 --- a/Buffs/DamageOverTime/HolyInferno.cs +++ b/Buffs/DamageOverTime/HolyInferno.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -19,7 +20,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Laceration.cs b/Buffs/DamageOverTime/Laceration.cs index 8e50c0422d..021829ed16 100644 --- a/Buffs/DamageOverTime/Laceration.cs +++ b/Buffs/DamageOverTime/Laceration.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/MiracleBlight.cs b/Buffs/DamageOverTime/MiracleBlight.cs index 448b4616a7..eccb776377 100644 --- a/Buffs/DamageOverTime/MiracleBlight.cs +++ b/Buffs/DamageOverTime/MiracleBlight.cs @@ -13,6 +13,7 @@ using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -55,7 +56,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Nightwither.cs b/Buffs/DamageOverTime/Nightwither.cs index dbdbef4d02..9578921853 100644 --- a/Buffs/DamageOverTime/Nightwither.cs +++ b/Buffs/DamageOverTime/Nightwither.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Plague.cs b/Buffs/DamageOverTime/Plague.cs index 45875dc587..7c3b9a3e77 100644 --- a/Buffs/DamageOverTime/Plague.cs +++ b/Buffs/DamageOverTime/Plague.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/RiptideDebuff.cs b/Buffs/DamageOverTime/RiptideDebuff.cs index e68629fae6..74b3d510fc 100644 --- a/Buffs/DamageOverTime/RiptideDebuff.cs +++ b/Buffs/DamageOverTime/RiptideDebuff.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index 5065122406..ba20aefe40 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -58,7 +59,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) { diff --git a/Buffs/DamageOverTime/SearingLava.cs b/Buffs/DamageOverTime/SearingLava.cs index 708af57feb..bdc5182787 100644 --- a/Buffs/DamageOverTime/SearingLava.cs +++ b/Buffs/DamageOverTime/SearingLava.cs @@ -2,6 +2,7 @@ using CalamityMod.DataStructures; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -33,7 +34,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Shadowflame.cs b/Buffs/DamageOverTime/Shadowflame.cs index 3b89427e23..f7ef42d959 100644 --- a/Buffs/DamageOverTime/Shadowflame.cs +++ b/Buffs/DamageOverTime/Shadowflame.cs @@ -5,6 +5,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -18,7 +19,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = DebuffData.Shadowflame; + CalamityBuffSets.DebuffDataset[Type] = DebuffData.Shadowflame; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/ShellfishClaps.cs b/Buffs/DamageOverTime/ShellfishClaps.cs index c70408473c..11edc8040c 100644 --- a/Buffs/DamageOverTime/ShellfishClaps.cs +++ b/Buffs/DamageOverTime/ShellfishClaps.cs @@ -1,8 +1,11 @@ -using CalamityMod.Balancing; +using System; +using CalamityMod.Balancing; using CalamityMod.DataStructures; using CalamityMod.Projectiles.Summon; using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -10,11 +13,14 @@ namespace CalamityMod.Buffs.DamageOverTime { public static DebuffData debuffData = new DebuffData() { - EnemyLostRegen = 150, //Damage per shellfish + EnemyLostRegen = 170, //Damage per shellfish NPCLifeRegenMethod = ShellfishStacking }; public static void ShellfishStacking(NPC npc, int buffType, ref int buffIndex, ref int damage) { + if (npc.SuperArmor) + return; + int projectileCount = 0; int owner = 255; foreach (Projectile p in Main.ActiveProjectiles) @@ -38,7 +44,7 @@ namespace CalamityMod.Buffs.DamageOverTime if (CalamityUtils.ShouldTriggerSummonPenalty(Main.player[owner], heldItem)) totalDamage = (int)(totalDamage * BalancingConstants.SummonerCrossClassNerf); - int totalDisplayedDamage = totalDamage / 5; + int totalDisplayedDamage = (int)Math.Max(totalDamage * debuffData.MultiplierDamageTickSize, debuffData.MinimumDamageTickSize); npc.Calamity().ApplyDPSDebuff(projectileCount * totalDamage, projectileCount * totalDisplayedDamage, ref npc.lifeRegen, ref damage); } public override void SetStaticDefaults() @@ -46,7 +52,8 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; + BuffID.Sets.IsATagBuff[Type] = true; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/SnapClamDebuff.cs b/Buffs/DamageOverTime/SnapClamDebuff.cs index acf115c563..8f9f59d4aa 100644 --- a/Buffs/DamageOverTime/SnapClamDebuff.cs +++ b/Buffs/DamageOverTime/SnapClamDebuff.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -34,7 +35,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/StaticDischarge.cs b/Buffs/DamageOverTime/StaticDischarge.cs index 5b88e5a0c0..457d88f93c 100644 --- a/Buffs/DamageOverTime/StaticDischarge.cs +++ b/Buffs/DamageOverTime/StaticDischarge.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -20,7 +21,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/SulphuricPoisoning.cs b/Buffs/DamageOverTime/SulphuricPoisoning.cs index 614e9f0c56..73e3144904 100644 --- a/Buffs/DamageOverTime/SulphuricPoisoning.cs +++ b/Buffs/DamageOverTime/SulphuricPoisoning.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; // Acid Venom immunity is granted automatically if you are immune to Sulphuric Poisoning. BuffID.Sets.GrantImmunityWith[BuffID.Venom].Add(Type); diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs index e7eb641700..2145aba8db 100644 --- a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -28,7 +29,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().trueVHex = true; diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index 87e8b8d1b7..47068b9b71 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -23,7 +24,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/VermillionFlux.cs b/Buffs/DamageOverTime/VermillionFlux.cs index 8e4f03ccc0..71384ef591 100644 --- a/Buffs/DamageOverTime/VermillionFlux.cs +++ b/Buffs/DamageOverTime/VermillionFlux.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/Voidfrost.cs b/Buffs/DamageOverTime/Voidfrost.cs index 37280063fa..44b85decd2 100644 --- a/Buffs/DamageOverTime/Voidfrost.cs +++ b/Buffs/DamageOverTime/Voidfrost.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index d1275f89ae..2ce9745729 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -31,7 +32,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true; diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs index 75bf7fdde9..9a0fd3a13b 100644 --- a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -1,6 +1,7 @@ using CalamityMod.DataStructures; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().weakBrimstoneFlames = true; diff --git a/Buffs/DamageOverTime/WindChilled.cs b/Buffs/DamageOverTime/WindChilled.cs new file mode 100644 index 0000000000..4b5197bc2b --- /dev/null +++ b/Buffs/DamageOverTime/WindChilled.cs @@ -0,0 +1,108 @@ +using System; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class WindChilled : ModBuff + { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 12, + NPCLifeRegenMethod = WindChilledNPCLifeRegen, + ColdDebuffScaling = 1 + }; + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + CalamityBuffSets.DebuffDataset[Type] = debuffData; + } + public static void WindChilledNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + + int baseDoTValue = (int)(cnpc.windChilledMult * npc.Calamity().ActiveColdDebuffMultiplier.ApplyTo(debuffData.EnemyLostRegen)); + cnpc.ApplyDPSDebuff(baseDoTValue, Math.Max((int)(baseDoTValue * debuffData.MultiplierDamageTickSize), debuffData.MinimumDamageTickSize) / 2, ref npc.lifeRegen, ref damage); + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().windChilled = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().windChilled = true; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + { + Player player = drawInfo.drawPlayer; + + float widthMult = 1; + float hightMult = 1; + Color color = Elumphant.color1; + Color color2 = Elumphant.color2; + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi); + if (Main.rand.NextBool(16)) + { + bool start = !Main.rand.NextBool(4); + Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + player.velocity * 0.85f; + Vector2 particlePos = player.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult); + Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult))); + GeneralParticleHandler.SpawnParticle(mist, true, Enums.GeneralDrawLayer.AfterPlayers); + } + if (Main.rand.NextBool(11)) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1); + Dust dust2 = Dust.NewDustPerfect(player.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType(), + Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult)); + dust2.noGravity = false; + dust2.color = Main.rand.NextBool() ? color : color2; + dust2.customData = new Vector2(0.7f, 1.4f); + dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult); + } + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + float maxSizeMult = 10f; + float widthMult = MathF.Pow(Utils.Remap(npc.width, 10, 500, 1f, maxSizeMult, false), 0.8f); + float hightMult = MathF.Pow(Utils.Remap(npc.height, 10, 500, 1f, maxSizeMult, false), 0.8f); + Color color = Elumphant.color1; + Color color2 = Elumphant.color2; + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi); + if (Main.rand.NextBool(16)) + { + bool start = !Main.rand.NextBool(4); + Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + npc.velocity * 0.85f; + Vector2 particlePos = npc.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult); + Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult))); + GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs); + } + if (Main.rand.NextBool(11)) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1); + Dust dust2 = Dust.NewDustPerfect(npc.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType(), + Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult)); + dust2.noGravity = false; + dust2.color = Main.rand.NextBool() ? color : color2; + dust2.customData = new Vector2(0.7f, 1.4f); + dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult); + } + } + } +} diff --git a/Buffs/DamageOverTime/WindChilled.png b/Buffs/DamageOverTime/WindChilled.png new file mode 100644 index 0000000000..ad600bb991 Binary files /dev/null and b/Buffs/DamageOverTime/WindChilled.png differ diff --git a/Buffs/Placeables/BlueCandleBuff.png b/Buffs/Placeables/BlueCandleBuff.png index a73721ff8f..c8ba5aa330 100644 Binary files a/Buffs/Placeables/BlueCandleBuff.png and b/Buffs/Placeables/BlueCandleBuff.png differ diff --git a/Buffs/Placeables/CorruptionEffigyBuff.png b/Buffs/Placeables/CorruptionEffigyBuff.png index 557440806c..c4e47d8cc1 100644 Binary files a/Buffs/Placeables/CorruptionEffigyBuff.png and b/Buffs/Placeables/CorruptionEffigyBuff.png differ diff --git a/Buffs/Placeables/PinkCandleBuff.png b/Buffs/Placeables/PinkCandleBuff.png index c299a08857..a5eb745a86 100644 Binary files a/Buffs/Placeables/PinkCandleBuff.png and b/Buffs/Placeables/PinkCandleBuff.png differ diff --git a/Buffs/Placeables/PurpleCandleBuff.png b/Buffs/Placeables/PurpleCandleBuff.png index 3ff18f000a..64959e5df2 100644 Binary files a/Buffs/Placeables/PurpleCandleBuff.png and b/Buffs/Placeables/PurpleCandleBuff.png differ diff --git a/Buffs/Placeables/YellowCandleBuff.png b/Buffs/Placeables/YellowCandleBuff.png index 2ac39e16dd..cf263248cb 100644 Binary files a/Buffs/Placeables/YellowCandleBuff.png and b/Buffs/Placeables/YellowCandleBuff.png differ 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/StatBuffs/SmashedEvil.cs b/Buffs/StatBuffs/SmashedEvil.cs index 9991a19dad..57f5c2ac60 100644 --- a/Buffs/StatBuffs/SmashedEvil.cs +++ b/Buffs/StatBuffs/SmashedEvil.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Accessories; using Terraria; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatBuffs { @@ -47,7 +48,7 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatDebuffs/AbsorberAffliction.cs b/Buffs/StatDebuffs/AbsorberAffliction.cs index 55df57f042..5d8251900e 100644 --- a/Buffs/StatDebuffs/AbsorberAffliction.cs +++ b/Buffs/StatDebuffs/AbsorberAffliction.cs @@ -4,6 +4,7 @@ using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { @@ -21,7 +22,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/StatDebuffs/Crumbling.cs b/Buffs/StatDebuffs/Crumbling.cs index 2539449caf..48ce39f04c 100644 --- a/Buffs/StatDebuffs/Crumbling.cs +++ b/Buffs/StatDebuffs/Crumbling.cs @@ -6,8 +6,6 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Crumbling : ModBuff { - public static int DefenseReduction = 10; - public static float MultiplicativeDamageReductionPlayer = 0.7f; // 8% DR reduction public static float MultiplicativeDamageReductionEnemy = 0.92f; @@ -24,10 +22,5 @@ namespace CalamityMod.Buffs.StatDebuffs { npc.Calamity().crumble = true; } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().crumble = true; - } } } diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index 512476ef2d..7cafbbd2d4 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -4,6 +4,7 @@ using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { @@ -15,7 +16,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } // Purely to make it get electric color in tooltips public static DebuffData debuffData = new DebuffData() diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index 21166569fe..ce9a20f3f4 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { @@ -53,7 +54,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) 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/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index 04f29017ff..a7d62109e7 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -2,11 +2,15 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatDebuffs { public class WhisperingDeath : ModBuff { + public static float PlayerDamageReduction = 0.2f; + public static float EnemyDamageReduction = 0.1f; + // Whispering Death does not deal DoT, but is classified as a sickness debuff. public static DebuffData debuffData = new DebuffData() { @@ -18,7 +22,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; - BuffDatasets.DebuffDataset[Type] = debuffData; + CalamityBuffSets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Summon/RareSandElemental.cs b/Buffs/Summon/OasisElementalBuff.cs similarity index 68% rename from Buffs/Summon/RareSandElemental.cs rename to Buffs/Summon/OasisElementalBuff.cs index 2748620ff6..962ce3dadb 100644 --- a/Buffs/Summon/RareSandElemental.cs +++ b/Buffs/Summon/OasisElementalBuff.cs @@ -1,12 +1,12 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class RareSandElemental : BaseSummonBuff + public class OasisElementalBuff : BaseSummonBuff { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.rareSandEleBuff; + protected override ref bool MinionBool => ref BuffModdedOwner.oasisEleBuff; } } diff --git a/Buffs/Summon/RareSandElemental.png b/Buffs/Summon/OasisElementalBuff.png similarity index 100% rename from Buffs/Summon/RareSandElemental.png rename to Buffs/Summon/OasisElementalBuff.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 7817879e17..e8e6ac4798 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; @@ -60,7 +61,6 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.Shortswords; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; @@ -69,6 +69,7 @@ using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Mechanic; using CalamityMod.Utilities; +using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -84,7 +85,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Net; -using Terraria.WorldBuilding; using static Terraria.Main; using static Terraria.ModLoader.ModContent; @@ -140,6 +140,13 @@ namespace CalamityMod.CalPlayer /// public bool heldGaelsLastFrame = false; /// + /// Tracks whether or not the player is currently holding Elephant Killer.
+ /// Used to reset stealth when swapping to this item. + ///
+ public bool heldElephantKillerLastFrame = false; + public float elephantKillerJoke = 0; + public bool drawingElephantKillerJoke = false; + /// /// Tracks whether or not the player currently has Draedon's Heart equipped.
/// Used to reset Adrenaline when (un)equipped to prevent exploits. ///
@@ -379,9 +386,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.
@@ -769,8 +779,6 @@ namespace CalamityMod.CalPlayer #endregion #region Permanent Buff - /// If true, the player has spawned in Punch Card through its one-time chat easter egg. - public bool spawnedPunchCard = false; /// If true, the player has consumed Celestial Onion. public bool extraAccessoryML = false; /// If true, the player has consumed Comet Shard. @@ -805,6 +813,7 @@ namespace CalamityMod.CalPlayer #endregion #region Accessory + public int friendlyMinions = 0; public bool shieldOfTheHighRulerDashVelocityBoosted = false; public bool yharimsGift = false; public bool luxorsGift = false; @@ -863,6 +872,11 @@ namespace CalamityMod.CalPlayer public bool ascendantInsignia = false; public int ascendantInsigniaBuffTime = 0; public int ascendantInsigniaCooldown = 0; + public bool fishStocks = false; + public float fishStockVisual = 0; + public float fishStockPower = 0; + public float fishStockSlidingPower = 0; + public (float, float, float, float, float) fishStockOldPower = (0, 0, 0, 0, 0); /// Used to toggle dust spawned while swinging, through accessory visibility. public bool magmaStoneVisuals = true; public bool eGauntlet = false; @@ -1034,6 +1048,10 @@ namespace CalamityMod.CalPlayer /// At 0f, the player has regular crit damage. At 1f, the player has +100% crit damage. ///
public float critDamage = 0; + /// + /// Multiplies the amount of coins the player gets from enemies. + /// + public float coinDropMult = 1f; public bool darkSunRing = false; public bool crawCarapace = false; public bool baroclaw = false; @@ -1041,9 +1059,9 @@ namespace CalamityMod.CalPlayer public int fallingBootVelCheckTimer = 0; public bool voidOfCalamity = false; public bool apollyon = false; - public bool eArtifact = false; - public bool dArtifact = false; - public bool auricSArtifact = false; + public bool fragmentsOfAnotherWorld = false; + public bool crushingEgo = false; + public bool fadedIdolatry = false; public bool pSoulArtifact = false; public bool giantPearl = false; public bool shieldOfTheOcean = false; @@ -1082,8 +1100,8 @@ namespace CalamityMod.CalPlayer public float summonProjCooldown; public bool sandElemental = false; public bool sandElementalVanity = false; - public bool rareSandElemental = false; - public bool rareSandElementalVanity = false; + public bool oasisElemental = false; + public bool oasisElementalVanity = false; public bool cloudElemental = false; public bool cloudElementalVanity = false; public bool brimElemental = false; @@ -1130,6 +1148,11 @@ namespace CalamityMod.CalPlayer public bool scionsCurioGotHit = false; public bool scionsCurioVisuals = false; public float scionsCurioDebuffDamage = 0; + public bool frozenCube = false; + public bool frozenCubeVisuals = false; + public float frozenCubeDebuffBoost = 0; + public float frozenCubeElumphantBoost = 0; + public int frozenCubeUsedDefense = 0; public bool miniOldDuke = false; public bool miniOldDukeVanity = false; public bool starbusterCore = false; @@ -1370,7 +1393,6 @@ namespace CalamityMod.CalPlayer public bool staticDischarge = false; public bool miracleBlight = false; public bool armorCrunch = false; - public bool crumble = false; public bool irradiated = false; public bool bane = false; public bool brimstoneFlames = false; @@ -1396,6 +1418,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; @@ -1408,6 +1431,7 @@ namespace CalamityMod.CalPlayer public bool vaporfied = false; public bool banishingFire = false; public bool wither = false; + public bool windChilled = false; public bool ManaBurn = false; /// Counter variable used to prevent the player from being inflicted with another immobilizing debuff for a short time after being inflicted with one. @@ -1487,6 +1511,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; @@ -1566,7 +1592,7 @@ namespace CalamityMod.CalPlayer /// Elemental in a Bottle. public bool sandEleBuff = false; /// Rare Elemental in a Bottle. - public bool rareSandEleBuff = false; + public bool oasisEleBuff = false; /// Eye of the Storm. public bool cloudEleBuff = false; /// Rose Stone. @@ -1841,7 +1867,6 @@ namespace CalamityMod.CalPlayer #region Saving And Loading public override void Initialize() { - spawnedPunchCard = false; extraAccessoryML = false; eCore = false; mFruit = false; @@ -1893,7 +1918,6 @@ namespace CalamityMod.CalPlayer public override void SaveData(TagCompound tag) { var boost = new List(); - boost.AddWithCondition("spawnedPunchCard", spawnedPunchCard); boost.AddWithCondition("extraAccessoryML", extraAccessoryML); boost.AddWithCondition("etherealCore", eCore); boost.AddWithCondition("miracleFruit", mFruit); @@ -1983,7 +2007,6 @@ namespace CalamityMod.CalPlayer public override void LoadData(TagCompound tag) { var boost = tag.GetList("boost"); - spawnedPunchCard = boost.Contains("spawnedPunchCard"); extraAccessoryML = boost.Contains("extraAccessoryML"); eCore = boost.Contains("etherealCore"); mFruit = boost.Contains("miracleFruit"); @@ -2163,6 +2186,7 @@ namespace CalamityMod.CalPlayer externalAuricRejectionImmunity = false; alcoholPoisonLevel = 0; + alcoholPoisonMax = alcoholPoisonMaxBase; noLifeRegen = false; //Stratus Starburst amount management @@ -2252,6 +2276,7 @@ namespace CalamityMod.CalPlayer if (!pSoulArtifact) pSoulShieldDurability = 0; } + friendlyMinions = 0; pSoulShieldVisible = false; roverDrive = false; roverDriveShieldVisible = false; @@ -2422,6 +2447,7 @@ namespace CalamityMod.CalPlayer teslaVisuals = true; cryogenSoul = false; ascendantInsignia = false; + fishStocks = false; magmaStoneVisuals = true; eGauntlet = false; eGauntletVisuals = true; @@ -2471,9 +2497,9 @@ namespace CalamityMod.CalPlayer baroclaw = false; voidOfCalamity = false; apollyon = false; - eArtifact = false; - dArtifact = false; - auricSArtifact = false; + fragmentsOfAnotherWorld = false; + crushingEgo = false; + fadedIdolatry = false; pSoulArtifact = false; giantPearl = false; shieldOfTheOcean = false; @@ -2511,6 +2537,7 @@ namespace CalamityMod.CalPlayer camper = false; corrosiveSpine = false; scionsCurio = false; + frozenCube = false; frozenCubeDebuffBoost = 0; frozenCubeElumphantBoost = 0; frozenCubeUsedDefense = 0; rottenDogTooth = false; angelicAlliance = false; ChaosStone = false; @@ -2669,7 +2696,6 @@ namespace CalamityMod.CalPlayer staticDischarge = false; miracleBlight = false; armorCrunch = false; - crumble = false; irradiated = false; bane = false; brimstoneFlames = false; @@ -2696,6 +2722,7 @@ namespace CalamityMod.CalPlayer riptide = false; hadopelagicPressure = false; fishAlert = false; + malnourished = false; clamity = false; NOU = false; enraged = false; @@ -2709,6 +2736,7 @@ namespace CalamityMod.CalPlayer vaporfied = false; banishingFire = false; wither = false; + windChilled = false; ManaBurn = false; TypelessDebuffMultiplier = new(); @@ -2783,6 +2811,7 @@ namespace CalamityMod.CalPlayer moscowMule = false; whiteWine = false; evergreenGin = false; + baconOil = false; tranquilityCandle = false; chaosCandle = false; @@ -2829,7 +2858,7 @@ namespace CalamityMod.CalPlayer cEnergy = false; pSoulGuardians = false; sandEleBuff = false; - rareSandEleBuff = false; + oasisEleBuff = false; cloudEleBuff = false; brimEleBuff = false; waterEleBuff = false; @@ -2846,8 +2875,8 @@ namespace CalamityMod.CalPlayer MutatedTruffleBool = false; sandElemental = false; sandElementalVanity = false; - rareSandElemental = false; - rareSandElementalVanity = false; + oasisElemental = false; + oasisElementalVanity = false; cloudElemental = false; cloudElementalVanity = false; brimElemental = false; @@ -3072,6 +3101,7 @@ namespace CalamityMod.CalPlayer if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0) consecutiveCaughtFish = 0; heldGaelsLastFrame = false; + heldElephantKillerLastFrame = false; partialLifeRegenCounter = 0f; gaelSwipes = 0; whitewaterHeal = 0; @@ -3097,6 +3127,7 @@ namespace CalamityMod.CalPlayer holyInfernoFadeIntensity = 0f; spiritOriginCritBoost = 0; critDamage = 0f; + coinDropMult = 1f; rage = 0f; adrenaline = 0f; raiderCritLifespan = 0; @@ -3153,7 +3184,6 @@ namespace CalamityMod.CalPlayer staticDischarge = false; miracleBlight = false; armorCrunch = false; - crumble = false; irradiated = false; bane = false; brimstoneFlames = false; @@ -3180,6 +3210,7 @@ namespace CalamityMod.CalPlayer riptide = false; hadopelagicPressure = false; fishAlert = false; + malnourished = false; clamity = false; NOU = false; snowmanNoseless = false; @@ -3192,6 +3223,7 @@ namespace CalamityMod.CalPlayer vaporfied = false; banishingFire = false; wither = false; + windChilled = false; ImmobilityDebuffImmunityTimer = 0; TypelessDebuffMultiplier = new(); HeatDebuffMultiplier = new(); @@ -3294,6 +3326,7 @@ namespace CalamityMod.CalPlayer moscowMule = false; whiteWine = false; evergreenGin = false; + baconOil = false; tranquilityCandle = false; chaosCandle = false; blueCandle = false; @@ -4275,12 +4308,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; @@ -4597,12 +4835,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 { @@ -4851,6 +5089,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 ((CalamityBuffSets.DebuffDataset[buffID] != null && CalamityBuffSets.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(); @@ -4883,7 +5147,7 @@ namespace CalamityMod.CalPlayer #region PostUpdateEquips public override void PostUpdateEquips() { - + var dripPlayer = Player.GetModPlayer(); var item = Player.HeldItem; if (!(item.IsAir || item.damage <= 0)) { @@ -4892,11 +5156,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) @@ -4906,11 +5172,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 { @@ -4923,10 +5190,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 { @@ -4939,10 +5207,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 { @@ -4955,10 +5224,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 { @@ -4979,6 +5250,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. @@ -5081,6 +5356,9 @@ namespace CalamityMod.CalPlayer public override void PostUpdate() { + if (Player.Calamity().XykVisualsBlue || Player.Calamity().XykVisualsOrange) + Player.wings = 0; + if (ZoneAbyss && Main.netMode != NetmodeID.Server) { //Main aura @@ -5115,7 +5393,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; } @@ -5134,6 +5412,17 @@ namespace CalamityMod.CalPlayer } } + // Frozen Cube defense cut + if (Player.Calamity().frozenCube) + { + int usedDefense = (Player.statDefense / FrozenCube.usedDefenseDivide); + Player.Calamity().frozenCubeUsedDefense = usedDefense; + Player.statDefense -= usedDefense; + } + + 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; @@ -5265,6 +5554,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 @@ -5296,7 +5671,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. } } @@ -5308,6 +5684,8 @@ namespace CalamityMod.CalPlayer if (moscowMule) knockback += MoscowMule.KnockbackBoost; + if (Player.GetModPlayer().HasAlcohol(AlcoholType.MoscowMule)) + knockback += MoscowMule.KnockbackBoost; if (titanHeartMantle && rogue) knockback += TitanHeartMantle.RogueKnockbackBoost; @@ -5486,7 +5864,7 @@ namespace CalamityMod.CalPlayer { if (bladeArmEnchant) return false; - if (purpleHaze) + if (purpleHaze || Player.GetModPlayer().HasAlcohol(AlcoholType.PurpleHaze)) { if (item.CountsAsClass() && StealthStrikeAvailable()) { @@ -5548,6 +5926,8 @@ namespace CalamityMod.CalPlayer { Main.projectile[p].DamageType = DamageClass.Generic; //Makes it not proc shit like nanotech, extorter and other stuff Main.projectile[p].Calamity().LocketClone = true; //To not have clones trigger effects like Sacrifice's Lifesteal and Final Dawn's stealth generation + + Projectile.NewProjectile(LocketSource, Main.projectile[p].Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); // Spawn a little portal! } // Handle AI edge-cases. These are like overlapping projectiles and the projectile not spawning at all @@ -6017,6 +6397,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 @@ -6083,7 +6467,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) @@ -6092,12 +6476,6 @@ namespace CalamityMod.CalPlayer stealthGenMoving += ShadowPotion.StealthRegenBoost; } - if (eArtifact) - { - stealthGenStandstill += 0.15f; - stealthGenMoving += 0.15f; - } - // Accessory modifiers can boost these stats stealthGenStandstill += accStealthGenBoost; stealthGenMoving += accStealthGenBoost; diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index c00ca129b2..538ffc89ef 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -584,6 +584,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.vHex && drawInfo.shadow == 0f) VulnerabilityHex.DrawEffects(drawInfo); + + if (calamityPlayer.windChilled && drawInfo.shadow == 0f) + WindChilled.DrawEffects(drawInfo); #endregion if (calamityPlayer.fortunesFavor && drawInfo.shadow == 0f) 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 d00a4d970a..ed3d0c1c42 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -284,6 +284,11 @@ namespace CalamityMod.CalPlayer if (damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { + if (fishStocks && fishStockPower < 0) + { + string year = DateTime.Now.ToString("yy"); + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.FishStocks" + Main.rand.Next(1, 6 + 1)).ToNetworkText(Player.name, year)); + } if (alcoholPoisoning) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholBig" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); @@ -480,6 +485,9 @@ namespace CalamityMod.CalPlayer #region Modify Hit NPC public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + if (Player.Calamity().coinDropMult != 1) + target.Calamity().coinDropMult = Player.Calamity().coinDropMult; + if (target.HasBuff()) { //This is essentially 10 AP, but independent of armor amount @@ -494,7 +502,7 @@ namespace CalamityMod.CalPlayer for (int index = 0; index < target.buffType.Length; index++) { int type = target.buffType[index]; - var debuffData = BuffDatasets.DebuffDataset[type]; + var debuffData = CalamityBuffSets.DebuffDataset[type]; if (debuffData != null) numOfDebuffs++; } @@ -595,7 +603,19 @@ namespace CalamityMod.CalPlayer { if (proj.npcProj || proj.trap) return; - + + //Add raider crit before hit + if (!proj.Calamity().stealthStrike && !proj.Calamity().stealthStrikeSubProjectile && raiderCritLifespan > 0f) + { + if (nanotech) + proj.CritChance += Items.Accessories.Nanotech.RaiderBonus; + else if (vampiricTalisman) + proj.CritChance += VampiricTalisman.RaiderBonus; + else if (raiderTalisman) + proj.CritChance += RaidersTalisman.RaiderBonus; + } + + modifiers.CritDamage += critDamage; // All Calamity multipliers are added together to prevent insane exponential stacking @@ -707,70 +727,10 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().antlionCloudDebuffTimer > 0) modifiers.SourceDamage *= AntlionSkewer.CloudDamageDebuffMult; - // Enemies deal less contact damage while sick, due to being weakened. - if (npc.poisoned) - { - float damageReductionFromPoison = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromPoison *= 2f; - else - damageReductionFromPoison /= 2f; - } - damageReductionFromPoison = 1f - damageReductionFromPoison; - - modifiers.SourceDamage *= damageReductionFromPoison; - } - - if (npc.venom) - { - float damageReductionFromVenom = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromVenom *= 2f; - else - damageReductionFromVenom /= 2f; - } - damageReductionFromVenom = 1f - damageReductionFromVenom; - - modifiers.SourceDamage *= damageReductionFromVenom; - } - - if (npc.Calamity().astralInfection) - { - float damageReductionFromAstralInfection = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromAstralInfection *= 2f; - else - damageReductionFromAstralInfection /= 2f; - } - damageReductionFromAstralInfection = 1f - damageReductionFromAstralInfection; - - modifiers.SourceDamage *= damageReductionFromAstralInfection; - } - - if (npc.Calamity().plague) - { - float damageReductionFromPlague = (float)((npc.Calamity().irradiated? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); - if (npc.Calamity().VulnerableToSickness.HasValue) - { - if (npc.Calamity().VulnerableToSickness.Value) - damageReductionFromPlague *= 2f; - else - damageReductionFromPlague /= 2f; - } - damageReductionFromPlague = 1f - damageReductionFromPlague; - - modifiers.SourceDamage *= damageReductionFromPlague; - } - + // Whispering Death makes enemies deal less damage if (npc.Calamity().whisperingDeath) { - float damageReductionFromWhisperingDeath = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.1f); + float damageReductionFromWhisperingDeath = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * WhisperingDeath.EnemyDamageReduction); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -1342,11 +1302,11 @@ namespace CalamityMod.CalPlayer if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0) { - int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + int cooldownTime = RelicOfResilience.baseCooldown; rOfResilienceCooldown = cooldownTime; Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); SoundStyle youGotHit = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); - SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.5f }, Player.Center); } if (alchFlask) @@ -1517,6 +1477,7 @@ namespace CalamityMod.CalPlayer Player.AddCooldown(GlobalDodge.ID, cooldownDuration); else Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, IconToUse); + Player.SetImmuneTimeForAllTypes(Player.longInvince ? 120 : 80); } //Dodge activation order is as follows: @@ -1624,8 +1585,8 @@ namespace CalamityMod.CalPlayer #region Player Incoming Damage Multiplier (Increases) double damageMult = 1D; - if (dArtifact) // Dimensional Soul Artifact increases incoming damage by 15%. - damageMult += 0.15; + if (crushingEgo) + damageMult += 0.2; if (enraged) // Demonshade Enrage damageMult += DemonshadeHelm.MultDamageTakenBoost; @@ -2876,8 +2837,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..77bfe9b3c8 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; @@ -102,6 +101,7 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(whisperingDeath, 0, laudanum); ApplyDoTDebuff(irradiated, 4); + ApplyDoTDebuff(windChilled, 4); int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0) - (corrosiveSpine ? 2 : 0); ApplyDoTDebuff(sulphurPoison, sulphurDoT); ApplyDoTDebuff(riptide, 6); @@ -191,17 +191,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 = CalamityBuffSets.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 = CalamityBuffSets.GetBuffIDFromAlcoholType(dripPlayer.currentAlcohol); + + if (ivBuffID != -1) + { + var ivData = CalamityBuffSets.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 +230,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 +285,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; @@ -318,7 +338,7 @@ namespace CalamityMod.CalPlayer } // Permafrost's Concoction increases life regen while afflicted with a fire debuff - if (permafrostsConcoction && Player.buffType.Any(l => BuffDatasets.DebuffDataset[l] is not null && BuffDatasets.DebuffDataset[l].HeatDebuffScaling > 0)) + if (permafrostsConcoction && Player.buffType.Any(l => CalamityBuffSets.DebuffDataset[l] is not null && CalamityBuffSets.DebuffDataset[l].HeatDebuffScaling > 0)) Player.lifeRegen += 6; if (grandDadHealTimer == 0 && grandDadHealPool >= 7) @@ -341,8 +361,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 +588,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 => CalamityBuffSets.DebuffDataset[i] is not null && CalamityBuffSets.DebuffDataset[i].AlcoholLevel > 0); if (Player.lifeRegen < 0) Player.lifeRegen += lesserEffect ? 1 : regenBoost; } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c652d14afa..bf17e85055 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; @@ -17,6 +16,7 @@ using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Ammo; using CalamityMod.Items.Armor.Aerospec; using CalamityMod.Items.Armor.Auric; @@ -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,19 +273,21 @@ 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)) { bool Orange = XykVisualsOrange; - Color effectColor = Orange ? Color.Gold : Color.DodgerBlue; + Color effectColor = Orange ? XyksBlessingOrange.baseMainColor : XyksBlessingBlue.baseMainColor; float rate = Main.GlobalTimeWrappedHourly * 12; List eColors = new List() { - Orange ? new Color(248, 117, 52) : Color.DodgerBlue, - Orange ? Color.Gold : Color.Cyan, - Orange ? Color.Orange : Color.RoyalBlue + Orange ? XyksBlessingOrange.baseMainColor : XyksBlessingBlue.baseMainColor, + Orange ? XyksBlessingOrange.baseAccentColor : XyksBlessingBlue.baseAccentColor, + Orange ? XyksBlessingOrange.baseEffectColor : XyksBlessingBlue.baseEffectColor }; int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; @@ -278,7 +296,10 @@ namespace CalamityMod.CalPlayer bool rageOrAdren = (Player.Calamity().rageModeActive || Player.Calamity().adrenalineModeActive); bool rageAndAdren = (Player.Calamity().rageModeActive && Player.Calamity().adrenalineModeActive); - Color attemptColor = (rageAndAdren ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Player.Calamity().adrenalineModeActive ? Color.MediumSpringGreen : Player.Calamity().rageModeActive ? Color.Crimson : effectColor); + Color dashColor = Orange ? XyksBlessingOrange.animEffectColor : XyksBlessingBlue.animEffectColor; + Color attemptColor = (rageAndAdren ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : + Player.Calamity().adrenalineModeActive ? Color.MediumSpringGreen : Player.Calamity().rageModeActive ? Color.Crimson : + Player.dashDelay == -1 ? dashColor : effectColor); XykFXColor = Color.Lerp(XykFXColor, attemptColor, rageOrAdren ? 0.05f : 0.25f); @@ -430,7 +451,7 @@ namespace CalamityMod.CalPlayer { if (dashStart) { - Player.velocity.X *= 2.2f; // +120% dash speed + Player.velocity.X *= 1 + LeviathanAmbergris.DashSpeedIncrease; int damage = (int)Player.GetBestClassDamage().ApplyTo(LeviathanAmbergris.ambergrisDashDamage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } @@ -562,9 +583,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) @@ -880,6 +908,11 @@ namespace CalamityMod.CalPlayer int scoriaOreID = ModContent.TileType(); int abyssKelpID = ModContent.TileType(); + // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor or have God Mode + // Auric Rejection causes an electrical explosion that yeets the player a considerable distance + // CIT 17AUG2024: Despite providing full invulnerability, Silva armor revive intentionally does not prevent Auric rejection's yeeting. + // 25FEB2025 Ozzatron: Added external bool to control Auric Rejection immunity from the ore. + bool rejectionImmunity = auricSet || seraphTracers || Player.creativeGodMode || externalAuricRejectionImmunity; int auricRejectionDamage = 300; float auricRejectionKB = Player.noKnockback ? 20f : 40f; @@ -916,11 +949,6 @@ namespace CalamityMod.CalPlayer Player.AddBuff(BuffID.Burning, 2); } - // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor or have God Mode - // Auric Rejection causes an electrical explosion that yeets the player a considerable distance - // CIT 17AUG2024: Despite providing full invulnerability, Silva armor revive intentionally does not prevent Auric rejection's yeeting. - // 25FEB2025 Ozzatron: Added external bool to control Auric Rejection immunity from the ore. - bool rejectionImmunity = auricSet || seraphTracers || Player.creativeGodMode || externalAuricRejectionImmunity; bool oreRejection = (tile.TileType == auricOreID) && !rejectionImmunity; // Repulsers always perform this effect because they are player-placed tiles made for this exact purpose @@ -947,6 +975,16 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), Player.Center); } } + + if (Player.sitting.TryGetSittingBlock(Player, out Tile AuricToiletTile) && !rejectionImmunity) + { + Player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AuricRejection").ToNetworkText(Player.name)), auricRejectionDamage, 0); + Player.AddBuff(ModContent.BuffType(), 120); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), Player.Center); + Player.sitting.SitUp(Player, false); + Vector2 yeetVec = new Vector2(Player.direction, -1.5f); + Player.velocity += yeetVec * auricRejectionKB; + } } private void HandleBlazingMouseEffects() { @@ -1277,6 +1315,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; @@ -1651,52 +1701,101 @@ namespace CalamityMod.CalPlayer } } } + float minVis = 0.001f; + if (fishStockVisual > minVis) // Fish stock effects are active as long as the UI exists, even if the player removes the item + { + fishStockSlidingPower = MathHelper.Lerp(fishStockSlidingPower, fishStockPower, 0.05f); + if (Player.miscCounter % 60 == 0) + { + bool isExtreme = fishStockPower > 1.5f || fishStockPower < -1.5f; + float smallJump = Main.rand.NextBool(4) ? 0.55f : 0; + float bigJump = Main.rand.NextBool(isExtreme ? 7 : 10) ? 1.8f : 0; + int riseOrFall = Main.rand.NextBool() ? -1 : 1; + float newFishStockPower = Math.Clamp(fishStockPower + (Main.rand.NextFloat(0.1f, 0.2f) + Math.Max(smallJump, bigJump)) * riseOrFall, -2, 2); + fishStockOldPower = // Cycle each power point up as the new point is gotten + (fishStockPower, + fishStockOldPower.Item1, + fishStockOldPower.Item2, + fishStockOldPower.Item3, + fishStockOldPower.Item4); + fishStockPower = newFishStockPower; + } + // Stats + Player.GetDamage() += 0.15f * fishStockPower; + Player.GetCritChance() += 10 * fishStockPower; + Player.Calamity().critDamage += 0.15f * fishStockPower; + Player.statDefense += (int)(10 * fishStockPower); + Player.endurance += 0.1f * fishStockPower; + Player.lifeRegen += (int)(6 * fishStockPower); + Player.pickSpeed -= 0.25f * fishStockPower; + Player.fishingSkill += (int)(50 * fishStockPower); + Player.luck += 0.55f * fishStockPower; + float CoinMult = MathF.Abs(fishStockPower) * 1.5f; + float givenMult = (fishStockPower < 0 ? (1 / CoinMult) : CoinMult); + Player.Calamity().coinDropMult = givenMult; + } + // Only put away fish stocks if the stocks are even or higher, or if they've already been started to be put away + float goalVis = (!fishStocks && (fishStockPower >= 0 || fishStockVisual < 0.9f)) ? 0 : 1; + fishStockVisual = MathF.Round(MathHelper.Lerp(fishStockVisual, goalVis, 0.05f), 4); // Fade in and out the U // The fire boots debuff boosts // bootLevel exists SO THAT THEY DO NOT STACK. Please help me maintain my sanity so we're not "fixing" this issue seventy times if (bootLevel > 0) HeatDebuffMultiplier += 0.25f * bootLevel; - if (rOfResilienceEffect > 0) - rOfResilienceEffect--; - if (Player.HeldItem.type == ModContent.ItemType()) // All players close to a player holding RoR get the benefits + bool holdingRoR = Player.HeldItem.type == ModContent.ItemType(); + bool shieldIsSetup = (rOfResilienceEffect >= RelicOfResilience.baseTimeMax); + bool chargedButNotHolding = (rOfResilienceEffect > RelicOfResilience.baseTimeMax && !holdingRoR); + bool reduceEffect = (!shieldIsSetup || chargedButNotHolding); + if (rOfResilienceEffect > 0 && reduceEffect) + { rOfResilienceEffect -= (chargedButNotHolding ? 4 : 1); if (shieldIsSetup && rOfResilienceEffect < RelicOfResilience.baseTimeMax) rOfResilienceEffect = RelicOfResilience.baseTimeMax; if (rOfResilienceEffect < 0) rOfResilienceEffect = 0; } + if (holdingRoR) // All players close to a player holding RoR get the benefits { - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead) + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead && Main.netMode != NetmodeID.MultiplayerClient) { Projectile relic = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); } for (int index = 0; index < Main.player.Length; index++) { Player fella = Main.player[index]; - if (Utils.Distance(fella.Center, Player.Center) < 650 && fella.team == Player.team) + float maxDistancePlayersCanBe = 1000; + bool validEffectBoost = Utils.Distance(fella.Center, Player.Center) < maxDistancePlayersCanBe && fella.team == Player.team && fella.Calamity().rOfResilienceEffect < RelicOfResilience.maxPowerTime + && fella.Calamity().rOfResilienceCooldown == 0 && (fella.Calamity().rOfResilienceEffect > RelicOfResilience.baseTimeMax ? holdingRoR : true); + if (validEffectBoost) { - fella.Calamity().rOfResilienceEffect = (fella != Player ? 480 : 2); + fella.Calamity().rOfResilienceEffect += (reduceEffect ? 2 : 1) + (Player.Calamity().profanedSoulRelicBuff ? 1 : 0); // gets subtracted by 1 every frame, so this goes up by more to keep up } } } + // Adds a floor for defense and dr, will not ignore defense damage + if (Player.Calamity().rOfResilienceCooldown >= RelicOfResilience.baseCooldown / 2|| Player.Calamity().rOfResilienceCooldown == 0) + { + float fadeInStats = Utils.GetLerpValue(0, RelicOfResilience.baseTimeMax, rOfResilienceEffect, true); + float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? fadeInStats : MathF.Pow(Utils.GetLerpValue(RelicOfResilience.baseCooldown / 2, RelicOfResilience.baseCooldown, Player.Calamity().rOfResilienceCooldown, true), 3)); + float overchargeBoost = 1 + (Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, rOfResilienceEffect, true) * (Player.Calamity().profanedSoulRelicBuff ? RelicOfResilience.additionalMaxPowerDefensesMult * 5 : RelicOfResilience.additionalMaxPowerDefensesMult)); // The amount of bulk this gives with artifact is way overkill but it is REALLY funny + int def = (int)(RelicOfResilience.baseDefenseFloor * overchargeBoost); + float dr = RelicOfResilience.baseDrFloor * overchargeBoost; + int maxDefFloor = (int)(def * fadeStats); + float MaxDRFloor = dr * fadeStats; + if (Player.statDefense < maxDefFloor) + Player.statDefense += maxDefFloor - Player.statDefense; + if (Player.endurance < MaxDRFloor) + Player.endurance += MaxDRFloor - Player.endurance; + } if (rOfResilienceEffect > 0) { - if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0) + if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0 && holdingRoR) { - int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + int cooldownTime = RelicOfResilience.baseCooldown; rOfResilienceCooldown = cooldownTime; Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); SoundStyle y = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); SoundEngine.PlaySound(y with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); } - // Adds a floor for defense and dr at 150 and 10% respectivley, will not ignore defense damage - if (Player.Calamity().rOfResilienceCooldown > 300 || Player.Calamity().rOfResilienceCooldown == 0) - { - float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? 1 : Utils.GetLerpValue(300, 600, Player.Calamity().rOfResilienceCooldown, true)); - int maxDefFloor = (int)(150 * fadeStats); - float MaxDRFloor = 0.10f * fadeStats; - if (Player.statDefense < maxDefFloor) - Player.statDefense += maxDefFloor - Player.statDefense; - if (Player.endurance < MaxDRFloor) - Player.endurance += MaxDRFloor - Player.endurance; - } - + int shardBaseCap = (Player.Calamity().profanedSoulRelicBuff ? (int)(RelicOfResilience.baseMaxShardCount * 1.5f) : RelicOfResilience.baseMaxShardCount); + float postMaxedShards = MathHelper.Lerp(shardBaseCap, shardBaseCap * RelicOfResilience.maxPowerShardMult, MathF.Pow(Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, rOfResilienceEffect, true), 2)); + int maxShards = (int)(postMaxedShards * Utils.GetLerpValue(0, RelicOfResilience.baseTimeMax, rOfResilienceEffect, true)); int numOfShards = 0; for (int x = 0; x < Main.maxProjectiles; x++) { @@ -1706,7 +1805,26 @@ namespace CalamityMod.CalPlayer numOfShards++; } } - if (Player.miscCounter % (Player.Calamity().profanedSoulRelicBuff ? 4 : 8) == 0 && numOfShards < (Player.Calamity().profanedSoulRelicBuff ? 75 : 30) && Player.Calamity().rOfResilienceCooldown == 0) + float lowestNum = 0; + int whoAmI = 0; + if (numOfShards > maxShards) // Kill the most recent shard if there's too many + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Player.whoAmI && projectile.ai[2] > lowestNum) + { + whoAmI = projectile.whoAmI; + lowestNum = projectile.ai[2]; + } + } + if (whoAmI != 0) + { + Projectile shard = Main.projectile[whoAmI]; + shard.ai[1] = -1; + } + } + if (numOfShards < maxShards && Player.Calamity().rOfResilienceCooldown == 0 && (rOfResilienceEffect >= RelicOfResilience.baseTimeMax || holdingRoR)) { if (numOfShards == 0) { @@ -1714,12 +1832,23 @@ namespace CalamityMod.CalPlayer SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = -0.3f }, Player.Center); } - int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(420); - Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); + int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(Player.Calamity().profanedSoulRelicBuff ? RelicOfResilience.shardBaseDamage * 5 : RelicOfResilience.shardBaseDamage); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); } } if (rOfResilienceCooldown > 0) - rOfResilienceCooldown--; + { rOfResilienceCooldown -= (holdingRoR ? 2 : 1); if (rOfResilienceCooldown < 0) rOfResilienceCooldown = 0; } + + if (Player.Calamity().friendlyMinions > 0) + { + 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 { @@ -2252,8 +2381,6 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown--; if (silvaMageCooldown > 0) silvaMageCooldown--; - if (scuttlerCooldown > 0) - scuttlerCooldown--; if (nanotechHitCooldown > 0) nanotechHitCooldown--; if (spectralVeilImmunity > 0) @@ -2265,7 +2392,7 @@ namespace CalamityMod.CalPlayer if (bloomStoneTotalHeal > 0) { - float healRateDiv = (Player.statLife >= Player.statLifeMax ? 5 : // 5 times as slow if at max hp already (overheal prevention) + float healRateDiv = (Player.statLife >= Player.statLifeMax ? 2 : // 2 times as slow if at max hp already (overheal prevention) bloomStoneBuffedHealRateTimer > 0 ? Utils.Remap(bloomStoneBuffedHealRateTimer, 90, 0, 0.5f, 1f, true) // 2 times faster if pollen buffed, scales back down to regular speed as the buff fades : 1); // Regular speed bloomStoneHealRate = 1 / healRateDiv; @@ -2707,12 +2834,6 @@ namespace CalamityMod.CalPlayer } } - // Raider Talisman bonus - if (raiderTalisman && !vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) - Player.GetCritChance() += RaidersTalisman.RaiderBonus; - if (vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) - Player.GetCritChance() += VampiricTalisman.RaiderBonus; - if (avertorBonus) Player.GetDamage() += 0.1f; @@ -2784,7 +2905,7 @@ namespace CalamityMod.CalPlayer if (permafrostsConcoction) { Player.manaCost -= 0.15f; - Player.statManaMax2 += 50; + Player.statManaMax2 += 40; } if (encased) @@ -3355,7 +3476,7 @@ namespace CalamityMod.CalPlayer #region Other Buff Effects private void OtherBuffEffects() { - + var dripPlayer = Player.GetModPlayer(); if (gravityNormalizer) { Player.buffImmune[BuffID.VortexDebuff] = true; @@ -3543,30 +3664,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; @@ -3578,7 +3719,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) @@ -3588,9 +3734,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) { @@ -3702,7 +3848,7 @@ namespace CalamityMod.CalPlayer Player.lifeMagnet = true; if (whisperingDeath && !laudanum) - Player.GetDamage() -= 0.2f; + Player.GetDamage() -= WhisperingDeath.PlayerDamageReduction; if (armorCrunch && !laudanum) { @@ -3969,15 +4115,6 @@ namespace CalamityMod.CalPlayer Player.npcTypeNoAggro[ModContent.NPCType()] = true; } - if (eArtifact) - { - Player.manaCost -= 0.25f; - Player.maxMinions++; - } - - if (auricSArtifact && Player.FindBuffIndex(ModContent.BuffType()) != -1) - Player.maxMinions += Player.ownedProjectileCounts[ModContent.ProjectileType()]; - if (pSoulArtifact) { if (Player.whoAmI == Main.myPlayer) @@ -4324,7 +4461,7 @@ namespace CalamityMod.CalPlayer else if (hasBuff == ModContent.BuffType()) { Player.lifeRegenCount += 5; - Player.GetDamage() += 0.2f; + Player.GetDamage() += WhisperingDeath.PlayerDamageReduction; } switch (hasBuff) @@ -4410,8 +4547,8 @@ namespace CalamityMod.CalPlayer // Add any multiplicative damage bonuses here float multiplicativeDamage = 1; - if (dArtifact) - multiplicativeDamage += 0.2f; + if (crushingEgo) + multiplicativeDamage += 0.3f; if (WarbanneroftheRighteous) multiplicativeDamage += warbannerDamageMult; if (multiplicativeDamage != 1) @@ -4741,6 +4878,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 40606790ab..a0102e7693 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -86,11 +86,11 @@ namespace CalamityMod.CalPlayer target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; + target.Calamity().IncreasedColdEffects_FrozenCube = frozenCube; 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; @@ -212,6 +212,17 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer) return; + //Undo raider crit after hit + if (!proj.Calamity().stealthStrike && !proj.Calamity().stealthStrikeSubProjectile && raiderCritLifespan > 0f) + { + if (nanotech) + proj.CritChance -= Items.Accessories.Nanotech.RaiderBonus; + else if (vampiricTalisman) + proj.CritChance -= VampiricTalisman.RaiderBonus; + else if (raiderTalisman) + proj.CritChance -= RaidersTalisman.RaiderBonus; + } + // Apply this to player equippable sources ie. Orichalcum set bonus petal spawns // Do not apply if this effect is an extension of a weapon ie. Pearl God round effect as it will mess up Old Fashioned var source = Player.GetSource_OnHit(target); @@ -229,7 +240,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) @@ -244,10 +258,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; @@ -1000,7 +1020,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% @@ -1028,13 +1048,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; } @@ -1073,8 +1086,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && modProj.stealthStrike) { raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); - // TO DO: Add nanotech here - Player.AddCooldown(RaiderBoost.ID, raiderCritLifespan, true, vampiricTalisman ? "Bloodfeast" : "default"); + Player.AddCooldown(RaiderBoost.ID, raiderCritLifespan, true, nanotech ? "Nanotech" : vampiricTalisman ? "Vampiric" : "default"); if (raiderSoundCooldown <= 0) { SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, Player.Center); @@ -1282,11 +1294,11 @@ namespace CalamityMod.CalPlayer Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, heal, (raiderCritLifespan > 0 && !proj.Calamity().stealthStrike) ? 1.2f : 1.5f); } - if (bloodyGlove && proj.CountsAsClass() && modProj.stealthStrike && proj.numHits < 1) + if (bloodyGlove && proj.CountsAsClass() && (modProj.stealthStrike || (nanotech && raiderCritLifespan > 0)) && proj.numHits < 1) //Nanotech has the same heal as Electrician's glove Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, electricianGlove ? 10 : 5, electricianGlove ? 2f : 3f); - if (proj.CountsAsClass() && Player.HeldItem.CountsAsClass()) + if (proj.CountsAsClass()) { if (manaOverloader) { diff --git a/Cooldowns/NanotechBoost.png b/Cooldowns/NanotechBoost.png new file mode 100644 index 0000000000..430bd3b98c Binary files /dev/null and b/Cooldowns/NanotechBoost.png differ diff --git a/Cooldowns/NanotechBoostOutline.png b/Cooldowns/NanotechBoostOutline.png new file mode 100644 index 0000000000..cdd0da28cc Binary files /dev/null and b/Cooldowns/NanotechBoostOutline.png differ diff --git a/Cooldowns/NanotechBoostOverlay.png b/Cooldowns/NanotechBoostOverlay.png new file mode 100644 index 0000000000..d1000ec9a4 Binary files /dev/null and b/Cooldowns/NanotechBoostOverlay.png differ diff --git a/Cooldowns/RaiderBoost.cs b/Cooldowns/RaiderBoost.cs index 79bb9ae02d..9ea22fb9fd 100644 --- a/Cooldowns/RaiderBoost.cs +++ b/Cooldowns/RaiderBoost.cs @@ -26,7 +26,14 @@ namespace CalamityMod.Cooldowns { switch (skin) { - case "Bloodfeast": + case "Nanotech": + skinTexture = "NanotechBoost"; + outlineColor = new Color(14, 103, 129); + cooldownColorStart = new Color(85, 252, 229); + cooldownColorEnd = new Color(52,255,171); + break; + + case "Vampiric": skinTexture = "VampiricTalismanBoost"; outlineColor = new Color(143, 27, 27); cooldownColorStart = new Color(133, 5, 5); diff --git a/Cooldowns/RelicOfResilienceCooldown.cs b/Cooldowns/RelicOfResilienceCooldown.cs index 18da908039..cf3109b412 100644 --- a/Cooldowns/RelicOfResilienceCooldown.cs +++ b/Cooldowns/RelicOfResilienceCooldown.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Tools; +using Microsoft.Xna.Framework; using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.Cooldowns { @@ -12,5 +14,11 @@ namespace CalamityMod.Cooldowns public override Color OutlineColor => new Color(255, 191, 73); public override Color CooldownStartColor => new Color(122, 66, 59); public override Color CooldownEndColor => new Color(165, 103, 87); + + public override void Tick() + { + if (instance.player.HeldItem.type == ModContent.ItemType()) + instance.timeLeft--; + } } } diff --git a/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs index ae5320365e..69e430fd75 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; @@ -7,26 +9,6 @@ using Terraria.ModLoader; namespace CalamityMod.DataStructures { - [ReinitializeDuringResizeArrays] - public static class BuffDatasets - { - public static DebuffData[] DebuffDataset = BuffID.Sets.Factory.CreateNamedSet("DebuffData") - .Description("Stores DebuffData for a particular debuff") - .RegisterCustomSet(null, - BuffID.OnFire, DebuffData.OnFire, - BuffID.OnFire3, DebuffData.Hellfire, - BuffID.CursedInferno, DebuffData.CursedInferno, - BuffID.ShadowFlame, DebuffData.Shadowflame, - BuffID.Daybreak, DebuffData.Daybroken, - BuffID.Burning, DebuffData.Burning, - BuffID.Frostburn, DebuffData.Frostburn, - BuffID.Frostburn2, DebuffData.Frostbite, - BuffID.Poisoned, DebuffData.Poisoned, - BuffID.Venom, DebuffData.AcidVenom, - BuffID.Electrified, DebuffData.Electrified, - BuffID.Oiled, DebuffData.Oiled - ); - } public class DebuffData { /// @@ -113,11 +95,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/Dusts/LemonNadeExplodeDust.cs b/Dusts/LemonNadeExplodeDust.cs new file mode 100644 index 0000000000..691f4de2ff --- /dev/null +++ b/Dusts/LemonNadeExplodeDust.cs @@ -0,0 +1,71 @@ +using System; +using CalamityMod.Utilities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class LemonNadeExplodeDust : ModDust + { + public override string Texture => "CalamityMod/Particles/LemonNadeExplode"; + Color RandomColor + { + get + { + switch (Main.rand.Next(4)) + { + case 0: return new Color(54, 54, 54); + case 1: return new Color(76, 36, 36); + case 2: return new Color(132, 72, 56); + case 3: return new Color(50, 45, 37); + } + return Color.White; + } + } + public override void OnSpawn(Dust dust) + { + if (dust.color == Color.Transparent) + dust.color = RandomColor; + dust.dataAsFloat = 0.75f; + dust.rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); + } + public override bool MidUpdate(Dust dust) + { + return true; + } + + public override bool Update(Dust dust) + { + dust.dataAsFloat *= 0.96f; + dust.position += dust.velocity; + dust.velocity *= 0.925f; + dust.rotation += MathF.Sin(dust.dustIndex * 0.1f) * 0.2f * dust.dataAsFloat; + if (dust.dataAsFloat <= 0.01f) + dust.active = false; + return false; + } + + static Asset tex; + public override bool PreDraw(Dust dust) + { + tex ??= ModContent.Request("CalamityMod/Particles/LemonNadeExplode"); + Main.EntitySpriteDraw( + tex.Value, + dust.position - Main.screenPosition, + null, + dust.color * dust.dataAsFloat, + dust.rotation, + tex.Size() * 0.5f, + dust.scale * 0.1f * (0.75f + 0.25f * dust.dataAsFloat), + SpriteEffects.None, + 0 + ); + return false; + } + + + } +} diff --git a/Gores/LemonNadePin.png b/Gores/LemonNadePin.png new file mode 100644 index 0000000000..bf59dbedf1 Binary files /dev/null and b/Gores/LemonNadePin.png differ 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/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 8c9a78f382..d962242faa 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -322,7 +322,7 @@ namespace CalamityMod.Graphics.Primitives } // Legacy behaviour: sample based on requested point count using Catmull-Rom style interpolation. - PositionsIndex = 1; + PositionsIndex = 0; float controlCountMinusOne = controlCount - 1f; PrimitiveSmoothingType legacyType = settings.SmoothingType; @@ -344,8 +344,6 @@ namespace CalamityMod.Graphics.Primitives MainPositions[PositionsIndex] = EvaluateCurve(legacyType, p0, p1, p2, p3, localSplineInterpolant, settings); PositionsIndex++; } - - MainPositions[0] = controlPoints[0]; MainPositions[PositionsIndex] = controlPoints[controlCount - 1]; PositionsIndex++; controlPoints.Clear(); diff --git a/Graphics/Primitives/PrimitiveSettings.cs b/Graphics/Primitives/PrimitiveSettings.cs index ebc4b51fcd..7996352e4e 100644 --- a/Graphics/Primitives/PrimitiveSettings.cs +++ b/Graphics/Primitives/PrimitiveSettings.cs @@ -309,7 +309,7 @@ namespace CalamityMod.Graphics.Primitives SmoothingTension = smoothingTension; FrameTransportMode = frameTransportMode; Topology = topology; - CapStyle = PrimitiveCapStyle.Flat; + CapStyle = capStyle; } } } diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 2e0e15714d..086b566167 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -401,6 +401,32 @@ namespace CalamityMod.ILEditing } #endregion + #region Flail Balance Changes + // Make flails be unaffected by player velocity + private static void FlailsNoLongerAffectedByPlayerVelocity(On_Projectile.orig_AI_015_Flails orig, Projectile self) + { + orig(self); + if (self.ai[0] == 1f && self.ai[1] == 0f) + self.velocity -= Main.player[self.owner].velocity; + } + + // Increase Flower Pow's return speed + private static void IncreaseFlowerPowRetSpeed(ILContext il) + { + var cursor = new ILCursor(il); + // Move to where Flower Pow receives its specific flail stat changes. This moves it after num2 = 23f + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcR4(23f), i => i.MatchStloc(6))) + { + LogFailure("Flower Pow Buff", "Could not move to Flower Pow's specific flail stat changes."); + return; + } + + // Emit an instruction setting num5 (the return speed) to 21. Vanilla is 16 + cursor.Emit(OpCodes.Ldc_R4, 21f); + cursor.Emit(OpCodes.Stloc, 9); + } + #endregion + #region Terrarian Projectile Limitation for Extra Updates private static void LimitTerrarianProjectiles(ILContext il) { @@ -748,5 +774,115 @@ 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 + + #region Remove Vanilla Whip Tag Crits + // Code written by Habble + /// + /// IL edits both vanilla whip crit tags' crit bool set calls to ensure they're never assigned a new value + /// + /// + private static void PreventVanillaWhipTagCrits(ILContext context) + { + ILCursor cursor = new(context); + #region Morning Star + // Go to the unique instructions nearest to the Morning Star tag's crit roll and then stand before the crit bool set call + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdloc(59)) || !cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(30))) + { + LogFailure("Removing vanilla whip tag crits", "Could not locate the crit bool set call under Morning Star tag"); + return; + } + // Put the previous value of the crit bool on the stack to then return that instead of the supplied value by "consuming" them as parameters, so as to not overwrite it + // This is more ideal than modifying label conditions because it is likelier for the latter to change over time + cursor.Emit(OpCodes.Ldloc, 30); + cursor.EmitDelegate((int input, bool originalValue) => originalValue.ToInt()); + #endregion Morning Star + #region Kaleidoscope + // Similar deal for Kaleidoscope as well + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStloc(30)) || !cursor.TryGotoNext(MoveType.Before, i => i.MatchStloc(30))) + { + LogFailure("Removing vanilla whip tag crits", "Could not locate the crit bool set call under Kaleidoscope tag"); + return; + } + cursor.Emit(OpCodes.Ldloc, 30); + cursor.EmitDelegate((int input, bool originalValue) => originalValue.ToInt()); + #endregion Kaleidoscope + } + #endregion } } diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index d5fb8e25e0..4000c108ed 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -104,8 +104,12 @@ namespace CalamityMod.ILEditing // Damage and health balance On_Main.DamageVar_float_int_float += AdjustDamageVariance; IL_NPC.ScaleStats_ApplyExpertTweaks += RemoveExpertHardmodeScaling; + IL_Projectile.Damage += PreventVanillaWhipTagCrits; 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; IL_Projectile.AI_120_StardustGuardian += StardustGuardianAttackBuffs; On_Player.ConsumeSolarFlare += SolarWingsDashChange; On_Projectile.IsDamageDodgable += GFBNurseMeteorUndodgeable; @@ -150,7 +154,6 @@ namespace CalamityMod.ILEditing IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; - On_Projectile.AI_015_Flails += FlailsNoLongerAffectedByPlayerVelocity; IL_Projectile.AI_061_FishingBobber += WhitelistVictideBobber; On_Player.ItemCheck_CheckFishingBobbers += PreventVictideBobberFromJamming; 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/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 8b11dcb9e3..3c04413d31 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -318,15 +318,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Remove Flail Throw Velocity Being Affected By Player Velocity - private static void FlailsNoLongerAffectedByPlayerVelocity(On_Projectile.orig_AI_015_Flails orig, Projectile self) - { - orig(self); - if (self.ai[0] == 1f && self.ai[1] == 0f) - self.velocity -= Main.player[self.owner].velocity; - } - #endregion - #region Allow Victide Bobber to Exist private static void WhitelistVictideBobber(ILContext il) { diff --git a/Items/Accessories/BatholithBangle.cs b/Items/Accessories/BatholithBangle.cs index c244cd51d4..94f50319a8 100644 --- a/Items/Accessories/BatholithBangle.cs +++ b/Items/Accessories/BatholithBangle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public static int cooldown = 600; - public static int damage = 100; + public static int damage = 50; public override void SetDefaults() { Item.width = 36; diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/CrushingEgo.cs similarity index 88% rename from Items/Accessories/DimensionalSoulArtifact.cs rename to Items/Accessories/CrushingEgo.cs index b8541a3f47..13c92cc9fb 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/CrushingEgo.cs @@ -9,7 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class DimensionalSoulArtifact : ModItem, ILocalizedModType + [LegacyName("DimensionalSoulArtifact")] + public class CrushingEgo : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -24,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dArtifact = true; + modPlayer.crushingEgo = true; } public override void AddRecipes() diff --git a/Items/Accessories/DimensionalSoulArtifact.png b/Items/Accessories/CrushingEgo.png similarity index 100% rename from Items/Accessories/DimensionalSoulArtifact.png rename to Items/Accessories/CrushingEgo.png diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index 2fbb970c79..1e6b2dbbc3 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories /// The amount of critical strike chance bonus where crit starts decaying faster.
/// When the crit bonus reaches this value, the decay rate increases by one tier. ///
- public static readonly int CritDecayThreshold = 60; + public static readonly int CritDecayThreshold = 50; /// /// When the critical strike chance bonus has exceeded , it continues to decay faster for every more. @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Accessories /// /// The maximum amount of extra critical strike chance you can get from this accessory. /// - public static readonly int CritHardCap = 100; + public static readonly int CritHardCap = 75; #endregion @@ -151,7 +151,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(15). AddIngredient(15). AddIngredient(ItemID.LunarBar, 10). - AddIngredient(4). + AddIngredient(ItemID.FragmentVortex, 5). AddTile(TileID.MythrilAnvil). Register(); } 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/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index 98ee31e460..0a3073ee10 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Items.Accessories public class EtherealExtorter : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int soulDamage => 20; public override void SetDefaults() { Item.width = 28; diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index b3c6331489..d6135d8c6c 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -7,6 +7,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; @@ -15,6 +16,13 @@ namespace CalamityMod.Items.Accessories public class EtherealTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int MaxManaBoost = 60; + public static float ManaCostReduction = 0.08f; + public static float MagicDamageBoost = 0.15f; + public static int MagicCritBoost = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + public override void SetDefaults() { Item.width = 28; @@ -72,10 +80,10 @@ namespace CalamityMod.Items.Accessories if (manaFlowerEnabled) player.manaFlower = true; - player.statManaMax2 += 150; - player.GetDamage() += 0.15f; - player.manaCost -= 0.1f; - player.GetCritChance() += 5; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Accessories/AuricSoulArtifact.cs b/Items/Accessories/FadedIdolatry.cs similarity index 87% rename from Items/Accessories/AuricSoulArtifact.cs rename to Items/Accessories/FadedIdolatry.cs index 9ff5405c94..72f213f81d 100644 --- a/Items/Accessories/AuricSoulArtifact.cs +++ b/Items/Accessories/FadedIdolatry.cs @@ -9,8 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [LegacyName("GodlySoulArtifact")] - public class AuricSoulArtifact : ModItem, ILocalizedModType + [LegacyName("GodlySoulArtifact", "AuricSoulArtifact")] + public class FadedIdolatry : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.auricSArtifact = true; + modPlayer.fadedIdolatry = true; } public override void AddRecipes() diff --git a/Items/Accessories/AuricSoulArtifact.png b/Items/Accessories/FadedIdolatry.png similarity index 100% rename from Items/Accessories/AuricSoulArtifact.png rename to Items/Accessories/FadedIdolatry.png diff --git a/Items/Accessories/FishStocks.cs b/Items/Accessories/FishStocks.cs new file mode 100644 index 0000000000..a5fab55a28 --- /dev/null +++ b/Items/Accessories/FishStocks.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class FishStocks : ModItem, ILocalizedModType, IHoldShiftTooltipItem + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 30; + Item.height = 38; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().fishStocks = true; + } + } +} diff --git a/Items/Accessories/FishStocks.png b/Items/Accessories/FishStocks.png new file mode 100644 index 0000000000..0916c5320a Binary files /dev/null and b/Items/Accessories/FishStocks.png differ diff --git a/Items/Accessories/FleshTotem.cs b/Items/Accessories/FleshTotem.cs index 078e6827e3..c01e7ac7ec 100644 --- a/Items/Accessories/FleshTotem.cs +++ b/Items/Accessories/FleshTotem.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories modPlayer.fleshTotem = true; modPlayer.fleshTotemMinion = true; modPlayer.fleshTotemVisual = !hideVisual; - player.statManaMax2 += 30; + player.statManaMax2 += 20; player.GetCritChance() += 5; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/FragmentsOfAnotherWorld.cs similarity index 55% rename from Items/Accessories/EldritchSoulArtifact.cs rename to Items/Accessories/FragmentsOfAnotherWorld.cs index 0e1299f0ed..046e44ba43 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/FragmentsOfAnotherWorld.cs @@ -5,12 +5,20 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Placeables.Plates; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class EldritchSoulArtifact : ModItem, ILocalizedModType + [LegacyName("EldritchSoulArtifact")] + public class FragmentsOfAnotherWorld : ModItem, ILocalizedModType { + static float MeleeSpeedIncrease => 0.2f; + static float RangedSpecialistDmgMult => 1.15f; + static float ManaCostReduction => 0.25f; + static int MaxSentries => 2; + static float RogueSpeedIncrease => 0.1f; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -21,12 +29,19 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Purple; } + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeSpeedIncrease.ToPercent(), RangedSpecialistDmgMult, ManaCostReduction.ToPercent(), MaxSentries, RogueSpeedIncrease.ToPercent()); + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eArtifact = true; + modPlayer.fragmentsOfAnotherWorld = true; + player.buffImmune[ModContent.BuffType()] = true; - player.GetAttackSpeed() += 0.1f; + player.GetAttackSpeed() += MeleeSpeedIncrease; + player.specialistDamage *= RangedSpecialistDmgMult; + player.manaCost -= ManaCostReduction; + player.maxTurrets += MaxSentries; + player.GetAttackSpeed() += RogueSpeedIncrease; } public override void AddRecipes() diff --git a/Items/Accessories/EldritchSoulArtifact.png b/Items/Accessories/FragmentsOfAnotherWorld.png similarity index 100% rename from Items/Accessories/EldritchSoulArtifact.png rename to Items/Accessories/FragmentsOfAnotherWorld.png diff --git a/Items/Accessories/FrozenCube.cs b/Items/Accessories/FrozenCube.cs new file mode 100644 index 0000000000..6cd386972d --- /dev/null +++ b/Items/Accessories/FrozenCube.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories +{ + public class FrozenCube : ModItem, ILocalizedModType + { + public static int mistBaseDamage = 1; + public static int slamBaseDamage = 20; + public static int baseAttackSpeed = 90; + public static int baseAttackCooldown = 180; + + public static int usedDefenseDivide = 3; + public static int debuff = ModContent.BuffType(); + + public static readonly SoundStyle noise = new("CalamityMod/Sounds/Item/ElumphantSound") { Volume = 0.6f }; + public static readonly SoundStyle cry = new("CalamityMod/Sounds/Item/ElumphantCry") { Volume = 0.6f }; + public static readonly SoundStyle hit = new("CalamityMod/Sounds/Item/ElumphantBop") { Volume = 0.6f }; + public static readonly SoundStyle jokeBonk = new("CalamityMod/Sounds/Item/Bonk") { Volume = 0.6f }; + + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 34; + Item.height = 34; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.accessory = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.frozenCube = true; + modPlayer.frozenCubeVisuals = !hideVisual; + + int projectile = ProjectileType(); + if (player.ownedProjectileCounts[projectile] < 1 && !player.dead) + { + int damage = (int)player.GetTotalDamage().ApplyTo(slamBaseDamage); + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, damage, 0f, player.whoAmI); + } + } + public override void ModifyTooltips(List list) + { + if (Main.LocalPlayer != null) + list.FindAndReplace("[DAMAGELINE]", Main.LocalPlayer.Calamity().frozenCube ? + this.GetLocalization("EquippedDebuff").Format((Main.LocalPlayer.Calamity().frozenCubeDebuffBoost.ToPercent("N0")).ToString()) + "\n" + + this.GetLocalization("EquippedElumphant").Format((Main.LocalPlayer.Calamity().frozenCubeElumphantBoost.ToPercent("N1")).ToString()) + : this.GetLocalizedValue("Unequipped")); + } + } +} diff --git a/Items/Accessories/FrozenCube.png b/Items/Accessories/FrozenCube.png new file mode 100644 index 0000000000..01db00cba3 Binary files /dev/null and b/Items/Accessories/FrozenCube.png differ diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 948499ad65..3f22fbf8c0 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot, bool modded) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.brimElemental || modPlayer.sandElemental || modPlayer.rareSandElemental || modPlayer.cloudElemental || modPlayer.waterElemental) + if (modPlayer.brimElemental || modPlayer.sandElemental || modPlayer.oasisElemental || modPlayer.cloudElemental || modPlayer.waterElemental) { return false; } @@ -177,7 +177,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). 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/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 50ae2b6ba1..8f9a198dee 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -8,7 +8,8 @@ namespace CalamityMod.Items.Accessories public class LeviathanAmbergris : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int ambergrisDashDamage = 650; + public static int ambergrisDashDamage => 350; + public static float DashSpeedIncrease => 1f; public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/ManaPolarizer.cs b/Items/Accessories/ManaPolarizer.cs index 73fc472501..dbf71c47da 100644 --- a/Items/Accessories/ManaPolarizer.cs +++ b/Items/Accessories/ManaPolarizer.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.manaOverloader = true; - player.statManaMax2 += 50; + player.statManaMax2 += 40; } } } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index cc6ed61b48..6616b0030f 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.moonCrown = true; modPlayer.mageCrownVisibility = !hideVisual; - player.statManaMax2 += 70; + player.statManaMax2 += 40; player.GetDamage() += (0.02f * modPlayer.mageCrownCount); //2% per moon sigil, up to 20% player.manaCost -= (0.01f * modPlayer.mageCrownCount); //1% per moon sigil, up to 10% if (modPlayer.mageCrownCount >= 5) //At 5 sigils, grant a mana regen bonus @@ -56,7 +56,8 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). + AddIngredient(2). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 270d1bbe1c..b6472598ad 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Accessories { //The stealth damage boost is handled in CalamityPlayer for some reason, maybe someone didn't want em to stack? public new string LocalizationCategory => "Items.Accessories"; + public static int RaiderBonus => 10; public override void SetDefaults() { Item.width = 46; @@ -27,6 +29,7 @@ namespace CalamityMod.Items.Accessories modPlayer.electricianGlove = true; modPlayer.filthyGlove = true; modPlayer.bloodyGlove = true; + modPlayer.raiderTalisman = true; player.GetDamage() += 0.15f; player.Calamity().rogueVelocity += 0.15f; } @@ -35,7 +38,9 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). + AddIngredient(). AddIngredient(). + AddIngredient(ItemID.LunarBar, 8). AddIngredient(4). AddTile(). Register(); diff --git a/Items/Accessories/RareElementalinaBottle.cs b/Items/Accessories/OasisElementalinaBottle.cs similarity index 80% rename from Items/Accessories/RareElementalinaBottle.cs rename to Items/Accessories/OasisElementalinaBottle.cs index 6dafdf72e7..f3315de701 100644 --- a/Items/Accessories/RareElementalinaBottle.cs +++ b/Items/Accessories/OasisElementalinaBottle.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -8,8 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [LegacyName("WifeinaBottlewithBoobs")] // Yes, that was the actual name. - public class RareElementalinaBottle : ModItem, ILocalizedModType + [LegacyName("WifeinaBottlewithBoobs", "RareElementalinaBottle")] // Yes, that was the actual name. + public class OasisElementalinaBottle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -38,12 +39,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rareSandElemental = true; + modPlayer.oasisElemental = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { @@ -59,12 +60,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rareSandElementalVanity = true; + modPlayer.oasisElementalVanity = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/Items/Accessories/RareElementalinaBottle.png b/Items/Accessories/OasisElementalinaBottle.png similarity index 100% rename from Items/Accessories/RareElementalinaBottle.png rename to Items/Accessories/OasisElementalinaBottle.png diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index c9c1807c50..59558577fa 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -36,7 +36,11 @@ namespace CalamityMod.Items.Accessories public const int maxMinionRequirement = 10; public const int maxPscAnimTime = 120; - public static SummonTag SummonTag = new() { MultiplicativeTagDamage = 0.2f, TagModifyHitEffects = ApplyTagModifyHit, AutoDrawTooltip = false }; + public static SummonTag SummonTag = new() { + MultiplicativeTagDamage = 0.2f, + TagModifyHitEffects = ApplyTagModifyHit, + AutoDrawTooltip = false + }; public static void ApplyTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) { @@ -221,7 +225,7 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - SummonTag.TagItem = Item.type; + SummonTag.TagItem = Type; SummonTag.TagTexture = TextureAssets.Item[Type]; Item.width = 50; Item.height = 50; 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/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs index 9efd1466f7..57ce750d51 100644 --- a/Items/Accessories/QuiverofNihility.cs +++ b/Items/Accessories/QuiverofNihility.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddRecipeGroup("AnyQuiver"). - AddIngredient(5). + AddIngredient(ItemID.FragmentVortex, 5). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 775a842fa1..2e45d69df2 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 15f; - public const int RaiderCooldown = 10; //seconds + public static int RaiderBonus => 15; + public static int RaiderCooldown => 10; //seconds public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); public override void SetDefaults() diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 94c5dd7487..a3dee2aa70 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Accessories public class SigilofCalamitas : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int MaxManaBoost = 60; + public static float MagicDamageBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, MagicDamageBoost.ToPercent()); + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 8)); @@ -27,9 +33,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.manaMagnet = true; - player.statManaMax2 += 100; - player.GetDamage() += 0.15f; - player.manaCost -= 0.1f; + player.statManaMax2 += MaxManaBoost; + player.GetDamage() += MagicDamageBoost; } public override void AddRecipes() diff --git a/Items/Accessories/SlagsplitterPauldron.cs b/Items/Accessories/SlagsplitterPauldron.cs index 62ca8e1c6d..497c71082d 100644 --- a/Items/Accessories/SlagsplitterPauldron.cs +++ b/Items/Accessories/SlagsplitterPauldron.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories public class SlagsplitterPauldron : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int PauldronSlamDamage = 330; + public static int PauldronSlamDamage => 250; public override void SetDefaults() { Item.width = 42; 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/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 4d4836af00..981577f498 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -39,11 +39,11 @@ namespace CalamityMod.Items.Accessories modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.amalgam = true; player.brainOfConfusionItem = Item; - modPlayer.HeatDebuffMultiplier += 3f; - modPlayer.ColdDebuffMultiplier += 3f; - modPlayer.SicknessDebuffMultiplier += 3f; - modPlayer.WaterDebuffMultiplier += 3f; - modPlayer.ElectricDebuffMultiplier += 3f; + modPlayer.HeatDebuffMultiplier += 2f; + modPlayer.ColdDebuffMultiplier += 2f; + modPlayer.SicknessDebuffMultiplier += 2f; + modPlayer.WaterDebuffMultiplier += 2f; + modPlayer.ElectricDebuffMultiplier += 2f; } public override void AddRecipes() diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index eb0800a9db..9967c7d23e 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -9,9 +9,9 @@ namespace CalamityMod.Items.Accessories { public class VampiricTalisman : ModItem, ILocalizedModType, IHoldShiftTooltipItem { - internal const int ArmorCrunchDebuffTime = 150; - internal const int HeavyBleedingDebuffTime = 300; - public const float RaiderBonus = 15f; + internal static int ArmorCrunchDebuffTime => 150; + internal static int HeavyBleedingDebuffTime => 300; + public static int RaiderBonus => 15; public bool ShowExtensionIndicator => false; diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 3c0954a148..359862b34c 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -1,9 +1,20 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.NetModules; +using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.Net; namespace CalamityMod.Items.Accessories.Vanity @@ -11,7 +22,14 @@ namespace CalamityMod.Items.Accessories.Vanity public class XyksBlessingBlue : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - + int itemFrame = 0; + int itemFrameTimer = 1; + int pulseTimer = 0; + public static Vector2 extraPosition = Vector2.Zero; + public static Color baseEffectColor = new Color(150, 255, 210); // Teal-ish Glow + public static Color animEffectColor = new Color(255, 85, 252); // Purple Flash + public static Color baseMainColor = new Color(25, 118, 218); // Mid Blue + public static Color baseAccentColor = new Color(0, 255, 250); // Light blue public override (EquipType, string, string)[] EquipSlots => [ (EquipType.Head, "Xyk", null), @@ -19,11 +37,104 @@ namespace CalamityMod.Items.Accessories.Vanity (EquipType.Legs, "Xyk", null), (EquipType.Wings, null, null), //results in setting this equip slot to -1 ]; + public static Asset Texture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingBlueAnim"); + public static Asset AltTexture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingBlueAnim2"); + public static Asset ShapeTexture = ModContent.Request("CalamityMod/Particles/BloomRing"); + public static Asset BloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + bool NoArmorEnabled = false; + bool DoTransformAnimation = false; + float effectsMult = 1; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", NoArmorEnabled ? this.GetLocalizedValue("ArmorDisabled") : this.GetLocalizedValue("ArmorEnabled")); + } + public override bool ConsumeItem(Player player) => !Main.keyState.PressingShift(); + public override void SaveData(TagCompound tag) + { + tag.Add("noArmor", NoArmorEnabled); + tag.Add("doAnim", DoTransformAnimation); + } + public override void LoadData(TagCompound tag) + { + NoArmorEnabled = tag.GetBool("noArmor"); + DoTransformAnimation = tag.GetBool("doAnim"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(NoArmorEnabled); + writer.Write(DoTransformAnimation); + } + public override void NetReceive(BinaryReader reader) + { + NoArmorEnabled = reader.ReadBoolean(); + DoTransformAnimation = reader.ReadBoolean(); + } + public Rectangle GetFrame() + { + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + int vertialFramesNum = DoTransformAnimation ? 13 : 20; + Rectangle frame = texture.Frame(verticalFrames: vertialFramesNum, frameY: itemFrame); + return frame; + } + public void DrawItem(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, float scale, float rotation, bool inWorld) + { + itemFrameTimer++; + if (itemFrameTimer % 5 == 0) + itemFrame++; + + effectsMult = MathHelper.Lerp(effectsMult, 1, 0.1f); + Color effectColor = Color.Lerp(baseAccentColor, animEffectColor, Math.Max(effectsMult - 1, 0)); + + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 5); + extraPosition = new Vector2(0, 5 * (inWorld ? 1 : 0.2f) * sine); + Vector2 animPlaceAdjust = Vector2.UnitY * (DoTransformAnimation ? 2.8f : 0); + + float pulseProgress = MathF.Pow(Utils.GetLerpValue(90, 0, pulseTimer % 90), 3.5f); + + if (itemFrame >= (DoTransformAnimation ? 13 : 20)) + { + itemFrame = (DoTransformAnimation ? 8 : 0); + if (DoTransformAnimation) { DoTransformAnimation = false; Item.NetStateChanged(); } + } + //Pulse + Texture2D pulse = ShapeTexture.Value; + spriteBatch.Draw(pulse, position + extraPosition, null, Color.Lerp(effectColor, baseEffectColor, pulseProgress) with { A = 0 } * pulseProgress, rotation, pulse.Size() / 2, scale * (1 - pulseProgress) * effectsMult, SpriteEffects.None, 0f); + + Texture2D bloom = BloomTexture.Value; + Vector2 squash = new Vector2(1 + Math.Max(effectsMult - 1, 0) * 3.5f, 0.85f - Math.Max(effectsMult - 1, 0) * 0.75f); + float bloomScale = 0.75f; + // Bloom effects + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, new Vector2(1, 0.85f) * (scale + 0.05f * sine) * bloomScale, SpriteEffects.None, 0f); + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, squash * (scale + 0.05f * sine) * 0.9f * bloomScale, SpriteEffects.None, 0f); + // Sprite + spriteBatch.Draw(texture, position + extraPosition + animPlaceAdjust, frame, (inWorld ? Lighting.GetColor((Item.Center + extraPosition + animPlaceAdjust).ToTileCoordinates()) : Color.White), 0f, frame.Size() / 2, scale, SpriteEffects.None, 0f); + pulseTimer++; + } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + frame = GetFrame(); + DrawItem(spriteBatch, position, frame, scale * 1.5f, 0, false); + return false; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Rectangle itemFrame = GetFrame(); + Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, (itemFrame.Size() / 2).Y); + DrawItem(spriteBatch, drawPosition, itemFrame, scale * 0.5f, rotation, true); + return false; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3); + Color clr = Color.Lerp(baseEffectColor, baseMainColor, Utils.GetLerpValue(-1, 1, sine)); + Lighting.AddLight(Item.Center + extraPosition, clr.ToVector3() * 0.55f); + } public override void SetDefaults() { - Item.width = 36; - Item.height = 34; + Item.width = 30; + Item.height = 25; Item.accessory = true; Item.vanity = true; Item.rare = ModContent.RarityType(); @@ -33,23 +144,43 @@ namespace CalamityMod.Items.Accessories.Vanity public override bool CanRightClick() => true; public override void RightClick(Player player) { - player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); + if (Main.keyState.PressingShift()) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/StarfleetFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) + 0.9f * i, MaxInstances = 6 }, player.Center); + + effectsMult = 2; + pulseTimer = 20; + itemFrameTimer = 1; + itemFrame = 0; + NoArmorEnabled = !NoArmorEnabled; + DoTransformAnimation = true; + Item.NetStateChanged(); + } + else + player.PutItemInInventoryFromItemUsage(ModContent.ItemType()); } + public override Func ShouldTransform => ((player) => !NoArmorEnabled); public override void UpdateVanity(Player player) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsBlue = true; + EquipEffects(player); } - public override void UpdateAccessory(Player player, bool hideVisual) { if (!hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsBlue = true; + EquipEffects(player); } } - + public void EquipEffects(Player player) + { + player.DisableWingFlapSound(); + if (NoArmorEnabled) + IsForced = false; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsBlue = true; + } // Also research the other variant public override void OnResearched(bool fullyResearched) { diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.png b/Items/Accessories/Vanity/XyksBlessingBlue.png index de950cbaa1..1ee0bc2ffb 100644 Binary files a/Items/Accessories/Vanity/XyksBlessingBlue.png and b/Items/Accessories/Vanity/XyksBlessingBlue.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingBlueAnim.png b/Items/Accessories/Vanity/XyksBlessingBlueAnim.png new file mode 100644 index 0000000000..b1931d456b Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingBlueAnim.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingBlueAnim2.png b/Items/Accessories/Vanity/XyksBlessingBlueAnim2.png new file mode 100644 index 0000000000..f62e4bba41 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingBlueAnim2.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index 940278db9e..fb3a71a78d 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -1,9 +1,17 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent.NetModules; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.Net; namespace CalamityMod.Items.Accessories.Vanity @@ -11,7 +19,14 @@ namespace CalamityMod.Items.Accessories.Vanity public class XyksBlessingOrange : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - + int itemFrame = 0; + int itemFrameTimer = 1; + int pulseTimer = 0; + public static Vector2 extraPosition = Vector2.Zero; + public static Color baseEffectColor = new Color(255, 153, 153); // Red-ish Glow + public static Color animEffectColor = new Color(255, 105, 85); // Crimson Flash + public static Color baseMainColor = new Color(239, 117, 34); // Mid Orange + public static Color baseAccentColor = new Color(251, 242, 54); // Light Orange/Yellow public override (EquipType, string, string)[] EquipSlots => [ (EquipType.Head, "Xyk2", null), @@ -19,11 +34,104 @@ namespace CalamityMod.Items.Accessories.Vanity (EquipType.Legs, "Xyk2", null), (EquipType.Wings, null, null), //results in setting this equip slot to -1 ]; + public static Asset Texture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingOrangeAnim"); + public static Asset AltTexture = ModContent.Request("CalamityMod/Items/Accessories/Vanity/XyksBlessingOrangeAnim2"); + public static Asset ShapeTexture = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick"); + public static Asset BloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + bool NoArmorEnabled = false; + bool DoTransformAnimation = false; + float effectsMult = 1; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", NoArmorEnabled ? this.GetLocalizedValue("ArmorDisabled") : this.GetLocalizedValue("ArmorEnabled")); + } + public override bool ConsumeItem(Player player) => !Main.keyState.PressingShift(); + public override void SaveData(TagCompound tag) + { + tag.Add("noArmor", NoArmorEnabled); + tag.Add("doAnim", DoTransformAnimation); + } + public override void LoadData(TagCompound tag) + { + NoArmorEnabled = tag.GetBool("noArmor"); + DoTransformAnimation = tag.GetBool("doAnim"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(NoArmorEnabled); + writer.Write(DoTransformAnimation); + } + public override void NetReceive(BinaryReader reader) + { + NoArmorEnabled = reader.ReadBoolean(); + DoTransformAnimation = reader.ReadBoolean(); + } + public Rectangle GetFrame() + { + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + int vertialFramesNum = DoTransformAnimation ? 13 : 20; + Rectangle frame = texture.Frame(verticalFrames: vertialFramesNum, frameY: itemFrame); + return frame; + } + public void DrawItem(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, float scale, float rotation, bool inWorld) + { + itemFrameTimer++; + if (itemFrameTimer % 5 == 0) + itemFrame++; + + effectsMult = MathHelper.Lerp(effectsMult, 1, 0.1f); + Color effectColor = Color.Lerp(baseAccentColor, animEffectColor, Math.Max(effectsMult - 1, 0)); + + Texture2D texture = DoTransformAnimation ? AltTexture.Value : Texture.Value; + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 5); + extraPosition = new Vector2(0, 5 * (inWorld ? 1 : 0.2f) * sine); + Vector2 animPlaceAdjust = Vector2.UnitY * (DoTransformAnimation ? 2.8f : 0); + + float pulseProgress = MathF.Pow(Utils.GetLerpValue(90, 0, pulseTimer % 90), 3.5f); + + if (itemFrame >= (DoTransformAnimation ? 13 : 20)) + { + itemFrame = (DoTransformAnimation ? 8 : 0); + if (DoTransformAnimation) { DoTransformAnimation = false; Item.NetStateChanged(); } + } + //Pulse + Texture2D pulse = ShapeTexture.Value; + spriteBatch.Draw(pulse, position + extraPosition, null, Color.Lerp(effectColor, baseEffectColor, pulseProgress) with { A = 0 } * pulseProgress, rotation + MathHelper.PiOver4, pulse.Size() / 2, scale * (1 - pulseProgress) * effectsMult * 0.65f, SpriteEffects.None, 0f); + + Texture2D bloom = BloomTexture.Value; + Vector2 squash = new Vector2(1 + Math.Max(effectsMult - 1, 0) * 3.5f, 0.85f - Math.Max(effectsMult - 1, 0) * 0.75f); + float bloomScale = 0.75f; + // Bloom effects + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, new Vector2(1, 0.85f) * (scale + 0.05f * sine) * bloomScale, SpriteEffects.None, 0f); + spriteBatch.Draw(bloom, position + extraPosition, null, effectColor with { A = 0 }, rotation, bloom.Size() / 2, squash * (scale + 0.05f * sine) * 0.9f * bloomScale, SpriteEffects.None, 0f); + // Sprite + spriteBatch.Draw(texture, position + extraPosition + animPlaceAdjust, frame, (inWorld ? Lighting.GetColor((Item.Center + extraPosition + animPlaceAdjust).ToTileCoordinates()) : Color.White), 0f, frame.Size() / 2, scale, SpriteEffects.None, 0f); + pulseTimer++; + } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + frame = GetFrame(); + DrawItem(spriteBatch, position, frame, scale * 1.5f, 0, false); + return false; + } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Rectangle itemFrame = GetFrame(); + Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, (itemFrame.Size() / 2).Y); + DrawItem(spriteBatch, drawPosition, itemFrame, scale * 0.5f, rotation, true); + return false; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3); + Color clr = Color.Lerp(baseEffectColor, baseMainColor, Utils.GetLerpValue(-1, 1, sine)); + Lighting.AddLight(Item.Center + extraPosition, clr.ToVector3() * 0.55f); + } public override void SetDefaults() { - Item.width = 36; - Item.height = 34; + Item.width = 30; + Item.height = 25; Item.accessory = true; Item.vanity = true; Item.rare = ModContent.RarityType(); @@ -33,23 +141,44 @@ namespace CalamityMod.Items.Accessories.Vanity public override bool CanRightClick() => true; public override void RightClick(Player player) { - player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); + if (Main.keyState.PressingShift()) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/StarfleetFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) + 0.9f * i, MaxInstances = 6 }, player.Center); + + effectsMult = 2; + pulseTimer = 20; + itemFrameTimer = 1; + itemFrame = 0; + NoArmorEnabled = !NoArmorEnabled; + DoTransformAnimation = true; + Item.NetStateChanged(); + } + else + player.PutItemInInventoryFromItemUsage(ModContent.ItemType()); + } + public override Func ShouldTransform => ((player) => !NoArmorEnabled); public override void UpdateVanity(Player player) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsOrange = true; + EquipEffects(player); } - public override void UpdateAccessory(Player player, bool hideVisual) { if (!hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.XykVisualsOrange = true; + EquipEffects(player); } } - + public void EquipEffects(Player player) + { + player.DisableWingFlapSound(); + if (NoArmorEnabled) + IsForced = false; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.XykVisualsOrange = true; + } // Also research the other variant public override void OnResearched(bool fullyResearched) { diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.png b/Items/Accessories/Vanity/XyksBlessingOrange.png index 34e567b436..03504a8213 100644 Binary files a/Items/Accessories/Vanity/XyksBlessingOrange.png and b/Items/Accessories/Vanity/XyksBlessingOrange.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingOrangeAnim.png b/Items/Accessories/Vanity/XyksBlessingOrangeAnim.png new file mode 100644 index 0000000000..59a9ef12c0 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingOrangeAnim.png differ diff --git a/Items/Accessories/Vanity/XyksBlessingOrangeAnim2.png b/Items/Accessories/Vanity/XyksBlessingOrangeAnim2.png new file mode 100644 index 0000000000..2800fb1b86 Binary files /dev/null and b/Items/Accessories/Vanity/XyksBlessingOrangeAnim2.png differ 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/Aerospec/AerospecHeadMagic.cs b/Items/Armor/Aerospec/AerospecHeadMagic.cs index 5dda2d7b17..76456d1b89 100644 --- a/Items/Armor/Aerospec/AerospecHeadMagic.cs +++ b/Items/Armor/Aerospec/AerospecHeadMagic.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Aerospec { public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public static int MaxManaBoost = 30; + public static int MaxManaBoost = 40; public static float MagicDamageBoost = 0.1f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, MagicDamageBoost.ToPercent()); diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index fd2394ccd7..1b29e447df 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(15). - AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index b93e9b2d92..188e83ea26 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index 09107dbbf4..e5e8e4b668 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index b52bf0a10a..0eadffe839 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index 495458d722..2007d1a7df 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index ec516460a0..2b2026327c 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -75,7 +75,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Daedalus/DaedalusLeggings.cs b/Items/Armor/Daedalus/DaedalusLeggings.cs index 0d45fae2e7..34b19ad388 100644 --- a/Items/Armor/Daedalus/DaedalusLeggings.cs +++ b/Items/Armor/Daedalus/DaedalusLeggings.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(10). - AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } 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/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 395471447f..a8e33fe18f 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -74,6 +74,7 @@ namespace CalamityMod.Items.Armor.Fearmonger ModContent.BuffType(), BuffID.Chilled, BuffID.Frozen, + ModContent.BuffType(), }; for (var i = 0; i < immuneDebuffs.Length; ++i) player.buffImmune[immuneDebuffs[i]] = true; diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index b4e1b3c222..5bfc895a14 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor { //These tag damage fields determine the damage of the spawned eater. The resulting number from each is added together //So, 0.5 multiplicative and 10 flat would make the damage be 50% of the spawning hit's damage, plus 10 more. - //If you want entirely flt, set multiplicative to 0. If you want entirely multiplicative, set flat to 0. + //If you want entirely flat, set multiplicative to 0. If you want entirely multiplicative, set flat to 0. MultiplicativeTagDamage = 0.25f, FlatTagDamage = 5, AllowsWhipStacking = true, @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Armor if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; summonTag.TagItem = Type; - CalamityBuffSets.SummonTagDebuff.Add(ModContent.BuffType(),summonTag); } public override void SetDefaults() diff --git a/Items/Armor/GemTech/GemTechBodyArmor.cs b/Items/Armor/GemTech/GemTechBodyArmor.cs index 4e5af57b08..0470808230 100644 --- a/Items/Armor/GemTech/GemTechBodyArmor.cs +++ b/Items/Armor/GemTech/GemTechBodyArmor.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GemTech @@ -25,7 +26,11 @@ namespace CalamityMod.Items.Armor.GemTech { CreateRecipe() .AddIngredient(16) - .AddIngredient(5) + .AddIngredient(ItemID.FragmentSolar, 5) + .AddIngredient(ItemID.FragmentVortex, 5) + .AddIngredient(ItemID.FragmentNebula, 5) + .AddIngredient(ItemID.FragmentStardust, 5) + .AddIngredient(5) .AddIngredient(2) .AddTile() .Register(); diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index cc96471327..af3aecac6d 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -4,6 +4,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -150,7 +151,11 @@ namespace CalamityMod.Items.Armor.GemTech { CreateRecipe(). AddIngredient(10). - AddIngredient(3). + AddIngredient(ItemID.FragmentSolar, 5). + AddIngredient(ItemID.FragmentVortex, 5). + AddIngredient(ItemID.FragmentNebula, 5). + AddIngredient(ItemID.FragmentStardust, 5). + AddIngredient(5). AddIngredient(2). AddTile(). SortBeforeFirstRecipesOf(ModContent.ItemType()). diff --git a/Items/Armor/GemTech/GemTechSchynbaulds.cs b/Items/Armor/GemTech/GemTechSchynbaulds.cs index 84ba7d24ea..178c1cade7 100644 --- a/Items/Armor/GemTech/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTech/GemTechSchynbaulds.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GemTech @@ -26,7 +27,11 @@ namespace CalamityMod.Items.Armor.GemTech { CreateRecipe(). AddIngredient(12). - AddIngredient(4). + AddIngredient(ItemID.FragmentSolar, 4). + AddIngredient(ItemID.FragmentVortex, 4). + AddIngredient(ItemID.FragmentNebula, 4). + AddIngredient(ItemID.FragmentStardust, 4). + AddIngredient(4). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index 6e4f64d76f..b35d5bc00d 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(15). - AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index 1eb312a365..c6961124b2 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index dad4af3e81..eafe23a27c 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index 4aaa9d6e2c..e772532f66 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index c64bfd93f5..c906206ff5 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index a13dce4e57..86ad6eba9f 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -76,7 +76,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index 2dcac69f9c..f896863d03 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(10). - AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index 4eb7dc362e..83f1874634 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 28; + Item.defense = 20; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index 7e881b56ac..beb164e68f 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 19; + Item.defense = 15; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index 60637a499a..d0d6e96c73 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 22; + Item.defense = 15; Item.rare = ModContent.RarityType(); } diff --git a/Items/Armor/Reaver/ReaverCuisses.cs b/Items/Armor/Reaver/ReaverCuisses.cs index f44835ab63..991ad6b50e 100644 --- a/Items/Armor/Reaver/ReaverCuisses.cs +++ b/Items/Armor/Reaver/ReaverCuisses.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(10). - AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index 26598da235..307e36a692 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -75,7 +75,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverHeadMobility.cs b/Items/Armor/Reaver/ReaverHeadMobility.cs index ec0e3a7efd..613eb37fb2 100644 --- a/Items/Armor/Reaver/ReaverHeadMobility.cs +++ b/Items/Armor/Reaver/ReaverHeadMobility.cs @@ -59,7 +59,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 8d84aede61..6ab102d56c 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(7). - AddIngredient(). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index 90cba4743e..60d307b21b 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(15). - AddIngredient(3). AddTile(TileID.MythrilAnvil). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); 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 2c440600c8..17967c5c79 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -329,9 +329,6 @@ namespace CalamityMod.Items if (modPlayer.gloveOfRecklessness) velocity = velocity.RotatedByRandom(MathHelper.ToRadians(12f)); } - - if (modPlayer.eArtifact && item.CountsAsClass()) - velocity *= 1.25f; } public override bool Shoot(Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack) @@ -887,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) @@ -939,7 +938,9 @@ namespace CalamityMod.Items { // Xyk 3MARCH2026: Doesn't work on any non use style 1 items currently, Doze will fix it if (item.CountsAsClass() && player.HasBuff(BuffID.Tipsy)) - scale += 0.15f; + scale += 0.25f; + if (item.CountsAsClass() && (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake))) + scale += 0.25f; } public override void UpdateArmorSet(Player player, string set) { @@ -1089,18 +1090,18 @@ namespace CalamityMod.Items modPlayer.fairyBoots = true; // Mana Flower tinker buffs - if (item.type == ItemID.MagnetFlower) - player.manaCost -= 0.02f; - if (item.type == ItemID.ArcaneFlower || item.type == ItemID.ManaCloak) - player.manaCost -= 0.04f; if (item.type == ItemID.ArcaneFlower) player.GetDamage() += 0.05f; - if (item.type == ItemID.EyeoftheGolem) { player.Calamity().critDamage += 0.15f; } + if (item.type == ItemID.ReconScope) + { + player.GetDamage() += 0.05f; //Total 15% damage + player.GetCritChance() -= 5; //Total 5% crit + } if (item.type == ItemID.SniperScope) { player.GetDamage() -= 0.1f; //Total 0% damage @@ -1195,6 +1196,7 @@ namespace CalamityMod.Items if (item.type == ItemID.GravityGlobe) { + player.noFallDmg = true; player.GetJumpState().Enable(); if (player.Calamity().justChangedGravity) { @@ -1433,8 +1435,7 @@ namespace CalamityMod.Items #region PostUpdate public override void PostUpdate(Item item) { - if (CalamityItemSets.ItemForcedInsideWorld[item.type]) - CalamityUtils.ForceItemIntoWorld(item); + CalamityUtils.ForceItemIntoWorld(item); } #endregion diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 6a8de021c9..82366f393f 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -173,7 +173,10 @@ namespace CalamityMod.Items //Add "Uses X Minion Slots right above "Uses X Mana" if (ItemID.Sets.StaffMinionSlotsRequired[item.type] > 1 || ContentSamples.ProjectilesByType[item.shoot].minionSlots > 0) { - tooltips.Insert(tooltips.FindIndex(0, (x) => x.Name == "Knockback") + 1, new(Mod, "Minions", CalamityUtils.GetText(ItemID.Sets.StaffMinionSlotsRequired[item.type] > 1 ? "Common.MinionSlotCost" : "Common.MinionSlotCostSingle").Format(ItemID.Sets.StaffMinionSlotsRequired[item.type]))); + float cost = ItemID.Sets.StaffMinionSlotsRequired[item.type]; + if (item.type == ModContent.ItemType() && Main.LocalPlayer.Calamity().fadedIdolatry) + cost--; + tooltips.Insert(tooltips.FindIndex(0, (x) => x.Name == "Knockback") + 1, new(Mod, "Minions", CalamityUtils.GetText(cost > 1 ? "Common.MinionSlotCost" : "Common.MinionSlotCostSingle").Format(cost))); } @@ -523,12 +526,8 @@ namespace CalamityMod.Items string MultTagTooltip(float mult) => (CalamityUtils.GetText($"Common.SummonTagDamageMult").Format((mult + 1).ToString("0.##"))); string CritTagTooltip(float crit) => (CalamityUtils.GetText($"Common.SummonTagCrit").Format((crit * 100).ToString("0.#"))); - Dictionary TagByItem = new(); - foreach (SummonTag tag1 in CalamityBuffSets.SummonTagDebuff.Values) - { - if (tag1.TagItem > -1) TagByItem.Add(tag1.TagItem, tag1); - } - if (TagByItem.TryGetValue(item.type, out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff.FirstOrDefault(x => x is not null && x.TagItem == item.type && x.AutoDrawTooltip, null); + if (tag is not null) { if (!tag.AutoDrawTooltip) return; var modPlayer = Main.LocalPlayer.Calamity(); @@ -732,7 +731,7 @@ namespace CalamityMod.Items } #endregion - // Whip tag is dynamically generated for all whips based on the SummonTagDebuffDict, so we'll remove the vanilla tag tootlips. + // Whip tag is dynamically generated for all whips based on the SummonTagDebuff dictionary, so we'll remove the vanilla tag tootlips. #region Whip Tag removal // Additive tag changes if (item.type == ItemID.BlandWhip) @@ -817,7 +816,11 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text = EditedTooltip("RifleScope2")); } if (item.type == ItemID.ReconScope) + { EditTooltipByNum(0, (line) => line.Text += AddedTooltip("RifleScope")); + EditTooltipByNum(1, (line) => line.Text = EditedTooltip("ReconScope1")); + EditTooltipByNum(1, (line) => line.Text += AddedTooltip("ReconScope2")); + } if (item.type == ItemID.SniperScope) { EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SniperScope")); @@ -826,10 +829,6 @@ namespace CalamityMod.Items } // Mana Flower tinker buffs. - if (item.type == ItemID.MagnetFlower) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("8%", "10%")); - if (item.type == ItemID.ArcaneFlower || item.type == ItemID.ManaCloak) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("8%", "12%")); if (item.type == ItemID.ArcaneFlower) EditTooltipByNum(2, (line) => line.Text += AddedTooltip("ArcaneFlower")); @@ -936,18 +935,6 @@ namespace CalamityMod.Items #endregion #region Hardmode Armor - // Cobalt - if (item.type == ItemID.CobaltHat) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("40", $"{CobaltArmorSetChange.MaxManaBoost + 40}")); - - // Mythril - if (item.type == ItemID.MythrilHood) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("60", $"{MythrilArmorSetChange.MaxManaBoost + 60}")); - - // Adamantite - if (item.type == ItemID.AdamantiteHeadgear) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("80", $"{AdamantiteArmorSetChange.MaxManaBoost + 80}")); - // Titanium if (item.type == ItemID.TitaniumMask) EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("9%", "14%")); @@ -1510,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; @@ -1518,17 +1517,15 @@ namespace CalamityMod.Items float rate = Main.GlobalTimeWrappedHourly * 6; List eColors = new List() { - Color.DodgerBlue, - Color.Cyan, - Color.RoyalBlue + XyksBlessingBlue.baseMainColor, + XyksBlessingBlue.baseAccentColor, }; int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); Vector2 backScale = line.BaseScale; - Color backColor = usedColor; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); @@ -1536,19 +1533,19 @@ namespace CalamityMod.Items int draws = 20; for (int i = 0; i < draws; i++) { + float clrProgress = Utils.GetLerpValue(0, draws - 1, i, true); Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); - ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, Color.Lerp(usedColor, XyksBlessingBlue.animEffectColor, clrProgress), line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); } Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Texture2D square = ModContent.Request("CalamityMod/Particles/BloomRing").Value; Vector2 drawPosition = basePosition; - Color drawColor = backColor; Vector2 rotationPoint = texture.Size() * 0.5f; int length = line.Text.Length; for (int i = 0; i < 8; i++) { - Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, usedColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); } for (int i = 0; i < 10; i++) { @@ -1557,10 +1554,11 @@ namespace CalamityMod.Items float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * -23 * squareSine * sine2 + new Vector2(5, 10); + float clrProgress = Utils.GetLerpValue(0, 9, i, true); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingBlue.animEffectColor, clrProgress) * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingBlue.animEffectColor, clrProgress) * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); } Main.spriteBatch.End(); @@ -1579,38 +1577,35 @@ namespace CalamityMod.Items float rate = Main.GlobalTimeWrappedHourly * 6; List eColors = new List() { - new Color(248, 117, 52), - Color.Gold, - Color.Orange + XyksBlessingOrange.baseMainColor, + XyksBlessingOrange.baseAccentColor, }; int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); Vector2 backScale = line.BaseScale; - Color backColor = usedColor; - Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); int draws = 20; for (int i = 0; i < draws; i++) { + float clrProgress = Utils.GetLerpValue(0, draws - 1, i, true); Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); - ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, Color.Lerp(usedColor, XyksBlessingOrange.animEffectColor, clrProgress), line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); } Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Texture2D texture2 = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; Texture2D square = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; Vector2 drawPosition = basePosition; - Color drawColor = backColor; Vector2 rotationPoint = texture.Size() * 0.5f; int length = line.Text.Length; for (int i = 0; i < 8; i++) { - Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, usedColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); } for (int i = 0; i < 10; i++) { @@ -1618,10 +1613,11 @@ namespace CalamityMod.Items float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * 23 * squareSine + Vector2.UnitY * 5.5f * sine + new Vector2(5, 10); + float clrProgress = Utils.GetLerpValue(0, 9, i, true); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingOrange.animEffectColor, clrProgress) * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); for (int t = 0; t < 3; t++) - Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, Color.Lerp(usedColor, XyksBlessingOrange.animEffectColor, clrProgress) * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); } Main.spriteBatch.End(); diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 14b50af115..cc2634a200 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -49,22 +49,21 @@ namespace CalamityMod.Items { ItemID.Anchor, Do(DamageExact(107), UseExact(30)) }, // VANILLA: 70 DMG, 20 UT { ItemID.AntlionClaw, Do(UseExact(10)) }, // Mandible Blade. VANILLA: 18 UT { ItemID.AquaScepter, Do(DamageRatio(0.9f)) }, // VANILLA: 27 DMG. Uses ratios due to remix seed - { ItemID.Bananarang, Do(DamageExact(76), UseExact(14)) }, // VANILLA: 45 DMG, 11 UT + { ItemID.Bananarang, Do(DamageExact(60)) }, // VANILLA: 45 DMG { ItemID.BatScepter, Do(DamageExact(50)) }, // VANILLA: 45 DMG { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(131), UseAnimationExact(40), KnockbackExact(8)) }, // VANILLA: 52 DMG, 20 UT, 6.5 KB - { ItemID.BeeGun, Do(DamageExact(11), ManaExact(4)) }, // VANILLA: 9 DMG, 5 MANA + { ItemID.BeeGun, Do(DamageExact(11)) }, // VANILLA: 9 DMG { ItemID.BeeKeeper, Do(UseTurn, DamageExact(32)) }, // VANILLA: 30 DMG { ItemID.Beenade, Do(UseTimeExact(22), ShootSpeedExact(10f)) }, // VANILLA: 15 UT, 6 VEL { ItemID.BeesKnees, Do(DamageExact(21), UseExact(35)) }, // VANILLA: 23 DMG, 23 UT { ItemID.Bladetongue, Do(UseTurn, DamageExact(120), UseExact(22)) }, // VANILLA: 55 DMG, 28 UT - { ItemID.BlizzardStaff, Do(DamageExact(41), ManaExact(7)) }, // VANILLA: 58 DMG, 9 MANA + { ItemID.BlizzardStaff, Do(DamageExact(41)) }, // VANILLA: 58 DMG { ItemID.BloodyMachete, Do(DamageExact(24)) }, // VANILLA: 20 DMG { ItemID.Blowgun, Do(DamageExact(40), ShootSpeedExact(15f)) }, // VANILLA: 27 DMG, 13 VEL { ItemID.BluePhaseblade, phaseblade }, { ItemID.BluePhasesaber, phasesaber }, { ItemID.BoneSword, Do(UseTurn, DamageExact(25)) }, // VANILLA: 19 DMG - { ItemID.BookofSkulls, Do(DamageExact(27), ManaExact(13), ShootSpeedExact(5.5f)) }, // VANILLA: 29 DMG, 18 MANA, 3.5 VEL - { ItemID.BookStaff, Do(ManaExact(14)) }, // Tome of Infinite Wisdom. VANILLA: 20 MANA + { ItemID.BookofSkulls, Do(ShootSpeedExact(5.5f)) }, // VANILLA: 3.5 VEL { ItemID.Boomstick, Do(DamageExact(11)) }, // VANILLA: 14 DMG { ItemID.BreakerBlade, Do(UseTurn, DamageExact(140)) }, // VANILLA: 70 DMG { ItemID.CandyCornRifle, Do(DamageExact(66)) }, // VANILLA: 44 DMG @@ -96,7 +95,7 @@ namespace CalamityMod.Items { ItemID.DarkLance, Do(TrueMelee, DamageExact(40)) }, // VANILLA: 34 DMG { ItemID.DartRifle, Do(DamageExact(58)) }, // VANILLA: 52 DMG { ItemID.DayBreak, Do(DamageExact(125), UseExact(22)) }, // VANILLA: 150 DMG, 16 UT - { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // VANILLA: 39 DMG. Compensation for removing aerial multiplier + { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // Aerial Bane. VANILLA: 39 DMG. Compensation for removing aerial multiplier { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed, DamageExact(150)) }, // Flying Dragon. VANILLA: 180 DMG { ItemID.DeadlySphereStaff, Do(DamageExact(50)) }, // VANILLA: 40 DMG { ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(65), ShootSpeedExact(15f)) }, // VANILLA: 57 DMG, 9 VEL @@ -113,11 +112,11 @@ namespace CalamityMod.Items { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow. VANILLA: 50 DMG { ItemID.FalconBlade, Do(UseTurn, UseExact(13)) }, // VANILLA: 20 UT { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration. VANILLA: 25 DMG, 30 UT - { ItemID.Flamarang, Do(DamageExact(37)) }, // VANILLA: 49 DMG - { ItemID.Flamelash, Do(DamageExact(36), ManaExact(18)) }, // VANILLA: 32 DMG, 21 MANA + { ItemID.Flamarang, Do(DamageExact(40)) }, // VANILLA: 49 DMG + { ItemID.Flamelash, Do(DamageExact(36)) }, // VANILLA: 32 DMG { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, // VANILLA: 35 DMG, 7 VEL - { ItemID.FlowerofFire, Do(DamageRatio(0.78f), ManaExact(7)) }, // VANILLA: 48 DMG, 12 MANA. Uses ratios due to remix seed - { ItemID.FlowerofFrost, Do(DamageExact(70), UseExact(22), ManaExact(7), ShootSpeedExact(14)) }, // VANILLA: 60 DMG, 12 UT, 11 MANA, 9 VEL + { ItemID.FlowerofFire, Do(DamageRatio(0.78f)) }, // VANILLA: 48 DMG. Uses ratios due to remix seed + { ItemID.FlowerPow, Do(DamageExact(80)) }, // Displays as 160 damage. VANILLA: 65 DMG (displays as 130) { ItemID.FlyingKnife, Do(DamageExact(53)) }, // VANILLA: 40 DMG { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(88)) }, // VANILLA: 49 DMG { ItemID.Gatligator, Do(UseExact(6)) }, // VANILLA: 7 UT @@ -147,18 +146,17 @@ namespace CalamityMod.Items { ItemID.KOCannon, Do(DamageRatio(2.65f)) }, // VANILLA: 40 DMG. Uses ratios due to remix seed { ItemID.Kraken, Do(DamageExact(65)) }, // VANILLA: 95 DMG { ItemID.LaserMachinegun, Do(DamageExact(49)) }, // VANILLA: 60 DMG - { ItemID.LaserRifle, Do(DamageExact(46), UseExact(10), ManaExact(4)) }, // VANILLA: 29 DMG, 12 UT, 8 MANA - { ItemID.LastPrism, Do(DamageExact(57), ManaExact(10)) }, // VANILLA: 100 DMG, 12 MANA + { ItemID.LaserRifle, Do(DamageExact(46)) }, // VANILLA: 29 DMG + { ItemID.LastPrism, Do(DamageExact(57)) }, // VANILLA: 100 DMG { ItemID.LeadShortsword, Do(TrueMelee, DamageExact(11)) }, // VANILLA: 9 DMG { ItemID.LeafBlower, Do(DamageExact(61)) }, // VANILLA: 48 DMG { ItemID.LightDisc, Do(DamageExact(80), ShootSpeedExact(18)) }, // VANILLA: 60 DMG, 16 VEL { ItemID.LunarFlareBook, Do(DamageExact(110)) }, // VANILLA: 100 DMG { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, // VANILLA: 42 DMG, 4.5 VEL - { ItemID.MagicMissile, Do(DamageExact(23), UseAnimationExact(20), UseTimeExact(10), ManaExact(10)) }, // VANILLA: 35 DMG, 22 UT/UA, 14 MANA + { ItemID.MagicMissile, Do(DamageExact(23), UseAnimationExact(20), UseTimeExact(10)) }, // VANILLA: 35 DMG, 22 UT/UA { ItemID.Marrow, Do(DamageExact(60)) }, // VANILLA: 53 DMG - { ItemID.MedusaHead, Do(DamageExact(75), ManaExact(6)) }, // VANILLA: 40 DMG, 15 MANA + { ItemID.MedusaHead, Do(DamageExact(75)) }, // VANILLA: 40 DMG { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)) }, // VANILLA: 200 DMG - { ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) }, // VANILLA: 50 DMG, 9 MANA, 10 VEL { ItemID.MiniNukeI, Do(DamageExact(90)) }, // VANILLA: 75 DMG { ItemID.MiniNukeII, Do(DamageExact(90)) }, { ItemID.Minishark, Do(DamageExact(4)) }, // VANILLA: 6 DMG @@ -175,7 +173,7 @@ namespace CalamityMod.Items { ItemID.MythrilRepeater, Do(UseExact(16)) }, // VANILLA: 20 UT { ItemID.MythrilSword, Do(UseTurn, DamageExact(70), UseExact(8)) }, // VANILLA: 50 DMG, 20 UT { ItemID.NailGun, Do(DamageExact(77)) }, // VANILLA: 85 DMG - { ItemID.NettleBurst, Do(DamageExact(65), ManaExact(10)) }, // VANILLA: 35 DMG, 12 MANA + { ItemID.NettleBurst, Do(DamageExact(65)) }, // VANILLA: 35 DMG { ItemID.NightsEdge, Do(TrueMelee, DamageExact(45)) }, // VANILLA: 40 DMG { ItemID.NorthPole, Do(UseMeleeSpeed) }, { ItemID.OrangePhaseblade, phaseblade }, @@ -199,9 +197,9 @@ 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.RainbowGun, Do(DamageExact(60), ManaExact(40)) }, // VANILLA: 45 DMG, 20 MANA - { ItemID.RainbowRod, Do(DamageExact(40), KnockbackExact(8f), ManaExact(13)) }, // VANILLA: 50 DMG, 6 KB, 21 MANA + { 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 { ItemID.RavenStaff, Do(DamageExact(36)) }, // VANILLA: 55 DMG { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, // VANILLA: 85 DMG @@ -231,7 +229,7 @@ namespace CalamityMod.Items { ItemID.SpaceGun, Do(DamageExact(23)) }, // VANILLA: 17 DMG { ItemID.Spear, Do(TrueMelee, DamageExact(14)) }, // VANILLA: 8 DMG { ItemID.SpectreStaff, Do(DamageExact(72)) }, // VANILLA: 65 DMG - { ItemID.SpiritFlame, Do(UseExact(20), ManaExact(11), ShootSpeedExact(2f)) }, // VANILLA: 22 UT, 14 MANA, 3 VEL + { ItemID.SpiritFlame, Do(UseExact(20), ShootSpeedExact(2f)) }, // VANILLA: 22 UT, 3 VEL { ItemID.StaffofEarth, Do(DamageExact(150)) }, // VANILLA: 125 DMG { ItemID.StarCannon, Do(UseExact(18)) }, // VANILLA: 12 UT { ItemID.StardustDragonStaff, Do(DamageExact(20)) }, // VANILLA: 40 DMG @@ -256,7 +254,7 @@ namespace CalamityMod.Items { ItemID.TitaniumSword, Do(UseTurn, DamageExact(192)) }, // VANILLA: 61 DMG { ItemID.TitaniumTrident, Do(TrueMelee, DamageExact(144), ShootSpeedExact(6.5f)) }, // VANILLA: 48 DMG, 5 VEL { ItemID.TopazStaff, Do(ManaExact(2)) }, // VANILLA: 5 MANA - { ItemID.ToxicFlask, Do(DamageExact(62), UseExact(33), ManaExact(20)) }, // VANILLA: 52 DMG, 45 UT, 30 MANA + { ItemID.ToxicFlask, Do(DamageExact(62), UseExact(33)) }, // VANILLA: 52 DMG, 45 UT { ItemID.Toxikarp, Do(UseExact(9)) }, // VANILLA: 10 UT { ItemID.Trident, Do(TrueMelee, DamageExact(20)) }, // VANILLA: 14 DMG { ItemID.Trimarang, Do(DamageExact(24)) }, // VANILLA: 21 DMG @@ -266,10 +264,9 @@ namespace CalamityMod.Items { ItemID.TungstenBullet, Do(DamageExact(8)) }, // VANILLA: 9 DMG { ItemID.TungstenShortsword, Do(TrueMelee, DamageExact(15)) }, // VANILLA: 10 DMG { ItemID.UnholyArrow, Do(DamageExact(11)) }, // VANILLA: 12 DMG - { ItemID.UnholyTrident, Do(DamageRatio(0.91f), ManaRatio(0.78f)) }, // VANILLA: 88 DMG, 19 MANA. Uses ratios due to remix seed + { ItemID.UnholyTrident, Do(DamageRatio(0.91f)) }, // VANILLA: 88 DMG. Uses ratios due to remix seed { ItemID.Uzi, Do(UseExact(8)) }, // VANILLA: 9 UT { ItemID.ValkyrieYoyo, Do(DamageExact(48)) }, // VANILLA: 70 DMG. Has the same stats as Red's Throw - { ItemID.VenomStaff, Do(UseExact(27)) }, // VANILLA: 30 UT { ItemID.WaspGun, Do(DamageExact(41)) }, // VANILLA: 31 DMG { ItemID.WaterBolt, Do(DamageExact(23)) }, // VANILLA: 19 DMG { ItemID.WhitePhaseblade, phaseblade }, diff --git a/Items/Fishing/FishingRods/TrustyOldRod.cs b/Items/Fishing/FishingRods/TrustyOldRod.cs new file mode 100644 index 0000000000..2f77e5458c --- /dev/null +++ b/Items/Fishing/FishingRods/TrustyOldRod.cs @@ -0,0 +1,33 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.FishingRods +{ + public class TrustyOldRod : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public static (int, int) enemyChance = (1, 3); // x/x Chance to pull up enemies + public override void SetDefaults() + { + Item.width = 70; + Item.height = 70; + Item.useAnimation = 8; + Item.useTime = 8; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item1; + Item.fishingPole = 45; + Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + } + public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineOriginOffset = new Vector2(68f, -52f); + lineColor = new Color(171, 171, 171, 0); + } + } +} diff --git a/Items/Fishing/FishingRods/TrustyOldRod.png b/Items/Fishing/FishingRods/TrustyOldRod.png new file mode 100644 index 0000000000..4b0dddb409 Binary files /dev/null and b/Items/Fishing/FishingRods/TrustyOldRod.png differ diff --git a/Items/Fishing/RageBait.cs b/Items/Fishing/RageBait.cs new file mode 100644 index 0000000000..43c2ac8f62 --- /dev/null +++ b/Items/Fishing/RageBait.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing +{ + public class RageBait : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public static (int, int) junkChance = (2, 3); // x/x Chance to turn items to junk + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = Item.CommonMaxStack; + Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(copper: 1); + Item.bait = 100; + Item.consumable = true; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.FishingBait; + } + } +} diff --git a/Items/Fishing/RageBait.png b/Items/Fishing/RageBait.png new file mode 100644 index 0000000000..1d97f4c96d Binary files /dev/null and b/Items/Fishing/RageBait.png differ diff --git a/Items/Materials/DisgustingSlop.png b/Items/Materials/DisgustingSlop.png new file mode 100644 index 0000000000..6d88c2df93 Binary files /dev/null and b/Items/Materials/DisgustingSlop.png differ diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs deleted file mode 100644 index f1bdcb44f6..0000000000 --- a/Items/Materials/GalacticaSingularity.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class GalacticaSingularity : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 24)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - ItemID.Sets.ItemNoGravity[Type] = true; - ItemID.Sets.SortingPriorityMaterials[Type] = 99; // Luminite - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 28; - Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 80); - Item.rare = ItemRarityID.Red; - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.FragmentSolar). - AddIngredient(ItemID.FragmentVortex). - AddIngredient(ItemID.FragmentNebula). - AddIngredient(ItemID.FragmentStardust). - AddTile(TileID.LunarCraftingStation). - Register(); - } - - public override void Update(ref float gravity, ref float maxFallSpeed) - { - float brightness = (float)Main.rand.Next(90, 111) * 0.01f; - brightness *= Main.essScale; - Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 1f * brightness, 0.3f * brightness, 0.3f * brightness); - } - } -} diff --git a/Items/Materials/GalacticaSingularity.png b/Items/Materials/GalacticaSingularity.png deleted file mode 100644 index cdf70f5cf0..0000000000 Binary files a/Items/Materials/GalacticaSingularity.png and /dev/null 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/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 39a7fa9695..46ba4a1278 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -88,7 +88,11 @@ namespace CalamityMod.Items.Materials AddIngredient(5). AddIngredient(). AddIngredient(). - AddIngredient(3). + AddIngredient(ItemID.FragmentSolar, 3). + AddIngredient(ItemID.FragmentVortex, 3). + AddIngredient(ItemID.FragmentNebula, 3). + AddIngredient(ItemID.FragmentStardust, 3). + AddIngredient(3). AddIngredient(). AddTile(). Register(); diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index 3511bc45e1..84aa0dd540 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.PermanentBoosters { public new string LocalizationCategory => "Items.Misc"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/CometShardUse"); - public const int ManaBoost = 50; + public const int ManaBoost = 60; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost); public override void SetStaticDefaults() diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index 4f5d4438ce..ca91374064 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.PermanentBoosters { public new string LocalizationCategory => "Items.Misc"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/EtherealCoreUse"); - public const int ManaBoost = 50; + public const int ManaBoost = 60; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost); public override void SetStaticDefaults() diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index bfa46677c1..bfc1d8f6c5 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.PermanentBoosters { public new string LocalizationCategory => "Items.Misc"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PhantomHeartUse"); - public const int ManaBoost = 50; + public const int ManaBoost = 60; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaBoost); public override void SetStaticDefaults() diff --git a/Items/Placeables/Furniture/CorruptionEffigy.png b/Items/Placeables/Furniture/CorruptionEffigy.png index 8885e6ffce..d7ba8c6e67 100644 Binary files a/Items/Placeables/Furniture/CorruptionEffigy.png and b/Items/Placeables/Furniture/CorruptionEffigy.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index 55da90cc1e..5da9b8e3af 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -29,7 +29,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddRecipeGroup("HardmodeAnvil"). AddIngredient(10). AddIngredient(ItemID.LunarBar, 10). - AddIngredient(12). + AddIngredient(ItemID.FragmentSolar, 12). + AddIngredient(ItemID.FragmentVortex, 12). + AddIngredient(ItemID.FragmentNebula, 12). + AddIngredient(ItemID.FragmentStardust, 12). + AddIngredient(12). AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Placeables/Furniture/GluttonyBlender.cs b/Items/Placeables/Furniture/GluttonyBlender.cs new file mode 100644 index 0000000000..f4355809c8 --- /dev/null +++ b/Items/Placeables/Furniture/GluttonyBlender.cs @@ -0,0 +1,66 @@ +using CalamityMod.Tiles.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class GluttonyBlender : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Orange; + Item.value = Item.buyPrice(gold: 5); + } + } + + public class QualitySlop : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override string Texture => "CalamityMod/Items/Potions/Food/QualitySlop"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = [ + new Color(183, 65, 68), + new Color(167, 116, 36), + new Color(175, 87, 190) + ]; + ItemID.Sets.IsFood[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Ambrosia; + } + + public override void SetDefaults() + { + Item.DefaultToFood(32, 30, BuffID.WellFed3, CalamityUtils.MinutesToFrames(30)); + Item.value = Item.sellPrice(gold: 1); + Item.rare = ItemRarityID.Orange; + } + } + + public class DisgustingSlop : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override string Texture => "CalamityMod/Items/Materials/DisgustingSlop"; + + public override void SetStaticDefaults() + { + ItemID.Sets.ExtractinatorMode[Type] = ItemID.OldShoe; + } + public override void SetDefaults() + { + Item.width = 26; + Item.height = 36; + Item.maxStack = Item.CommonMaxStack; + Item.rare = ItemRarityID.Gray; + Item.MakeUsableWithChlorophyteExtractinator(); + } + } +} diff --git a/Items/Placeables/Furniture/GluttonyBlender.png b/Items/Placeables/Furniture/GluttonyBlender.png new file mode 100644 index 0000000000..18cc167ca0 Binary files /dev/null and b/Items/Placeables/Furniture/GluttonyBlender.png differ diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index 7d1da4f007..cfaef17681 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -61,19 +61,18 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Cooper", "CosmaticMango", "CrabBar", + "Critaquil", "Dandy", - "Dia", "Done", "dozezoze", "Flowaria", "Fluffy", "fryzahh", + "Gpscorpion", "jasper", "LordMetarex", - "math2", "Moonburn", "Ozzatron", - "Piky", "PokerFace", "Raesh", "Sagittariod", @@ -108,6 +107,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Daim", "DarkTiny", "Demik", + "Dia", "DM Dokuro", "Doog", "drh", @@ -147,6 +147,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Lompl Allimath", "Lucille Karma", "MarieArk", + "math2", "Mercutio 'Merkalto' Takle", "Mihaii", "Minecat", @@ -163,6 +164,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Pbtopacio", "Phantasmal Deathray", "Phupperbat", + "Piky", "Pinkie Poss", "Poly", "Popo", diff --git a/Items/Placeables/Furniture/ResilientCandle.png b/Items/Placeables/Furniture/ResilientCandle.png index 29c5480f8c..dad1b54c54 100644 Binary files a/Items/Placeables/Furniture/ResilientCandle.png and b/Items/Placeables/Furniture/ResilientCandle.png differ diff --git a/Items/Placeables/Furniture/ShroombleCage.cs b/Items/Placeables/Furniture/ShroombleCage.cs new file mode 100644 index 0000000000..d8a02e2f78 --- /dev/null +++ b/Items/Placeables/Furniture/ShroombleCage.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class ShroombleCage : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Terrarium). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/ShroombleCage.png b/Items/Placeables/Furniture/ShroombleCage.png new file mode 100644 index 0000000000..f794638982 Binary files /dev/null and b/Items/Placeables/Furniture/ShroombleCage.png differ diff --git a/Items/Placeables/Furniture/SpitefulCandle.png b/Items/Placeables/Furniture/SpitefulCandle.png index 48403fea34..c078643850 100644 Binary files a/Items/Placeables/Furniture/SpitefulCandle.png and b/Items/Placeables/Furniture/SpitefulCandle.png differ 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/Placeables/Furniture/VigorousCandle.png b/Items/Placeables/Furniture/VigorousCandle.png index ca1f8a3523..d347366a31 100644 Binary files a/Items/Placeables/Furniture/VigorousCandle.png and b/Items/Placeables/Furniture/VigorousCandle.png differ diff --git a/Items/Placeables/Furniture/WeightlessCandle.png b/Items/Placeables/Furniture/WeightlessCandle.png index bf005cfb95..02faad55a9 100644 Binary files a/Items/Placeables/Furniture/WeightlessCandle.png and b/Items/Placeables/Furniture/WeightlessCandle.png differ diff --git a/Items/Placeables/GreedPot.cs b/Items/Placeables/GreedPot.cs new file mode 100644 index 0000000000..582e5f67ed --- /dev/null +++ b/Items/Placeables/GreedPot.cs @@ -0,0 +1,19 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles; + +namespace CalamityMod.Items.Placeables +{ + public class GreedPot : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(gold: 5); + } + } +} diff --git a/Items/Placeables/GreedPot.png b/Items/Placeables/GreedPot.png new file mode 100644 index 0000000000..9b89cb6405 Binary files /dev/null and b/Items/Placeables/GreedPot.png differ diff --git a/Items/Potions/Alcohol/BaconOil.cs b/Items/Potions/Alcohol/BaconOil.cs new file mode 100644 index 0000000000..d3b20577ee --- /dev/null +++ b/Items/Potions/Alcohol/BaconOil.cs @@ -0,0 +1,50 @@ +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Alcohol +{ + public class BaconOil : ModItem, ILocalizedModType, IAlcoholItem + { + public new string LocalizationCategory => "Items.Potions"; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BaconOil.DripEffect"); + public AlcoholType AlcoholVariant => AlcoholType.BaconOil; + public Action IVDripAlcoholEffect => ApplyBaconOilEffect; + + private static void ApplyBaconOilEffect(Player player, float intensity) + { + // See CalamityPlayer + } + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { + new Color(204, 90, 73), + new Color(168, 37, 37), + new Color(120, 28, 28) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 1 * player.direction; + player.itemLocation.Y -= 5; + } + } +} diff --git a/Items/Potions/Alcohol/BaconOil.png b/Items/Potions/Alcohol/BaconOil.png new file mode 100644 index 0000000000..a9b35f923c 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..39aa5c99b9 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,35 +1,55 @@ -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class BloodyMary : ModItem, ILocalizedModType + public class BloodyMary : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public static float PierceDamageMultiplier = 0.66f; + public static float SpawnRateGateMultiplier = 0.142f; + public static float IVDripAdditionalSpawnRateGateMultiplier = 0.7f; + public static float SpawnLimitMultiplier = 5f; + public static float IVDripAdditionalSpawnLimitMultiplier = 1.5f; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.BloodyMary.DripEffect"); + public AlcoholType AlcoholVariant => AlcoholType.BloodyMary; + + public Action IVDripAlcoholEffect => ApplyBloodyMaryEffect; + + private static void ApplyBloodyMaryEffect(Player player, float intensity) + { + // See CalamityPlayerOnHit + } + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(204, 90, 73), new Color(168, 37, 37), new Color(120, 28, 28) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(34, 56, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } - public override void AddRecipes() + public override void AddRecipes() { CreateRecipe(10). AddIngredient(ItemID.Bottle, 10). @@ -37,5 +57,11 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 11; + } } } diff --git a/Items/Potions/Alcohol/BloodyMary.png b/Items/Potions/Alcohol/BloodyMary.png index 333f4ab986..60acaee69e 100644 Binary files a/Items/Potions/Alcohol/BloodyMary.png and b/Items/Potions/Alcohol/BloodyMary.png differ diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index ea3de081cf..1b51c9b792 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,35 +1,48 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CaribbeanRum : ModItem, ILocalizedModType + public class CaribbeanRum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MoveSpeedBoost = 0.25f; public static float GravityMultiplier = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), (1-GravityMultiplier).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CaribbeanRum.DripEffect").WithFormatArgs(MoveSpeedBoost.ToPercent(), (1 - GravityMultiplier).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.CaribbeanRum; + + public Action IVDripAlcoholEffect => ApplyCaribbeanRumEffect; + + private static void ApplyCaribbeanRumEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Based on the drink itself + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(105, 29, 14), new Color(128, 39, 22), new Color(138, 28, 7) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(28, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; @@ -43,5 +56,11 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.png b/Items/Potions/Alcohol/CaribbeanRum.png index 834ce1a26a..4a833a3dd4 100644 Binary files a/Items/Potions/Alcohol/CaribbeanRum.png and b/Items/Potions/Alcohol/CaribbeanRum.png differ diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index 990fcb4353..04031b69ea 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,31 +1,44 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class CinnamonRoll : ModItem, ILocalizedModType + public class CinnamonRoll : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public AlcoholType AlcoholVariant => AlcoholType.CinnamonRoll; + public override LocalizedText Tooltip => base.Tooltip; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.CinnamonRoll.DripEffect"); + public Action IVDripAlcoholEffect => ApplyCinnamonRollEffect; + + private static void ApplyCinnamonRollEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(245, 223, 181), new Color(222, 186, 147), new Color(176, 129, 106) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(28, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; @@ -38,5 +51,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.png b/Items/Potions/Alcohol/CinnamonRoll.png index 66f03882a4..d58d51053b 100644 Binary files a/Items/Potions/Alcohol/CinnamonRoll.png and b/Items/Potions/Alcohol/CinnamonRoll.png differ diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 3089c42d4d..0568ee5ec5 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Everclear : ModItem, ILocalizedModType + public class Everclear : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,20 +19,29 @@ namespace CalamityMod.Items.Potions.Alcohol public static int RegenLoss = 10; public static float DefenseLossPercent = 0.30f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Everclear.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), RegenLoss.ToRegenPerSecond(), DefenseLossPercent.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Everclear; + public Action IVDripAlcoholEffect => ApplyEverclearEffect; + + private static void ApplyEverclearEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Everclear is clear so uhm... yeah? + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { new Color(153, 168, 162, 180), new Color(198, 205, 207, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(16, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -44,5 +56,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/Everclear.png b/Items/Potions/Alcohol/Everclear.png index 5e734af391..b7d15e16e5 100644 Binary files a/Items/Potions/Alcohol/Everclear.png and b/Items/Potions/Alcohol/Everclear.png differ diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index e1b4a1fa07..7e55b0710d 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,35 +1,51 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class EvergreenGin : ModItem, ILocalizedModType + public class EvergreenGin : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.EvergreenGin.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.EvergreenGin; + + public Action IVDripAlcoholEffect => ApplyEvergreenGinEffect; + private static void ApplyEvergreenGinEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.SicknessDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.WaterDebuffMultiplier += EvergreenGin.DebuffBoost; + cplayer.ElectricDebuffMultiplier -= EvergreenGin.DebuffLoss; + cplayer.HeatDebuffMultiplier -= EvergreenGin.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Pale green-blue + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(201, 248, 248), new Color(201, 248, 221), new Color(177, 240, 184) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(34, 56, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -44,5 +60,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.png b/Items/Potions/Alcohol/EvergreenGin.png index 5f1f9ae1ff..5848d618af 100644 Binary files a/Items/Potions/Alcohol/EvergreenGin.png and b/Items/Potions/Alcohol/EvergreenGin.png differ diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index 8fcea00497..f6942b5d7e 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,34 +1,50 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Fireball : ModItem, ILocalizedModType + public class Fireball : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Fireball.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Fireball; + + public Action IVDripAlcoholEffect => ApplyFireballEffect; + + private static void ApplyFireballEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier += Fireball.DebuffBoost; + cplayer.SicknessDebuffMultiplier -= Fireball.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(245, 171, 22), new Color(227, 128, 41), new Color(237, 82, 31) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(16, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(20, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -36,7 +52,6 @@ namespace CalamityMod.Items.Potions.Alcohol public override void AddRecipes() { - CreateRecipe(10). AddIngredient(ItemID.Bottle, 10). AddIngredient(ItemID.LivingFireBlock, 50). @@ -44,5 +59,9 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Fireball.png b/Items/Potions/Alcohol/Fireball.png index 48ba41816b..a9b9596bcc 100644 Binary files a/Items/Potions/Alcohol/Fireball.png and b/Items/Potions/Alcohol/Fireball.png differ diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 231f2c2d19..3f46580767 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,37 +1,48 @@ -using CalamityMod.Buffs.Alcohol; using System; -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class GrapeBeer : ModItem, ILocalizedModType + public class GrapeBeer : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; + public static float CloseRangeDistance = 80; public static float LongRangeDistance = 1200; public static float CloseRangeDamage = 0.75f; public static float LongRangeDamage = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LongRangeDamage,LongRangeDistance/16f); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.GrapeBeer.DripEffect").WithFormatArgs(LongRangeDamage, LongRangeDistance / 16f); + public AlcoholType AlcoholVariant => AlcoholType.GrapeBeer; + public Action IVDripAlcoholEffect => ApplyGrapeBeerEffect; + + private static void ApplyGrapeBeerEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(36, 2, 41), new Color(56, 0, 64), new Color(82, 10, 92) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(12, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(20, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -44,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.png b/Items/Potions/Alcohol/GrapeBeer.png index 1727991aa4..dc93fd517a 100644 Binary files a/Items/Potions/Alcohol/GrapeBeer.png and b/Items/Potions/Alcohol/GrapeBeer.png differ diff --git a/Items/Potions/Alcohol/Manhattan.cs b/Items/Potions/Alcohol/Manhattan.cs index b2b338a0b3..dc38313a10 100644 --- a/Items/Potions/Alcohol/Manhattan.cs +++ b/Items/Potions/Alcohol/Manhattan.cs @@ -1,35 +1,49 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Manhattan : ModItem, ILocalizedModType + public class Manhattan : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Manhattan.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Manhattan; + public Action IVDripAlcoholEffect => ApplyManhattanEffect; + + private static void ApplyManhattanEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ColdDebuffMultiplier += Manhattan.DebuffBoost; + cplayer.WaterDebuffMultiplier -= Manhattan.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(225, 84, 33), new Color(244, 176, 77), new Color(255, 218, 102) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(19, 58, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; @@ -43,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 8 * player.direction; + player.itemLocation.Y -= 14; + } } } diff --git a/Items/Potions/Alcohol/Manhattan.png b/Items/Potions/Alcohol/Manhattan.png index c6226e8ff7..226f575e75 100644 Binary files a/Items/Potions/Alcohol/Manhattan.png and b/Items/Potions/Alcohol/Manhattan.png differ diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 4df44ae8fb..2a86e3127a 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Margarita : ModItem, ILocalizedModType + public class Margarita : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,21 +19,37 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffLoss = 0.5f; public static int MinuteDuration = 3; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Margarita.DripEffect").WithFormatArgs(DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Margarita; + public Action IVDripAlcoholEffect => ApplyMargaritaEffect; + + private static void ApplyMargaritaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.HeatDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Margarita.DebuffLoss; + cplayer.TypelessDebuffMultiplier -= Margarita.DebuffLoss; + // Also see CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(219, 227, 191), new Color(186, 189, 147), new Color(142, 161, 125) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(28, 40, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(42, 52, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +62,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 14; + } } } diff --git a/Items/Potions/Alcohol/Margarita.png b/Items/Potions/Alcohol/Margarita.png index e147d8dfd4..3471d98bf5 100644 Binary files a/Items/Potions/Alcohol/Margarita.png and b/Items/Potions/Alcohol/Margarita.png differ diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index fd89995259..d684a80632 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,34 +1,46 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Moonshine : ModItem, ILocalizedModType + public class Moonshine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxLifePercentBoost = 0.33f; + public static float MaxLifePercentBoost = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Moonshine.DripEffect").WithFormatArgs(MaxLifePercentBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Moonshine; + public Action IVDripAlcoholEffect => ApplyMoonshineEffect; + + private static void ApplyMoonshineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerHitHurt + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Another clear drink + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(237, 237, 218, 128), new Color(227, 219, 191, 128), new Color(209, 204, 194, 128) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(30, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; @@ -43,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Moonshine.png b/Items/Potions/Alcohol/Moonshine.png index f4131089b9..9eed064da5 100644 Binary files a/Items/Potions/Alcohol/Moonshine.png and b/Items/Potions/Alcohol/Moonshine.png differ diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index 69406883aa..8e5c1c37e9 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,35 +1,46 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class MoscowMule : ModItem, ILocalizedModType + public class MoscowMule : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float KnockbackBoost = 0.5f; + public static float PierceDamageMultiplier = 0.7f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(KnockbackBoost.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.MoscowMule.DripEffect").WithFormatArgs(KnockbackBoost.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.MoscowMule; + public Action IVDripAlcoholEffect => ApplyMoscowMuleEffect; + + private static void ApplyMoscowMuleEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerOnHit + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Pale green with a hint of red + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(194, 252, 192), new Color(226, 252, 192), new Color(250, 225, 222) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(32, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(46, 46, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -42,5 +53,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 8 * player.direction; + player.itemLocation.Y -= 12; + } } } diff --git a/Items/Potions/Alcohol/MoscowMule.png b/Items/Potions/Alcohol/MoscowMule.png index 9a3a129c08..3673e404b9 100644 Binary files a/Items/Potions/Alcohol/MoscowMule.png and b/Items/Potions/Alcohol/MoscowMule.png differ diff --git a/Items/Potions/Alcohol/OddMushroom.png b/Items/Potions/Alcohol/OddMushroom.png index 947d323e19..2d8288fb9f 100644 Binary files a/Items/Potions/Alcohol/OddMushroom.png and b/Items/Potions/Alcohol/OddMushroom.png differ diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index 802234bc9d..f2f8c726c4 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,34 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class OldFashioned : ModItem, ILocalizedModType + public class OldFashioned : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static readonly float DamageBoostMultiplier = 1.25f; public static readonly float DamageReductionMultiplier = 0.75f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DamageBoostMultiplier).ToString("N2"), (DamageReductionMultiplier).ToString("N2")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.OldFashioned.DripEffect").WithFormatArgs(DamageBoostMultiplier.ToString("N2"), DamageReductionMultiplier.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.OldFashioned; + public Action IVDripAlcoholEffect => ApplyOldFashionedEffect; + + private static void ApplyOldFashionedEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(255, 118, 3), new Color(255, 200, 82), new Color(255, 228, 122) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(30, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(38, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; @@ -41,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 12; + } } } diff --git a/Items/Potions/Alcohol/OldFashioned.png b/Items/Potions/Alcohol/OldFashioned.png index c46adf86ba..618028fba5 100644 Binary files a/Items/Potions/Alcohol/OldFashioned.png and b/Items/Potions/Alcohol/OldFashioned.png differ diff --git a/Items/Potions/Alcohol/PurpleHaze.cs b/Items/Potions/Alcohol/PurpleHaze.cs index 4c7792e387..5da0e3abdf 100644 --- a/Items/Potions/Alcohol/PurpleHaze.cs +++ b/Items/Potions/Alcohol/PurpleHaze.cs @@ -1,7 +1,10 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -9,28 +12,38 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { [LegacyName("FabsolsVodka")] - public class PurpleHaze : ModItem, ILocalizedModType + public class PurpleHaze : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DamageBoost = 0.25f; public static float StealthDamageLoss = 0.25f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(),StealthDamageLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.PurpleHaze.DripEffect").WithFormatArgs(DamageBoost.ToPercent(), StealthDamageLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.PurpleHaze; + + public Action IVDripAlcoholEffect => ApplyPurpleHazeEffect; + + private static void ApplyPurpleHazeEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(239, 123, 202), new Color(187, 56, 158), new Color(165, 47, 255) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(24, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; @@ -44,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/PurpleHaze.png b/Items/Potions/Alcohol/PurpleHaze.png index 2baf8212db..d43e134c80 100644 Binary files a/Items/Potions/Alcohol/PurpleHaze.png and b/Items/Potions/Alcohol/PurpleHaze.png differ diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index f0314cc7f1..2afbf3ad47 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,36 +1,49 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class RedWine : ModItem, ILocalizedModType + public class RedWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float VerticalSpeedBoost = 0.1f; public static float FlightTimeLoss = 0.25f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.RedWine.DripEffect").WithFormatArgs(VerticalSpeedBoost.ToPercent(), FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.RedWine; + + public Action IVDripAlcoholEffect => ApplyRedWineEffect; + + private static void ApplyRedWineEffect(Player player, float intensity) + { + // See CalamityPlayer and CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(54, 5, 21), new Color(82, 9, 36), new Color(105, 4, 29) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6)); - + Item.DefaultToFood(20, 61, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Pink; } @@ -42,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 1 * player.direction; + player.itemLocation.Y -= 5; + } } } diff --git a/Items/Potions/Alcohol/RedWine.png b/Items/Potions/Alcohol/RedWine.png index 025a1ad4fa..991922d87a 100644 Binary files a/Items/Potions/Alcohol/RedWine.png and b/Items/Potions/Alcohol/RedWine.png differ diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index e1b83237a8..59de073e29 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,34 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Rum : ModItem, ILocalizedModType + public class Rum : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float NonMinionBoost = 1.15f; public static float MinionBoost = 0.85f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((NonMinionBoost-1).ToPercent(), (1- MinionBoost).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Rum.DripEffect").WithFormatArgs((NonMinionBoost - 1).ToPercent(), (1 - MinionBoost).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Rum; + public Action IVDripAlcoholEffect => ApplyRumEffect; + + private static void ApplyRumEffect(Player player, float intensity) + { + // See CalamityGlobalProjectile + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(237, 165, 9), new Color(247, 219, 54), new Color(255, 195, 31) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(24, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(30, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -41,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 3 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/Rum.png b/Items/Potions/Alcohol/Rum.png index 1f582e6294..fef2821ba3 100644 Binary files a/Items/Potions/Alcohol/Rum.png and b/Items/Potions/Alcohol/Rum.png differ diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 65c071fa43..ae75b8f518 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,36 +1,51 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Screwdriver : ModItem, ILocalizedModType + public class Screwdriver : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Screwdriver.DripEffect").WithFormatArgs(DebuffBoost.ToString("N2"), DebuffLoss.ToString("N2")); + public AlcoholType AlcoholVariant => AlcoholType.Screwdriver; + public Action IVDripAlcoholEffect => ApplyScrewdriverEffect; + + private static void ApplyScrewdriverEffect(Player player, float intensity) + { + player.blockRange += 5; + player.tileSpeed += 1; + player.wallSpeed += 1; + player.GetDamage(DamageClass.Generic) *= 0.75f; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(225, 84, 33), new Color(244, 176, 77), new Color(255, 218, 102) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(32, 46, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } @@ -42,5 +57,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 5 * player.direction; + player.itemLocation.Y -= 10; + } } } diff --git a/Items/Potions/Alcohol/Screwdriver.png b/Items/Potions/Alcohol/Screwdriver.png index e499f35d90..aa6147ccb9 100644 Binary files a/Items/Potions/Alcohol/Screwdriver.png and b/Items/Potions/Alcohol/Screwdriver.png differ diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index bbc2dc0f21..7493d3d13c 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,35 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class StarBeamRye : ModItem, ILocalizedModType + public class StarBeamRye : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float MagicDmgMult = 0.9f; public static int ManaRegenBoost = 30; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDmgMult); + public AlcoholType AlcoholVariant => AlcoholType.StarBeamRye; + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.StarBeamRye.DripEffect").WithFormatArgs(MagicDmgMult); + public Action IVDripAlcoholEffect => ApplyStarBeamRyeEffect; + + private static void ApplyStarBeamRyeEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Dark red-orange + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(89, 18, 10), new Color(102, 39, 14), new Color(128, 31, 9) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(20, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(20, 54, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; @@ -42,5 +54,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.png b/Items/Potions/Alcohol/StarBeamRye.png index 3c1d30b238..f61b9aea7d 100644 Binary files a/Items/Potions/Alcohol/StarBeamRye.png and b/Items/Potions/Alcohol/StarBeamRye.png differ diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index b9d4df742e..c5ba5d92f8 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,14 +1,17 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.DataStructures; namespace CalamityMod.Items.Potions.Alcohol { - public class Tequila : ModItem, ILocalizedModType + public class Tequila : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; @@ -16,21 +19,32 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DebuffBoost = 0.5f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Tequila.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Tequila; + public Action IVDripAlcoholEffect => ApplyTequilaEffect; + + private static void ApplyTequilaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.ElectricDebuffMultiplier += Tequila.DebuffBoost; + cplayer.ColdDebuffMultiplier -= Tequila.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(163, 110, 10), new Color(176, 135, 0), new Color(194, 132, 25) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { - Item.DefaultToFood(16, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - + Item.DefaultToFood(32, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -44,5 +58,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 9; + } } } diff --git a/Items/Potions/Alcohol/Tequila.png b/Items/Potions/Alcohol/Tequila.png index 8ef6726cd6..87d5dd41e0 100644 Binary files a/Items/Potions/Alcohol/Tequila.png and b/Items/Potions/Alcohol/Tequila.png differ diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 2e04f06f82..71fd80ec42 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,35 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class TequilaSunrise : ModItem, ILocalizedModType + public class TequilaSunrise : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DoTMultiplier = 1.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DoTMultiplier-1).ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.TequilaSunrise.DripEffect").WithFormatArgs((DoTMultiplier-1).ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.TequilaSunrise; + public Action IVDripAlcoholEffect => ApplyTequilaSunriseEffect; + + private static void ApplyTequilaSunriseEffect(Player player, float intensity) + { + // See CalamityPlayerLifeRegen + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(220, 75, 59), new Color(229, 147, 47), new Color(255, 190, 76) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { Item.DefaultToFood(22, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +55,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 9 * player.direction; + player.itemLocation.Y -= 10; + } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.png b/Items/Potions/Alcohol/TequilaSunrise.png index 30974d148a..4f2ee50759 100644 Binary files a/Items/Potions/Alcohol/TequilaSunrise.png and b/Items/Potions/Alcohol/TequilaSunrise.png differ diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index ca404e6e3c..f91304ab41 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,30 +1,47 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Vodka : ModItem, ILocalizedModType + public class Vodka : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float DebuffBoost = 0.25f; public static float DebuffLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Vodka.DripEffect").WithFormatArgs((DebuffBoost).ToPercent(), DebuffLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Vodka; + public Action IVDripAlcoholEffect => ApplyVodkaEffect; + + private static void ApplyVodkaEffect(Player player, float intensity) + { + var cplayer = player.Calamity(); + cplayer.TypelessDebuffMultiplier += Vodka.DebuffBoost; + cplayer.HeatDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ColdDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.SicknessDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.WaterDebuffMultiplier -= Vodka.DebuffLoss; + cplayer.ElectricDebuffMultiplier -= Vodka.DebuffLoss; + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Another clear drink + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { new Color(219, 219, 208, 180), new Color(181, 181, 176, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() @@ -43,5 +60,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 2 * player.direction; + player.itemLocation.Y -= 8; + } } } diff --git a/Items/Potions/Alcohol/Vodka.png b/Items/Potions/Alcohol/Vodka.png index f1e7333959..5ffef8df03 100644 Binary files a/Items/Potions/Alcohol/Vodka.png and b/Items/Potions/Alcohol/Vodka.png differ diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 8affbb3282..fc77890852 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,37 +1,52 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class Whiskey : ModItem, ILocalizedModType + public class Whiskey : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; - public static float MaxDamageBoost = 0.15f; - public static float MinDamageBoost = -0.15f; + public static float StandardDamageCeiling = 0.15f; + public static float StandardDamageFloor = -0.15f; public static float TimeToDischarge = 600; public static float TimeToRecharge = 300; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinDamageBoost.ToPercent(), MaxDamageBoost.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public static float CombinedDamageCeiling = 0.3f; + public static float CombinedDamageFloor = -0.3f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge/60).ToString("0.##"), (TimeToRecharge/60).ToString("0.##")); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.Whiskey.DripEffect").WithFormatArgs(StandardDamageFloor.ToPercent(), StandardDamageCeiling.ToPercent(), (TimeToDischarge / 60).ToString("0.##"), (TimeToRecharge / 60).ToString("0.##"), CombinedDamageFloor.ToPercent(), CombinedDamageCeiling.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.Whiskey; + + public Action IVDripAlcoholEffect => ApplyWhiskeyEffect; + + private static void ApplyWhiskeyEffect(Player player, float intensity) + { + // See CalamityPlayer + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(227, 148, 11), new Color(235, 177, 5), new Color(250, 190, 12) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; } @@ -43,5 +58,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 2 * player.direction; + player.itemLocation.Y -= 7; + } } } diff --git a/Items/Potions/Alcohol/Whiskey.png b/Items/Potions/Alcohol/Whiskey.png index 351f288939..b4e8e20c6d 100644 Binary files a/Items/Potions/Alcohol/Whiskey.png and b/Items/Potions/Alcohol/Whiskey.png differ diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 32890d06ad..17ab737b17 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,32 +1,43 @@ -using CalamityMod.Buffs.Alcohol; +using System; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameInput; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { - public class WhiteWine : ModItem, ILocalizedModType + public class WhiteWine : ModItem, ILocalizedModType, IAlcoholItem { public new string LocalizationCategory => "Items.Potions"; public static float FlightTimeRecoveryAmount = 0.66f; public static float FlightTimeLoss = 0.5f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeLoss.ToPercent()); + public LocalizedText DripEffectText => Language.GetText("Mods.CalamityMod.Items.Potions.WhiteWine.DripEffect").WithFormatArgs(FlightTimeLoss.ToPercent()); + public AlcoholType AlcoholVariant => AlcoholType.WhiteWine; + public Action IVDripAlcoholEffect => ApplyWhiteWineEffect; + + private static void ApplyWhiteWineEffect(Player player, float intensity) + { + // See CalamityPlayerMiscEffects + } public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - // Clear, yellow-green + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(242, 252, 177, 180), new Color(250, 252, 215, 180), new Color(228, 245, 181, 180) }; + ItemID.Sets.IsFood[Type] = true; } public override void SetDefaults() @@ -48,5 +59,10 @@ namespace CalamityMod.Items.Potions.Alcohol AddTile(TileID.Kegs). Register(); } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.itemLocation.X += 4 * player.direction; + player.itemLocation.Y -= 5; + } } } diff --git a/Items/Potions/Alcohol/WhiteWine.png b/Items/Potions/Alcohol/WhiteWine.png index 2341999a22..11d14186eb 100644 Binary files a/Items/Potions/Alcohol/WhiteWine.png and b/Items/Potions/Alcohol/WhiteWine.png differ diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index b184457a0b..4cbbc4eaf7 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.Potions { public new string LocalizationCategory => "Items.Potions"; - public static int ManaPerFrame = 2; - public static int SelfDamage = 5; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaPerFrame * 60, SelfDamage); + public static int ManaPerFrame = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ManaPerFrame * 60); public override void SetStaticDefaults() { @@ -28,24 +27,12 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.DefaultToFood(14, 34, ModContent.BuffType(), CalamityUtils.SecondsToFrames(5), true); + Item.DefaultToFood(14, 34, ModContent.BuffType(), CalamityUtils.SecondsToFrames(6), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Lime; } - public override void OnConsumeItem(Player player) - { - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime / 2, true); - player.statLife -= SelfDamage; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-SelfDamage, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AstralInjection" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), 1000.0, 0, false); - } - } + public override void OnConsumeItem(Player player) => player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); public override void AddRecipes() { diff --git a/Items/Potions/BottledPanacea.cs b/Items/Potions/BottledPanacea.cs index 347e59c2f1..b61d284f6d 100644 --- a/Items/Potions/BottledPanacea.cs +++ b/Items/Potions/BottledPanacea.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Items.Potions { @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Potions for (int i = Player.MaxBuffs - 1; i >= 0; i--) { int buffType = player.buffType[i]; - if (BuffDatasets.DebuffDataset[buffType] is not null && (BuffDatasets.DebuffDataset[buffType].SicknessDebuffScaling > 0 || BuffDatasets.DebuffDataset[buffType].ElectricDebuffScaling > 0)) + if (CalamityBuffSets.DebuffDataset[buffType] is not null && (CalamityBuffSets.DebuffDataset[buffType].SicknessDebuffScaling > 0 || CalamityBuffSets.DebuffDataset[buffType].ElectricDebuffScaling > 0)) player.DelBuff(i); } diff --git a/Items/Potions/Food/QualitySlop.png b/Items/Potions/Food/QualitySlop.png new file mode 100644 index 0000000000..236e7ebf2d Binary files /dev/null and b/Items/Potions/Food/QualitySlop.png differ diff --git a/Items/Potions/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..eae462625c --- /dev/null +++ b/Items/Potions/TheElixir.cs @@ -0,0 +1,112 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Packets; +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 (Main.rand.NextBool(4)) + { + int locationIndex = Main.rand.Next(3); + if (Main.dedServ) + TheElixirTeleportSyncPacket.Send(player, locationIndex); + + Vector2? location = locationIndex 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/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 2c7bbb1321..341e60f662 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -60,7 +60,11 @@ namespace CalamityMod.Items.SummonItems // sequence breaking recipe CreateRecipe(). AddIngredient(ItemID.LunarBar, 40). - AddIngredient(10). + AddIngredient(ItemID.FragmentSolar, 10). + AddIngredient(ItemID.FragmentVortex, 10). + AddIngredient(ItemID.FragmentNebula, 10). + AddIngredient(ItemID.FragmentStardust, 10). + AddIngredient(10). AddIngredient(40). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/SummonItems/TownPets/TheHousingContract.cs b/Items/SummonItems/TownPets/TheHousingContract.cs new file mode 100644 index 0000000000..c646795033 --- /dev/null +++ b/Items/SummonItems/TownPets/TheHousingContract.cs @@ -0,0 +1,67 @@ +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Packets; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Chat; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.TownPets +{ + public class TheHousingContract : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.SummonItems"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.useStyle = ItemUseStyleID.HoldUp; + Item.consumable = true; + Item.useAnimation = 45; + Item.useTime = 45; + Item.UseSound = SoundID.Item92; + Item.width = 28; + Item.height = 28; + Item.maxStack = Item.CommonMaxStack; + Item.SetShopValues(ItemRarityColor.Green2, Item.buyPrice(0, 5)); + } + + public override bool? UseItem(Player player) + { + int npcType = ModContent.NPCType(); + if (player.ItemAnimationJustStarted && (!CalamityWorld.unlockedTownPig || NPC.AnyNPCs(npcType))) + { + if (player.whoAmI == Main.myPlayer) + { + SpawnPiggy(); + } + return true; + } + return false; + } + + public static void SpawnPiggy() + { + Color color = new(50, 255, 130); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (!CalamityWorld.unlockedTownPig) + { + SyncTownPigLicensePacket.Send(); + } + } + else if (!CalamityWorld.unlockedTownPig) + { + CalamityWorld.unlockedTownPig = true; + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Mods.CalamityMod.Misc.PiggyLicense"), color); + CalamityNetcode.SyncWorld(); + } + } + } +} diff --git a/Items/SummonItems/TownPets/TheHousingContract.png b/Items/SummonItems/TownPets/TheHousingContract.png new file mode 100644 index 0000000000..e2b10b4af8 Binary files /dev/null and b/Items/SummonItems/TownPets/TheHousingContract.png 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/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index 44429ca5dd..dd8eaa1695 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,14 +16,14 @@ namespace CalamityMod.Items.Tools { Item.width = 80; Item.height = 66; - Item.damage = 110; + Item.damage = 55; Item.crit = 10; Item.knockBack = 7f; Item.useTime = 8; Item.useAnimation = 12; Item.axe = 135 / 5; Item.tileBoost += 1; - + Item.shoot = ProjectileID.Spark; // Dummy argument to ensure it doesn't get set to true melee Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; @@ -31,6 +33,8 @@ namespace CalamityMod.Items.Tools Item.autoReuse = true; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => false; + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { hitbox = CalamityUtils.FixSwingHitbox(54, 54); @@ -112,7 +116,7 @@ namespace CalamityMod.Items.Tools sparkXSpawn *= (float)player.direction; sparkYSpawn *= player.gravDir; var source = player.GetSource_ItemUse(Item); - int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage * 0.2f); + int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage * 0.5f); int spark = Projectile.NewProjectile(source, (float)(hitbox.X + hitbox.Width / 2) + sparkXSpawn, (float)(hitbox.Y + hitbox.Height / 2) + sparkYSpawn, (float)player.direction * sparkXVel, sparkYVel * player.gravDir, ProjectileID.Spark, damage, 0f, player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) Main.projectile[spark].DamageType = DamageClass.Melee; @@ -129,9 +133,10 @@ namespace CalamityMod.Items.Tools if (hit.Crit) { var source = player.GetSource_ItemUse(Item); - int boom = Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, Item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (boom.WithinBounds(Main.maxProjectiles)) - Main.projectile[boom].DamageType = DamageClass.Melee; + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, Item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int onHitDamage = player.CalcIntDamage(Item.damage * 0.5f); + Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); + blast.DamageType = Item.DamageType; } target.AddBuff(BuffID.OnFire3, 300); } 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/RelicOfResilience.cs b/Items/Tools/RelicOfResilience.cs index af20a97f04..db68a53d8c 100644 --- a/Items/Tools/RelicOfResilience.cs +++ b/Items/Tools/RelicOfResilience.cs @@ -7,6 +7,16 @@ namespace CalamityMod.Items.Tools public class RelicOfResilience : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; + public static int baseTimeMax => 300; + public static int maxPowerTime => 1800; + public static int baseCooldown => 900; + public static int baseDefenseFloor => 200; + public static float baseDrFloor => 0.1f; + public static int shardBaseDamage => 180; + public static float orbitDamageMult => 0.2f; + public static int baseMaxShardCount => 30; + public static float maxPowerShardMult => 2; // Applied to number of shards at max power + public static float additionalMaxPowerDefensesMult => 1; // This is added to the base 100% effectiveness public override void SetDefaults() { Item.width = 40; diff --git a/Items/Tools/TheGift.cs b/Items/Tools/TheGift.cs new file mode 100644 index 0000000000..1fd6f97a7f --- /dev/null +++ b/Items/Tools/TheGift.cs @@ -0,0 +1,154 @@ +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 = 30; + 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..24954690d3 --- /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.Hasty2, + PrefixID.Quick2 + }; + + 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/VanillaArmorChanges/AdamantiteArmorSetChange.cs b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs index 8ae7e117cf..e37abd0f63 100644 --- a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs @@ -17,18 +17,11 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Adamantite"; - public const int MaxManaBoost = 20; public const int DefenseBoostMax = 10; public const int TimeUntilDecayBeginsAfterAttacking = 60; public const int TimeUntilBoostCompletelyDecays = 210; // Unlisted use: this is also the amount of hits to max out defense. public const int CritToDRConversionPercent = 25; - public override void ApplyHeadPieceEffect(Player player) - { - if (player.armor[0].type == ItemID.AdamantiteHeadgear) - player.statManaMax2 += MaxManaBoost; - } - public override void UpdateSetBonusText(ref string setBonusText) { Player player = Main.LocalPlayer; diff --git a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs index d8cd7c5c0f..b4441ddbcd 100644 --- a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs @@ -18,16 +18,9 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Cobalt"; public const int SpeedBoostSetBonusPercentage = 10; - public const int MaxManaBoost = 20; public const int MovementSpeedBoostPercentageMax = 10; public const int MovementSpeedBoostMphThreshold = 80; - public override void ApplyHeadPieceEffect(Player player) - { - if (player.armor[0].type == ItemID.CobaltHat) - player.statManaMax2 += MaxManaBoost; - } - public override void UpdateSetBonusText(ref string setBonusText) { Player player = Main.LocalPlayer; diff --git a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs index 5ed1269dab..ac878db015 100644 --- a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Mythril"; - public const int MaxManaBoost = 20; public const int FlareFrameSpawnDelay = 12; public const int FlareDamageSoftcap = 40; @@ -27,12 +26,6 @@ namespace CalamityMod.Items.VanillaArmorChanges setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(FlareFrameSpawnDelay)}"; } - public override void ApplyHeadPieceEffect(Player player) - { - if (player.armor[0].type == ItemID.MythrilHood) - player.statManaMax2 += MaxManaBoost; - } - public override void ApplyArmorSetBonus(Player player) { player.Calamity().MythrilSet = true; 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/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index 7520d358ee..a7d095df89 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -33,10 +33,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Magic; Item.damage = 705; Item.knockBack = 7f; - Item.useTime = 45; - Item.useAnimation = 45; + Item.useAnimation = Item.useTime = 45; Item.autoReuse = true; - Item.mana = 24; + Item.mana = 36; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = FireSound; diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 45033681b3..73226ea694 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -24,10 +24,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Magic; Item.damage = 42; Item.knockBack = 3f; - Item.useTime = 64; - Item.useAnimation = 64; + Item.useAnimation = Item.useTime = 64; Item.autoReuse = true; - Item.mana = 15; + Item.mana = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = PulseRifle.FireSound with { Pitch = 0.3f, Volume = 0.7f }; diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 4abbc9858a..6745f8807d 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 10f; Item.useTime = Item.useAnimation = 90; Item.autoReuse = true; - Item.mana = 60; + Item.mana = 120; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = FireSound; diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index bc02df607b..e168061648 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 86; Item.height = 32; - Item.damage = 27; + Item.damage = 30; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 14; Item.useAnimation = Item.useTime = 19; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/AlphaDraconis.cs b/Items/Weapons/Magic/AlphaDraconis.cs index ee0ed26f78..9789aa3161 100644 --- a/Items/Weapons/Magic/AlphaDraconis.cs +++ b/Items/Weapons/Magic/AlphaDraconis.cs @@ -28,9 +28,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 74; Item.damage = 150; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 12; - Item.useAnimation = 12; + Item.mana = 16; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.2f; diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 2bf63f0bd7..7f6cb2cda0 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -20,9 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 52; Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = 17; - Item.useAnimation = 17; + Item.mana = 15; + Item.useAnimation = Item.useTime = 17; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/Apathanull.cs b/Items/Weapons/Magic/Apathanull.cs index 799f6e63bc..71c021eeaa 100644 --- a/Items/Weapons/Magic/Apathanull.cs +++ b/Items/Weapons/Magic/Apathanull.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 63; Item.DamageType = DamageClass.Magic; Item.crit = 12; - Item.mana = 20; + Item.mana = 26; Item.useTime = 8; Item.useAnimation = 20; Item.reuseDelay = 8; @@ -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/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index db3036dc29..2052a2ec6f 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 40; Item.DamageType = DamageClass.Magic; Item.mana = 14; - Item.useAnimation = 5; - Item.useTime = 5; + Item.useAnimation = Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 6f; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 278a72e01e..dbfc18e573 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 34; Item.damage = 222; Item.DamageType = DamageClass.Magic; - Item.mana = 42; + Item.mana = 277; Item.useAnimation = Item.useTime = 167; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index a5eab40668..a933cc1bdf 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 84; Item.damage = 17; Item.DamageType = DamageClass.Magic; - Item.mana = 3; - Item.useTime = 22; - Item.useAnimation = 22; + Item.mana = 10; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; diff --git a/Items/Weapons/Magic/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index 654f269409..60dcbb5cbb 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 68; Item.damage = 58; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 23; - Item.useAnimation = 23; + Item.mana = 23; + Item.useAnimation = Item.useTime = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; diff --git a/Items/Weapons/Magic/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index b16f045350..48eedfc601 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -16,9 +17,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 70; Item.height = 70; - Item.damage = 80; + Item.damage = 120; Item.DamageType = DamageClass.Magic; - Item.mana = 20; + Item.mana = 60; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,6 +35,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.Calamity().donorItem = true; } + // Cancels out the mana used to summon the holdout + public override void OnConsumeMana(Player player, int manaConsumed) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.statMana += manaConsumed; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index a4338c8a20..ed1cac00a0 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -21,9 +21,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 52; Item.damage = 55; Item.DamageType = DamageClass.Magic; - Item.mana = 19; - Item.useTime = 21; - Item.useAnimation = 21; + Item.mana = 16; + Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index 9aaf1df0bd..4a6587427b 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -24,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 81; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 15; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index f9e5d70960..37e6ec4379 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 22; Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 16; Item.useTime = 12; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/BlackAnurian.cs b/Items/Weapons/Magic/BlackAnurian.cs index 3c40c780a5..366922308f 100644 --- a/Items/Weapons/Magic/BlackAnurian.cs +++ b/Items/Weapons/Magic/BlackAnurian.cs @@ -14,11 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 38; - Item.damage = 21; + Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 9; - Item.useTime = 18; - Item.useAnimation = 18; + Item.mana = 13; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 53bf0748d8..3485e92f94 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 50; Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 12; Item.useTime = 15; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index 3baf578096..a451948664 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -20,9 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 34; Item.damage = 45; Item.DamageType = DamageClass.Magic; - Item.mana = 6; - Item.useTime = 16; - Item.useAnimation = 16; + Item.mana = 12; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 91257ae1d1..606e5db6e8 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 30; - Item.damage = 69; + Item.damage = 56; Item.DamageType = DamageClass.Magic; Item.mana = 8; Item.useTime = 20; diff --git a/Items/Weapons/Magic/ChronomancersScythe.cs b/Items/Weapons/Magic/ChronomancersScythe.cs index 7785365ef0..33b9019373 100644 --- a/Items/Weapons/Magic/ChronomancersScythe.cs +++ b/Items/Weapons/Magic/ChronomancersScythe.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = false; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item71; - Item.mana = 10; + Item.mana = 30; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; diff --git a/Items/Weapons/Magic/CoralSpout.cs b/Items/Weapons/Magic/CoralSpout.cs index 29915efe9f..495e00f293 100644 --- a/Items/Weapons/Magic/CoralSpout.cs +++ b/Items/Weapons/Magic/CoralSpout.cs @@ -25,9 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 9; Item.DamageType = DamageClass.Magic; - Item.mana = 7; - Item.useTime = 26; - Item.useAnimation = 26; + Item.mana = 30; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index cb6f719579..646bddac01 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 34; Item.damage = 96; Item.DamageType = DamageClass.Magic; - Item.mana = 18; - Item.useTime = 40; - Item.useAnimation = 40; + Item.mana = 22; + Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index ed3956944a..a7bd4d6d42 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 16; Item.damage = 60; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 12; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 6eb2576e61..15de8c3c0b 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 60; Item.damage = 943; Item.DamageType = DamageClass.Magic; - Item.mana = 30; + Item.mana = 90; Item.useTime = 10; Item.useAnimation = 30; Item.reuseDelay = 40; diff --git a/Items/Weapons/Magic/EidolonStaff.cs b/Items/Weapons/Magic/EidolonStaff.cs index f3c14ab5b0..cbd9a58959 100644 --- a/Items/Weapons/Magic/EidolonStaff.cs +++ b/Items/Weapons/Magic/EidolonStaff.cs @@ -24,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 180; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 18; - Item.useAnimation = 18; + Item.mana = 24; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index db855f0b79..fefa3f26ea 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 32; Item.DamageType = DamageClass.Magic; Item.crit = 5; - Item.mana = 7; + Item.mana = 13; Item.useTime = 7; Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 39d89390ce..913475841f 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 40; Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; - Item.mana = 30; + Item.mana = 300; Item.useAnimation = Item.useTime = 120; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index 70401af4c4..3215eaa9db 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 40; Item.height = 46; - Item.damage = 70; + Item.damage = 120; Item.knockBack = 3.5f; Item.noMelee = true; Item.DamageType = DamageClass.Magic; - Item.mana = 12; + Item.mana = 45; - Item.useAnimation = Item.useTime = 32; + Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index bff3fc20e7..a2182c7753 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 50; Item.damage = 130; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 14; Item.useTime = 5; Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index 26f28c4056..b89d9b77dd 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -25,8 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 120; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.useTime = 16; - Item.useAnimation = 16; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 2dfac6fc97..8f3e2f1489 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 38; Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 22; - Item.useTime = 80; - Item.useAnimation = 80; + Item.mana = 40; + Item.useAnimation = Item.useTime = 80; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index c88eaef054..65e04f2664 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -27,9 +27,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 42; Item.damage = 95; Item.DamageType = DamageClass.Magic; - Item.mana = 13; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index 1e24726a97..cfa6466d6a 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -22,9 +22,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; - Item.mana = 20; - Item.useTime = 27; - Item.useAnimation = 27; + Item.mana = 36; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index f3806aa889..56a4cd3c5b 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 53; Item.DamageType = DamageClass.Magic; - Item.mana = 11; - Item.useTime = 27; - Item.useAnimation = 27; + Item.mana = 15; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index fa31df187f..899d39a098 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -9,16 +9,18 @@ namespace CalamityMod.Items.Weapons.Magic public class GloriousEnd : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public static int PlayerExplosionDmgMin = 60; - public static int PlayerExplosionDmgMax = 80; + + // Scales with difficulty (Expert: 60-80) + public static int PlayerExplosionDmgMin = 30; + public static int PlayerExplosionDmgMax = 40; public override void SetDefaults() { Item.width = 30; Item.height = 58; - Item.damage = 100; + Item.damage = 60; Item.knockBack = 10f; Item.useAnimation = Item.useTime = 30; - Item.mana = 20; + Item.mana = 60; Item.DamageType = DamageClass.Magic; Item.channel = true; Item.shootSpeed = 7f; diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index 2e56c3fd15..1ee7f0c77f 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; - Item.mana = 400; - Item.useTime = 27; - Item.useAnimation = 27; + Item.mana = 30; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index c6f37bff86..bd8cd04e77 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -24,20 +24,14 @@ namespace CalamityMod.Items.Weapons.Magic public static int AftershotCooldownFrames = 17; public static int FullChargeFrames = 88; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; - } - public override void SetDefaults() { Item.width = 112; Item.height = 112; Item.DamageType = DamageClass.Magic; - Item.damage = 2700; + Item.damage = 3000; Item.knockBack = 9.5f; - Item.mana = 80; + Item.mana = 120; Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.autoReuse = true; Item.noMelee = true; diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 1a4654ad88..8d9e965715 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -21,9 +21,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 34; Item.damage = 22; Item.DamageType = DamageClass.Magic; - Item.mana = 7; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 10; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 6b23620bef..258c342866 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 60; Item.useStyle = ItemUseStyleID.HoldUp; Item.DamageType = DamageClass.Magic; - Item.mana = 180; + Item.mana = 300; Item.noMelee = true; Item.UseSound = CastSound; diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 5b4f710290..773ea06d41 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 50; Item.DamageType = DamageClass.Magic; Item.crit = 25; - Item.mana = 15; + Item.mana = 25; Item.useTime = 2; Item.useAnimation = 30; Item.reuseDelay = Item.useAnimation + 6; diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index 7da3eaaf27..542b049cc2 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -21,11 +21,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 30; - Item.damage = 111; + Item.damage = 130; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 46; - Item.useAnimation = 46; + Item.mana = 28; + Item.useAnimation = Item.useTime = 46; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; @@ -33,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 11f; + Item.shootSpeed = 14f; } // Shoots twice as fast (and uses half as much mana to compensate) during hellblasts diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index c3a329728b..f08a786564 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 78; Item.damage = 200; Item.DamageType = DamageClass.Magic; - Item.mana = 32; - Item.useTime = 37; - Item.useAnimation = 37; + Item.mana = 45; + Item.useAnimation = Item.useTime = 37; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 79a5e5bdbf..09233ac96a 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 38; Item.damage = 20; Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = 38; - Item.useAnimation = 38; + Item.mana = 15; + Item.useAnimation = Item.useTime = 38; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index e2d1fb0d40..9adc8327e4 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 64; Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 16; + Item.mana = 22; Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index 426c3841ea..f9fd80822b 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -20,11 +20,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 48; Item.height = 48; - Item.damage = 54; + Item.damage = 59; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 6; - Item.useAnimation = 6; + Item.mana = 7; + Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Magic/NebulousCataclysm.cs b/Items/Weapons/Magic/NebulousCataclysm.cs index 00b99ac405..b83032ebf9 100644 --- a/Items/Weapons/Magic/NebulousCataclysm.cs +++ b/Items/Weapons/Magic/NebulousCataclysm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 124; Item.damage = 530; Item.DamageType = DamageClass.Magic; - Item.mana = 70; + Item.mana = 120; Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = null; diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 7cdb460325..89b098e73e 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -20,9 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 20; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 15; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; diff --git a/Items/Weapons/Magic/NuclearFury.cs b/Items/Weapons/Magic/NuclearFury.cs index 8dddf82b8d..53f67402a2 100644 --- a/Items/Weapons/Magic/NuclearFury.cs +++ b/Items/Weapons/Magic/NuclearFury.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 40; Item.damage = 108; Item.DamageType = DamageClass.Magic; - Item.mana = 22; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 30; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/Nucleosynthesis.cs b/Items/Weapons/Magic/Nucleosynthesis.cs index 76e953984c..9e1bfad48f 100644 --- a/Items/Weapons/Magic/Nucleosynthesis.cs +++ b/Items/Weapons/Magic/Nucleosynthesis.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 116; Item.damage = 70; Item.DamageType = DamageClass.Magic; - Item.mana = 18; + Item.mana = 30; Item.useTime = 4; Item.useAnimation = 16; Item.reuseDelay = 14; diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index 551aecb37b..fe5f1c9c71 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 80; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 15; Item.useAnimation = Item.useTime = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(10). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). AddTile(). Register(); } diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index ecae376a81..5a87c385ae 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = Item.height = 52; Item.damage = 12; Item.knockBack = 3f; - Item.mana = 10; + Item.mana = 12; Item.useAnimation = Item.useTime = 35; Item.autoReuse = true; Item.DamageType = DamageClass.Magic; diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index 3c3c0b7f3f..bb4bbb35b7 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 60; Item.damage = 190; Item.DamageType = DamageClass.Magic; - Item.mana = 80; + Item.mana = 120; Item.useTime = 3; Item.useAnimation = 45; Item.reuseDelay = 75; diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 1d915a0feb..2bfd0561cf 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 140; Item.damage = 140; Item.DamageType = DamageClass.Magic; - Item.mana = 35; + Item.mana = 40; Item.useTime = 15; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index c1bb33dcf2..d6192eacb9 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 32; Item.damage = 52; Item.DamageType = DamageClass.Magic; - Item.mana = 12; - Item.useTime = 49; - Item.useAnimation = 49; + Item.mana = 30; + Item.useAnimation = Item.useTime = 49; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 7f76b27f3f..883e202d33 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 3825; Item.DamageType = DamageClass.Magic; - Item.mana = 95; + Item.mana = 104; Item.useTime = Item.useAnimation = 72; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index e75ae3fdfe..6745b62828 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 48; Item.damage = 152; Item.DamageType = DamageClass.Magic; - Item.mana = 50; - Item.useTime = 38; - Item.useAnimation = 38; + Item.mana = 14; + Item.useAnimation = Item.useTime = 38; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -34,6 +33,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } + + // Cancels out the mana used to summon the holdout + public override void OnConsumeMana(Player player, int manaConsumed) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.statMana += manaConsumed; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 49abe53755..bb50e67103 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 170; Item.DamageType = DamageClass.Magic; - Item.mana = 25; + Item.mana = 60; Item.crit += 4; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 96af4794a6..171a1c539b 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -18,11 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 54; Item.damage = 60; Item.crit = 20; - Item.mana = 17; + Item.mana = 22; Item.noMelee = true; - Item.useAnimation = 22; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 22; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index f7fa8e662f..3c886885ef 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 52; Item.damage = 117; Item.DamageType = DamageClass.Magic; - Item.mana = 15; + Item.mana = 30; Item.useAnimation = Item.useTime = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SandstreamScepter.cs b/Items/Weapons/Magic/SandstreamScepter.cs index f4cb2ed872..fcd7ce5a95 100644 --- a/Items/Weapons/Magic/SandstreamScepter.cs +++ b/Items/Weapons/Magic/SandstreamScepter.cs @@ -22,9 +22,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 16; Item.DamageType = DamageClass.Magic; - Item.mana = 4; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 7; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 90da4ae001..b2cb6a3820 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 1050; Item.DamageType = DamageClass.Magic; Item.mana = 36; - Item.useTime = 25; - Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.channel = true; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 45cd4e9c0e..7ed607b5d1 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -20,9 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 32; Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 60; - Item.useAnimation = 60; + Item.mana = 30; + Item.useAnimation = Item.useTime = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.75f; diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index 2a9e1ff387..24722773df 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 10; Item.ArmorPenetration = ArmorPenetration; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 35; - Item.useAnimation = 35; + Item.mana = 22; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/ShadecrystalBarrage.cs b/Items/Weapons/Magic/ShadecrystalBarrage.cs index 1858eb3dc1..007414071b 100644 --- a/Items/Weapons/Magic/ShadecrystalBarrage.cs +++ b/Items/Weapons/Magic/ShadecrystalBarrage.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 24; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 40; Item.useTime = 7; Item.useAnimation = 14; Item.reuseDelay = 49; diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 8fc506cf8e..883a3f8033 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = Item.height = 42; Item.damage = 19; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 14; Item.useAnimation = Item.useTime = 34; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index f5639d3e79..d5699749e6 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 56; Item.damage = 285; Item.DamageType = DamageClass.Magic; - Item.mana = 15; + Item.mana = 72; Item.useTime = 8; Item.useAnimation = 24; Item.reuseDelay = 30; diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index cc5d6061da..05e3a9466b 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -20,11 +20,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 74; - Item.damage = 8; + Item.damage = 11; Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 9; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index 64ddf0ec5d..ac30f155d5 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 40; Item.damage = 50; Item.DamageType = DamageClass.Magic; - Item.mana = 11; + Item.mana = 20; Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 674b3ffb97..62f3485b23 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -15,9 +15,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 39; Item.DamageType = DamageClass.Magic; Item.channel = true; - Item.mana = 18; - Item.useTime = 70; - Item.useAnimation = 70; + Item.mana = 40; + Item.useAnimation = Item.useTime = 70; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5; diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index 52b15901ca..93525a8476 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 64; Item.damage = 235; Item.DamageType = DamageClass.Magic; - Item.mana = 19; + Item.mana = 30; Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index c6784b6a12..d01f95d050 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.useAnimation = Item.useTime = 20; Item.shootSpeed = 7f; - Item.mana = 22; + Item.mana = 28; Item.knockBack = 5f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/TheCauldron.cs b/Items/Weapons/Magic/TheCauldron.cs index 065b00b449..7ba64395a2 100644 --- a/Items/Weapons/Magic/TheCauldron.cs +++ b/Items/Weapons/Magic/TheCauldron.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.useTime = Item.useAnimation = 60; Item.knockBack = 8f; - Item.mana = 18; + Item.mana = 30; Item.UseSound = SoundID.DD2_MonkStaffSwing; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs index 9f50835ece..620409269f 100644 --- a/Items/Weapons/Magic/TheDanceofLight.cs +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 515; Item.DamageType = DamageClass.Magic; Item.crit = 20; - Item.mana = 6; + Item.mana = 26; Item.knockBack = 4f; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index 7aec53e0f5..ce8e78ee62 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 102; Item.height = 112; - Item.damage = 166; + Item.damage = 180; Item.knockBack = 4.25f; Item.shootSpeed = 23.5f; Item.DamageType = DamageClass.Magic; Item.noMelee = true; - Item.mana = 12; + Item.mana = 16; Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index 4a02a8674c..66469c5d15 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 40; Item.height = 36; Item.damage = 14; // same as 1.4 Wand of Sparking - Item.mana = 150; + Item.mana = 200; Item.DamageType = DamageClass.Magic; Item.noMelee = true; Item.useAnimation = 19; diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index d948d7f944..0b35898e83 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 68; Item.damage = 120; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 23; - Item.useAnimation = 23; + Item.mana = 27; + Item.useAnimation = Item.useTime = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index 7a665800ad..1b3f482bb5 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 30; Item.damage = 23; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 15; - Item.useAnimation = 15; + Item.mana = 6; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5; diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 79819761d0..1569a747dc 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(ItemID.AquaScepter). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentNebula, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index 0e330fb229..05bffd9f68 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 44; Item.damage = 6666; Item.DamageType = DamageClass.Magic; - Item.mana = 41; + Item.mana = 120; Item.useAnimation = Item.useTime = 43; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index ea4d77de37..266081b80c 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -21,11 +22,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 70; Item.height = 68; - Item.damage = 2800; + Item.damage = 1150; Item.DamageType = DamageClass.Magic; - Item.mana = 40; - Item.useTime = 65; - Item.useAnimation = 65; + Item.mana = 90; + Item.useAnimation = Item.useTime = 65; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index c5095b7d93..6b9d38be46 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 62; Item.height = 62; Item.damage = 50; - Item.mana = 7; + Item.mana = 8; Item.DamageType = DamageClass.Magic; Item.useAnimation = Item.useTime = 15; Item.noMelee = true; diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index a384441b9a..00845c8521 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 62; Item.damage = 2626; //Some kind of... brainstorm Item.DamageType = DamageClass.Magic; - Item.mana = 45; + Item.mana = 60; Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 25647e0b5a..f1d67cd0e7 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 140; Item.height = 140; - Item.damage = 133; + Item.damage = 162; Item.DamageType = DamageClass.Magic; - Item.mana = 42; + Item.mana = 54; Item.useTime = 4; Item.useAnimation = 20; Item.reuseDelay = Item.useAnimation; diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index 8c0e9cfa2a..e929c61010 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 130; Item.damage = 210; Item.DamageType = DamageClass.Magic; - Item.mana = 60; + Item.mana = 70; Item.useAnimation = Item.useTime = 49; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 2f20bd1f80..055cd4f965 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 78; Item.damage = 215; Item.DamageType = DamageClass.Magic; - Item.mana = 32; + Item.mana = 45; Item.useTime = Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Magic/Volterion.cs b/Items/Weapons/Magic/Volterion.cs index 8ce8aee871..e212d83ebb 100644 --- a/Items/Weapons/Magic/Volterion.cs +++ b/Items/Weapons/Magic/Volterion.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 60; Item.damage = 890; Item.DamageType = DamageClass.Magic; - Item.mana = 50; + Item.mana = 90; Item.useAnimation = Item.useTime = 80; // 42 frames of firing animation Item.knockBack = 2f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index b083e19c88..e5e24a1386 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -16,9 +16,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 42; Item.damage = 82; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 15; - Item.useAnimation = 15; + Item.mana = 8; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; diff --git a/Items/Weapons/Magic/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs index 1028f4af5a..adbbc94821 100644 --- a/Items/Weapons/Magic/WulfrumProsthesis.cs +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -32,9 +32,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 42; Item.damage = 18; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 10; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3; diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index 67b618de61..a60e099d50 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -22,9 +22,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 74; Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 23; - Item.useAnimation = 23; + Item.mana = 14; + Item.useAnimation = Item.useTime = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.75f; diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index d2173baeb2..b49a1b5680 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 16; Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 10; + Item.mana = 15; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); 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/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index de1086891f..f09743e25f 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(ItemID.BlueMoon). AddIngredient(8). AddIngredient(3). AddIngredient(16). diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index 3b7300228c..9b8f4af53d 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 128; Item.height = 140; - Item.damage = 1075; + Item.damage = 888; Item.knockBack = 7.5f; Item.useAnimation = Item.useTime = 25; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index 8316a87785..6fa77ead69 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -90,8 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee Particle spark3 = new AltSparkParticle(partPos, partVel, false, 24, partScale, Color.Black); GeneralParticleHandler.SpawnParticle(spark3); Particle spark2 = new SparkParticle(partPos, partVel, false, 24, partScale * 0.6f, Color.LightGreen); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); @@ -104,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/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 9fbcb94c5e..623a1e3b37 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -132,7 +132,10 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.StarWrath). AddIngredient(10). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). + AddIngredient(ItemID.FragmentVortex, 5). + AddIngredient(ItemID.FragmentNebula, 5). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 108b448374..0f9a59b975 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 44; Item.useStyle = ItemUseStyleID.Rapier; Item.damage = 600; - Item.DamageType = DamageClass.Melee; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 8; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index bae656ef03..6014501a47 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -13,11 +13,6 @@ namespace CalamityMod.Items.Weapons.Melee public override int ProjectileType => ModContent.ProjectileType(); - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; - } public override bool SizeModifiers => false; public override void SetDefaults() { 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..34d63e2784 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; } @@ -157,7 +165,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.LunarBar, 7). AddIngredient(). - AddIngredient(5). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 27700e8c12..e1007508fa 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ModContent.RarityType(); } - public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", Main.zenithWorld ? "\n" + this.GetLocalizedValue("GFBFlavor") : ""); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 3152bb7eb5..581bcc23f6 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; @@ -92,33 +91,9 @@ namespace CalamityMod.Items.Weapons.Melee { if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) { - proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); - (proj2.ModProjectile as MirrorBlast).shardShield = 0; - (proj2.ModProjectile as MirrorBlast).shardNum = 11; - proj2.netUpdate = true; - } - } - reflectTimer = 0; - return; - } else - if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle)) - { - if (shardCount > 0) - { - SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center); - } - if (shardCount >= 10) - { - player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30); - } - proj.Calamity().multiplicativeDR += shardCount / 10f; - proj.Calamity().multiplicativeDRTimer = 60; - foreach (var proj2 in Main.projectile) - { - if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) - { - proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); + //Don't amplify Evolution shards + if (proj2.DamageType != DamageClass.Generic) + proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); (proj2.ModProjectile as MirrorBlast).shardShield = 0; (proj2.ModProjectile as MirrorBlast).shardNum = 11; proj2.netUpdate = true; @@ -127,6 +102,35 @@ namespace CalamityMod.Items.Weapons.Melee reflectTimer = 0; return; } + else + if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle)) + { + if (shardCount > 0) + { + SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center); + } + if (shardCount >= 10) + { + player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30); + } + proj.Calamity().multiplicativeDR += shardCount / 10f; + proj.Calamity().multiplicativeDRTimer = 60; + foreach (var proj2 in Main.projectile) + { + if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) + { + //Don't amplify Evolution shards + if (proj2.DamageType != DamageClass.Generic) + proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); + (proj2.ModProjectile as MirrorBlast).shardShield = 0; + (proj2.ModProjectile as MirrorBlast).shardNum = 11; + proj2.netUpdate = true; + } + } + reflectTimer = 0; + return; + } } } reflectTimer--; @@ -149,9 +153,9 @@ namespace CalamityMod.Items.Weapons.Melee hasShard = true; } } - + if (!alreadyReflecting && hasShard) - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy,player.Center); + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy, player.Center); return false; } return base.Shoot(player, source, position, velocity, type, damage, knockback); diff --git a/Items/Weapons/Melee/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index d3673b326a..5afd75b448 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 76; Item.height = 76; - Item.damage = 144; + Item.damage = 100; Item.DamageType = TrueMeleeDamageClass.Instance; Item.crit = 11; Item.useAnimation = Item.useTime = 90; // Yes it's actually supposed to be this slow diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index ac56bb47f4..19639914f2 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 146; Item.damage = 100; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.crit = 45; - Item.useAnimation = 12; + Item.crit = 41; + Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; Item.useTurn = true; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 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/Pandemic.cs b/Items/Weapons/Melee/Pandemic.cs index f6e8d04a94..e5c60d9495 100644 --- a/Items/Weapons/Melee/Pandemic.cs +++ b/Items/Weapons/Melee/Pandemic.cs @@ -11,9 +11,13 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static float Reach = 480f; - public static float Speed = 40f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed); + //Changing these first 3 values requires restarting the game or hijacking some function to do the yoyo's SetStaticDefaults again. + public static float Lifetime => 15; + public static float Reach => 480f; + public static float Speed => 24f; + public static float DamageMultiplier(int count) => 1 + count * 0.2f; + public static float SizeMultiplier(int count) => 0.5f + DamageMultiplier(count) * 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(Reach.ToTiles(), Speed, Lifetime); public override void SetStaticDefaults() { @@ -27,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 32; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 100; + Item.damage = 125; Item.knockBack = 2.5f; Item.useTime = 22; Item.useAnimation = 22; 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/SolsticeClaymore.cs b/Items/Weapons/Melee/SolsticeClaymore.cs index 33deea51ab..8435cf73c5 100644 --- a/Items/Weapons/Melee/SolsticeClaymore.cs +++ b/Items/Weapons/Melee/SolsticeClaymore.cs @@ -78,7 +78,8 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.BeamSword). AddIngredient(20). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/StellarContempt.cs b/Items/Weapons/Melee/StellarContempt.cs index ca015ca064..0dd8609220 100644 --- a/Items/Weapons/Melee/StellarContempt.cs +++ b/Items/Weapons/Melee/StellarContempt.cs @@ -39,7 +39,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). + AddIngredient(2). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Swordsplosion.cs b/Items/Weapons/Melee/Swordsplosion.cs index be38aa1993..5e101a6f57 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -100,6 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.LunarBar, 5). AddIngredient(10). AddIngredient(15). AddTile(TileID.MythrilAnvil). 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/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 25c24004a0..3ade4726b1 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 42; Item.height = 40; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 475; + Item.damage = 400; Item.knockBack = 7.5f; Item.useTime = 20; Item.useAnimation = 20; 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/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index a8ed967b01..2efc46e683 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -70,7 +70,6 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(25). AddIngredient(8). AddIngredient(20). - AddIngredient(5). AddTile(). 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/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 973c243ce8..bb4e8b030a 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.SuperStarCannon). AddIngredient(4). AddIngredient(ItemID.FallenStar, 15). - AddIngredient(3). + AddIngredient(ItemID.FragmentStardust, 5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/ThreadOfEradication.cs b/Items/Weapons/Ranged/ThreadOfEradication.cs index cde4b30f11..fb9c7c7ffc 100644 --- a/Items/Weapons/Ranged/ThreadOfEradication.cs +++ b/Items/Weapons/Ranged/ThreadOfEradication.cs @@ -18,10 +18,6 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { - CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; - } public override void SetDefaults() { Item.width = 40; diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index 68c8965605..036b76098e 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 14; Item.height = 38; - Item.damage = 56; + Item.damage = 49; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 10; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/DimensionTearingDisk.cs b/Items/Weapons/Rogue/DimensionTearingDisk.cs index 762b079e8d..1545a49316 100644 --- a/Items/Weapons/Rogue/DimensionTearingDisk.cs +++ b/Items/Weapons/Rogue/DimensionTearingDisk.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.width = 62; Item.height = 58; Item.DamageType = RogueDamageClass.Instance; - Item.useTime = Item.useAnimation = 24; + Item.useTime = Item.useAnimation = 27; Item.knockBack = 7f; - Item.damage = 980; + Item.damage = 725; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; } + public override float StealthDamageMultiplier => 1.3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index 612a1f66f7..772267450b 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 20; Item.height = 24; - Item.damage = 65; + Item.damage = 85; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 28; @@ -25,38 +25,21 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; + Item.channel = true; } - - public override float StealthDamageMultiplier => 0.6f; - - public static int CloudLifetime = 200; - public static float DustRadius = 11f; - - //Cloud hitbox size manipulation - public static float MaxSize = 3.2f; - public static float MaxSizeStealth = 3.6f; - public static float GrowthRate = 0.025f; - public static float StealthGrowthRate = 0.035f; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void HoldItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SandstorminaBottle). + AddIngredient(). AddIngredient(ItemID.AncientCloth,5). AddIngredient(). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index e625e2d5b1..cceb7bbd87 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 30; Item.height = 34; - Item.damage = 2850; + Item.damage = 2000; Item.DamageType = RogueDamageClass.Instance; Item.useTime = 42; Item.useAnimation = 42; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 17f; } - public static float StealthDmgMult = 0.3f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers + public static float StealthDmgMult = 0.25f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers public override float StealthDamageMultiplier => StealthDmgMult; public override float StealthVelocityMultiplier => 0.8f; diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 073d54b200..3e6437c8e5 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,60 +1,837 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; 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; +using Terraria.UI.Chat; +#region Item namespace CalamityMod.Items.Weapons.Rogue { public class EclipsesFall : RogueWeapon { + /// + /// Base damage of the spear, dynamically updated to match rogue stats. + /// This is reduced if the spear has less fragments than MaxFragmentCount + /// + public static int EclipseSpearBaseDmg => 1250; + /// + /// How much damage fragments and sparks should do + /// + public static float FragmentDmgMult => 0.33f; + /// + /// How many fragments are spawned per spear hit + /// + public static int FragmentCount => 2; + /// + /// How many fragments can exist before they start homing in. + /// Also the required amount of fragments for 100% base dmg on Eclipse Spear + /// + public static int MaxFragmentCount => 20; + public override void SetDefaults() { Item.width = 82; Item.height = 88; - Item.damage = 500; + Item.damage = 1000; Item.knockBack = 3.5f; Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; Item.DamageType = RogueDamageClass.Instance; - Item.shootSpeed = 15f; - Item.shoot = ModContent.ProjectileType(); - + Item.shootSpeed = 32f; + Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) - type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request(Texture + "Glow").Value); public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(8). - AddIngredient(8). - AddIngredient(12). + AddIngredient(5). + AddIngredient(15). AddTile(). Register(); } } } +#endregion + +namespace CalamityMod.Projectiles.Rogue +{ + #region Main Javelin + public class EclipsesFall_Javelin : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; + private int SplitProjDamage => (int)(Projectile.damage * EclipsesFall.FragmentDmgMult); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 50; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.MaxUpdates = 2; + Projectile.penetrate = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; + Projectile.timeLeft = 150 * Projectile.MaxUpdates; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Main.rand.NextBool(5)) + { + Vector2 trailPos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-16f, 16f); + float trailScale = Main.rand.NextFloat(0.8f, 1.2f); + Color trailColor = Main.rand.NextBool() ? Color.Indigo : Color.DarkOrange; + Particle eclipseTrail = new SparkParticle(trailPos, Projectile.velocity * 0.2f, false, 60, trailScale, trailColor); + GeneralParticleHandler.SpawnParticle(eclipseTrail); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int onHitCount = EclipsesFall.FragmentCount + 4; + float spread = 20f; + int projectileDamage = SplitProjDamage; + float kb = 5f; + int sparkID = ModContent.ProjectileType(); + int starID = ModContent.ProjectileType(); + for (int i = 0; i < onHitCount; i++) + { + int projID = i < EclipsesFall.FragmentCount ? starID : sparkID; + Vector2 velocity = Projectile.oldVelocity.RotateRandom(MathHelper.ToRadians(spread)) * 0.5f; + float speed = Main.rand.NextFloat(1.5f, 2f); + float moveDuration = Main.rand.Next(5, 15); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * speed, projID, projectileDamage, kb, Projectile.owner, 0f, moveDuration, 20); + } + + SoundEngine.PlaySound(SoundID.Item62 with { Volume = SoundID.Item62.Volume * 0.6f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item68 with { Volume = SoundID.Item68.Volume * 0.2f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item122 with { Volume = SoundID.Item122.Volume * 0.4f }, Projectile.position); + + + List frags = new(); + var p = -2; + foreach (var item in Main.ActiveProjectiles) + { + + if (item.type == ModContent.ProjectileType() && item.owner == Projectile.owner && item.Opacity > 0.1f) + { + if (Projectile.Calamity().stealthStrike && item.timeLeft > 600 * item.MaxUpdates) + { + if (item.timeLeft < 1120 * item.MaxUpdates) + { + item.timeLeft = 60 * item.MaxUpdates; + item.ai[0] = target.whoAmI; + continue; + } + item.timeLeft = 1200 * item.MaxUpdates; + p = item.whoAmI; + } + item.ai[0] = target.whoAmI; + } + if (item.type == ModContent.ProjectileType() && item.owner == Projectile.owner && item.ai[0] > -2) + { + frags.Add(item); + } + } + if (Projectile.Calamity().stealthStrike && p < 0) + for (int i = 0; i < 1; i++) + { + int projID = ModContent.ProjectileType(); + Vector2 velocity = Vector2.Zero; + var proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.SafeNormalize(default) * 64f, projID, Projectile.damage, kb, Projectile.owner, target.whoAmI, 0, Math.Min(20, frags.Count(x => x.ai[0] == 0))); + proj.rotation = Projectile.rotation; + p = proj.whoAmI; + } + + + frags = frags.OrderBy(x => x.timeLeft).ToList(); + int toRemove = frags.Count(x => x.ai[0] == 0) - EclipsesFall.MaxFragmentCount; + foreach (var item in frags) + { + if (toRemove > 0 && item.ai[0] == 0) + { + item.ai[0] = -2; + item.timeLeft = EclipsesFall_LightFragment.lifetime; + toRemove--; + continue; + } + if (Projectile.Calamity().stealthStrike) + { + if (item.ai[0] == 0) + { + item.ai[1] = Main.rand.Next(5, 15); + item.ai[2] = 20; + } + item.ai[0] = p + 1; + item.timeLeft = EclipsesFall_LightFragment.lifetime; + item.damage = 0; + item.netUpdate = true; + } + } + + + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D glow = ModContent.Request(Texture + "Glow").Value; + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + #endregion + + #region Stealth Projectiles + + [PierceResistException] + public class EclipsesFall_StealthSpear : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + bool initialized = false; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + (Vector2 start, Vector2 end) LinePos = (new(), new()); + float LineWidth = 0; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 48; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.MaxUpdates = 1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 1; + Projectile.timeLeft = 1200 * Projectile.MaxUpdates; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void AI() + { + if (!initialized) + { + Projectile.ai[0] = -1; + Projectile.localAI[0] = Projectile.ai[2]; + Projectile.ai[2] = 0; + initialized = true; + } + + Projectile.originalDamage = (int)(EclipsesFall.EclipseSpearBaseDmg * (Projectile.ai[2] / (float)EclipsesFall.MaxFragmentCount)); + if (Projectile.ai[0] >= 0 && Projectile.ai[2] >= Projectile.localAI[0] && Projectile.Opacity > 0) + { + LinePos.end = Projectile.position; + Projectile.velocity = Projectile.DirectionTo(Main.npc[(int)Projectile.ai[0]].Center) * 64; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center + Projectile.velocity; + Projectile.Damage(); + Projectile.ai[0] = -1; + LineWidth = 1f; + LinePos.start = Projectile.Center; + Projectile.localAI[1] = 0; + } + + + LineWidth -= 0.05f; + Projectile.localAI[1]++; + if (Projectile.localAI[1] > 60) + { + var dis = Projectile.Distance(Main.player[Projectile.owner].Center); + Projectile.velocity += Projectile.DirectionTo(Main.player[Projectile.owner].Center) * dis / 320f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + + } + Projectile.velocity *= 0.9f; + } + public override bool PreDraw(ref Color lightColor) + { + + if (LineWidth > 0) + { + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + + using (Main.spriteBatch.Scope()) + { + using (lease.Scope(clearColor: Color.Transparent)) + { + + List posList = []; + //For the prim to render properly I need to divide the distance between the positions into a couple points. Just using start and end doesn't render. + for (var i = 0; i <= 2; i++) + { + posList.Add(Vector2.Lerp(Projectile.position, LinePos.end, i / 2f)); + } + var pos = posList.ToArray(); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(pos, new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), pos.Length); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + PrimitiveRenderer.RenderTrail(pos, new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), pos.Length); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + } + } + var tex = TextureAssets.Item[ModContent.ItemType()]; + if (Projectile.Opacity > 0.5f) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, 0); + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(default, BlendState.NonPremultiplied, null, null, null, null, Main.Transform); + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White * Projectile.Opacity * (Projectile.localAI[0] > 0 ? Projectile.ai[2] / Projectile.localAI[0] : 1), Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + Main.spriteBatch.End(); + } + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.oldPosition + new Vector2(Projectile.width, Projectile.height) * 0.5f, Projectile.Center, 48f, ref _)) + { + return true; + } + + return base.Colliding(projHitbox, targetHitbox); + } + + public override bool? CanHitNPC(NPC target) + { + if (Projectile.ai[0] < 0) + return false; + return null; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + //Half damage to any NPC that isn't the primary target + if (Projectile.ai[0] != target.whoAmI) + modifiers.SourceDamage *= 0.5f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + + if (Projectile.timeLeft < 600 * Projectile.MaxUpdates && Projectile.ai[0] == target.whoAmI) + { + Projectile.Opacity = 0; + Projectile.Center = target.Center; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; + Projectile.velocity = new(0, 1E-05f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + } + Projectile.netUpdate = true; + if (Projectile.ai[0] == target.whoAmI) + SoundEngine.PlaySound(SarosPossession.FiringSound with { Pitch = -1f, Volume = 0.75f, }, Projectile.Center); + } + + public override void OnKill(int timeLeft) + { + if (Projectile.Opacity > 0) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + return; + } + + public float FireWidthFunction(float completion, Vector2 vertexPos) + { + return 96 * LineWidth * MathHelper.Clamp((Projectile.ai[2] / 20f), 0.25f, 1f); + } + + public Color FireColorFunction(float completion, Vector2 vertexPos) + { + Color mainColor = Color.Lerp(new Color(238, 226, 153), new Color(255, 191, 73), (MathF.Sin(completion * MathHelper.TwoPi + Main.GlobalTimeWrappedHourly * 5) + 1) * 0.5f); + return mainColor * MathF.Pow(1 - completion * 1.1f, 0.5f); + } + + public float FireCoreWidthFunction(float completion, Vector2 vertexPos) + { + return 32 * LineWidth * MathHelper.Clamp((Projectile.ai[2] / 20f), 0.25f, 1f); + } + + public Color FireCoreColorFunction(float completion, Vector2 vertexPos) + { + return Color.Black * MathF.Pow(1 - completion * 1.1f, 0.5f); + } + } + public class EclipsesFall_StealthSpearExplosion : ModProjectile, IAdditiveDrawer, ILocalizedModType + { + //Based on Terratomere explosion + public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 520; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.scale = 0.2f; + Projectile.hide = true; + } + + public override void AI() + { + // Play an explosion sound on the first frame of this projectile's existence. + if (Projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SubsumingVortex.ExplosionSound with { Volume = 0.6f }, Projectile.Center); + Projectile.localAI[0] = 1f; + } + + // Emit a strong white light. + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.5f); + + // Determine frames. Once the maximum frame is reached the projectile dies. + Projectile.frameCounter++; + if (Projectile.frameCounter % 5 == 4) + Projectile.frame++; + if (Projectile.frame >= 17) + Projectile.Kill(); + + // Exponentially accelerate. + Projectile.scale *= 1.013f; + Projectile.Opacity = Utils.GetLerpValue(5f, 36f, Projectile.timeLeft, true); + } + + public override bool PreDraw(ref Color lightColor) + { + return base.PreDraw(ref lightColor); + } + + public void AdditiveDraw(SpriteBatch spriteBatch) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Texture2D lightTexture = ModContent.Request("CalamityMod/Skies/XerocLight").Value; + Rectangle frame = texture.Frame(3, 6, Projectile.frame / 6, Projectile.frame % 6); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = frame.Size() * 0.5f; + + for (int i = 0; i < 2; i++) + { + Vector2 lightDrawPosition = drawPosition + (MathHelper.TwoPi * i / 36f + Main.GlobalTimeWrappedHourly * 5f).ToRotationVector2() * Projectile.scale * 12f; + Color lightBurstColor = CalamityUtils.MulticolorLerp(Projectile.timeLeft / 144f, Terratomere.TerraColor1, Terratomere.TerraColor2); + lightBurstColor = Color.Lerp(lightBurstColor, Color.White, 0.4f) * Projectile.Opacity * 0.24f; + Main.spriteBatch.Draw(lightTexture, lightDrawPosition, null, lightBurstColor, 0f, lightTexture.Size() * 0.5f, Projectile.scale * 1.32f, SpriteEffects.None, 0); + } + if (Projectile.timeLeft < 149) + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(default, BlendState.NonPremultiplied, null, null, null, null, Main.Transform); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, 1.6f, 0); + Main.spriteBatch.End(); + } + } + } + #endregion + + #region Shatter Projectiles + public class EclipsesFall_LightFragment : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public static int lifetime => 1200; + Color? color = null; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 32; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = lifetime; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.MaxUpdates = 2; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.rotation += Projectile.direction * 0.02f; + if (Projectile.ai[0] < -1) + { + Projectile.penetrate = 1; + Projectile.damage = Projectile.originalDamage; + Projectile.stopsDealingDamageAfterPenetrateHits = false; + var target = Projectile.FindTargetWithinRange(4000); + if (target is not null) + { + Projectile.velocity += Projectile.DirectionTo(target.Center) * 2; + Projectile.velocity *= 0.95f; + } + } + + if (Projectile.ai[0] == 0f || Projectile.ai[2] > 0) + { + if (Projectile.timeLeft < (lifetime - Projectile.ai[1]) && Projectile.ai[2] >= 0) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + Projectile.velocity *= Projectile.ai[2]; + Projectile.ai[2]--; + } + } + else + { + if (Main.projectile.IndexInRange((int)Projectile.ai[0] - 1) && Main.projectile[(int)Projectile.ai[0] - 1].active) + { + var proj = Main.projectile[(int)Projectile.ai[0] - 1]; + if (Projectile.timeLeft > 100) + Projectile.timeLeft = 100; + Projectile.Center = Vector2.Lerp(Projectile.Center, proj.Center, (1 - (Projectile.timeLeft / 100f))); + Projectile.velocity = new(0, 1E-05f); + if (Projectile.Distance(proj.Center) < 16) + { + proj.ai[2]++; + proj.netUpdate = true; + if (proj.ai[2] == proj.localAI[0]) + SoundEngine.PlaySound(SarosPossession.SpawnSound with { Pitch = 1f, Volume = 1f, }, Projectile.Center); + Projectile.active = false; + + } + } + } + } + public override bool? CanHitNPC(NPC target) + { + if (Projectile.ai[0] < -1 && target.Calamity().IsArmored()) + return false; + return null; + } + + public override void OnKill(int timeLeft) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + using (lease.Scope(clearColor: Color.Transparent)) + { + var list = Projectile.oldPos.Take(16).ToArray(); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list, new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list, new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + } + float dis = Projectile.position.Distance(Projectile.oldPos.Last()) / 32; + if (dis > 1) + { + dis = 1f; + } + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White * dis, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); + + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(default, BlendState.NonPremultiplied, null, null, null, null, Main.Transform); + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + Main.spriteBatch.End(); + } + return false; + } + + // Matches Saros Possesion sunfire with slight edits + public float FireWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = 24f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireColorFunction(float completion, Vector2 vertexPos) + { + Color mainColor = new Color(238, 226, 153); + return Color.Lerp(mainColor, Color.Transparent, completion); + } + + public float FireCoreWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = Projectile.scale * 16; + float curveRatio = 0.25f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireCoreColorFunction(float completion, Vector2 vertexPos) + { + Color mainColor = new Color(255, 191, 73); + return mainColor; + } + } + public class EclipsesFall_LightExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + public const int Lifetime = 35; // 7 animation frames, 12 FPS + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 7; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 102; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5; + + if (Projectile.frameCounter > Lifetime) + Projectile.Kill(); + } + + public override void PostDraw(Color lightColor) + { + Texture2D glow = ModContent.Request(Texture + "Glow").Value; + Rectangle frame = glow.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + public class EclipsesFall_LightSpark : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static int lifetime = 150; + Color? color = null; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 32; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 3; + Projectile.timeLeft = lifetime; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localAI[0] = 20f; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.MaxUpdates = 2; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.rotation += Projectile.direction * Projectile.ai[0]; + + if (Projectile.timeLeft < (lifetime - Projectile.ai[1]) && Projectile.localAI[0] >= 0) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= Projectile.localAI[0]; + Projectile.localAI[0]--; + Projectile.timeLeft++; + } + + if (Projectile.localAI[0] == 0) + { + Projectile.velocity = new(0, 1E-05f); + Projectile.damage = 0; + float dis = Projectile.position.Distance(Projectile.oldPos.Take(16).Last()); + if (dis < 0.1f) + Projectile.Kill(); + } + } + + public override bool PreDraw(ref Color lightColor) + { + color ??= Color.Lerp(Color.OrangeRed, new Color(255, 191, 73), Main.rand.NextFloat(0.25f, 0.5f)); + + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var lease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + using (lease.Scope(clearColor: Color.Transparent)) + { + var list = Projectile.oldPos.Take(16); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireCoreWidthFunction, FireCoreColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), 32); + } + float dis = Projectile.position.Distance(Projectile.oldPos.Take(16).Last()) / 128f - 0.1f; + if (dis > 1) + { + dis = 1f; + } + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White * dis, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + + Main.spriteBatch.Begin(ss); + + return false; + } + + public float FireWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = 24f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireColorFunction(float completion, Vector2 vertexPos) + { + Color mainColor = new Color(255, 191, 73); + return Color.Lerp(mainColor, Color.Transparent, completion); + } + + public float FireCoreWidthFunction(float completion, Vector2 vertexPos) + { + float width; + float maxBodyWidth = Projectile.scale * 16; + float curveRatio = 0.25f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + + if (completion < curveRatio) + width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireCoreColorFunction(float completion, Vector2 vertexPos) + { + Color mainColor = color.Value; + return mainColor; + } + } + #endregion +} diff --git a/Items/Weapons/Rogue/ElephantKiller.cs b/Items/Weapons/Rogue/ElephantKiller.cs new file mode 100644 index 0000000000..efb7d64b46 --- /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 = 120; + 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/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index e67b1ec4cc..cbdba9dccb 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; - Item.damage = 25; - Item.useAnimation = Item.useTime = 20; + Item.damage = 22; + Item.useAnimation = Item.useTime = 30; Item.knockBack = 2f; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Swing; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } - public override float StealthDamageMultiplier => 0.7f; + public override float StealthDamageMultiplier => 0.6f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index 2f6b9a5492..d4ed994172 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 32; - Item.damage = 22; + Item.damage = 19; Item.DamageType = RogueDamageClass.Instance; Item.crit = 6; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = 22; + Item.useAnimation = 22; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3; Item.value = Item.buyPrice(gold: 10); // Sold by Bandit @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override float StealthVelocityMultiplier => 1.3f; - public override float StealthDamageMultiplier => 0.6f; + public override float StealthDamageMultiplier => 0.4f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { var p = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, -1f); diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 0beafe26c6..8a6c367c30 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 66; - Item.damage = 45; - Item.crit = 7; + Item.damage = 35; + Item.crit = 3; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 12; + Item.useAnimation = 17; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; + Item.useTime = 17; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index fdbb110ebd..7a08a73b3c 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 12; Item.DamageType = RogueDamageClass.Instance; Item.crit = 16; - Item.knockBack = 12; + Item.knockBack = 9; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; diff --git a/Items/Weapons/Rogue/LemonNade.cs b/Items/Weapons/Rogue/LemonNade.cs new file mode 100644 index 0000000000..478b7623da --- /dev/null +++ b/Items/Weapons/Rogue/LemonNade.cs @@ -0,0 +1,45 @@ +using CalamityMod.Projectiles.Rogue; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class LemonNade : RogueWeapon + { + public override void SetDefaults() + { + Item.width = 26; + Item.height = 30; + Item.damage = 33; + Item.DamageType = RogueDamageClass.Instance; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.shootSpeed = 13f; + Item.shoot = ModContent.ProjectileType(); + } + + public override void HoldItem(Player player) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Lemon). + AddIngredient(ItemID.BouncyGrenade, 99). + AddTile(TileID.TinkerersWorkbench). + Register(); + } + } +} diff --git a/Items/Weapons/Rogue/LemonNade.png b/Items/Weapons/Rogue/LemonNade.png new file mode 100644 index 0000000000..7116727e0f Binary files /dev/null and b/Items/Weapons/Rogue/LemonNade.png differ diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 73a34dda76..bf62e3515b 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 40; Item.height = 40; - Item.damage = 45; + Item.damage = 33; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 26; diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 5c21deb49e..7b108c5096 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,5 +1,4 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -7,6 +6,7 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Weapons.Rogue public class MoltenAmputator : RogueWeapon { public float speed = 16; + + public static int FlurryCount => 30; public override void SetDefaults() { Item.width = 92; @@ -36,9 +38,9 @@ namespace CalamityMod.Items.Weapons.Rogue player.Calamity().mouseWorldListener = true; if (player.Calamity().mouseRight) { - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && player.Calamity().focusFlurryAttackCount < FlurryCount) { - player.Calamity().focusFlurryAttackCount = 30; + player.Calamity().focusFlurryAttackCount = FlurryCount; player.Calamity().ConsumeStealthByAttacking(); SoundStyle buff = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay"); SoundEngine.PlaySound(buff with { Volume = 1f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, player.Center); @@ -72,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { bool fastToss = player.Calamity().focusFlurryAttackCount > 0; - + SoundStyle fire = new("CalamityMod/Sounds/Item/SpearofDestiny"); SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = (player.Calamity().focusFlurryAttackCount > 0 ? -0.4f + (player.Calamity().focusFlurryAttackCount * 0.02f) : Main.rand.NextFloat(-0.4f, -0.65f)) }, position); // Since the positioning of the scythe is important, its velocity is based on your mouse position @@ -87,8 +89,10 @@ namespace CalamityMod.Items.Weapons.Rogue player.Calamity().focusFlurryAttackCount--; } player.Calamity().ConsumeStealthByAttacking(); - + return false; } + + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlurryCount); } } diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index b7be65a638..2b52df3964 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -12,12 +12,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 12; Item.height = 40; - Item.damage = 80; + Item.damage = 66; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 10; + Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 10; Item.knockBack = 1.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index d05f728ce9..bb276e95a3 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 54; Item.height = 54; - Item.damage = 118; + Item.damage = 81; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 24; @@ -27,11 +27,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.9f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + float aiVal = player.Calamity().StealthStrikeAvailable() ? -12f : 0f; + int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, ai1: aiVal); if (javelin.WithinBounds(Main.maxProjectiles)) Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 5814d9db9d..ae93270b57 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -11,19 +11,21 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ProfanedPartisan : RogueWeapon { + public static int SpearBaseDamage => 125; + public static int StarBaseDamage => 80; public override void SetDefaults() { Item.width = 68; Item.height = 68; - Item.damage = 222; + Item.damage = 300; Item.crit = 15; Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 18; - Item.useAnimation = 18; + Item.useTime = 21; + Item.useAnimation = 21; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); 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/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 1aa1b4dd1f..74846f81a0 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -13,38 +14,31 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.width = Item.height = 34; - Item.damage = 260; - Item.knockBack = 5f; - Item.useAnimation = Item.useTime = 25; - Item.useStyle = ItemUseStyleID.Swing; + Item.width = 32; + Item.height = 32; + Item.damage = 425; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; - - Item.noMelee = Item.noUseGraphic = true; - Item.UseSound = SoundID.Item106; - + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 3; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.shootSpeed = 13f; + Item.shoot = ModContent.ProjectileType(); Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 0.75f; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void HoldItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index c55b583ae2..2bc2ac984a 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Weapons.Rogue public class Seraphim : RogueWeapon { public const int SplitDaggerCount = 6; - public const int StealthStrikeLightCount = 7; + public const int StealthStrikeLightCount = 8; public override void SetDefaults() { Item.width = 82; Item.height = 82; - Item.damage = 320; + Item.damage = 280; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 13; 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/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index 519c1c8cb2..bad85a5962 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -9,11 +9,15 @@ namespace CalamityMod.Items.Weapons.Rogue { public class SpearofPaleolith : RogueWeapon { + public static int ShardBaseDamage => 40; + + public static int NormalShardCount => 3; + public static int ImpaledShardCount => 5; public override void SetDefaults() { Item.width = 54; Item.height = 54; - Item.damage = 65; + Item.damage = 90; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 27; @@ -25,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 35f; + Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; } 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/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 81900bf511..03fd321fe6 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -14,14 +14,20 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Supernova : RogueWeapon { + public static float StealthTimeInSeconds => 2f; public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.9f }; public static readonly SoundStyle StealthExplosionSound = new("CalamityMod/Sounds/Item/SupernovaStealthExplode") { Volume = 1f }; public static readonly SoundStyle StealthChargeSound = new("CalamityMod/Sounds/Item/SupernovaStealthCharge") { Volume = 1f }; + + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } public override void SetDefaults() { Item.width = 106; Item.height = 112; - Item.damage = 5036; + Item.damage = 5200; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 70; @@ -31,26 +37,21 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); + Item.channel = true; } - public override float StealthDamageMultiplier => 0.7f; + public override bool AltFunctionUse(Player player) => true; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override float StealthDamageMultiplier => 0.8f; + + public override void HoldItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - else - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - return false; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index 309102e5a2..dee0622c01 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -66,6 +66,11 @@ namespace CalamityMod.Items.Weapons.Summon EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this); } + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 3; + } + public override void SetDefaults() { Item.width = Item.height = 36; diff --git a/Items/Weapons/Summon/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index 56b6601cad..da08793d07 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { summonTag.TagItem = Type; - CalamityBuffSets.SummonTagDebuff.Add(BuffType(), summonTag); } public override void SetDefaults() diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index b70e451dc8..992fcc965a 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 28; Item.height = 20; Item.mana = 10; - Item.damage = 8; + Item.damage = 7; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index d1d6cfef1f..85e6139d53 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -5,9 +5,11 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -73,5 +75,29 @@ namespace CalamityMod.Items.Weapons.Summon AddTile(). Register(); } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + int currentCooldown = Main.LocalPlayer.Calamity().sarosEclipseBeamUsage; + float fill = 1 - currentCooldown / 300f; + + if (fill >= 1) + return; + + + var barBG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; + + float barScale = 1/(32f/TextureAssets.Item[Type].Width()) * 0.9f; + + Vector2 barOrigin = barBG.Size() * 0.5f; + float yOffset = 0f; + Vector2 drawPos = position + new Vector2(0, (float)TextureAssets.Item[Type].Height() * 0.5f) * scale; + Rectangle frameCrop = new Rectangle(0, 0, (int)((fill) * barFG.Width), barFG.Height); + Color colorBG = Color.Black; + Color colorFG = Color.Lerp(Color.OrangeRed, new Color(238, 226, 153), fill); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, barOrigin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG, 0f, barOrigin, scale * barScale, 0f, 0f); + } } } diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 9d5ac24f1d..0bc84b41ec 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -58,8 +58,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SandstoneBrick, 20). - AddIngredient(2). + AddIngredient(ItemID.Amber, 5). + AddIngredient(ItemID.AntlionMandible, 3). + AddIngredient(ItemID.PalmWood, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index e71c91306d..433e5068c8 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Weapons.Summon { ItemID.Sets.StaffMinionSlotsRequired[Type] = 4f; summonTag.TagItem = Type; - CalamityBuffSets.SummonTagDebuff.Add(ModContent.BuffType(), summonTag); } public override void SetDefaults() 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 db28331712..d4dc4bfd67 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -154,14 +154,15 @@ Archmage: One of the world's foremost experts on magical theory, he is renowned Bandit: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. BrimstoneWitch: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. +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..6c163a44d0 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 @@ -398,6 +403,22 @@ WeakBrimstoneFlames: { Description: Using the Supreme Witch's power causes you to suffer, but makes your weapons strong } +WindChilled: { + DisplayName: Wind Chilled + Description: Should have worn a coat + ItemTooltipPlayer: + ''' + Cold - 2 DPS + Reduced movement speed + ''' + ItemTooltipEnemy: + ''' + Cold - 6 DPS + 1.5x damage if the enemy is inflicted with a Water debuff + Enhances Water debuff damage + ''' +} + // Mounts AndromedaBuff: { @@ -737,6 +758,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 @@ -1199,7 +1225,7 @@ WhisperingDeath: { DisplayName: Whispering Death Description: Death approaches; attack power and life regen reduced ItemTooltipPlayer: Negates life regen, reduces damage - ItemTooltipEnemy: Reduced contact damage + ItemTooltipEnemy: Reduced damage } WitherDebuff: { @@ -1574,9 +1600,9 @@ PuffWarriorBuff: { Description: It confidently and excitedly protects you } -RareSandElemental: { - DisplayName: Rare Sand Elemental - Description: The Sand Elemental will heal you +OasisElementalBuff: { + DisplayName: Oasis Elemental + Description: The Oasis Elemental will heal you } ResurrectionButterflyBuff: { @@ -1758,6 +1784,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 d5741ccba2..5b519b68ec 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -247,12 +247,12 @@ AsgardsValor: { ''' } -AuricSoulArtifact: { - DisplayName: Auric Soul Artifact +FadedIdolatry: { + DisplayName: Faded Idolatry Tooltip: ''' - For each Fiery Draconid you have summoned, you gain 1 minion slot - Loyalty + Summoned [i:CalamityMod/YharonsKindleStaff] Fiery Draconids cost one less minion slot + [c/ffe100:'Once everything has crumbled to dust, what will be left of the world you created?'] ''' } @@ -350,7 +350,7 @@ BloomStone: { Tooltip: ''' Healing Potions are 50% more effective, but provide their healing over time - Grappling hooks retract and pull the player 50% faster, and grow a flower at hookpoints + Grappling hooks retract and pull the player 30 mph faster, and grow a flower at hookpoints Touching a flower makes it burst into pollen which gives a temporary boost to potion healing over time Potion healing slows drastically when at full health 'One of the ancient relics' @@ -588,12 +588,12 @@ DiamondOfTheDeep: { ''' } -DimensionalSoulArtifact: { - DisplayName: Dimensional Soul Artifact +CrushingEgo: { + DisplayName: Crushing Ego Tooltip: ''' - Multiplies all damage by 1.2x, but at the cost of taking 15% increased damage - Power + Multiplies all damage by 1.3x, but at the cost of taking 20% increased damage + [c/ff00ff:'Don the mask of arrogance, and dance by your lonesome. Once the ball has gone quiet, you'll be the last man standing.'] ''' } @@ -658,13 +658,17 @@ EclipseMirror: { FlavorTooltip: "'Its reflection shows naught but darkness'" } -EldritchSoulArtifact: { - DisplayName: Eldritch Soul Artifact +FragmentsOfAnotherWorld: { + DisplayName: Fragments of Another World Tooltip: ''' - Boosts melee speed by 10%, ranged velocity by 25%, rogue stealth regen by 15%, max minions by 1 and reduces mana cost by 25% Grants immunity to [cbuffplr:CalamityMod/WhisperingDeath] - Knowledge + {0}% increased melee speed + {1}x specialist ranged damage + {2}% reduced mana usage + +{3} maximum sentries + {4}% increased rogue attack speed + [c/ff0000:'Don't speak of your desires to the shadows, they listen.'] ''' } @@ -729,8 +733,8 @@ EtherealTalisman: { DisplayName: Ethereal Talisman Tooltip: ''' - 15% increased magic damage, 5% increased magic critical strike chance - +150 max mana and 10% decreased mana usage + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} Increases pickup range for mana stars You automatically use mana potions when needed [c/aaaaaa:Shift- in your inventory to toggle] [i:ManaFlower] [c/aaaaaa:Mana Flower's effect] @@ -774,6 +778,30 @@ FilthyGlove: { Tooltip: Stealth strikes have +8 armor penetration and deal 8% more damage } +FishStocks: { + DisplayName: Fish Stocks + Tooltip: + ''' + Pulls up a view of the fish stocks + Provides stats that are multiplied by the state of fish stocks + When unequipped, the effects will only be disabled once stocks are even or higher + ''' + HoldShiftTooltip: + ''' + Stats include: + +10 defense + +15% damage + +10% critical strike chance + +15% critical strike damage + +10% damage reduction + +3HP/s life regeneration + +25% mining speed + +50 fishing power + +0.55 luck + 1.5x coin drops + ''' +} + FlameLickedShell: { DisplayName: Flame-Licked Shell Tooltip: @@ -792,7 +820,7 @@ FleshTotem: { Tooltip: ''' 5% increased magic critical strike chance - +30 max mana + +20 max mana Summons an effigy above your head that stores mana as you use it, up to 600 mana The effigy occasionally pulses, restoring 25 mana Pulses appear more frequently the more mana is stored @@ -1028,12 +1056,16 @@ IVDripOnTheRocks: { DisplayName: IV Drip on the Rocks Tooltip: ''' - Multiplies most non-weapon, non-debuff damage by {0}x - Multiplies all weapon damage by {1}x - Counts as an alcohol stack toward Alcohol Poisoning + [EFFECT] + [NAME] + Inserted alcohols contribute toward alcohol poisoning {$Common.AlcoholWarning} + [c/aaaaaa:Shift- this item in your inventory to empty its contents] [ceffect/drunk:'(drunken mumbling)'] ''' + Empty: Place an alcoholic beverage on this item in your inventory to pour its contents in + CurrentAlcoholText: Filled with + SakeAndAleText: Increases melee weapon scale by 25%, but decreases melee speed by 10% } JellyChargedBattery: { @@ -1063,7 +1095,7 @@ LeviathanAmbergris: { DisplayName: Leviathan Ambergris Tooltip: ''' - 120% increased initial dash velocity, 33% faster dash cooldown, and greatly increased dash deceleration + 100% increased initial dash velocity, 33% faster dash cooldown, and greatly increased dash deceleration Your dashes are empowered by water, knocking back and damaging enemies with vicious currents that inflict [cbuff:CalamityMod/RiptideDebuff] Visual effects are reduced if visibility is disabled ''' @@ -1098,12 +1130,12 @@ ManaPolarizer: { DisplayName: Mana Polarizer Tooltip: ''' - Increases max mana by 50 + Increases max mana by 40 Provides life regeneration and magic damage that scales based on how much mana you have Lower mana means more life regeneration, but less magic damage These scale from -2 to +2 HP/s, and 15% to 5% damage The provided regeneration is halved when under Mana Sickness - Magic projectiles steal enemy life while holding a magic weapon + Magic projectiles steal enemy life ''' } @@ -1130,7 +1162,7 @@ MoonstoneCrown: { DisplayName: Moonstone Crown Tooltip: ''' - +70 max mana + +40 max mana Summons a [c/27F5E0:Lunar Sigil] every 2 seconds, up to a maximum of 10 Each [c/27F5E0:Lunar Sigil] increases magic damage by 2% and reduces mana cost by 1% With 5 sigils, increases mana regeneration by +5 MP/s @@ -1151,9 +1183,9 @@ Nanotech: { ''' Rogue projectiles create nanoblades as they travel Stealth strikes summon nanobeams and sparks on enemy hits - Stealth strikes have +15 armor penetration, deal 5% more damage, and heal for 2 HP + Stealth strikes have lifesteal, +15 armor penetration, deal 5% more damage 15% increased rogue damage and 15% increased rogue velocity - Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds + Stealth strikes grant lifesteal and 10% critical strike chance to non-stealth strikes for 10 seconds ''' } @@ -1281,7 +1313,7 @@ PermafrostsConcoction: { DisplayName: Permafrost's Concoction Tooltip: ''' - Increases maximum mana by 50 and reduces mana cost by 15% + Increases maximum mana by 40 and reduces mana cost by 15% +0.5 HP/s life regen below half health, +1 HP/s when below 25% health and +2 HP/s when below 10% health +3 HP/s life regen while afflicted with any fire debuff You will survive fatal damage and revive with 30% life on a 3 minute cooldown @@ -1435,12 +1467,12 @@ RampartofDeities: { ToggleEffect: ", increases movement speed," } -RareElementalinaBottle: { - DisplayName: Rare Elemental in a Bottle +OasisElementalinaBottle: { + DisplayName: Oasis Elemental in a Bottle Tooltip: ''' - Summons a sand elemental to heal you - ;D + Summons an oasis elemental to assist you + The elemental fires healing orbs that restore 10 health while you are damaged ''' } @@ -1627,8 +1659,8 @@ SigilofCalamitas: { DisplayName: Sigil of Calamitas Tooltip: ''' - 15% increased magic damage and 10% decreased mana usage - +100 max mana + {$CommonItemTooltip.IncreasesMaxManaBy} + {$CommonItemTooltip.PercentIncreasedMagicDamage@1} Increases pickup range for mana stars ''' } @@ -1878,7 +1910,7 @@ TheAmalgam: { DisplayName: The Amalgam Tooltip: ''' - All attacks inflict a variety of debuffs, 300% increased elemental debuff damage + All attacks inflict a variety of debuffs, 200% increased elemental debuff damage Most buffs last twice as long, and persist after dying Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds @@ -2226,10 +2258,13 @@ XyksBlessingBlue: { Tooltip: ''' Applies visual effects to your dashes, wings, and deaths - to transform + this item in your inventory to transform it, or Shift- to toggle armor visibility + Armor visibility is [TOGGLE] 'It's simply too much to turn back now; passion and time have long since stained it. [c/5f8ae1:Have I always been so selfish?'] ''' + ArmorDisabled: "[c/D44748:DISABLED]" + ArmorEnabled: "[c/58D447:ENABLED]" } XyksBlessingOrange: { @@ -2237,8 +2272,28 @@ XyksBlessingOrange: { Tooltip: ''' Applies visual effects to your dashes, wings, and deaths - to transform + this item in your inventory to transform it, or Shift- to toggle armor visibility + Armor visibility is [TOGGLE] 'Even so, the march of time waits for none. Recall that feeling of fulfillment, and show it to the world. [c/E1B65F:Prove that it was never a waste.'] ''' + ArmorDisabled: "[c/D44748:DISABLED]" + ArmorEnabled: "[c/58D447:ENABLED]" +} + +FrozenCube: { + DisplayName: Frozen Cube + Tooltip: + ''' + A frozen block of ice with something inside + Summons an Elumphant to sit atop your head and protect you + The Elumphant will cycle between shooting cold air that inflicts [cbuff:CalamityMod/WindChilled], and headbutting enemies + Elumphant's headbutts only target enemies inflicted with [cbuff:CalamityMod/WindChilled] + Reduces your defense by 33%, but uses that defense to boost the Elumphant's power and your cold debuff damage + [DAMAGELINE] + [c/7497ED:'What I wanna know is, where's the mammoth?'] + ''' + EquippedDebuff: Current Cold Debuff boost: +{0}% + EquippedElumphant: Current Elumphant Power: +{0}% + Unequipped: Equip this accessory to view its statistics } 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..442de828f9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -143,11 +143,6 @@ ExoPrism: { Tooltip: Fractal energies shimmer across its surface } -GalacticaSingularity: { - DisplayName: Galactica Singularity - Tooltip: A shard of the cosmos -} - GrandScale: { DisplayName: Grand Scale Tooltip: Large scale of an apex predator @@ -175,12 +170,7 @@ Lumenyl: { MeldBlob: { DisplayName: Meld Blob - Tooltip: "" -} - -MeldConstruct: { - DisplayName: Meld Construct - Tooltip: "" + Tooltip: "'Shrieks of distorted memories echo within this mass' " } MiracleMatter: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 18c738eb26..dd1317d330 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -329,3 +329,8 @@ LegendaryShortTooltip: [c/FF6F00:Tales of legends past radiate around you...] [c/BABABA:Hold Shift to listen closer] ''' + +DisgustingSlop: { + DisplayName: Disgusting Slop + Tooltip: Can be extractinated +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 4a8f1cc711..4f4d3f9c8d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -798,6 +798,15 @@ GloomTorch: { Tooltip: "" } +GluttonyBlender: { + DisplayName: Gluttony Blender + Tooltip: + ''' + A strange industrial contraption which appears to process food + Has the potential to turn food into something more nutritious... maybe + ''' +} + LanternCenter: { DisplayName: Lantern Center Tooltip: Lights up the night sky with celebratory lanterns @@ -964,6 +973,11 @@ SeaMinnowJar: { Tooltip: "" } +ShroombleCage: { + DisplayName: Shroomble Cage + Tooltip: "" +} + SpitefulCandle: { DisplayName: Spiteful Candle Tooltip: @@ -990,6 +1004,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: @@ -4695,3 +4718,8 @@ MossyStone: { DisplayName: Mossy Stone Tooltip: "" } + +GreedPot: { + DisplayName: Urn of Avarice + Tooltip: Offer your treasures to the Urn, and your avarice may at last be satiated +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index f87aed0533..8d861a4e6f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -8,7 +8,7 @@ AstralInjection: { Tooltip: ''' Restores {0} mana per second - Lower your health by {1} and inflicts {$BuffName.ManaSickness} when used + Inflicts [cbuff:ManaSickness] when used ''' } @@ -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: { @@ -294,7 +367,7 @@ OddMushroom: { Tooltip: ''' Causes you to see many fake, vibrant copies of all nearby entities - [c/FF232C:These visual effects may be nauseating or otherwise bad for some] + [c/FF232C:These visual effects may be nauseating or harmful to those with photosensitivity issues] 'Trippy' ''' } @@ -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 @@ -435,6 +580,15 @@ Mangosteen: { ''' } +QualitySlop: { + DisplayName: Quality Slop + Tooltip: + ''' + "{$CommonItemTooltip.MajorStats}" + 'You only like it because it's good' + ''' +} + Salak: { DisplayName: Salak Tooltip: "{$CommonItemTooltip.MinorStats}" @@ -448,3 +602,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.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 8423bc9f44..3ec4c48e04 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -177,7 +177,7 @@ MarkofProvidence: { Summons the Ceaseless Void Despawns on the surface ''' - SpawnSignus: Summons Signus, Envoy of the Devourer + SpawnSignus: Summons Signus SpawnWeaver: Summons the Storm Weaver } @@ -289,6 +289,11 @@ Terminus: { Tooltip: Hold to start or end the Boss Rush } +TheHousingContract: { + DisplayName: The Housing Contract + Tooltip: Use to adopt a piggy for your town +} + YharonEgg: { DisplayName: Blessed Phoenix Egg Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 935171ee91..ea1ac9b35e 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: @@ -39,7 +51,7 @@ AridArtifact: { ''' Summons a sandstorm The sandstorm will happen shortly after the item is used - If used during a sandstorm, the sandstorm will stop some time afterward. + If used during a sandstorm, the sandstorm will stop some time afterward ''' } @@ -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,15 +226,27 @@ GreatbayPickaxe: { Tooltip: Can mine Demonite, Crimtane, Meteorite, Sea Prisms and Sea Prism Crystals } -InfernaCutter: { - DisplayName: Inferna Cutter +HurriedVoucher: { + DisplayName: Hurried Voucher Tooltip: ''' - Critical hits with the blade cause small explosions - Generates a number of small sparks when swung + 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: + ''' + Critical hits with the blade cause small explosions + Generates a number of small sparks when swung + ''' +} + MarniteDeconstructor: { DisplayName: Marnite Deconstructor 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: "" @@ -292,10 +337,12 @@ RelicOfResilience: { Tooltip: ''' Holding this item creates orbiting rock shards around you and nearby allies - While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10% - Taking a hit or pressing will pull in the shards, then blast them outward, crippling hit enemies - This effect has a 10 second cooldown after taking a hit - Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you + After 5 seconds, the relic will retain orbiting rocks even when not holding the item + Continuing to hold the item will steadily increase the number of rocks and defenses until reaching max power + While they orbit you, your minimum defense is set to 200 and minimum damage reduction to 10% + Taking a hit or pressing while holding this item will pull in the shards, then blast them outward, crippling hit enemies + This effect has a 10 second cooldown after taking a hit, but recharges faster if holding the item + Holding out the shield heavily reduces the damage of all summons [c/FF8C00:I saw a massacre and did nothing to stop it. My vow broken, I was shunned.] [c/FF8C00:My will to forge ahead vanished. My final wish was simply to not die alone.] [c/FF8C00:But when She put faith in my shield, I would never again let it falter.] @@ -358,6 +405,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 +426,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.TreasureBags.hjson b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson index 61238dff19..b9516e17d0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson @@ -105,7 +105,7 @@ RavagerBag: { } SignusBag: { - DisplayName: Treasure Bag (Signus, Envoy of the Devourer) + DisplayName: Treasure Bag (Signus) Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index ce22045fcb..c0dfbca3bc 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -702,8 +702,8 @@ RecitationoftheBeast: { DisplayName: Recitation of the Beast Tooltip: ''' - Summons beast scythes around the player in a small circle, - before firing toward the cursor and home in to nearby enemies + Summons beast scythes around the player in a small circle + Beast scythes fire toward the cursor and home in to nearby enemies ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 410a5c6147..0a2152a8e6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -405,7 +405,7 @@ DragonRage: { Tooltip: ''' Twirls a baton that causes explosions of [cbuff:CalamityMod/Dragonfire] on enemy hits - Every ten hits will summon a ring of fireballs + Once every two seconds, hits summon a ring of fireballs that target the enemy with the most health ''' } @@ -779,11 +779,9 @@ Lacerator: { The saw does more damage the more often the yoyo hits, and fades away when not striking enemies Enemies touching the edge of the sawblade get blood orbs torn out of them Picking up these blood orbs reduces the duration of [cbuffplr:PotionSickness] - The direction of the saw's spin depends on which direction you originally threw the yoyo - [GFB] + The direction of the saw's spin depends on which direction you originally threw the yoyo[GFB] ''' - TooltipNormal: Someone thought this was a viable weapon against DoG at one point lol - TooltipGFB: May be a viable weapon against DoG... + GFBFlavor: "[c/ff0a0a:May be a viable weapon against DoG...]" } LifehuntScythe: { @@ -993,8 +991,10 @@ Pandemic: { DisplayName: Pandemic Tooltip: ''' - {$Common.YoyoStatsInfinite} - Fires plague seekers when enemies are near + {$Common.YoyoStats} + Each unique enemy struck that is infected with [cbuff:CalamityMod/Plague] increases the yoyo's size, power, and airtime + Refreshes [cbuff:CalamityMod/Plague] duration if a target is already infected + Counterweights inflict [cbuff:CalamityMod/Plague] and move twice as fast ''' } @@ -1380,7 +1380,11 @@ TheObliterator: { {$Common.YoyoStatsInfinite} [GFB] ''' - TooltipNormal: Occasionally performs a miniature [ceffect/dog:Dimensional Drive] at nearby foes + TooltipNormal: + ''' + Occasionally performs a miniature [ceffect/dog:Dimensional Drive] at nearby foes + Counterweight hits instantly begin another [ceffect/dog:Dimensional Drive] + ''' TooltipGFB: just a slight bit of dust spam on this weapon im afraid } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 62a4828a7c..cd1455e9bc 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -842,6 +842,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 689983fb5d..57fd63cf5d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -339,8 +339,11 @@ DuststormInABottle: { DisplayName: Duststorm in a Bottle Tooltip: ''' - Explodes into a dust cloud - Stealth strikes form a more intense and longer lasting dust cloud + Disables normal stealth generation + Throws a bottle filled with high-pressure dust that shatters on impact with a target or after a short delay + Hold to generate stealth, but cause the bottle to shatter sooner + Stealth strikes cause the bottle to leak dust clouds around it for a few seconds instead of shattering + Will shatter in your hand if charged for too long ''' } @@ -358,9 +361,27 @@ EclipsesFall: { DisplayName: Eclipse's Fall Tooltip: ''' - Summons spears from the sky on hit - Stealth strikes impale enemies and summon a constant barrage of spears over time - 'When the sun goes dark, you will know judgement' + Throws a javelin that shatters into fragments of primordial light upon enemy hits + If more than 20 fragments exist, the oldest fragments will seek out enemies to attack + Stealth strikes coalesce fragments into [ceffect/darksun:Spear of Obscuration], gaining power based on the number of fragments + [ceffect/darksun:Spear of Obscuration] will pierce though any enemy hit by Eclipse's Fall + [ceffect/darksun:'When the sun goes dark, all will know terror'] + ''' +} + +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'] ''' } @@ -762,7 +783,7 @@ MoltenAmputator: { Throw a spinning scythe that lingers at your cursor to recall all existing scythes Recalling a scythe while it's on an enemy rends them for massive damage - with sufficient stealth to empower yourself, greatly increasing attack speed for a short time + with sufficient stealth to empower the next {0} scythes and greatly increase attack speed You cannot recall scythes thrown while empowered ''' } @@ -865,8 +886,10 @@ ProfanedPartisan: { DisplayName: Profaned Partisan Tooltip: ''' - Fires an unholy spear that explodes on enemy hits - Stealth strikes spawn smaller spears to fly along side it + Throws a profaned spear that splits into miniature spears upon hitting an enemy + Stealth strikes remain impaled in an enemy for 10 seconds + While an enemy is impaled, all spears that strike them instead shatter into exploding stars + Inflicts [cbuff:CalamityMod/HolyFlames] ''' } @@ -995,8 +1018,12 @@ SealedSingularity: { DisplayName: Sealed Singularity Tooltip: ''' - Shatters on impact, summoning a black hole that sucks in nearby enemies - Stealth strikes summon a black hole that lasts longer and sucks enemies with stronger force + Disables normal stealth generation + Throws a contained singularity bomb that slows down and creates a damaging field after a short fuse + Hold to generate stealth, but burn through the bomb's fuse + After the field collapses, the singularity seeks out the strongest target that it hit and explodes + Stealth strikes increase the size and duration of the damaging field + Will explode in your hand if you hold the fuse too long ''' } @@ -1006,7 +1033,7 @@ Seraphim: { ''' Throws an extraordinarily fast dagger which slows down exponentially and dissipates into light Once dissipation has ended, 6 splitting blades that slice nearby targets are released, along with a large laserbeam - Stealth strikes release a volley of 7 lights which explode into smaller laser beams along with the dagger + Stealth strikes release a volley of 8 lights which explode into smaller laser beams along with the dagger ''' } @@ -1086,9 +1113,10 @@ SpearofPaleolith: { DisplayName: Spear of Paleolith Tooltip: ''' - Throws an ancient spear that shatters enemy armor - Spears rain fossil shards as they travel - Stealth strikes travel slower but further, raining more fossil shards + Throws an ancient spear that shatters into fossil shards upon hitting an enemy + Stealth strikes remain impaled in the enemy for 10 seconds + While an enemy is impaled, all spears that strike them erupt into even more fossil shards + Inflicts [cbuff:CalamityMod/ArmorCrunch] ''' } @@ -1156,6 +1184,8 @@ Supernova: { DisplayName: Supernova Tooltip: ''' + Disables normal stealth generation + Hold to generate stealth, or hold to toss the bomb without generating stealth Tosses a smart bomb that locks onto and tracks targets If no target is found it will return to you Each bomb creates a miniature [cbuff:CalamityMod/MiracleBlight] supernova that drags in weak enemies and chases strong enemies @@ -1228,8 +1258,8 @@ ThrowingBrick: { DisplayName: Throwing Brick Tooltip: ''' - Prove its resistance by throwing it upwards and catching it with your face - Throws a brick that shatters if stealth is full + Stealth strikes cause the brick to shatter + 'Prove its resistance by throwing it upwards and catching it with your face' ''' } @@ -1394,3 +1424,16 @@ Pumpkaboom: { Stealth strikes throw larger pumpkins which pull enemies in before releasing a larger explosion ''' } + +LemonNade: { + DisplayName: Lemon 'nade + Tooltip: + ''' + Disables normal stealth generation + Hold to pull the pin and generate stealth, and release to throw + The longer it is held, the shorter the fuse once the 'nade is thrown + Will explode in your hand if the fuse is held too long + Stealth strikes explode into exploding lemon seeds + 'Burn their house down!' + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 27a0b40339..a3f4cfa7b6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -48,7 +48,6 @@ AresExoskeleton: { Creates a panel with four slots and four choices above it: Plasma, Tesla, Laser, and Gauss Clicking one of the choices and then clicking one of the slots summons a cannon of that type Clicking on a slot that's already occupied destroys its associated cannon and clears the slot - Cannons take 3 minion slots each ''' } @@ -206,7 +205,7 @@ CosmicImmaterializer: { ''' Summons a cosmic energy spiral to fight for you The orb will fire swarms of homing energy bolts that cause [cbuff:CalamityMod/MiracleBlight] - Requires 10 minion slots to use and there can only be one energy spiral + There can only be one energy spiral ''' } @@ -224,11 +223,7 @@ CosmicViperEngine: { Cosmilamp: { DisplayName: Cosmilamp - Tooltip: - ''' - Summons a cosmic lantern above your head to fight for you - Each lantern takes up 2 minion slots - ''' + Tooltip: Summons a cosmic lantern above your head to fight for you } CrimslimeStaff: { @@ -305,7 +300,6 @@ DragonbloodDisgorger: { Summons a skeletal dragon and her two children Baby spits burst into blood orbs upon hitting an enemy Picking up these blood orbs reduces the duration of [cbuffplr:PotionSickness] - Requires 6 minion slots to be summoned There can only be one family at a time ''' } @@ -338,8 +332,7 @@ Endogenesis: { The first mode makes it shoot sweeping lasers aimed at the enemy The second mode sacrifices its limbs to shoot out homing projectiles The third mode allows it to aggressively tackle its enemies - The fourth mode makes the limbs function as endothermic flamethrowers - Requires 10 minion slots to be summoned + The fourth mode makes the limbs function as endothermic flamethrowers There can only be one construct at a time [c/B0FBFF:'Ice puns not included'] ''' @@ -356,11 +349,7 @@ EndoHydraStaff: { EntropysVigil: { DisplayName: Entropy's Vigil - Tooltip: - ''' - Summons a mini Calamitas Clone and her brothers to protect you - One minion trio takes two minion slots - ''' + Tooltip: Summons a mini Calamitas Clone and her brothers to protect you } EtherealSubjugator: { @@ -399,11 +388,7 @@ FleshOfInfidelity: { FlowersOfMortality: { DisplayName: Flowers of Mortality - Tooltip: - ''' - Summons five rainbow flowers over your head that inflict [cbuff:CalamityMod/ElementalMix] - The combined flowers consume three minion slots - ''' + Tooltip: Summons five rainbow flowers over your head that inflict [cbuff:CalamityMod/ElementalMix] } ForgottenApexWand: { @@ -512,7 +497,7 @@ InfectedRemote: { Tooltip: ''' Summons a humanoid-hybrid Plaguebringer, codenamed 'Virili', to aid you in battle - Virili requires 3 minion slots to summon, and can only be summoned once + Virili can only be summoned once Virili uses a variety of attacks which she cycles through on a timer All attacks spread the [cbuff:CalamityMod/Plague], as was her original design intention 'There's a single label on the back: @@ -524,7 +509,7 @@ KingofConstellationsTenryu: { DisplayName: King of Constellations, Tenryū Tooltip: ''' - Uses 4 minion slots to summon a pair of celestial dragons to fight for you + Summons a pair of celestial dragons to fight for you There can only be one pair of dragons at a time 'The ones who will devour the Unmoving Star' ''' @@ -539,7 +524,6 @@ LiliesOfFinality: { DisplayName: Lilies of Finality Tooltip: ''' - Requires 2 minion slots to use Can only be summoned once 'Wake up' ''' @@ -553,7 +537,7 @@ Metastasis: { While the Sepulcher is active, brimstone hearts will begin to appear and orbit you When too many hearts are present, it will interrupt attacking to attack the hearts instead This happens more frequently depending on how many hearts are present - Requires 4 minion slots to use and can only be summoned once + Can only be summoned once ''' Calamitas: ''' @@ -589,7 +573,6 @@ MutatedTruffle: { ''' Summons a younger fishron to irradiate your foes The fishron will cycle between charging, projectiles, and a typhoon - Requires 3 minion slots to be used There can only be one minion ''' } @@ -610,7 +593,7 @@ Perdition: { {$CommonItemTooltip.Sentry} Summons a beacon at the position of the mouse When a target is manually selected via it releases torrents of souls from below onto the target - Requires one sentry slot to summon, and only one beacon may exist at a time + Only one beacon may exist at a time ''' } @@ -619,7 +602,7 @@ PlantationStaff: { Tooltip: ''' Summons a miniature Plantera to devastate enemies with floral fury - Occupies 3 minion slots and there can only be one Mini Plantera at a time + There can only be one Mini Plantera at a time ''' } @@ -679,8 +662,9 @@ SarosPossession: { ''' Summons a radiant aura harnessing the power of primordial light Repeated summons increase the power of the aura - with full summon slots to channel an eclipse beam that decays over time - This beam recharges when not in use + with full summon slots to channel [ceffect/darksun:Totality Ray] + [ceffect/darksun:Totality Ray] decays while in use and recharges when not in use + [ceffect/darksun:'A ballet of light and shadow, torn from the sky'] ''' } @@ -702,11 +686,7 @@ SeashineHilt: { ShellfishStaff: { DisplayName: Shellfish Staff - Tooltip: - ''' - Summons a shellfish to latch onto enemies and inflict [cbuff:CalamityMod/ShellfishClaps] - Each shellfish takes 2 minion slots - ''' + Tooltip: Summons a shellfish to latch onto enemies and inflict [cbuff:CalamityMod/ShellfishClaps] } Sirius: { @@ -813,7 +793,7 @@ TemporalUmbrella: { - A cyan umbrella to beat down your foes with grace - A lavender rifle to snipe those who stand in your way Best of all, you get to wear a top hat - Requires 5 minion slots to use and there can only be one set of tools at a time + There can only be one set of tools at a time 'Surprisingly sturdy, I reckon this could defeat the Mafia in a single blow' ''' } @@ -909,20 +889,12 @@ VoidEaterMarionette: { WarloksMoonFist: { DisplayName: Warloks' Moon Fist - Tooltip: - ''' - Summons a celestial fist to punch enemies for you - Requires 4 minion slots to use - ''' + Tooltip: Summons a celestial fist to punch enemies for you } WitherBlossomsStaff: { DisplayName: Wither Blossoms Staff - Tooltip: - ''' - Summons four decaying [cbuff:CalamityMod/Plague] flowers over your head - The combined flowers consume two minion slots - ''' + Tooltip: Summons four decaying [cbuff:CalamityMod/Plague] flowers over your head } WulfrumController: { @@ -939,9 +911,5 @@ WulfrumController: { YharonsKindleStaff: { DisplayName: Yharon's Kindle Staff - Tooltip: - ''' - Summons a fiery draconid to fight for you - Requires 5 minion slots to use - ''' + Tooltip: Summons a fiery draconid to fight for you } diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 8d617226ec..873189767c 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -57,12 +57,13 @@ SevensBust: Bust! SevensDoubles: Doubles! SevensTriples: Triples! StylishHammerHit: Stylish! +PiggyLicense: The license teleports away to the piggy delivery service... GenericConsumedText: "[c/8A8A8A:You have already consumed this item]" CelestialOnionText: You have already consumed a Celestial Onion. Consuming another would distort you. SanguineTangerineText: You have already consumed a Sanguine Tangerine. Eating any more would make your blood too thick to flow. MiracleFruitText: You have already consumed a Miracle Fruit. It would take a miracle to put you back together if you ate another. TaintedCloudberryText: You have already consumed a Tainted Cloudberry. Your body would become dust if you ate more than one. -SacredStrawberryText: You have already consumed a Sacred Strawberry. Any more draconic power and you'd be rejected. +SacredStrawberryText: You have already consumed a Sacred Strawberry. One more drop of draconic power would obliterate you. CometShardText: You have already used a Comet Shard. Your neurons would die if you used another. EtherealCoreText: You have already used an Ethereal Core. Your brain would escape your head if you dared to use it a second time. PhantomHeartText: You have already used a Phantom Heart. The voices are telling you it's a bad idea to use it again. diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index ac7691f508..1323a80e94 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -241,7 +241,7 @@ RavagerBody.DisplayName: Ravager RockPillar.DisplayName: Rock Pillar CosmicLantern.DisplayName: Cosmic Lantern CosmicMine.DisplayName: Cosmic Mine -Signus.DisplayName: Signus, Envoy of the Devourer +Signus.DisplayName: Signus CorruptSlimeSpawn.DisplayName: Corrupt Slime Spawn CrimsonSlimeSpawn.DisplayName: Crimson Slime Spawn CrimulanPaladin.DisplayName: Crimulan Paladin @@ -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,42 @@ 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. + } +} + +TownPiggy: { + DisplayName: Town Piggy + Census.SpawnCondition: Use The Housing Contract + + Name: { + Oolong: Oolong + Napoleon: Napoleon + Waddles: Waddles + Crenando: Crenando + Olivia: Olivia + Wilbur: Wilbur + Pumbaa: Pumbaa + Peppa: Peppa + Conan: Conan + Reuben: Reuben + Porky: Porky + Hamm: Hamm + Runt: Runt + Roko: Roko + RichardHam: Richard Ham + Curly: Curly + Techno: Techno + JohnPork: John Pork + Piglet: Piglet + } + + Chat: { + 0: Oink! + 1: Squeal... + 2: Snort! } } 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.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 303e04c84f..5ab80e38b0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -78,3 +78,5 @@ PlagueShot.DisplayName: Plague Shot PlagueShotBuffer.DisplayName: Plague Shot WaterShot.DisplayName: Water Shot WaterShotBuffer.DisplayName: Water Shot +// Animation +GreedTransmutation.DisplayName: Greed Transmutation diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 4ff31a2e48..2ddca62e16 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -271,3 +271,6 @@ AbyssalFire.DisplayName: Abyssal Fire BlahajBlast.DisplayName: Blahaj Blast MegalodonRocket.DisplayName: Megalodon Rocket VoidBlast.DisplayName: Void Blast +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 ac3e08848f..228285a23b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -78,19 +78,24 @@ DragonScalesInfernado.DisplayName: Infernado DragonShit.DisplayName: Fire DukesDecapitatorBubble.DisplayName: Duke Bubble DukesDecapitatorProj.DisplayName: Duke's Decapitator -DuststormCloud.DisplayName: Dust Cloud -DuststormCloudHitbox.DisplayName: Duststorm Cloud +DuststormCloud.DisplayName: Dust Storm DuststormInABottleProj.DisplayName: Duststorm Bottle +DuststormCloudExplosion.DisplayName: Dust Explosion +DuststormInABottleHoldout.DisplayName: Duststorm Bottle DynamicPursuerElectricity.DisplayName: Dynamic Electricity DynamicPursuerLaser.DisplayName: Dynamic Laser DynamicPursuerProjectile.DisplayName: Dynamic Pursuer EclipseMirrorBurst.DisplayName: Eclipse Mirror Flash -EclipsesFallMain.DisplayName: Eclipse's Fall -EclipsesSmol.DisplayName: Eclipse's Small -EclipsesStealth.DisplayName: Eclipse's Fall -EclipseStealthBoom.DisplayName: Eclipse Blast +EclipsesFall_Javelin.DisplayName: Eclipse's Fall +EclipsesFall_LightFragment.DisplayName: Fragment of Primordial Light +EclipsesFall_LightExplosion.DisplayName: Baily's Beads +EclipsesFall_LightSpark.DisplayName: Spark of Primodial Light +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 @@ -207,7 +212,8 @@ PrismallineProj.DisplayName: Prismalline PrismRocket.DisplayName: Prism Rocket PrismShurikenBlade.DisplayName: Refraction Blade ProfanedPartisanProj.DisplayName: Profaned Partisan -ProfanedPartisanSpear.DisplayName: Profaned Spear +ProfanedPartisanSpear.DisplayName: Holy Spear +ProfanedPartisanFlare.DisplayName: Holy Light PumpkaboomSmall.DisplayName: Small Pumpkaboom PumpkaboomBoomSmall.DisplayName: Pump-kaboom! PumpkaboomBig.DisplayName: Big Pumpkaboom @@ -243,9 +249,10 @@ ScourgeoftheSeasProjectile.DisplayName: Moist Scourge ScourgeVenomCloud.DisplayName: Venom Cloud SeafoamBombProj.DisplayName: Seafoam Bomb SeafoamBubble.DisplayName: Seafoam Bubble -SealedSingularityBlackhole.DisplayName: Sealed Blackhole +SealedSingularityRock.DisplayName: Sealed Singularity Rock SealedSingularityGore.DisplayName: Sealed Singularity Fragment -SealedSingularityProj.DisplayName: Sealed Singularity +SealedSingularityHoldout.DisplayName: Sealed Singularity +SealedSingularityProjectile.DisplayName: Sealed Singularity SeraphimAngelicLight.DisplayName: Light Orb SeraphimAngelicLight2.DisplayName: Light Orb SeraphimBeamLarge.DisplayName: Holy Beam @@ -270,6 +277,7 @@ SpearofDestinyProjectile.DisplayName: Destiny Spear SpearofDestinyStealth.DisplayName: Empowered Holy Lance SpearofDestinyStealthExplosion.DisplayName: Strong Burst SpearofPaleolithProj.DisplayName: Paleolith Spear +PaleoShatterExplosion.DisplayName: Paleo Shatter Explosion SpentFuelContainerProjectile.DisplayName: Spent Fuel Container SphereBladed.DisplayName: Bladed Sphere SphereBlue.DisplayName: Blue Thruster Sphere @@ -287,6 +295,7 @@ Stormfrontspark.DisplayName: Stormfront Spark SubductionFlameburst.DisplayName: Flame Pillar SubductionSlicerProj.DisplayName: Subduction Slicer SulphuricNukesplosion.DisplayName: Nuke +SupernovaHoldout.DisplayName: Supernova SupernovaBomb.DisplayName: Supernova Bomb SupernovaBoom.DisplayName: Micro Supernova SupernovaStealthBoom.DisplayName: Exo Supernova @@ -333,3 +342,5 @@ WrathwingFireball.DisplayName: Wrathwing Fireball WrathwingSpear.DisplayName: Wrathwing WulfrumKnifeProj.DisplayName: Wulfrum Knife NanoblackLightspeedCarveSlashVisual.DisplayName: Nanoblack Light-speed Carve Visuals +LemonNadeHoldout.DisplayName: Lemon 'nade +LemonNadeProjectile.DisplayName: Lemon 'nade diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 1d481724b0..cb32d297b4 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -246,7 +246,7 @@ SandnadoMinion.DisplayName: Sandnado SandTornado.DisplayName: Tornado SarosAura.DisplayName: Saros Aura SarosSunfire.DisplayName: Saros Sunfire -SarosEclipseBeam.DisplayName: Eclipse Beam +SarosEclipseBeam.DisplayName: Totality Ray SeashineSwordProj.DisplayName: Seashine Sword SeekerSummonProj.DisplayName: Soul Seeker SepulcherMinion.DisplayName: Sepulcher diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 51297508f0..cbe6fca08b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -49,9 +49,10 @@ DragonDust.DisplayName: Dust DunesandBallFalling.DisplayName: Dunesand Ball DuneSandBallGun.DisplayName: Dunesand Ball EarlyBloomBobber.DisplayName: Early Bloom Bobber +Elumphant.DisplayName: Elumphant +ElumphantMist.DisplayName: Elumphant Mist EmpyreanBlast.DisplayName: Empyrean Blast EmpyreanEmber.DisplayName: Empyrean Ember -EmpyreanGlob.DisplayName: Empyeran Glob EmpyreanMarble.DisplayName: Empyrean Marble EmpyreanStellarDetritus.DisplayName: Empyrean Stellar Detritus EnergyShell.DisplayName: Energy Shell @@ -72,10 +73,12 @@ FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem GenericElectricSpark.DisplayName: Electric Spark GhostlyBolt.DisplayName: Bolt +GluttonyBlenderAnimation.DisplayName: Gluttony Blender Animation GodKiller.DisplayName: God Killer GodSlayerShrapnel.DisplayName: Flame GodSlayerShrapnelRound.DisplayName: Round GreenLabSeeker.DisplayName: Seeking Mechanism +Gunshot.DisplayName: Gunshot HeronBobber.DisplayName: Heron Bobber HideOfAstrumDeusExplosion.DisplayName: Explosion HolyExplosionSupreme.DisplayName: Explosion @@ -107,6 +110,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 +156,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 dd505cfd52..ba47bbc760 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -7,8 +7,6 @@ Armageddon: "{0} failed the challenge at hand." AstralInfection1: "{0}'s infection spread too far." AstralInfection2: "{0}'s skin was replaced by the astral virus." AstralInfection3: "{0} succumbed to their spaceborne pustules." -AstralInjection1: "{0}'s blood vessels burst from drug overdose." -AstralInjection2: "{0} couldn't handle another cosmic mana transfer." AuricRebuke1: "{0}'s vital fluids violently vibrated out of their flesh." AuricRebuke2: "{0} did not survive their brief time as a supercapacitor." AuricRebuke3: "{0} could not contain the power overwhelming." @@ -68,6 +66,12 @@ DivinityDevourer3: "{0}'s essence was snuffed by [ceffect/dog:Divinity Devourer] ElementalMix1: "{0} was reduced to technicolor confetti." ElementalMix2: "{0} was blasted apart by a harmonized elemental onslaught." ElementalMix3: "{0} was overwhelmed by elemental turbulence." +FishStocks1: "{0} didn't diversify their portfolio." +FishStocks2: "{0} bought high and sold low." +FishStocks3: "{0} fell victim to the Fish Crash of '{1}." +FishStocks4: "{0} was left holding the bag." +FishStocks5: "{0} is food for the loan sharks." +FishStocks6: "{0} should have taken a short position on their health bar." FlareGunOverheat: "{0}'s gun was simply too hot to handle." GodSlayerInferno1: "{0}'s hopes and dreams were cremated." GodSlayerInferno2: "{0}'s consciousness slipped into oblivion." @@ -109,6 +113,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..d51df64d71 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -173,6 +173,8 @@ EditedTooltip: { MoltenQuiver: Lights wooden arrows ablaze and all arrows inflict Hellfire RifleScope1: Increase view range for guns ( to zoom out) RifleScope2: The scope effect can be toggled with visibility + ReconScope1: 15% increased ranged damage + ReconScope2: 5% increased ranged critical strike chance SniperScope: 12% increased ranged critical strike chance Magiluminescence: ''' @@ -209,7 +211,7 @@ EditedTooltip: { ArcheryPotion: 5% increased arrow damage and 20% increased arrow speed AleSake: ''' - Increases melee weapon scale by 15%, but decreases melee speed by 10% + Increases melee weapon scale by 25%, but decreases melee speed by 10% Counts as an alcohol for Alcohol Poisoning {$Common.AlcoholWarning} ''' @@ -255,8 +257,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 +297,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 +330,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 +367,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 +401,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/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index a813e9af22..2ccfab5288 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -122,7 +122,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); } 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 decf8303fd..bc08ca4f7e 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; @@ -155,13 +156,13 @@ namespace CalamityMod.NPCs // Cold debuff effects public bool IncreasedColdEffects_EskimoSet = false; public bool IncreasedColdEffects_CryoStone = false; + public bool IncreasedColdEffects_FrozenCube = false; // Electric effects public bool IncreasedElectricityEffects_Unused = false; // Heat debuff effects public bool IncreasedHeatEffects_Fireball = false; - public bool IncreasedHeatEffects_CinnamonRoll = false; public int IncreasedHeatEffects_FireBoots = 0; // Toxic Heart effect @@ -194,6 +195,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. @@ -351,6 +355,8 @@ namespace CalamityMod.NPCs ///
public bool pacified = false; + public float coinDropMult = 1; + // Soma Prime Shred deals damage with DirectStrikes instead of with direct debuff damage // It also stacks, scales with ranged damage, and can crit, meaning it needs to know who applied it most recently /// Tracks how many stacks of the Shred debuff this NPC is inflicted with. @@ -386,6 +392,8 @@ namespace CalamityMod.NPCs public bool trueVulnerabilityHex = false; public bool banishingFire = false; public bool wither = false; + public bool windChilled = false; + public float windChilledMult = 1; /// /// If greater than 0, this enemy will appear to disintegrate into ash when killed.
/// Used by Rancor's laser beam. @@ -512,9 +520,9 @@ namespace CalamityMod.NPCs myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet; myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone; + myClone.IncreasedColdEffects_FrozenCube = IncreasedColdEffects_FrozenCube; 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 +537,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]; @@ -604,6 +614,8 @@ namespace CalamityMod.NPCs myClone.pacified = pacified; + myClone.coinDropMult = coinDropMult; + myClone.somaShredStacks = somaShredStacks; myClone.somaShredApplicator = somaShredApplicator; myClone.somaShredFalloff = somaShredFalloff; @@ -632,6 +644,7 @@ namespace CalamityMod.NPCs myClone.trueVulnerabilityHex = trueVulnerabilityHex; myClone.banishingFire = banishingFire; myClone.wither = wither; + myClone.windChilled = windChilled; myClone.ashesOnDeath = ashesOnDeath; myClone.fortunesFavor = fortunesFavor; @@ -798,6 +811,7 @@ namespace CalamityMod.NPCs ladHearts--; banishingFire = false; wither = false; + windChilled = false; if (ashesOnDeath > 0) ashesOnDeath--; @@ -862,6 +876,7 @@ namespace CalamityMod.NPCs ActiveSicknessDebuffMultiplier = SicknessDebuffMultiplier; ActiveElectricDebuffMultiplier = ElectricDebuffMultiplier; ActiveWaterDebuffMultiplier = WaterDebuffMultiplier; + ActiveTypelessDebuffMultiplier = TypelessDebuffMultiplier; if (irradiated) { @@ -884,9 +899,13 @@ namespace CalamityMod.NPCs ActiveColdDebuffMultiplier += 1; ActiveHeatDebuffMultiplier -= 0.5f; } - if (npc.HasBuff(BuffID.Chilled)) //Nothing inflicts this at the moment. Put here so we can start using it. + if (npc.HasBuff(ModContent.BuffType())) { - ActiveWaterDebuffMultiplier += 1; + ActiveWaterDebuffMultiplier += 0.5f; + } + if (npc.buffType.Any(i => CalamityBuffSets.DebuffDataset[i] is not null && CalamityBuffSets.DebuffDataset[i].WaterDebuffScaling > 0) || npc.wet || npc.honeyWet || npc.dripping) + { + windChilledMult = 1.5f; } if (VulnerableToHeat.HasValue) { @@ -936,7 +955,7 @@ namespace CalamityMod.NPCs for (var index = 0; index < npc.buffType.Length; index++) { var type = npc.buffType[index]; - var debuffData = BuffDatasets.DebuffDataset[type]; + var debuffData = CalamityBuffSets.DebuffDataset[type]; if (debuffData == null || debuffData == DebuffData.Oiled) //Oiled is done after continue; debuffData.NPCLifeRegenMethod(npc, type, ref index, ref damage); @@ -997,7 +1016,7 @@ namespace CalamityMod.NPCs int dmg = 0; if (glaiveShredTimer > 0) { - dmg += 120; // 60 DPS + dmg += 200; // 100 DPS glaiveShredTimer--; } if (blazingStarShredTimer > 0) @@ -3745,7 +3764,8 @@ namespace CalamityMod.NPCs // Hitbox criteria were changed to allow long one dimensional projectiles so that Condemnation would work. bool acceptableVelocity = projectile.velocity != Vector2.Zero; bool acceptableHitbox = (projectile.width <= 36) || (projectile.height <= 36); - if (bullseye != null && acceptableVelocity && acceptableHitbox) + + if (bullseye != null && acceptableVelocity && acceptableHitbox && !CalamityProjectileSets.DaawnlightBlacklist[projectile.type]) { // Bullseyes are visually different on bosses and thus have larger hitboxes. float bullseyeRadius = npc.IsABoss() ? DaawnlightSpiritOrigin.BossBullseyeRadius : DaawnlightSpiritOrigin.RegularEnemyBullseyeRadius; @@ -3911,7 +3931,8 @@ namespace CalamityMod.NPCs if (npc.buffTime[i] >= 1) { int type = npc.buffType[i]; - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff[type]; + if (tag is not null) tag.TagModifyHitEffects(proj, npc, ref modifiers, ref TagDamageMult, ref critChance); } } @@ -3963,7 +3984,8 @@ namespace CalamityMod.NPCs if (npc.buffTime[i] >= 1) { int type = npc.buffType[i]; - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff[type]; + if (tag is not null) tag.TagOnHit(npc, projectile, hit, damagedone); } } @@ -4243,10 +4265,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 @@ -4825,6 +4853,9 @@ namespace CalamityMod.NPCs if (voidfrost) Voidfrost.DrawEffects(npc, ref drawColor); + if (windChilled) + WindChilled.DrawEffects(npc, ref drawColor); + // TODO -- These debuff visuals cannot be moved because they correspond to vanilla debuffs if (electrified) { @@ -4963,6 +4994,7 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/VermillionFlux", NPC => NPC.Calamity().vermillionFlux), ("CalamityMod/Buffs/DamageOverTime/Voidfrost", NPC => NPC.Calamity().voidfrost), ("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex", NPC => NPC.Calamity().vulnerabilityHex), + ("CalamityMod/Buffs/DamageOverTime/WindChilled", NPC => NPC.Calamity().windChilled), // All other important Calamity debuffs, in alphabetical order ("CalamityMod/Buffs/StatDebuffs/AbsorberAffliction", NPC => NPC.Calamity().absorberAffliction), @@ -5117,13 +5149,13 @@ namespace CalamityMod.NPCs ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, somaShredStacks.ToString(), npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset) + Vector2.One * 4f, Color.Gold, 0f, Vector2.Zero, Vector2.One * Main.UIScale * 0.8f); } - // Draw summon tag display. TODO: make it use custom textures provided by SummonTag. int yOffset = 0; for (int i = NPC.maxBuffs - 1; i >= 0; i--) { if (npc.buffTime[i] > 0) { - if (CalamityBuffSets.SummonTagDebuff.TryGetValue(npc.buffType[i], out SummonTag tag)) + var tag = CalamityBuffSets.SummonTagDebuff[npc.buffType[i]]; + if (tag is not null) { // Fetch the item and its frames var tex = TextureAssets.Item[tag.TagItem].Value; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 5fa1266546..fc2a6c5711 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; @@ -266,11 +267,11 @@ namespace CalamityMod.NPCs // Sand Elemental // Elemental in a Bottle @ 20% Normal, 33.33% Expert+ - // Rare Elemental in a Bottle @ 10% Normal, 16.67% Expert+ + // Oasis Elemental in a Bottle @ 10% Normal, 16.67% Expert+ // Desert Key @ 10% case NPCID.SandElemental: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); npcLoot.Add(ItemID.DungeonDesertKey, 10); break; @@ -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); @@ -1884,6 +1892,9 @@ DukeEditFailed: #region On Kill Main Hook public override void OnKill(NPC npc) { + if (npc.Calamity().coinDropMult != 1) + npc.value = (int)(npc.value * npc.Calamity().coinDropMult); + // Boss Rush on-kill effects if (BossRushEvent.BossRushActive) { diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 0d477e9611..ebc347aeeb 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"); @@ -1169,7 +1234,7 @@ namespace CalamityMod.NPCs public void BoundNPCSafety(Mod mod, NPC npc) { // Make Bound Town NPCs take no damage - if (CalamityNPCTypeSets.BoundTownNPC[npc.type]) + if (CalamityNPCSets.BoundTownNPC[npc.type]) npc.dontTakeDamageFromHostiles = true; } diff --git a/NPCs/CalamityTileCollisionHarmNPC.cs b/NPCs/CalamityTileCollisionHarmNPC.cs index 65507bd0af..9b18e6fe5d 100644 --- a/NPCs/CalamityTileCollisionHarmNPC.cs +++ b/NPCs/CalamityTileCollisionHarmNPC.cs @@ -136,11 +136,9 @@ namespace CalamityMod.NPCs { Vector2 pulseVel = -safeVel; Particle pulse1 = new CustomSpark(npc.Center, pulseVel * 2, "CalamityMod/Particles/BloomCircle", false, (int)(23 * MathF.Pow(scale, 2)), 0.6f * MathF.Pow(scale, 2), Color.DodgerBlue, new Vector2(2f, 1f), shrinkSpeed: -0.1f / scale, noShrink: true, glowCenter: true, glowOpacity: 0.8f); - GeneralParticleHandler.SpawnParticle(pulse1); - pulse1.Pixelate = true; + GeneralParticleHandler.SpawnParticle(pulse1, true); Particle pulse2 = new CustomSpark(npc.Center, pulseVel, "CalamityMod/Particles/BloomRing", false, (int)(18 * MathF.Pow(scale, 2)), 0.5f * MathF.Pow(scale, 2), Color.Blue, new Vector2(4f, 0.7f), shrinkSpeed: -0.3f / scale, noShrink: true); - GeneralParticleHandler.SpawnParticle(pulse2); - pulse2.Pixelate = true; + GeneralParticleHandler.SpawnParticle(pulse2, true); } diff --git a/NPCs/Crags/InfernalCongealment.cs b/NPCs/Crags/InfernalCongealment.cs index 4cfd936e34..74dfb53f73 100644 --- a/NPCs/Crags/InfernalCongealment.cs +++ b/NPCs/Crags/InfernalCongealment.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Crags if (DownedBossSystem.downedProvidence) { NPC.damage = 80; - NPC.defense = 20; + NPC.defense = 40; NPC.lifeMax = 3500; } Banner = NPC.type; diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index a2befaa003..fc2faaee99 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -32,8 +32,8 @@ namespace CalamityMod.NPCs.Cryogen NPC.width = 216; NPC.height = 216; NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || Main.getGoodWorld) ? 0.8f : 1f; - NPC.DR_NERD(0.4f); - NPC.LifeMaxNERB(2800, 3360, 33600); + NPC.DR_NERD(0.25f); + NPC.LifeMaxNERB(2500, 3000, 30000); NPC.Opacity = 0f; NPC.HitSound = Cryogen.HitSound; NPC.DeathSound = BreakSound; diff --git a/NPCs/DesertScourge/DesertPestBody.png b/NPCs/DesertScourge/DesertPestBody.png deleted file mode 100644 index 79e052b362..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody2.png b/NPCs/DesertScourge/DesertPestBody2.png deleted file mode 100644 index f651238e84..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody2.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody3.png b/NPCs/DesertScourge/DesertPestBody3.png deleted file mode 100644 index 2307268ff8..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody3.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestBody4.png b/NPCs/DesertScourge/DesertPestBody4.png deleted file mode 100644 index 922b55b874..0000000000 Binary files a/NPCs/DesertScourge/DesertPestBody4.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestHead.png b/NPCs/DesertScourge/DesertPestHead.png deleted file mode 100644 index 4d24a8bb61..0000000000 Binary files a/NPCs/DesertScourge/DesertPestHead.png and /dev/null differ diff --git a/NPCs/DesertScourge/DesertPestTail.png b/NPCs/DesertScourge/DesertPestTail.png deleted file mode 100644 index f6f82765e0..0000000000 Binary files a/NPCs/DesertScourge/DesertPestTail.png and /dev/null differ diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 9b1d42e7e7..2d45fb0d1d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -249,12 +249,12 @@ namespace CalamityMod.NPCs.DevourerofGods public static int LaserWallDamage = 75; // 300 public static int LaserWallMiddleBeamDamage = 85; // 340 - public static int FireballDamage = 60; // 240 + public static int FireballDamage = 55; // 220 public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 250; // 500 + NPC.damage = 235; // 470 NPC.npcSlots = 5f; NPC.width = 104; NPC.height = 104; @@ -2678,6 +2678,9 @@ namespace CalamityMod.NPCs.DevourerofGods GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); + GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); + GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); + GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), dropRate, dropMin, dropMax), true); } // Trophy (always directly from boss, never in bag) diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index b3e68cefb3..9524b527c3 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; @@ -179,6 +180,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemID.Leather, 1, 1, 2); // 100% chance of 1-2 leather + npcLoot.Add(ModContent.ItemType(), 12); // 8% chance to drop Tundra Leash LeadingConditionRule postCryo = npcLoot.DefineConditionalDropSet(DropHelper.PostCryo()); postCryo.Add(ModContent.ItemType()); } diff --git a/NPCs/NormalNPCs/WildBumblebirb.cs b/NPCs/NormalNPCs/WildBumblebirb.cs index 0670a351ec..e0f308ab27 100644 --- a/NPCs/NormalNPCs/WildBumblebirb.cs +++ b/NPCs/NormalNPCs/WildBumblebirb.cs @@ -80,6 +80,8 @@ namespace CalamityMod.NPCs.NormalNPCs float rotationMult = 4f; float rotationAmt = 0.04f; + NPC.ai[3]++; + if (Vector2.Distance(player.Center, NPC.Center) > 5600f) { if (NPC.timeLeft > 5) @@ -92,7 +94,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < Main.maxNPCs; i++) { - if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type) + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type && NPC.ai[3] >= 2) { Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center; if (otherSwarmerDirection.Length() < (NPC.width + NPC.height)) @@ -145,7 +147,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[0] = 1f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.ai[3] = 0f; } else if (swarmerIdleTargetDist.Length() > 400f) { @@ -190,7 +191,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[0] = 0f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; - NPC.ai[3] = 0f; } NPC.ai[2] += 0.0166666675f; diff --git a/NPCs/Noxus/Noxus.png b/NPCs/Noxus/Noxus.png deleted file mode 100644 index 95ec42e62c..0000000000 Binary files a/NPCs/Noxus/Noxus.png and /dev/null differ diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index b35bc6f9c9..5e565e819d 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -337,26 +337,11 @@ namespace CalamityMod.NPCs.Perforator // This is possibly the best or worst idea ever conceived if (Main.zenithWorld) { - float laserOffset = 1500f; - float laserVelocity = 4f; - int type = ModContent.ProjectileType(); - int damage = LaserWallDamage; - NPC.Calamity().newAI[3]++; if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast { if (NPC.Calamity().newAI[3] % 60 == 59) - { - SoundEngine.PlaySound(SoundID.Item12, player.Center); - for (int i = -7; i < 8; i++) // 15 lasers - { - float laserGap = (i * 128f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center + Main.rand.NextVector2CircularEdge(600, 600), Vector2.Zero, ModContent.ProjectileType(), LaserWallDamage, 0, Main.myPlayer, 0.45f, 180, Main.rand.Next(5)); if (NPC.Calamity().newAI[3] >= 300f) NPC.Calamity().newAI[3] = -300f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 4699dddf4c..5b48c83dd6 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -162,9 +162,9 @@ namespace CalamityMod.NPCs.Perforator // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; - bool spawnSmall = Main.getGoodWorld ? lifeRatio < 0.85f : lifeRatio < 0.75f; - bool spawnMedium = Main.getGoodWorld ? lifeRatio < 0.60f : lifeRatio < 0.50f; - bool spawnLarge = Main.getGoodWorld ? lifeRatio < 0.45f : lifeRatio < 0.25f; + bool spawnSmall = lifeRatio < 0.75f; + bool spawnMedium = lifeRatio < 0.50f; + bool spawnLarge = lifeRatio < 0.25f; if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f || !(player.ZoneCrimson || BossRushEvent.BossRushActive)) { @@ -332,16 +332,6 @@ namespace CalamityMod.NPCs.Perforator GeneralParticleHandler.SpawnParticle(blood); } - - if (Main.getGoodWorld && lifeRatio < 0.5f && Main.netMode != NetmodeID.MultiplayerClient) - { - if (lifeRatio > 0.35f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.2f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.05f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - } if (wormType != -1) { squashTimer = squashInterval; // Start scaling animation diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index e9c9606af2..c81061ba3e 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - NPC.damage = 70; // 140 + NPC.damage = 60; // 120 NPC.width = 22; NPC.height = 22; NPC.defense = 20; diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 2e39de458b..1c1c256a20 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 80; // 160 + NPC.damage = 70; // 140 NPC.width = 42; NPC.height = 42; NPC.defense = 20; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 0b9018bce2..ffe5aefd53 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -83,13 +83,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public static int StingerDamage = 28; // 112 - public static int NukeDamage = 35; // 140; Also applies to GFB Peanuts and Gauss Nukes + public static int StingerDamage = 25; // 100 + public static int NukeDamage = 30; // 120; Also applies to GFB Peanuts and Gauss Nukes public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 90; // 180 + NPC.damage = 75; // 150 NPC.npcSlots = 64f; NPC.width = 198; NPC.height = 198; @@ -1378,7 +1378,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath target.AddBuff(BuffID.Poisoned, 480); target.AddBuff(BuffID.Venom, 480); } - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index dc21b19b4f..1cb25c3921 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -21,7 +21,6 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 16; - NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -34,7 +33,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = 0; // 0 contact damage, projectile damage is handled separately + NPC.damage = 45; NPC.width = 56; NPC.height = 42; NPC.defense = 22; diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 597eded883..a15fe0bf0c 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -22,7 +22,6 @@ namespace CalamityMod.NPCs.SulphurousSea public const float CheckDistance = 480f; public override void SetStaticDefaults() { - NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); value.Position.Y += 4; value.PortraitPositionYOverride = 24f; @@ -32,7 +31,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = 0; // 0 contact damage, projectile damage is handled separately + NPC.damage = 45; NPC.width = 54; NPC.height = 42; NPC.defense = 25; diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png index eba5d41efc..2bba092f4a 100644 Binary files a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png and b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index a5fcdec89a..01165da0e4 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -103,10 +103,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool IsAtHp_Acceptance => NPC.life < 2; public bool IsAtBrothers => IsAtHp_BH3 && FinishedBH3; - public bool IsAtSeekers => IsAtHp_BH4 && FinishedBH4; + public bool IsAtSeekers => lifeRatio <= 0.2f; public bool IsAtSep2 => IsAtHp_BH5 && FinishedBH5; - public const int PermafrostAbsoluteZeroDamage = 3725; + public const int PermafrostAbsoluteZeroDamage = 1400; private const float PermafrostPhotonRipperDashVelocity = 6f; private const float PermafrostPhotonRipperMinDistanceFromTarget = 64f; private const float PermafrostPhotonRipperDashAcceleration = 0.3f; @@ -119,20 +119,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool canDespawn = false; public bool despawnProj = false; public bool startText = false; - public bool startBattle = false; //100% - public bool hasSummonedSepulcher1 = false; //100% - public bool startSecondAttack = false; //80% - public bool startThirdAttack = false; //60% - public bool halfLife = false; //40% - public bool startFourthAttack = false; //30% - public bool secondStage = false; //20% - public bool startFifthAttack = false; //10% - public bool gettingTired = false; //8% - public bool hasSummonedSepulcher2 = false; //8% - public bool gettingTired2 = false; //6% - public bool gettingTired3 = false; //4% - public bool gettingTired4 = false; //2% - public bool gettingTired5 = false; //1% + public bool startBattle = false; + public bool hasSummonedSepulcher1 = false; + public bool startSecondAttack = false; + public bool startThirdAttack = false; + public bool halfLife = false; + public bool startFourthAttack = false; + public bool hasSummonedSeekers = false; + public bool startFifthAttack = false; + public bool gettingTired = false; + public bool hasSummonedSepulcher2 = false; + public bool gettingTired2 = false; + public bool gettingTired3 = false; + public bool gettingTired4 = false; + public bool gettingTired5 = false; public bool willCharge = false; public bool canFireSplitingFireball = true; public bool fireFireblastFirst = true; @@ -164,6 +164,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public int preventionPause = 15; // Helps prevent telefragging public int attackPause = 0; public bool respawnBro = true; // Master Mode change + public bool teleport = false; //Used to teleport SCal to the center of the arena at the start of each bullet hell public float shieldOpacity = 1f; public float shieldRotation = 0f; @@ -364,7 +365,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(startFourthAttack); writer.Write(startFifthAttack); writer.Write(halfLife); - writer.Write(secondStage); + writer.Write(hasSummonedSeekers); writer.Write(hasSummonedSepulcher2); writer.Write(gettingTired); writer.Write(gettingTired2); @@ -416,7 +417,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas startFourthAttack = reader.ReadBoolean(); startFifthAttack = reader.ReadBoolean(); halfLife = reader.ReadBoolean(); - secondStage = reader.ReadBoolean(); + hasSummonedSeekers = reader.ReadBoolean(); hasSummonedSepulcher2 = reader.ReadBoolean(); gettingTired = reader.ReadBoolean(); gettingTired2 = reader.ReadBoolean(); @@ -490,9 +491,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - // Used for Scal's teleport at the start of brothers phase - bool teleport = false; - // permafrost and zenith scal are mutually exclusive bool zenithAI = Main.zenithWorld && !permafrost; @@ -1046,7 +1044,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; - + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH2 if (bulletHellCounter2 == (SecondBulletHellEndValue - 360)) BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); @@ -1073,6 +1081,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + teleport = false; } #endregion @@ -1177,7 +1187,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; - + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH3 if (bulletHellCounter2 == (ThirdBulletHellEndValue - 360)) BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); @@ -1204,6 +1224,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + teleport = false; } #endregion @@ -1353,6 +1375,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH4 if (bulletHellCounter2 == (FourthBulletHellEndValue - 360)) @@ -1380,6 +1413,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + teleport = false; } #endregion @@ -1508,7 +1543,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.damage = 0; NPC.chaseable = false; NPC.dontTakeDamage = true; - + //At the start of the bullet hell, teleport Scal to the center of the arena + if (!teleport) + { + Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) + Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); + NPC.velocity = Vector2.Zero; + NPC.Center = goalPos; + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + teleport = true; + } #region BulletHellEndTelegraphBH5 if (bulletHellCounter2 == (FifthBulletHellEndValue - 360)) BulletHellRumbleSlot = SoundEngine.PlaySound(BulletHellSound, player.Center); @@ -1535,6 +1580,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); + //Reset the teleport bool for the next bullet hell + //Technically not needed but I wanted to be safe + teleport = false; } #endregion @@ -2070,7 +2118,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (IsAtSeekers) { - if (!secondStage) + if (!hasSummonedSeekers) { if (!BossRushEvent.BossRushActive) { @@ -2113,7 +2161,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact, player.Center); - secondStage = true; + hasSummonedSeekers = true; } } @@ -2134,37 +2182,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas enteredBrothersPhase = true; attackCastDelay = brothersSpawnCastTime; NPC.netUpdate = true; - if (!teleport) - { - Vector2 goalPos = new Vector2(spawnX + (death ? 1000 : 1250), spawnY + (death ? 1000 : 1250)); // player.Center + new Vector2(0, -175) - Dust.QuickDustLine(NPC.Center, goalPos + new Vector2(0, -20), 500f, permafrost ? Color.Cyan : Color.Red); - NPC.velocity = Vector2.Zero; - NPC.Center = goalPos; - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); - GeneralParticleHandler.SpawnParticle(pulse); - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == bulletHellblast || - projectile.type == barrage || - projectile.type == wave) - { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - else if (projectile.type == fireblast || projectile.type == gigablast) - { - projectile.ai[2] = 1f; - - if (projectile.timeLeft > 15) - projectile.timeLeft = 15; - } - } - } - teleport = true; - } } else { @@ -2743,13 +2760,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) { - NPC.velocity *= 0.98f; + NPC.velocity *= 0f; if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) NPC.velocity.X = 0f; if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) NPC.velocity.Y = 0f; } + FrameType = FrameAnimationType.Casting; } #endregion #region LastStage @@ -3458,6 +3476,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath2") with { Pitch = -0.2f }, catastropheSpawnPosition); hasSummonedBrothers = true; } + + NPC.velocity *= 0f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + + FrameType = FrameAnimationType.Casting; } public void ConnectAllBrimstoneHearts(List heartIndices) 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/SupremeCalamitas/SupremeCalamitasHooded.png b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png index 0d99e8edfa..eae9fb6ec7 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png and b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.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/TownNPCs/TownPiggy.cs b/NPCs/TownNPCs/TownPiggy.cs new file mode 100644 index 0000000000..3c15194e38 --- /dev/null +++ b/NPCs/TownNPCs/TownPiggy.cs @@ -0,0 +1,205 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class TownPiggy : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 13; + NPCID.Sets.ExtraFramesCount[Type] = 0; + NPCID.Sets.AttackFrameCount[Type] = 0; + NPCID.Sets.DangerDetectRange[Type] = 250; + NPCID.Sets.HatOffsetY[Type] = -4; + NPCID.Sets.ShimmerTownTransform[Type] = false; + NPCID.Sets.SpecificDebuffImmunity[Type][BuffID.Shimmer] = true; + NPCID.Sets.SpecificDebuffImmunity[Type][BuffID.Confused] = true; + NPCID.Sets.NPCFramingGroup[Type] = 8; + + NPCID.Sets.IsTownPet[Type] = true; + NPCID.Sets.CannotSitOnFurniture[Type] = false; + NPCID.Sets.TownNPCBestiaryPriority.Add(Type); + NPCID.Sets.PlayerDistanceWhilePetting[Type] = 32; + NPCID.Sets.IsPetSmallForPetting[Type] = true; + + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new() + { + Velocity = 0.25f, + }; + + NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, drawModifiers); + } + + public override void SetDefaults() + { + NPC.townNPC = true; + NPC.friendly = true; + NPC.width = 20; + NPC.height = 20; + NPC.aiStyle = NPCAIStyleID.Passive; + AIType = NPCID.TownBunny; + NPC.damage = 0; + NPC.defense = 0; + NPC.lifeMax = 50; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.5f; + NPC.housingCategory = 1; + DrawOffsetY = -4; + } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange( + [ + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.TownPiggy") + ]); + } + + public override bool CanTownNPCSpawn(int numTownNPCs) + { + if (CalamityWorld.unlockedTownPig) + { + return true; + } + return false; + } + + public override void AI() + { + NPC.spriteDirection = NPC.direction; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + // Put a gold crown on Techno + if (NPC.GivenName == this.GetLocalizedValue("Name.Techno") && !BirthdayParty.PartyIsUp) + { + int equipID = ArmorIDs.Head.GoldCrown; + Main.instance.LoadArmorHead(equipID); + Texture2D crown = TextureAssets.ArmorHead[equipID].Value; + Rectangle crownFrame = crown.Frame(1, 20, 0, 0); + int frameHeight = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; + int curFrame = NPC.frame.Y / frameHeight; + int sheetOff = curFrame switch + { + 0 => 0, + 1 => -2, + 2 => -6, + 3 => -6, + 4 => -2, + 5 => -4, + 6 => -6, + 7 => -2, + _ => 0 + }; + spriteBatch.Draw(crown, NPC.Center - screenPos + new Vector2(8 * NPC.spriteDirection, -2 + NPC.gfxOffY + sheetOff).RotatedBy(NPC.rotation), crownFrame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(crown.Width / 2, crown.Height / 40), NPC.scale, NPC.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + } + + public override void FindFrame(int frameHeight) + { + // Sleep animation + if (NPC.ai[0] >= 20f && NPC.ai[0] <= 22f) + { + if (NPC.velocity.Y == 0) + { + if (NPC.ai[1] > 30f && (NPC.frame.Y < frameHeight * 8)) + { + NPC.frame.Y = frameHeight * 8; + } + if (NPC.frame.Y > 0) + { + NPC.frameCounter++; + } + if (NPC.frameCounter > 6) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y > 12 * frameHeight) + { + NPC.frame.Y = frameHeight * 8; + } + } + } + else if (NPC.velocity.X == 0) + { + NPC.frame.Y = 0; + } + else + { + if (NPC.velocity.Y == 0) + { + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + } + if (NPC.frame.Y < frameHeight) + NPC.frame.Y = frameHeight; + if (NPC.frame.Y > frameHeight * 7) + NPC.frame.Y = frameHeight; + } + } + + public override List SetNPCNameList() => new List() + { + // Original names + this.GetLocalizedValue("Name.Curly"), + + // Reference names + this.GetLocalizedValue("Name.Oolong"), // Dragon Ball + this.GetLocalizedValue("Name.Napoleon"), // Animal Farm + this.GetLocalizedValue("Name.Waddles"), // Gravity Falls + this.GetLocalizedValue("Name.Crenando"), // Ganondorf + this.GetLocalizedValue("Name.Olivia"), // Olivia + this.GetLocalizedValue("Name.Wilbur"), // Charlotte's Web + this.GetLocalizedValue("Name.Pumbaa"), // The Lion King + this.GetLocalizedValue("Name.Peppa"), // Peppa Pig + this.GetLocalizedValue("Name.Conan"), // Conan the mighty pig + this.GetLocalizedValue("Name.Reuben"), // Minecraft: Story Mode + this.GetLocalizedValue("Name.Porky"), // Looney Tunes + this.GetLocalizedValue("Name.Hamm"), // Toy Story + this.GetLocalizedValue("Name.Runt"), // Chicken Little + this.GetLocalizedValue("Name.Roko"), // Roko's Basilisk + this.GetLocalizedValue("Name.RichardHam"), // Pig from Clarkson's Farm named after Richard Hammond + this.GetLocalizedValue("Name.Techno"), // Technoblade + this.GetLocalizedValue("Name.JohnPork"), // John Pork + this.GetLocalizedValue("Name.Piglet"), // Winnie-the-Pooh + + // Dedicated names + }; + + public override string GetChat() + { + WeightedRandom chat = new(); + + for (int i = 0; i <= 2; i++) + { + chat.Add(CalamityUtils.GetText("NPCs.TownPiggy.Chat." + i).Value); + } + + return chat; + } + + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("UI.PetTheAnimal"); + } + } +} diff --git a/NPCs/TownNPCs/TownPiggy.png b/NPCs/TownNPCs/TownPiggy.png new file mode 100644 index 0000000000..ae68308cdf Binary files /dev/null and b/NPCs/TownNPCs/TownPiggy.png differ diff --git a/NPCs/TownNPCs/TownPiggy_Head.png b/NPCs/TownNPCs/TownPiggy_Head.png new file mode 100644 index 0000000000..a31c29b619 Binary files /dev/null and b/NPCs/TownNPCs/TownPiggy_Head.png differ diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs index a41c9c6511..f011ff78bd 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs @@ -352,6 +352,8 @@ public class BrainOfCthulhuAI : VanillaAIOverride NPC.defense = NPC.defDefense; NPC.chaseable = (AIState != BrainAIState.IllusionDash && AIState != BrainAIState.IllusionTrick); + if (Main.getGoodWorld && AIState >= BrainAIState.Phase2TransitionOpen) + NPC.brainOfGravity = NPC.whoAmI; } else NPC.defense = (int)(NPC.defDefense * Phase1DefenseMultiplier); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 870dd18391..972bc16f13 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -155,18 +155,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Start other phases; if arms are dead, start with spin phase if (phase2 || Main.getGoodWorld || allArmsDead) { - // Start spin phase after 1.5 seconds + // Start spin phase after 1.5 seconds if close enough; forced after 4.5 seconds NPC.ai[2] += phase3 ? 1.5f : 1f; if (NPC.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f))) { - bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[NPC.target].position.Y - 320f && - Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 400f; + bool shouldSpinAround = NPC.ai[1] == 4f && ((NPC.position.Y < Main.player[NPC.target].position.Y - 320f && + Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 400f) || + NPC.ai[2] >= (270f - (death ? 15f * (1f - lifeRatio) : 0f))); if (shouldSpinAround || NPC.ai[1] != 4f) { if (shouldSpinAround) { - NPC.localAI[3] = 300f; + NPC.localAI[3] = 200f; NPC.localAI[1] = 0; NPC.SyncVanillaLocalAI(); } @@ -309,7 +310,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityUtils.CalamityTargeting(NPC, CalamityTargetingParameters.BossDefaults); NPC.ai[2] = 0f; - NPC.ai[1] = 4f; + // Fly overhead and spit missiles if on low health + NPC.ai[1] = phase3 ? 6f : 4f; NPC.localAI[0] = 0f; } @@ -475,7 +477,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spin for about 3 seconds // Decreasing this number will INCREASE how fast he moves while spinning - float spinVelocity = 30f; + float spinVelocity = 25f; if (NPC.ai[2] == 2f) { // Play angry noise @@ -540,8 +542,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); - // Fly overhead and spit missiles if on low health - NPC.ai[1] = phase3 ? 6f : 1f; + NPC.ai[1] = 1f; NPC.ai[2] = 0f; NPC.localAI[3] = 0f; NPC.localAI[0] = 0f; @@ -590,8 +591,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (NPC.localAI[0] >= totalMissiles) { - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; + NPC.ai[1] = 4f; + NPC.ai[2] = -60f; NPC.localAI[3] = 0f; calamityGlobalNPC.newAI[0] = 0f; NPC.localAI[0] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index f30880b7a5..227077741e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -253,7 +253,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; - float delayBeforeChargingAgain = death ? 48f : 56f; + float delayBeforeChargingAgain = death ? 50f : 60f; if (NPC.ai[2] >= delayBeforeChargingAgain) { NPC.ai[3] += 1f; @@ -314,21 +314,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.rotation += NPC.ai[2]; NPC.ai[1] += 1f; - if (death && NPC.ai[2] >= 0.2f) - { - if (NPC.ai[1] % 10f == 0f) - { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.DeathLaser; - - Vector2 projectileVelocity = NPC.rotation.ToRotationVector2() * 7f; - float offset = 90f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projectileVelocity) * offset, projectileVelocity, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer); - } - } - } if (NPC.ai[1] == 100f) { @@ -620,7 +605,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (NPC.ai[1] == 4f) { float chargeLineUpDistance = spazAlive ? 600f : 500f; - float chargeSpeed = (death ? 20f : 18f) + (death ? 1.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = death ? 5f : 3f; float chargeAcceleration = death ? 0.495f : 0.45f; if (spazAlive) @@ -844,7 +829,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Rotation and velocity NPC.rotation = hoverRotation; - float chargeSpeed = death ? 19.25f + (phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 18f; + float chargeSpeed = 16f; + if (death) + chargeSpeed += (phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))); if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -935,20 +922,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.rotation += NPC.ai[2]; NPC.ai[1] += 1f; - if (death && NPC.ai[2] >= 0.2f) - { - if (NPC.ai[1] % 10f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = NPC.ai[1] % 20f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); - - Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, FireballDamage.CalculateMechDamage(), 0f, Main.myPlayer, 0f, 1f); - Main.projectile[proj].tileCollide = false; - } - } - } if (NPC.ai[1] == 100f) { @@ -1025,10 +998,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!NPC.IsMechQueenUp) { - // Boost speed if too far from target - if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); - if (Main.getGoodWorld) { maxVelocity *= 1.15f; 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/Packets/Entities/SyncTownPigLicensePacket.cs b/Packets/Entities/SyncTownPigLicensePacket.cs new file mode 100644 index 0000000000..4b5c3f865b --- /dev/null +++ b/Packets/Entities/SyncTownPigLicensePacket.cs @@ -0,0 +1,20 @@ +using System.IO; +using CalamityMod.Items.SummonItems.TownPets; +using CalamityMod.NPCs.Abyss; +using Terraria; + +namespace CalamityMod.Packets +{ + internal sealed class SyncTownPigLicensePacket : CalamityPacket + { + public static SyncTownPigLicensePacket Instance { get; private set; } + + public static void Send(int toClient = -1, int ignoreClient = -1) + { + var packet = Instance.CreateBasePacket(); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) => TheHousingContract.SpawnPiggy(); + } +} diff --git a/Packets/Players/TheElixirTeleportSyncPacket.cs b/Packets/Players/TheElixirTeleportSyncPacket.cs new file mode 100644 index 0000000000..ce86f534a9 --- /dev/null +++ b/Packets/Players/TheElixirTeleportSyncPacket.cs @@ -0,0 +1,47 @@ +using System.IO; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Packets +{ + internal class TheElixirTeleportSyncPacket : CalamityPacket + { + public static TheElixirTeleportSyncPacket Instance { get; private set; } + + public static void Send(Player player, int locationIndex = -1, int toClient = -1, int ignoreClient = -1) + { + if (player is null || locationIndex == -1) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(player); + packet.Write(locationIndex); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(BinaryReader packet, int sender) + { + var player = packet.ReadPlayer(); + var locationIndex = packet.ReadInt32(); + + if (player is null) + return; + + Vector2? location = locationIndex switch + { + 1 => CalamityPlayer.GetAbyssVoidTeleportPosition(player), + 2 => CalamityPlayer.GetTempleTeleportPosition(player), + _ => CalamityPlayer.GetDungeonArchivesTeleportPosition(player) + }; + + if (!location.HasValue) + return; + + player.AddBuff(BuffID.ChaosState, 300, false); + player.AddBuff(BuffID.Cursed, 300, false); + CalamityPlayer.ModTeleport(player, location.Value, false, TeleportationStyleID.RecallPotion); + } + } +} 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/CustomPulsingSpark.cs b/Particles/CustomPulsingSpark.cs new file mode 100644 index 0000000000..6723387a75 --- /dev/null +++ b/Particles/CustomPulsingSpark.cs @@ -0,0 +1,156 @@ +using System; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class CustomPulsingSpark : Particle + { + public Color InitialColor; + public Color BackColor; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public float GlowCenterScale = 1; + public float GlowOpacity = 1; + public Texture2D NewTexture; + public Texture2D NewTextureBack; + public float ExtraRotation; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public float ShrinkSpeed = 0; + public bool FlipHorizontal = false; + public bool NoShrink = false; + public float Spin = 0; + public float ColorFadeSpeed = 0; + public int PulseRate; + public int randTimeAdd = 0; + + public float SineRate = 0; + public float SineIntensity = 0; + public float Sine = 0; + public float SineRotation = 0; + public float TurnRate = 0; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool AltVisual = true; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public CustomPulsingSpark(Vector2 relativePosition, Vector2 velocity, string frontTexture, string backTexture, bool affectedByGravity, int lifetime, float scale, Color color, Color backColor, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, int pulseRate = 10, float turnRate = 0, float sineRate = 1, float sineIntensity = 0, float sineRotation = 0, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3) + { + Position = relativePosition; + Velocity = velocity; + NewTexture ??= ModContent.Request(frontTexture).Value; + NewTextureBack ??= ModContent.Request(backTexture).Value; + ExtraRotation = extraRotation; + AffectedByGravity = affectedByGravity; + AffectedByLight = affectedByLight; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + BackColor = backColor; + ShrinkSpeed = shrinkSpeed; + PulseRate = pulseRate; + + AltVisual = useAddativeBlend; + GlowCenter = glowCenter; + GlowCenterScale = glowCenterScale; + GlowOpacity = glowOpacity; + FlipHorizontal = flipHorizontal; + NoShrink = noShrink; + + FadeIn = fadeIn; + randTimeAdd = Main.rand.Next(0, 200 + 1); + SineRate = sineRate; + SineIntensity = sineIntensity; + SineRotation = sineRotation; + TurnRate = turnRate; + + if (FadeIn) + Scale = 0f; + Spin = spin; + ColorFadeSpeed = colorFadeSpeed; + } + + public override void Update() + { + if (!FadeIn) + { + if (!NoShrink) + Scale *= 0.95f; + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + ExtraRotation += Spin; + Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; + + Sine = (float)Math.Sin(((Time + randTimeAdd) * SineRate) / MathHelper.Pi) * SineIntensity; + if (TurnRate != 0) + Velocity = Velocity.RotatedBy(TurnRate); + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float pulseScale = 1 + Utils.Remap(Time % PulseRate, 0, PulseRate, 0, 0.85f); + Vector2 adjustedSquash = new Vector2(Math.Max(Stretch.X - 0.4f, 0.1f), Math.Max(Stretch.Y + 0.4f, 0.1f)); + Vector2 scale = adjustedSquash * Scale * pulseScale; + + float scaleMult = 1; + Color col = Color; + Color backCol = BackColor; + + Vector2 drawPos = Position + Vector2.UnitX.RotatedBy(SineRotation) * Sine; + if (AffectedByLight) + { + col = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(Color); + backCol = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(BackColor); + } + + if (Pixelate) + { + PixelationManager.AddPixelatedDrawer((_) => + { + float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed)); + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + if (GlowCenter) + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f)); + spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + }, Enums.GeneralDrawLayer.AfterProjectiles, UseAdditiveBlend ? BlendState.Additive : null); + } + else + { + float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed)); + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + if (GlowCenter) + spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f)); + spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + } + } + } +} 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/Particles/LemonNadeExplode.png b/Particles/LemonNadeExplode.png new file mode 100644 index 0000000000..85a849c338 Binary files /dev/null and b/Particles/LemonNadeExplode.png differ 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..8484b58f4f --- /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.66f; + public override float sizeMult => 2f; + } + 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/BaseProjectiles/BaseSwordHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs index 344bf53445..81a55e025a 100644 --- a/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.Graphics.Primitives; -using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -117,7 +116,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// Whether or not this should get melee speed bonuses /// Defaults to TRUE ///
- public virtual bool useMeleeSpeed { get; set; } = true; + public virtual bool useAttackSpeed { get; set; } = true; /// /// Whether or not this should get melee size bonuses (Titan Glove) @@ -333,9 +332,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles StartupTime *= Projectile.MaxUpdates; CooldownTime *= Projectile.MaxUpdates; swingTime *= Projectile.MaxUpdates; - if (useMeleeSpeed) + if (useAttackSpeed) { - var speed = Main.player[Projectile.owner].GetAttackSpeed(); + var speed = Main.player[Projectile.owner].GetTotalAttackSpeed(Projectile.DamageType); if (speed > 3f) speed = 3f; @@ -352,8 +351,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles } if (useMeleeSize) { - if (player.meleeScaleGlove) Projectile.scale *= 1.1f; - Projectile.scale *= player.HeldItem.scale; + Projectile.scale *= player.GetMeleeScale(); } baseScale = Projectile.scale; ExistsTime = swingTime + StartupTime + CooldownTime; diff --git a/Projectiles/Boss/BrainOfCthulhu/BloodScythe.cs b/Projectiles/Boss/BrainOfCthulhu/BloodScythe.cs index 93eef1ad99..083822adac 100644 --- a/Projectiles/Boss/BrainOfCthulhu/BloodScythe.cs +++ b/Projectiles/Boss/BrainOfCthulhu/BloodScythe.cs @@ -91,12 +91,9 @@ public class BloodScythe : ModProjectile, ILocalizedModType public override bool PreDraw(ref Color lightColor) { - Main.spriteBatch.SetBlendState(BlendState.Additive); Texture2D tex = TextureAssets.Projectile[Type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition; - Color drawColor = Color.Red; - if (!ChildSafety.Disabled) - drawColor = Main.DiscoColor; + Color drawColor = (ChildSafety.Disabled ? Color.Red : Main.DiscoColor) with { A = 0 }; for (int i = 0; i < (CalamityClientConfig.Instance.Afterimages ? Projectile.oldPos.Length : 1); ++i) { @@ -107,11 +104,9 @@ public class BloodScythe : ModProjectile, ILocalizedModType // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. float interpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.spriteBatch.Draw(tex, drawPos, null, drawColor, afterimageRot, tex.Size() * 0.5f, Projectile.scale * interpolant, SpriteEffects.None, 0f); + Main.EntitySpriteDraw(tex, drawPos, null, drawColor, afterimageRot, tex.Size() * 0.5f, Projectile.scale * interpolant, SpriteEffects.None); } - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - return false; } } 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/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index c3f0496bcf..1b9965b71d 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -88,6 +88,11 @@ namespace CalamityMod.Projectiles.Boss } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 360); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0) 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 3b43087db5..819d0a7cbc 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; @@ -16,6 +17,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 +36,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 +61,7 @@ using Terraria.WorldBuilding; using static Terraria.ModLoader.ModContent; using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech; + namespace CalamityMod.Projectiles { public partial class CalamityGlobalProjectile : GlobalProjectile @@ -265,6 +269,10 @@ namespace CalamityMod.Projectiles /// If true, this projectile is from a rogue stealth strike. The primary variable responsible for triggering stealth strike effects. public bool stealthStrike = false; /// + /// If true, this projectile is spawned from a stealth strike, but is not a primary projectile. Used to avoid proccing things like Raiders Talisman. + /// + public bool stealthStrikeSubProjectile = false; + /// /// Number of times this stealth strike projectile has pierced an enemy.
/// Used to limit the number of times a projectile can proc certain effects from rogue accessories. ///
@@ -341,7 +349,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. @@ -381,6 +390,9 @@ namespace CalamityMod.Projectiles grapeBeer = true; } + // Apply some parent information to children + if (parent.Calamity().ParentNPCIndex != -1) + ParentNPCIndex = parent.Calamity().ParentNPCIndex; if (parent.Calamity().IgnoreBoCIllusions) IgnoreBoCIllusions = true; @@ -412,9 +424,22 @@ namespace CalamityMod.Projectiles if (e.Context == "SetBonus_GhostHurt") projectile.damage /= 2; } + + if (source is EntitySource_Parent { Entity: Projectile proj }) + { + if (proj.Calamity().stealthStrike || proj.Calamity().stealthStrikeSubProjectile) + stealthStrikeSubProjectile = true; + } + + } + public override void SendExtraAI(Projectile projectile, BitWriter bitWriter, BinaryWriter binaryWriter) + { + binaryWriter.Write(ParentNPCIndex); + } + public override void ReceiveExtraAI(Projectile projectile, BitReader bitReader, BinaryReader binaryReader) + { + ParentNPCIndex = binaryReader.ReadInt32(); } - public override void SendExtraAI(Projectile projectile, BitWriter bitWriter, BinaryWriter binaryWriter) => binaryWriter.Write(ParentNPCIndex); - public override void ReceiveExtraAI(Projectile projectile, BitReader bitReader, BinaryReader binaryReader) => ParentNPCIndex = binaryReader.ReadInt32(); #endregion On Spawn #region Set Defaults @@ -457,11 +482,11 @@ namespace CalamityMod.Projectiles HomingTarget = -1; #region Vanilla Summons AI Changes - // - // MINION AI CHANGES: - // + // + // MINION AI CHANGES: + // - // Hornet Staff's minion changes. + // Hornet Staff's minion changes. if (projectile.type == ProjectileID.Hornet) return HornetMinionAI.DoHornetMinionAI(projectile); @@ -489,37 +514,16 @@ namespace CalamityMod.Projectiles if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == ProjAIStyleID.Yoyo) { // Store damage on first frame - if (projectile.ai[2] == 0f) - projectile.ai[2] = projectile.damage; + if (projectile.localAI[2] == 0f) + projectile.localAI[2] = projectile.damage; - // Find the first yoyo projectile owned by the corresponding player - // Limited lifespan yoyos are horrendous so it had to be this way - // EDIT: ownedProjectileCounts does not work what the fuck - int MainYoyo = -1; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile proj = Main.projectile[x]; - if (proj.active && proj.type == projectile.type && proj.owner == projectile.owner) - { - MainYoyo = x; - break; - } - } + var MainYoyo = Main.projectile.First(x => x.active && x.type == projectile.type && x.owner == projectile.owner).whoAmI; // Halve damage if not the main yoyo if (projectile.whoAmI != MainYoyo) - projectile.damage = (int)(projectile.ai[2] * 0.5f); + projectile.damage = (int)(projectile.localAI[2] * 0.5f); else - projectile.damage = (int)projectile.ai[2]; - } - - // This code fixes the wacky close-up burst damage bug which occurs with double yoyos and local iframes. - // Oh my good friends, do not ask me how or why this works, for I do not know! - // That being said, PLEASE DON'T REMOVE THIS, unless you think The Microwave killing Provi in 2 seconds with no effort is okay. - if (projectile.aiStyle == ProjAIStyleID.Yoyo) - { - if (projectile.ai[0] == -1) - projectile.Kill(); + projectile.damage = (int)projectile.localAI[2]; } if (projectile.minion && ExplosiveEnchantCountdown > 0) @@ -794,6 +798,12 @@ namespace CalamityMod.Projectiles return false; } + // This has extra updates but increments lifespan through AI slots, so we need to offset that + else if (projectile.type == ProjectileID.WeatherPainShot) + { + if (!projectile.FinalExtraUpdate()) + projectile.ai[1]--; + } else if (projectile.type == ProjectileID.BloodShot) { @@ -2569,7 +2579,7 @@ namespace CalamityMod.Projectiles projectile.velocity *= scaleFactor2; projectile.velocity *= 0.99f; - + if (projectile.ai[0] % (death ? 20f : 30f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector50 = projectile.rotation.ToRotationVector2(); @@ -2941,6 +2951,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) @@ -3070,6 +3083,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: @@ -3345,7 +3359,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; @@ -3547,7 +3560,7 @@ namespace CalamityMod.Projectiles if (owner.HasBuff(BuffID.WellFed2)) { var bIndex = owner.FindBuffIndex(BuffID.WellFed2); - if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) { owner.buffTime[bIndex] += 300; } @@ -3716,6 +3729,56 @@ 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 @@ -3875,20 +3938,14 @@ namespace CalamityMod.Projectiles } #region Flail Extendo Hacks - // Very hacky solution for making Dao of Pow's flail throw travel farther and faster + // Very hacky solution for making Dao of Pow's flail throw travel faster if (projectile.type == ProjectileID.TheDaoofPow) { // Guide to ai[0]: // 0: Spinning. 1: Being thrown. 2: Return after throw. 6: Dropped on ground. 4: Return after being dropped. if (projectile.ai[0] == 1f) { - if (projectile.ai[1] > 0f) - { - projectile.ai[2]++; - if (projectile.ai[2] <= 11f) // When ai[1] reaches 14, it starts returning, so this makes it take an extra 11 frames to return - projectile.ai[1]--; - } - else + if (projectile.ai[1] == 0f) projectile.velocity *= 1.33f; } } @@ -3910,15 +3967,10 @@ namespace CalamityMod.Projectiles { if (projectile.ai[0] == 1f) { - if (projectile.ai[1] > 0f) - { - projectile.ai[2]++; - if (projectile.ai[2] <= 5f) // When ai[1] reaches 12, it starts returning, so this makes it take an extra 5 frames to return - projectile.ai[1]--; - } - else - projectile.velocity *= 1.33f; + if (projectile.ai[1] == 0f) + projectile.velocity *= 1.25f; } + // Return speed is also increased using an IL edit, because why does it have a slower return speed than Dao of Pow??? } #endregion @@ -4321,14 +4373,16 @@ namespace CalamityMod.Projectiles if (grapeBeerHomingTarget == target.whoAmI) { grapeBeerHomingPower += 0.004f; - } else { + } + else + { 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) @@ -4564,8 +4618,8 @@ namespace CalamityMod.Projectiles { for (int i = 0; i < 8; i++) { - Particle floweyFromHitGameUndertale = new CustomSpark(player.Center, Utils.DirectionTo(player.Center, player.Calamity().mouseWorld).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 11f), - "CalamityMod/Particles/MiniFlower", false, Main.rand.Next(65, 78 + 1), Main.rand.NextFloat(1.8f, 2.8f), + Particle floweyFromHitGameUndertale = new CustomSpark(player.Center, Utils.DirectionTo(player.Center, player.Calamity().mouseWorld).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 11f), + "CalamityMod/Particles/MiniFlower", false, Main.rand.Next(65, 78 + 1), Main.rand.NextFloat(1.8f, 2.8f), Color.Lerp(Color.HotPink, Color.Plum, Main.rand.NextFloat(0, 0.65f)), new Vector2(1f, 1f), true, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi)); GeneralParticleHandler.SpawnParticle(floweyFromHitGameUndertale); @@ -4581,15 +4635,15 @@ namespace CalamityMod.Projectiles } public override void GrapplePullSpeed(Projectile projectile, Player player, ref float speed) { + if (player.Calamity().bloomStone) + speed += 6f; float mult = 1f; if (player.Calamity().reaverSpeed) mult += ReaverHeadMobility.SetBonusHookBoost; if (player.Calamity().tungstenArmorHookBoost) mult += TungstenArmorSetChange.HookBoost; - if (player.Calamity().bloomStone) - mult += 0.5f; - speed *= mult; + speed *= mult; if (player.velocity.Length() > 2f) { player.Calamity().hookPullVisuals = 60; @@ -4597,13 +4651,13 @@ namespace CalamityMod.Projectiles } public override void GrappleRetreatSpeed(Projectile projectile, Player player, ref float speed) { + if (player.Calamity().bloomStone) + speed += 6f; float mult = 1f; if (player.Calamity().reaverSpeed) mult += ReaverHeadMobility.SetBonusHookBoost; if (player.Calamity().tungstenArmorHookBoost) mult += TungstenArmorSetChange.HookBoost; - if (player.Calamity().bloomStone) - mult += 0.5f; speed *= mult; } #endregion @@ -4622,28 +4676,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 @@ -4688,9 +4743,7 @@ namespace CalamityMod.Projectiles else if (modPlayer.vampiricTalisman && projectile.Calamity().stealthStrike) { target.AddBuff(BuffType(), VampiricTalisman.ArmorCrunchDebuffTime); - - if (!modPlayer.nanotech) - target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); + target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); } if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) @@ -4744,25 +4797,51 @@ namespace CalamityMod.Projectiles } // Scuttler's Jewel projectiles can spawn either on-hit or on-kill, but only spawn once per projectile. - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.CountsAsClass() && modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0 && !JewelSpikeSpawned && !CannotProc) + if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.CountsAsClass() && !CannotProc) { - int damage = (int)player.GetTotalDamage().ApplyTo(16); + if (modPlayer.scuttlersJewel && stealthStrike && !JewelSpikeSpawned) + { + int damage = (int)player.GetTotalDamage().ApplyTo(16); - int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); - Main.projectile[spike].frame = 4; - if (spike.WithinBounds(Main.maxProjectiles)) - Main.projectile[spike].DamageType = DamageClass.Generic; - modPlayer.scuttlerCooldown = 30; - JewelSpikeSpawned = true; + int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); + Main.projectile[spike].frame = 4; + JewelSpikeSpawned = true; + } + if (modPlayer.etherealExtorter && extorterBoost && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) + { + for (int i = 0; i < 2; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + + int damage = (int)player.GetTotalDamage().ApplyTo(EtherealExtorter.soulDamage); + + int soul = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileType(), damage, 0f, projectile.owner); + Main.projectile[soul].tileCollide = false; + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].DamageType = DamageClass.Generic; + Main.projectile[soul].ArmorPenetration = 20; + } + extorterBoost = false; + } } + + } #endregion #region Modify Hit Player public override void ModifyHitPlayer(Projectile projectile, Player target, ref Player.HurtModifiers modifiers) - { + { modifiers.FinalDamage.Flat -= flatDR; modifiers.FinalDamage *= 1f - multiplicativeDR; + + // Reduce projectile damage if the enemy is inflicted with Whispering Death + if (ParentNPCIndex != -1) + { + NPC npc = Main.npc[(int)ParentNPCIndex]; + if (npc.active && npc.Calamity().whisperingDeath) + modifiers.FinalDamage *= 1f - WhisperingDeath.EnemyDamageReduction; + } } #endregion @@ -4782,7 +4861,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); @@ -5230,17 +5310,18 @@ namespace CalamityMod.Projectiles { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int damage = (int)player.GetTotalDamage().ApplyTo(20); + int damage = (int)player.GetTotalDamage().ApplyTo(EtherealExtorter.soulDamage); int soul = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileType(), damage, 0f, projectile.owner); Main.projectile[soul].tileCollide = false; if (soul.WithinBounds(Main.maxProjectiles)) Main.projectile[soul].DamageType = DamageClass.Generic; } + extorterBoost = false; } // Make sure the spike doesn't spawn again if it's already been spawned by on-hit. - if (modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0 && !JewelSpikeSpawned && !CannotProc) + if (modPlayer.scuttlersJewel && stealthStrike && !JewelSpikeSpawned && !CannotProc) { int damage = (int)player.GetTotalDamage().ApplyTo(16); @@ -5248,7 +5329,6 @@ namespace CalamityMod.Projectiles Main.projectile[spike].frame = 4; if (spike.WithinBounds(Main.maxProjectiles)) Main.projectile[spike].DamageType = DamageClass.Generic; - modPlayer.scuttlerCooldown = 30; } } } diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 2559da088c..ca674a3789 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ExplosiveBullet, Do(ExtraUpdatesDelta(+2), IDStaticIFrames(5), SingleHitImmunity) }, // Has an exception in Vanilla iframe code, uses 5 iframes { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150), DefaultIDStaticIFrames) }, - { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, + { ProjectileID.Flamarang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FlowerPetal, Do(MaxUpdatesExact(4), LocalIFrames(10)) }, // Orichalcum armor { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, @@ -188,6 +188,7 @@ namespace CalamityMod.Projectiles { ProjectileID.PalladiumDrill, standardDrillTweaks }, { ProjectileID.PartyBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.PurpleCounterweight, counterweightTweaks }, + { ProjectileID.PurpleLaser, Do(LocalIFrames(10 * 5)) }, // Laser Rifle, accounting for extra updates { ProjectileID.QueenSlimeGelAttack, Do(NoPiercing) }, { ProjectileID.QueenSlimeMinionPinkBall, Do(NoPiercing) }, { ProjectileID.RedCounterweight, counterweightTweaks }, @@ -213,7 +214,7 @@ namespace CalamityMod.Projectiles { ProjectileID.VenomSpider, Do( ExtraUpdatesExact(2), LocalIFrames(90)) }, //Spider Staff spiders. It has Venom, Dangerous, and Jumping spiders. { ProjectileID.VortexDrill, standardDrillTweaks }, { ProjectileID.Wasp, Do(PiercingExact(2)) }, - { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(3), TimeLeftExact(1920)) }, + { ProjectileID.WeatherPainShot, Do(ExtraUpdatesExact(3)) }, { ProjectileID.YellowCounterweight, counterweightTweaks }, #endregion @@ -491,7 +492,6 @@ namespace CalamityMod.Projectiles { ProjectileID.PulseBolt, defaultIFrames }, { ProjectileID.PureSpray, defaultIFrames }, { ProjectileID.PurificationPowder, defaultIFrames }, - { ProjectileID.PurpleLaser, defaultIFrames }, { ProjectileID.PygmySpear, defaultIFrames }, { ProjectileID.QuarterNote, defaultIFrames }, { ProjectileID.RainbowFlare, defaultIFrames }, 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/PulseGrenadeOrb.cs b/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs index 7ec723eb16..9453efdd6d 100644 --- a/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs +++ b/Projectiles/DraedonsArsenal/PulseGrenadeOrb.cs @@ -80,12 +80,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (time == 250 || Utils.Distance(Projectile.Center, Owner.Center) < 10) { - if (Projectile.ai[2] == 0 && Owner.HeldItem.type == ModContent.ItemType()) + if (Projectile.ai[2] == 0 && Owner.HeldItem.type == ModContent.ItemType() && Owner.controlUseItem) { - Projectile reformGrenade = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), goal, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0); + Projectile reformGrenade = Projectile.NewProjectileDirect(Owner.GetSource_ItemUse(Owner.HeldItem), goal, Vector2.Zero, ModContent.ProjectileType(), (int)Owner.GetTotalDamage().ApplyTo(Owner.HeldItem.damage), 0f, Owner.whoAmI, 0); reformGrenade.ai[1] = 5; reformGrenade.ai[0] = Owner.HeldItem.useTime * 0.7f; reformGrenade.Opacity = 0; + //Doze Apr 15 2026 - Because this isn't being spawnwed from the shoot, these bools break. Manually fixing here. + reformGrenade.Calamity().extorterBoost = true; + reformGrenade.Calamity().stealthStrikeSubProjectile = false; SoundStyle grab = new("CalamityMod/Sounds/Item/LightCatch"); SoundEngine.PlaySound(grab with { Volume = 1f, Pitch = 0 }, Projectile.Center); diff --git a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs index 2349a8ebe1..688343a936 100644 --- a/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseGrenadeProjectile.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.Center = Owner.Center; Projectile.extraUpdates = (Projectile.Calamity().stealthStrike ? 22 : 5); Projectile.rotation += Main.rand.NextFloat(-4, 4); - Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 9; + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 9 * Owner.Calamity().rogueVelocity; Projectile.velocity = velocity; if (Projectile.Calamity().stealthStrike) @@ -300,11 +300,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Do NOT change the damage of these here, do it on the on hit Projectile orb = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (vel * 7f).RotatedBy(MathHelper.PiOver4 / 2), ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0, spin, i); - orb.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; if (Projectile.Calamity().stealthStrike) { Projectile orb2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (vel * 10f), ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, 0, -spin, i + 1); - orb2.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } } @@ -338,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/Environment/MurkySteam.cs b/Projectiles/Environment/MurkySteam.cs index 7a08be9d5c..d98779f782 100644 --- a/Projectiles/Environment/MurkySteam.cs +++ b/Projectiles/Environment/MurkySteam.cs @@ -42,7 +42,9 @@ namespace CalamityMod.Projectiles.Environment public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (info.Damage <= 0) + // CIT 23MAY2026: Vanilla's logic for granting "Burning immunity" is incredibly stupid because Player.fireWalk actually just prevents running hot tile touch code. + // Thus we must add a manual check for Player.fireWalk here too. + if (info.Damage <= 0 || target.fireWalk) return; target.AddBuff(BuffID.Burning, 180); diff --git a/Projectiles/Environment/ThermalSteam.cs b/Projectiles/Environment/ThermalSteam.cs index 4539d420a9..84c4fdeeb2 100644 --- a/Projectiles/Environment/ThermalSteam.cs +++ b/Projectiles/Environment/ThermalSteam.cs @@ -42,7 +42,9 @@ namespace CalamityMod.Projectiles.Environment public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (info.Damage <= 0) + // CIT 23MAY2026: Vanilla's logic for granting "Burning immunity" is incredibly stupid because Player.fireWalk actually just prevents running hot tile touch code. + // Thus we must add a manual check for Player.fireWalk here too. + if (info.Damage <= 0 || target.fireWalk) return; target.AddBuff(BuffID.Burning, 180); diff --git a/Projectiles/Magic/ArtAttackHoldout.cs b/Projectiles/Magic/ArtAttackHoldout.cs index 88b9ed5af2..ca54e8abe0 100644 --- a/Projectiles/Magic/ArtAttackHoldout.cs +++ b/Projectiles/Magic/ArtAttackHoldout.cs @@ -41,12 +41,12 @@ namespace CalamityMod.Projectiles.Magic int attackType = ModContent.ProjectileType(); if (Owner.ownedProjectileCounts[attackType] == 0) { - if (Projectile.ai[0] >= 0f && Owner.CheckMana(Owner.HeldItem, -1, true, false)) + if (Projectile.ai[0] >= 1f && Owner.CheckMana(Owner.HeldItem, -1, true, false)) { SoundEngine.PlaySound(ArtAttack.UseSound, Owner.Center); Vector2 initialStarVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), initialStarVelocity, attackType, Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.ai[0] = -24f; + Projectile.ai[0] -= Owner.HeldItem.useAnimation; } else Projectile.ai[0]++; diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index a69ca4e9c8..0d87884419 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = end - 1; i >= start; i--) { float distanceFromStar = Vector2.Distance(Projectile.position, Projectile.oldPos[i]); - if (distanceFromStar < (distanceTraveled * 0.7f + 30f)) + if (distanceFromStar < (distanceTraveled * 0.7f + 20f)) { shapeIsComplete = true; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic averageDistanceFromStar /= end - start; // Cancel out intersection "completions" if the velocity is slow enough to be rebounding or the shape is relatively small. - if (averageDistanceFromStar < distanceTraveled + 70f) + if (averageDistanceFromStar < distanceTraveled + 100f) shapeIsComplete = false; } @@ -182,6 +182,10 @@ namespace CalamityMod.Projectiles.Magic if (Main.myPlayer == Projectile.owner) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Projectile.owner, n.whoAmI); + + damage /= 2; + if (damage < 1) + damage = 1; } } } diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index 80d7385459..6fdecf2031 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.extraUpdates = 3; Projectile.timeLeft = 120; Projectile.usesIDStaticNPCImmunity = true; diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index f1edf2171f..d129b88402 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -58,8 +58,7 @@ namespace CalamityMod.Projectiles.Magic Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.6f * scaler, 0f, 4, false); GeneralParticleHandler.SpawnParticle(blastRing); Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor * 0.6f, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f * scaler, 0f, 4, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing2, false, GeneralDrawLayer.AfterEverything); } Projectile.velocity *= 0.96f; if (time == 3) @@ -90,8 +89,7 @@ namespace CalamityMod.Projectiles.Magic Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 12, 0.07f * scaling, Color.Black * 0.85f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2), false); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 12, 0.035f * scaling, Color.LightGreen * 0.75f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2)); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } if (Main.rand.NextBool(6)) { @@ -113,8 +111,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 2; i++) { Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.36f, 0f, scalingTimerMax / 2, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing2, false, GeneralDrawLayer.AfterEverything); } Projectile.velocity = Vector2.Zero; } diff --git a/Projectiles/Magic/IncineratingFireball.cs b/Projectiles/Magic/IncineratingFireball.cs index eee796c453..30bdd882b4 100644 --- a/Projectiles/Magic/IncineratingFireball.cs +++ b/Projectiles/Magic/IncineratingFireball.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = 10; Projectile.hide = true; } @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Magic } // Can only deal damage while not fizzling out. - public override bool? CanDamage() => !Released; + public override bool? CanDamage() => !Released && Timer % Projectile.localNPCHitCooldown == 0; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -160,6 +160,9 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(Burn, target.Center); target.AddBuff(ModContent.BuffType(), 180); + if (damageDone > 2 && !target.Calamity().IsArmored()) + Projectile.damage = (int)(Projectile.damage * 0.7f); + // Whoa buddy no smoking allowed for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index 4640f39b2c..45f7cc3bf3 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic Owner.RemoveAllGrapplingHooks(); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld) * 14f; + Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld) * 12f; Owner.velocity = Projectile.velocity; Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); diff --git a/Projectiles/Magic/MeteorStarExplosion.cs b/Projectiles/Magic/MeteorStarExplosion.cs index 200e4d1f14..970630819f 100644 --- a/Projectiles/Magic/MeteorStarExplosion.cs +++ b/Projectiles/Magic/MeteorStarExplosion.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic int intendedDamage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += intendedDamage * (Main.masterMode ? 2.4f : Main.expertMode ? 1.6f : 1f); + modifiers.SourceDamage.Flat += intendedDamage.ScaleWithDifficulty(); if (Projectile.ai[0] == 1f) modifiers.SourceDamage.Flat /= 2; } @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic int intendedDamage = Main.rand.Next(GloriousEnd.PlayerExplosionDmgMin, GloriousEnd.PlayerExplosionDmgMax + 1); modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += intendedDamage * (Main.masterMode ? 2.4f : Main.expertMode ? 1.6f : 1f); + modifiers.SourceDamage.Flat += intendedDamage.ScaleWithDifficulty(); if (Projectile.ai[0] == 1f) modifiers.SourceDamage.Flat /= 2; } 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/PurgeGuzzlerHoldout.cs b/Projectiles/Magic/PurgeGuzzlerHoldout.cs index a465def812..1a04bce268 100644 --- a/Projectiles/Magic/PurgeGuzzlerHoldout.cs +++ b/Projectiles/Magic/PurgeGuzzlerHoldout.cs @@ -58,6 +58,15 @@ namespace CalamityMod.Projectiles.Magic return; } + if ((shootingTimer >= 10 && revFrames < 150) || (revFrames >= 150 && !isOnCooldown)) + { + if (!Owner.CheckMana(Owner.HeldItem, -1, true)) + { + Projectile.Kill(); + return; + } + } + revSpeed = Utils.Remap(revFrames, 0, 150, 1, 3, true); if (shootingTimer >= 10 && revFrames < 150) { diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 2858155357..caf48208a1 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -133,6 +133,16 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.FinalExtraUpdate()) Time++; + if (Time % 12f == 11f) + { + if (!Owner.CheckMana(Owner.HeldItem, -1, true)) + { + DeathCounter = 1f; + Projectile.netUpdate = true; + return; + } + } + // Set the hover offset to a zero vector after enough time has passed and the projectile is powerful/tame enough. bool tame = CurrentPower > 0.97f; if (tame) diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 7e270ed227..b8220ff855 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,4 +1,5 @@ using CalamityMod.Particles; +using CalamityMod.Utilities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -78,6 +79,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.Daybreak, 300); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.ApplyScalingForcedCrit(Projectile); + } + public override void OnKill(int timeLeft) { if (explode) diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 131d9f4eb6..a1f4663222 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Utilities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,6 +36,7 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.ApplyScalingForcedCrit(Projectile); if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.88f); if (Projectile.damage < 1) 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/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs index 31e478ef7c..20d403c4a6 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -48,6 +50,12 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + if (Owner.HeldItem.ModItem is not BrokenBiomeBlade || (Owner.HeldItem.ModItem as BrokenBiomeBlade).mainAttunement != AttunementSystem.FindOrNull(AttunementID.Default)) + { + Projectile.Kill(); + return; + } + if (CanHit || postSwing) mousePos = Owner.Center - aimPos; else diff --git a/Projectiles/Melee/BurningHolyBlast.cs b/Projectiles/Melee/BurningHolyBlast.cs index bf2e0d5981..5837114826 100644 --- a/Projectiles/Melee/BurningHolyBlast.cs +++ b/Projectiles/Melee/BurningHolyBlast.cs @@ -35,6 +35,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.damage = 1; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0], targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius * Projectile.ai[0] * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 61dafb5b13..2499c312b7 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -31,7 +31,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 180; Projectile.ignoreWater = true; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Player Owner = Main.player[Projectile.owner]; + float scale = Projectile.scale = Owner.GetMeleeScale(); + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { int randomToSubtract = Main.rand.Next(1, 4); diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index 08ff873084..31284e82c0 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -20,12 +20,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/CometQuasher"; - public override float HitboxOutset => 90; - - public override Vector2 HitboxSize => new Vector2(110, 110); + public int size = 94; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(-4, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-5, 96); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -45,7 +44,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Comet Quasher's projectile spawning @@ -159,20 +157,20 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 4; i++) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - Vector2 particlePos2 = Owner.Center + (new Vector2(Main.rand.Next(80, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + Vector2 particlePos2 = Owner.Center + (new Vector2(Main.rand.Next(80, 110), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (i % 2 == 0) { - Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); } else { - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos2, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 23, Main.rand.NextFloat(0.3f, 0.7f), 0.75f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos2, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 23, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, 0.75f, 0, true)); } } - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(120, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(120 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool(3) ? Color.AliceBlue : Color.DodgerBlue; @@ -221,7 +219,8 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, Main.rand.Next(3), 4); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, Main.rand.Next(3), 4); + meteor.scale = Projectile.scale; spawnBoom = false; } } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index 6627821de0..c5ed0d8f22 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -64,11 +64,11 @@ namespace CalamityMod.Projectiles.Melee { if (time % 11 == 0) { - GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); + GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20) * Projectile.scale - Projectile.velocity * 2, -Projectile.velocity * 2, false, 11, 0.025f * Projectile.scale, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); GeneralParticleHandler.SpawnParticle(orb); } if (time % 4 == 0) - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 6, Main.rand.NextFloat(0.4f, 0.9f), 0.65f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.AliceBlue : Color.DodgerBlue, 6, Main.rand.NextFloat(0.4f, 0.9f) * Projectile.scale, 0.65f, 0, true)); } if (Main.rand.NextBool(13)) { @@ -120,7 +120,8 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[2] > 0) { Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } if (Projectile.owner == Main.myPlayer) @@ -132,13 +133,16 @@ namespace CalamityMod.Projectiles.Melee } for (int i = 0; i < 13; i++) { - Particle spark3 = new GlowOrbParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 9), false, 20, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(5) ? Color.AliceBlue : Color.DodgerBlue, true, false, false); + Particle spark3 = new GlowOrbParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 9), false, 20, Main.rand.NextFloat(0.5f, 1f) * Projectile.scale, Main.rand.NextBool(5) ? Color.AliceBlue : Color.DodgerBlue, true, false, false); GeneralParticleHandler.SpawnParticle(spark3); } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); + if (!CalamityClientConfig.Instance.Photosensitivity) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * Projectile.scale, 1f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * Projectile.scale, 0.3f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index 093afc45b2..acb46b317d 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -29,15 +29,14 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation"; - public float hitboxMult = 1.3f; public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); public SlotId SoundSlot; - public override float HitboxOutset => 335; - - public override Vector2 HitboxSize => new Vector2(395, 395) * hitboxMult; + public int size = 118 + 285; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 285); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-3, 118); + public override float AdditionalScale => 0.15f; public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -78,7 +77,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction @@ -284,8 +282,8 @@ namespace CalamityMod.Projectiles.Melee float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; float randRot = Main.rand.NextFloat(-30, 30); Vector2 dustVel = -Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)).RotatedByRandom(0.3f) * Main.rand.NextFloat(7, 17) - Owner.velocity * 0.8f; - Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f)); + Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10 * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f)); } if (lastHitTarget != null && lastHitTarget.life > 0 && lastHitTarget.active) { @@ -348,16 +346,17 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 8; i++) { float randRot = Main.rand.NextFloat(-20, -100); - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(520 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-20, -100); Vector2 dustVel = (new Vector2(0, 11 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f), Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f)); + Vector2 placement = Owner.Center + (new Vector2(520, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f) * Projectile.scale, Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f)); } } } @@ -480,27 +479,29 @@ namespace CalamityMod.Projectiles.Melee if (true) { Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomLineAngled"); - int draws = 30; + int draws = 60; for (int i = 0; i < draws; i++) { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 25 + i * 6); + float newSine = 0.3f + (0.7f - sine * 0.25f) * Utils.Remap(i, 0, draws, 0.8f, 0.6f); Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); - Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (willDie ? deathFade : 1); - Vector2 drawOffset = -offsetDir * 10 * deathFade * i; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(18, 18), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.02f) * 0.06f, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + float jitter = Utils.Remap(i, 0, draws / 2, 10, 0f) * deathFade; + Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (Utils.Remap(jitter, 0, 10, 1, 3.5f)) * (willDie ? deathFade : 1); + Vector2 drawOffset = -offsetDir * 5 * deathFade * i * Projectile.scale; + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 30 * Projectile.scale - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(jitter, jitter), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation.ToRotationVector2().RotatedByRandom(jitter * 0.085f).ToRotation() + RotationOffset + r, new Vector2(FlipAsSword ? tex2.Width() : 0, tex2.Height()), Vector2.One * (1f - i * 0.01f) * 0.06f * Projectile.scale * newSine * Utils.Remap(jitter, 0, 10, 1, 0.3f), spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } } for (int i = 0; i < 20; i++) { Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : 1); - Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 7 * (willDie ? (1 - deathFade) * 3 : 2); - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(7, 7), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 2 * (willDie ? (1 - deathFade) * 3 : 2); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(4, 4), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } if ((useAnim > 0 || DrawUnconditionally)) { - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.9f * hitboxMult, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.2f * hitboxMult, SpriteEffects.None); - + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.3f, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.75f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } diff --git a/Projectiles/Melee/DevilsDevastationThrownBlade.cs b/Projectiles/Melee/DevilsDevastationThrownBlade.cs index 2daec84626..abc143e1bb 100644 --- a/Projectiles/Melee/DevilsDevastationThrownBlade.cs +++ b/Projectiles/Melee/DevilsDevastationThrownBlade.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); Projectile.localAI[1] = toMouse.ToRotation(); Projectile.netUpdate = true; + Projectile.scale = Owner.GetMeleeScale(); } } @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 30f; + Projectile.Center = Owner.MountedCenter + toMouse * 30f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; thrown = true; time = 0; @@ -211,32 +212,28 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; if (!exitedTarget) { - Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f * Projectile.scale, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); GeneralParticleHandler.SpawnParticle(spark2); } float rot = Projectile.rotation + (MathHelper.TwoPi * i); Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * Projectile.direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); if (exitedTarget && i == 0) { - //Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 60, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); - //dust.noGravity = true; - //dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; - - - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * Projectile.scale).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); dust2.noGravity = (dust2.type == 278 ? false : true); - dust2.scale = dust2.type == 278 ? 0.75f : 0.9f; + dust2.scale = (dust2.type == 278 ? 0.75f : 0.9f) * Projectile.scale; dust2.color = Main.rand.NextBool() ? Color.BlueViolet : clr; dust2.velocity = (vel * 2).RotatedByRandom(0.4f); + dust2.fadeIn = (dust2.type == 278 ? 0 : Projectile.scale - 1); } } if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -274,13 +271,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : clr; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void ThrowAnimation(float chargeProgress) @@ -294,7 +292,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -80f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -80f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -391,7 +389,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/DevilsDevastation").Value; @@ -409,9 +407,8 @@ namespace CalamityMod.Projectiles.Melee Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f), Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f * Projectile.Opacity, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f) * Projectile.scale, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f * Projectile.Opacity, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f * Projectile.scale, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index 40ea618ffa..d0ed429bd5 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -31,15 +31,22 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = lifeTime; Projectile.DamageType = DamageClass.Melee; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * Projectile.scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { if (Projectile.ai[0] == 0f) { - Projectile.ai[0] = Main.rand.NextFloat(40f, 70f); + Projectile.ai[0] = Main.rand.NextFloat(20f, 40f); Projectile.ai[1] = Main.rand.NextFloat(35f, 55f); } - target = Projectile.Center.ClosestNPCAt(1200f); + if (target != null && !target.CanBeChasedBy()) + target = null; + if (target is null) + target = GetTargetInRange(1200f); Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -62,6 +69,29 @@ namespace CalamityMod.Projectiles.Melee } } + + NPC GetTargetInRange(float range) + { + var player = Main.player[Projectile.owner]; + NPC gotTarget = null; + int currentHP = -1; + float distance = range; + foreach (var npc in Main.ActiveNPCs) + { + if (Projectile.localNPCImmunity[npc.whoAmI] > 0) + continue; + var myDistance = npc.Distance(Projectile.Center); + + if (npc.CanBeChasedBy() && ((myDistance < range && currentHP < npc.life) || (myDistance < distance && currentHP <= npc.life))) + { + distance = myDistance; + currentHP = npc.life; + gotTarget = npc; + } + } + return gotTarget; + + } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(ref Color lightColor) @@ -76,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.ExpandHitboxBy(80); + Projectile.ExpandHitboxBy(80 * Projectile.scale); for (int d = 0; d < 5; d++) { int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1f); @@ -145,6 +175,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.Damage(); } + public override bool? CanHitNPC(NPC target) + { + if (this.target != null && target.whoAmI != this.target.whoAmI) + return false; + return base.CanHitNPC(target); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 1d0d877dfa..71926dabb9 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -29,13 +29,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.hide = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 5; + Projectile.localNPCHitCooldown = -1; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void AI() { Player player = Main.player[Projectile.owner]; float spinCycleTime = 50f; + Projectile.scale = 0.85f * player.GetMeleeScale(); // If the player is dead, destroy the projectile if (player.dead || !player.channel) @@ -69,6 +71,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.Pi; Projectile.netUpdate = true; } + + if (Projectile.ai[0] % 5 == 0) + { + Projectile.numHits = 0; + Projectile.ResetLocalNPCHitImmunity(); + } SpawnDust(player, direction); PositionAndRotation(player); VisibilityAndLight(); @@ -142,9 +150,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (target.Calamity().IsArmored()) + Projectile.numHits--; //don't pierce falloff on targets it can't really damage target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(target.Center); } @@ -159,14 +168,12 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); - modPlayer.dragonRageHits++; - if (modPlayer.dragonRageHits >= 10 && modPlayer.dragonRageCooldown <= 0) + if (modPlayer.dragonRageCooldown <= 0) { SpawnFireballs(); - modPlayer.dragonRageHits = 0; } - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (1 - (0.25f * Projectile.numHits))*0.25f) , Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[proj].DamageType = DamageClass.Melee; } } @@ -182,13 +189,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 velocity = new Vector2(0f, speed); velocity = velocity.RotatedBy(angleStep * i * Main.rand.NextFloat(0.9f, 1.1f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); + Projectile fire = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 3f, Projectile.owner); + fire.scale = Projectile.scale; } - Main.player[Projectile.owner].Calamity().dragonRageCooldown = 60; + Main.player[Projectile.owner].Calamity().dragonRageCooldown = 120; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.SourceDamage *= 1 - (0.25f * Projectile.numHits); Player player = Main.player[Projectile.owner]; Rectangle myRect = Projectile.Hitbox; if (Projectile.owner == Main.myPlayer) @@ -237,12 +246,14 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { + Vector2 newSize = new Point(projHitbox.Width, projHitbox.Height).ToVector2() * Projectile.scale; + projHitbox = new Rectangle(projHitbox.X - (int)((newSize.X - projHitbox.Width) / 2f), projHitbox.Y - (int)((newSize.Y - projHitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); if (projHitbox.Intersects(targetHitbox)) { return true; } float spinning = Projectile.rotation - MathHelper.PiOver4 * (float)Math.Sign(Projectile.velocity.X); - float staffRadiusHit = 110f; + float staffRadiusHit = 110f * Projectile.scale; float useless = 0f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + spinning.ToRotationVector2() * -staffRadiusHit, Projectile.Center + spinning.ToRotationVector2() * staffRadiusHit, 23f * Projectile.scale, ref useless)) { diff --git a/Projectiles/Melee/DragoonBigBolt.cs b/Projectiles/Melee/DragoonBigBolt.cs index baf5c2aef5..1fd4fb8a29 100644 --- a/Projectiles/Melee/DragoonBigBolt.cs +++ b/Projectiles/Melee/DragoonBigBolt.cs @@ -52,21 +52,21 @@ namespace CalamityMod.Projectiles.Melee if (time < 120) { float velMult = (Projectile.ai[1] == 0.5f ? 0.2f : 3 * sizeMult); - Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); + Particle spark3 = new CustomSpark(pos, Projectile.velocity * 1.2f * velMult, "CalamityMod/Particles/GlowSpark", false, 11, 0.15f * sizeMult * Projectile.scale, usedColor, new Vector2(2f, 0.8f), true, true, shrinkSpeed: 1f); GeneralParticleHandler.SpawnParticle(spark3); sizeMult *= 0.97f; } - Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(35)) { - Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(10)) { - Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor, new Vector2(1, 4), true, true); + Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult * Projectile.scale, usedColor, new Vector2(1, 4), true, true); GeneralParticleHandler.SpawnParticle(spark2); } if (time % 5 == 0) @@ -80,9 +80,9 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 3; i++) { - Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 1.48f, 15); + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * Projectile.scale, 1.48f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.925f, 15); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * Projectile.scale, 0.925f * Projectile.scale, 15); GeneralParticleHandler.SpawnParticle(orb2); } } @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float size = 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1); + float size = 45 * sizeMult * (Projectile.numHits > 0 ? 6 : 1) * Projectile.scale; Player Owner = Main.player[Projectile.owner]; if (time <= 1 && Projectile.ai[1] != 0.5f) { diff --git a/Projectiles/Melee/DragoonSmallBolt.cs b/Projectiles/Melee/DragoonSmallBolt.cs index d230a95b11..66e1f1a513 100644 --- a/Projectiles/Melee/DragoonSmallBolt.cs +++ b/Projectiles/Melee/DragoonSmallBolt.cs @@ -43,12 +43,12 @@ namespace CalamityMod.Projectiles.Melee Vector2 pos = Projectile.Center; if (Projectile.timeLeft % 3 == 0) { - Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); + Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 15, 0.4f * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.5f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(35)) { - Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f), usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); + Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * Projectile.scale, usedColor, new Vector2(1.8f, 0.8f), true, true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark2); } if (time % 5 == 0) @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Melee if (time <= 1) { float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, 25, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, 25 * Projectile.scale, ref _); } else - return CalamityUtils.CircularHitboxCollision(Projectile.Center, 25, targetHitbox); + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 25 * Projectile.scale, targetHitbox); } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Melee/EarthBoom.cs b/Projectiles/Melee/EarthBoom.cs index b71021e706..b0080b8a33 100644 --- a/Projectiles/Melee/EarthBoom.cs +++ b/Projectiles/Melee/EarthBoom.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = Projectile.height = 500; + Projectile.width = Projectile.height = 620; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -26,6 +26,6 @@ namespace CalamityMod.Projectiles.Melee { } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index c51b91ec44..c91ce030e4 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; @@ -22,11 +23,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; - public override float HitboxOutset => 135; - public override Vector2 HitboxSize => new Vector2(288, 288) * (1 + bladeFade * 1.2f); + public int size = 186 + 30; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size) * (1 + bladeFade * 1.25f); + public override Vector2 SpriteOrigin => new(0, size - 30); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 186f); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -52,7 +54,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning @@ -195,22 +196,21 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f), mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f) * Projectile.scale, mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); } for (int i = 0; i < 6; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(270 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(270 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; if (Main.rand.NextBool(3)) { - Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f), mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f) * Projectile.scale, mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); GeneralParticleHandler.SpawnParticle(sparker); } else { - GeneralParticleHandler.SpawnParticle(new CustomSpark(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f), mainColor * 0.65f, new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); - //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, mainColor, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f, Main.rand.NextFloat(-0.1f, 0.1f), true)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, "CalamityMod/Particles/LargeBloom", false, Main.rand.Next(7, 9 + 1), Main.rand.NextFloat(0.3f, 0.35f) * Projectile.scale, mainColor * 0.65f, new Vector2(1f, 1.2f), true, false, 0, false, false, 0.45f)); } } } @@ -237,10 +237,10 @@ namespace CalamityMod.Projectiles.Melee float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale, Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f) * Projectile.scale, 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(270 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)) * Projectile.scale, DustID.FireworksRGB, dustVel); dust2.scale = Main.rand.NextFloat(0.65f, 1.05f); dust2.noGravity = true; dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); @@ -294,7 +294,8 @@ namespace CalamityMod.Projectiles.Melee else spawnSpot = chosenTarget.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, chosenTarget == null ? 0 : chosenTarget.whoAmI, 2); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, chosenTarget == null ? 0 : chosenTarget.whoAmI, 2); + meteor.scale = Projectile.scale; } spawnBoom = false; @@ -349,7 +350,6 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. - float spriteMult = 1.13f; if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) { Asset tex = ModContent.Request(Texture); @@ -370,26 +370,27 @@ namespace CalamityMod.Projectiles.Melee { if (swingCount % 2 != 0) { - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f / 4, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.89f, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.89f, SpriteEffects.FlipVertically); } else - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, spriteMult * Projectile.scale * 3.15f * 1.6f / 4, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.423f, SpriteEffects.None); } Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); - int draws = 24; + int draws = 45; for (int i = 0; i < draws; i++) { bool swordTip = i > draws * 0.73f; - float swordTipScale = swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1; + float swordTipScale = (swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1); Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); Color bladeColor = Color.Lerp(Color.MediumTurquoise, Color.Lerp(Color.LimeGreen, Color.OrangeRed, (i * 0.8f) / draws), i / (draws * 0.6f)); - Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.4f * bladeFade; - Vector2 drawOffset = -offsetDir * 9 * i * bladeFade; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale, 1f) * (0.75f * swordTipScale) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.3f * bladeFade; + Vector2 drawOffset = -offsetDir * 5 * i * bladeFade * Projectile.scale; + float bladeHiltMult = (MathHelper.Lerp(1.55f, 1, 1 - MathF.Pow(Utils.GetLerpValue(i > draws * 0.08f ? draws * 0.55f : 0, draws * 0.04f, i, true), 5))); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 * Projectile.scale - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale * MathF.Pow(bladeHiltMult, 0.6f), 0.5f / bladeHiltMult) * (0.75f * swordTipScale) * 0.9f * bladeFade * bladeHiltMult * Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/EarthMeteor.cs b/Projectiles/Melee/EarthMeteor.cs index 8acfbb5dd5..3b5754c090 100644 --- a/Projectiles/Melee/EarthMeteor.cs +++ b/Projectiles/Melee/EarthMeteor.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); NPC targeted = Projectile.ai[1] == 0 ? Owner.ClampedMouseWorld().ClosestNPCAt(1000) : Main.npc[(int)Projectile.ai[1]]; - Projectile.scale = 1.2f; randomColor = Main.rand.Next(3) switch { 0 => Color.OrangeRed, @@ -90,7 +89,8 @@ namespace CalamityMod.Projectiles.Melee else spawnSpot = targeted.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1], Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } if (time == fallTime) { @@ -120,26 +120,29 @@ namespace CalamityMod.Projectiles.Melee // Spawn in a helix-style pattern float sine = (float)Math.Sin(Projectile.timeLeft * 0.475f / MathHelper.Pi); - Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (16f + 34 * fadeIn); + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (16f + 34 * fadeIn) * Projectile.scale; if (targetDist < 1400f && time % 2 == 0) { - CustomSpark orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); + CustomSpark orb = new(Projectile.Center + offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, (0.3f + (0.4f * fadeIn)) * Projectile.scale, mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb); - CustomSpark orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f + (0.4f * fadeIn), mainColor, new Vector2(0.5f, 1f), true, false); + CustomSpark orb2 = new(Projectile.Center - offset, -Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 10, (0.3f + (0.4f * fadeIn)) * Projectile.scale, mainColor, new Vector2(0.5f, 1f), true, false); GeneralParticleHandler.SpawnParticle(orb2); } } else { - float randSize = Main.rand.NextFloat(0.8f, 1.2f); - for (int i = 0; i < 2; i++) + float randSize = Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale; + if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.8f * randSize, 0f, 3); - GeneralParticleHandler.SpawnParticle(bloom); + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.8f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom); + } + Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.65f * randSize, 0f, 3); + GeneralParticleHandler.SpawnParticle(bloom3); } - Particle bloom3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * (float)Math.Pow(Utils.Remap(time, 0, fallTime, 0f, 1f), 3), "CalamityMod/Particles/LargeBloom", new Vector2(Utils.Remap(time, 0, fallTime, 0.3f, 4), Utils.Remap(time, fallTime * 0.6f, fallTime, 1, 4)), 0, 0.65f * randSize, 0f, 3); - GeneralParticleHandler.SpawnParticle(bloom3); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; time++; @@ -149,10 +152,12 @@ namespace CalamityMod.Projectiles.Melee Asset tex = ModContent.Request("CalamityMod/Particles/VerticalSmearRagged"); if (time <= fallTime) return false; - - for (int i = 0; i < 10; i++) + if (!CalamityClientConfig.Instance.Photosensitivity) { - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (i - 110), null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * new Vector2(0.4f - i * 0.05f, 1.3f + i * 0.1f) * 0.4f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + for (int i = 0; i < 10; i++) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * (i - 110), null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * new Vector2(0.4f - i * 0.05f, 1.3f + i * 0.1f) * 0.4f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } } return false; @@ -169,7 +174,8 @@ namespace CalamityMod.Projectiles.Melee { Player Owner = Main.player[Projectile.owner]; Owner.SetScreenshake(4.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + Projectile boom = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + boom.scale = Projectile.scale; for (int i = 0; i < 15; i++) { randomColor = Main.rand.Next(3) switch @@ -183,29 +189,30 @@ namespace CalamityMod.Projectiles.Melee dust2.noGravity = false; dust2.color = Color.Lerp(Color.White, randomColor, 0.5f); - Particle sparker = new CustomSpark(target.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f), randomColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); + Particle sparker = new CustomSpark(target.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.5f, 20), "CalamityMod/Particles/Sparkle", false, 38, Main.rand.NextFloat(2.2f, 4.8f) * Projectile.scale, randomColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); GeneralParticleHandler.SpawnParticle(sparker); } - - for (int i = 0; i < 3; i++) - { - string tex = "CalamityMod/Particles/ShatteredExplosion"; - Particle bolt1 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 12, 0.5f - i * 0.08f, Color.OrangeRed * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt1); - Particle bolt2 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 10, 0.4f - i * 0.08f, Color.MediumTurquoise * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 8, 0.35f - i * 0.08f, Color.LawnGreen * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); - GeneralParticleHandler.SpawnParticle(bolt3); - } SoundStyle fire2 = new("CalamityMod/Sounds/Item/EarthMeteor"); SoundEngine.PlaySound(fire2 with { Volume = 0.9f }, target.Center); if (!CalamityClientConfig.Instance.Photosensitivity) { - Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f, 3f, 18, true); + for (int i = 0; i < 3; i++) + { + string tex = "CalamityMod/Particles/ShatteredExplosion"; + Particle bolt1 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 12, (0.5f - i * 0.08f) * Projectile.scale, Color.OrangeRed * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt1); + Particle bolt2 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 10, (0.4f - i * 0.08f) * Projectile.scale, Color.MediumTurquoise * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt2); + Particle bolt3 = new CustomSpark(target.Center, Vector2.Zero, tex, false, 8, (0.35f - i * 0.08f) * Projectile.scale, Color.LawnGreen * 0.8f, Vector2.One * 0.65f, extraRotation: Main.rand.NextFloat(-10f, 10f), shrinkSpeed: (i == 0 ? 0.6f : 0.8f)); + GeneralParticleHandler.SpawnParticle(bolt3); + + } + + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, mainColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 4f * Projectile.scale, 3f * Projectile.scale, 18, true); GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 2f, 18, true); + Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f * Projectile.scale, 2f * Projectile.scale, 18, true); GeneralParticleHandler.SpawnParticle(blastRing2); } } diff --git a/Projectiles/Melee/EvilSmasherProjectile.cs b/Projectiles/Melee/EvilSmasherProjectile.cs index 93f0a4c02a..5af5c7e264 100644 --- a/Projectiles/Melee/EvilSmasherProjectile.cs +++ b/Projectiles/Melee/EvilSmasherProjectile.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee public override int OffsetDistance => 50; public override int CooldownTime { get; set; } public override bool AlternateSwings => false; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => false; public override SoundStyle? UseSound => SoundID.DD2_MonkStaffSwing with {Volume = 1f}; bool hasSmashedTile = false; diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs index 279b825edd..f51c6b8198 100644 --- a/Projectiles/Melee/ExaltedOathbladeHoldout.cs +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -25,13 +25,13 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/ExaltedOathblade"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 70; - - public override Vector2 HitboxSize => new Vector2(155, 155) * hitboxMult; + public int size = 88 + 20; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 20); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override float AdditionalScale => 0.15f; - public override Vector2 SpriteOrigin => new(-3, 88); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -60,7 +60,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; @@ -218,14 +217,15 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(143 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(143, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); + Vector2 placement = Owner.Center + (new Vector2(143 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f) * Projectile.scale, Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); } } } @@ -336,7 +336,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.35f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.455f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs index 2e35aee3ab..b50aac643e 100644 --- a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs @@ -67,6 +67,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (time == 0) + Projectile.scale = Owner.GetMeleeScale(); float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.spriteDirection = Projectile.direction; @@ -153,20 +155,21 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; if (!exitedTarget) { - Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 75, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 9, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1, 1f), true, false, 0, false, 1.0f, 0.2f); + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 75 * Projectile.scale, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 9, 0.2f * Projectile.scale, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1, 1f), true, false, 0, false, 1.0f, 0.2f); GeneralParticleHandler.SpawnParticle(spark); } if (exitedTarget && i == 0 && Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45 * Projectile.scale, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } } if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -196,13 +199,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void throwAnimation() @@ -215,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -65f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -65f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -338,7 +342,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.25f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.25f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExaltedOathblade").Value; @@ -356,8 +360,8 @@ namespace CalamityMod.Projectiles.Melee Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey"); Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.BlueViolet with { A = 0 } * 0.45f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.8f, 1.15f), SpriteEffects.None); - Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.95f, SpriteEffects.None); + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, Color.BlueViolet with { A = 0 } * 0.45f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.2f * Main.rand.NextFloat(0.8f, 1.15f) * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 0.95f * Projectile.scale, SpriteEffects.None); } Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index ba2800c800..c3f9e30adc 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -26,13 +26,13 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/ForbiddenOathblade"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 60; - - public override Vector2 HitboxSize => new Vector2(120, 120) * hitboxMult; + public int size = 74 + 10; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 10); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override float AdditionalScale => 0.15f; - public override Vector2 SpriteOrigin => new(-3, 74); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -62,7 +62,6 @@ namespace CalamityMod.Projectiles.Melee DrawUnconditionally = true; CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; Projectile.ai[1] = -1; bool isOwner = Main.myPlayer == Projectile.owner; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction @@ -274,13 +273,14 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(113 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Vector2 placement = Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 placement = Owner.Center + (new Vector2(113 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f)); } } @@ -383,7 +383,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.29f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.377f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs index 3f80950563..87501574ab 100644 --- a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs @@ -80,6 +80,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Projectile.owner) { Vector2 toMouse = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.scale = Owner.GetMeleeScale(); Projectile.localAI[1] = toMouse.ToRotation(); Projectile.netUpdate = true; } @@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 toMouse = GetAimDirection(); Projectile.velocity = toMouse * 14; - Projectile.Center = Owner.MountedCenter + toMouse * 12f; + Projectile.Center = Owner.MountedCenter + toMouse * 12f * Projectile.scale; Projectile.spriteDirection = Projectile.direction; thrown = true; time = 0; @@ -197,16 +198,17 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(90 * (i == 0 ? 1 : -1))).RotatedByRandom(0.1f) * Main.rand.NextFloat(3, 4); if (!exitedTarget && Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60 * Projectile.scale, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 50; + dust.fadeIn = Projectile.scale - 1; } if (exitedTarget && i == 0) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, DustID.FireworksRGB, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45 * Projectile.scale, DustID.FireworksRGB, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f)); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; } @@ -214,7 +216,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(4)) { - Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f) * Projectile.scale, Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); GeneralParticleHandler.SpawnParticle(spark2); } } @@ -252,13 +254,14 @@ namespace CalamityMod.Projectiles.Melee Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; if (Main.rand.NextBool(4)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet; dust.noLight = true; dust.noLightEmittence = true; dust.alpha = 100; dust.velocity += Projectile.velocity; + dust.fadeIn = Projectile.scale - 1; } } public void throwAnimation(float chargeProgress) @@ -272,7 +275,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.spriteDirection = Owner.direction; Projectile.direction = Owner.direction; - Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir; + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir * Projectile.scale; Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); @@ -395,7 +398,7 @@ namespace CalamityMod.Projectiles.Melee return base.CanDamage(); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 1) * Projectile.scale, targetHitbox); // After exiting a target, the hitbox is larger public override bool PreDraw(ref Color lightColor) { Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/ForbiddenOathblade").Value; diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 630fa6b82b..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; @@ -316,12 +316,9 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Particle spark = new CustomSpark(target.Center, launchVel * 65, "CalamityMod/Particles/GlowSpark2", false, (int)(16 - Projectile.numHits * 3), 0.145f - Projectile.numHits * 0.015f, Color.Black, new Vector2(2f, 1f), false, shrinkSpeed: 1f, colorFadeSpeed: 10); - GeneralParticleHandler.SpawnParticle(spark); - spark.Pixelate = true; + GeneralParticleHandler.SpawnParticle(spark, true); Particle spark2 = new CustomSpark(target.Center, launchVel * 65, "CalamityMod/Particles/GlowSpark", false, (int)(16 - Projectile.numHits * 3), 0.105f - Projectile.numHits * 0.015f, Color.Lerp(Color.Blue, Color.DodgerBlue, 0.65f), new Vector2(2f, 1f), true, false, shrinkSpeed: 1f, colorFadeSpeed: 10); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.Pixelate = true; - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, true, GeneralDrawLayer.AfterEverything); } for (int i = 0; i < 25 - Projectile.numHits * 3; i++) @@ -369,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..f7a5b243a0 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 @@ -68,7 +72,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(energyLeak); } - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Melee/LightspeedHoldout.cs b/Projectiles/Melee/LightspeedHoldout.cs index 074be3fa64..4560a28a28 100644 --- a/Projectiles/Melee/LightspeedHoldout.cs +++ b/Projectiles/Melee/LightspeedHoldout.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Projectiles.Melee public Vector2 innateOffset = new(23f, -0.1f); public Vector2 handPos; public float bladeRot = 0; + public float baseScale = 1; // Primary public int primaryStabfireRate => 2; @@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.TwoPi * 0.75f; } - Projectile.Center = handPos; + Projectile.Center = handPos + toMouse * Projectile.scale; Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; @@ -173,8 +174,8 @@ namespace CalamityMod.Projectiles.Melee { var player = Main.player[Projectile.owner]; var modPlayer = player.GetModPlayer(); - - Projectile.scale = 0.6f; + baseScale = MathHelper.Lerp(baseScale, player.GetMeleeScale(), 0.3f / Projectile.MaxUpdates); + Projectile.scale = baseScale; if (!Owner.channel && DashState == 0) { @@ -225,18 +226,18 @@ namespace CalamityMod.Projectiles.Melee Vector2 stabDir = toMouse.RotatedBy(offset); Vector2 stabOrigin = Projectile.Center; - Vector2 stabTip = stabOrigin + stabDir * 62f; + Vector2 stabTip = stabOrigin + stabDir * 62f * Projectile.scale; for (int i = 0; i < 4; i++) { - Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f); + Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f) * Projectile.scale; Vector2 vel = stabDir * Main.rand.NextFloat(5f, 19f); - Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false); + Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Projectile.scale * Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false); GeneralParticleHandler.SpawnParticle(spark); } - Particle afterImage = new CustomSpark(Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(), new("CalamityMod/Items/Weapons/Melee/Lightspeed"), false, Main.rand.Next(5,9), Projectile.scale * Main.rand.NextFloat(0.9f, 1.02f), Color.White * Main.rand.NextFloat(0.66f, 0.825f), new Vector2(1, 1), true, false, flipHorizontal: Owner.direction == -1 ? true : false); + Particle afterImage = new CustomSpark(Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(), new("CalamityMod/Items/Weapons/Melee/Lightspeed"), false, Main.rand.Next(5,9), 0.6f * Main.rand.NextFloat(0.9f, 1.02f), Color.White * Main.rand.NextFloat(0.66f, 0.825f), new Vector2(1, 1), true, false, flipHorizontal: Owner.direction == -1 ? true : false); GeneralParticleHandler.SpawnParticle(afterImage); // Make blade randomly vibrate @@ -260,7 +261,8 @@ namespace CalamityMod.Projectiles.Melee } // Spawn the hitbox - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + toMouse * 20 * (float)Math.Pow(Projectile.scale, 4), toMouse * 25, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.MountedCenter + toMouse * 20 * Projectile.scale, toMouse, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + attack.scale = Projectile.scale; } private void UseSecondary() @@ -276,7 +278,7 @@ namespace CalamityMod.Projectiles.Melee Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; - Projectile.scale = 0.6f; + Projectile.scale = baseScale * 0.6f; if (!firstSecondaryIteration) { @@ -354,7 +356,8 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < Owner.hurtCooldowns.Length; k++) Owner.hurtCooldowns[k] = Owner.immuneTime; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + Projectile dash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.MountedCenter, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + dash.scale = Projectile.scale; } } @@ -369,7 +372,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= DashAcceleration; - Projectile.scale = MathHelper.Lerp(1f, 0.4f, MathF.Pow(1f - DashTimer / DashDuration, 5)); + Projectile.scale = baseScale * MathHelper.Lerp(1f, 0.4f, MathF.Pow(1f - DashTimer / DashDuration, 5)); Owner.heldProj = Projectile.whoAmI; Owner.itemTime = Owner.itemAnimation = 2; @@ -403,7 +406,7 @@ namespace CalamityMod.Projectiles.Melee SpriteEffects spriteEffects = Owner.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; lightColor = Color.White; // Fullbright - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, origin, 0.6f, spriteEffects, 0); DrawPierceTrail(); @@ -443,7 +446,7 @@ namespace CalamityMod.Projectiles.Melee { DashState = 0; DashTimer = 0; - Projectile.scale = 0.6f; + Projectile.scale = baseScale * 0.6f; } } } diff --git a/Projectiles/Melee/LightspeedM1Hitbox.cs b/Projectiles/Melee/LightspeedM1Hitbox.cs index 3e27b0a648..aad114d70e 100644 --- a/Projectiles/Melee/LightspeedM1Hitbox.cs +++ b/Projectiles/Melee/LightspeedM1Hitbox.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 84; - Projectile.height = 64; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -31,7 +31,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 4; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = float.NaN; + float hitboxSize = Projectile.width * Projectile.scale; + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10; + Vector2 start = (Projectile.timeLeft == 6 ? Main.player[Projectile.owner].Center : Projectile.Center - vel); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, Projectile.Center + vel, hitboxSize * Projectile.scale, ref _); + } public override void AI() { Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2()); @@ -39,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee float rotation = toMouse.ToRotation(); Projectile.rotation = rotation; - Projectile.velocity = toMouse * 34; + Projectile.velocity = toMouse * 34 * Projectile.scale; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/LucreciaBolt.cs b/Projectiles/Melee/LucreciaBolt.cs index 44d4c3f279..7c08cf0be9 100644 --- a/Projectiles/Melee/LucreciaBolt.cs +++ b/Projectiles/Melee/LucreciaBolt.cs @@ -46,7 +46,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.ai[2]; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { // Little bit of ambient lighting as it travels @@ -54,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.velocity *= 1.01f; - Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true) * Projectile.ai[2]; if (Projectile.FinalExtraUpdate()) Time++; @@ -103,7 +107,9 @@ namespace CalamityMod.Projectiles.Melee public float TrailWidth(float completionRatio, Vector2 vertexPos) { - float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))); + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completionRatio * 6); + float newSine = 0.7f - sine * 0.3f; + float width = newSine * (completionRatio < 0.4f ? 1 - MathF.Pow(Utils.GetLerpValue(0.4f, 0f, completionRatio, true), 3) : Utils.GetLerpValue(1f, 0.4f, completionRatio, true)) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))) * MathF.Pow(Projectile.ai[2], 0.4f); width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); @@ -123,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee return baseColor * Projectile.Opacity; } - public float MiniTrailWidth(float completionRatio, Vector2 vertexPos) => TrailWidth(completionRatio, vertexPos) * 5.5f; + public float MiniTrailWidth(float completionRatio, Vector2 vertexPos) => TrailWidth(completionRatio, vertexPos) * 5.5f * Projectile.ai[2]; public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/LucreciaDNATrailCreator.cs b/Projectiles/Melee/LucreciaDNATrailCreator.cs index 09f3bb6b96..6c44e8285d 100644 --- a/Projectiles/Melee/LucreciaDNATrailCreator.cs +++ b/Projectiles/Melee/LucreciaDNATrailCreator.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 255; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player owner = Main.player[Projectile.owner]; @@ -70,9 +74,9 @@ namespace CalamityMod.Projectiles.Melee middleStreakTimer = 6; // Spawn the main trail - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f * Projectile.scale, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f * Projectile.scale, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); GeneralParticleHandler.SpawnParticle(spark2); } @@ -83,8 +87,8 @@ namespace CalamityMod.Projectiles.Melee Vector2 purpleTrailOrigin = Projectile.Center + offsetLeft; Vector2 blueTrailOrigin = Projectile.Center + offsetRight; - Particle purpleLightEmission = new SquishyLightParticle(purpleTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f), Color.MediumPurple, Main.rand.Next(18, 46), 1, 1.5f); - Particle blueLightEmission = new SquishyLightParticle(blueTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f), Color.CornflowerBlue, Main.rand.Next(18, 46), 1, 1.5f); + Particle purpleLightEmission = new SquishyLightParticle(purpleTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f) * Projectile.scale, Color.MediumPurple, Main.rand.Next(18, 46), 1, 1.5f); + Particle blueLightEmission = new SquishyLightParticle(blueTrailOrigin, -Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 4f), Main.rand.NextFloat(0.3f, 0.6f) * Projectile.scale, Color.CornflowerBlue, Main.rand.Next(18, 46), 1, 1.5f); GeneralParticleHandler.SpawnParticle(blueLightEmission); GeneralParticleHandler.SpawnParticle(purpleLightEmission); @@ -100,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee private float WidthFunction(float completionRatio, Vector2 vertexPos) { - return MathHelper.Lerp(12f, 0f, completionRatio); + return MathHelper.Lerp(12f * Projectile.scale, 0f, completionRatio); } @@ -126,8 +130,8 @@ namespace CalamityMod.Projectiles.Melee trailShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); // Use the separate color functions for each trail - PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_,_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); - PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_,_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_,_) => Projectile.Size, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_,_) => Projectile.Size, pixelate: false, shader: trailShader)); return false; } } diff --git a/Projectiles/Melee/LucreciaHoldout.cs b/Projectiles/Melee/LucreciaHoldout.cs index 222b21699d..b30430df04 100644 --- a/Projectiles/Melee/LucreciaHoldout.cs +++ b/Projectiles/Melee/LucreciaHoldout.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee public class LucreciaHoldout : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override bool useMeleeSize => false; public override int swingWidth => 310; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override int CooldownTime { get; set; } public override int swingTime { get; set; } public override bool AlternateSwings { get => base.AlternateSwings; set => base.AlternateSwings = value; } - public override float lineCollisionLength => 225; + public override float lineCollisionLength => 155; public bool helixFired = false; public bool gotEnergyThisSwing = false; @@ -50,7 +50,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.noEnchantmentVisuals = true; Projectile.Opacity = 0.2f; // Starting point, fades in quickly upon startup Projectile.width = Projectile.height = 54; - Projectile.scale = 1.25f; } public override void Spawn() @@ -107,6 +106,7 @@ namespace CalamityMod.Projectiles.Melee { Player player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); + baseScale = MathHelper.Lerp(baseScale, player.GetMeleeScale() + 0.25f, 0.3f / Projectile.MaxUpdates); if (IsAlternateThrust) { @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (timer % 8 == 0) { Vector2 pos = player.MountedCenter + Projectile.rotation.ToRotationVector2() * 60f; - Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f); + Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f * Projectile.scale, 12, 0.3f, 1.2f); GeneralParticleHandler.SpawnParticle(sparkle); } Particle smear = new CircularSmearVFX(player.MountedCenter, Color.CornflowerBlue * 0.35f, Projectile.rotation, Projectile.scale * 1.25f); @@ -185,8 +185,10 @@ namespace CalamityMod.Projectiles.Melee if (!trailFXTriggered) { if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 7, Projectile.knockBack, Projectile.owner, 0f, 0f); - + { + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 7, Projectile.knockBack, Projectile.owner, 0f, 0f); + attack.scale = baseScale; + } SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash"); SoundEngine.PlaySound(swish with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); @@ -203,7 +205,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 particleOrigin = Projectile.Center; Vector2 particleSpeed = fireDirection.RotatedByRandom(MathHelper.ToRadians(46f)) * Main.rand.NextFloat(20f, 37f); - Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f), Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); + Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f) * Projectile.scale, Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); GeneralParticleHandler.SpawnParticle(sparks); } particlesSpawned = true; @@ -240,14 +242,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 shootDir = player.MountedCenter.DirectionTo(mousePosition) * 10f; int dir = -Math.Sign(mousePosition.X); float scale = lineCollisionLength / 550f; - Particle swipe = new CustomSpark(player.MountedCenter - shootDir * 4, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), scale, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); + Particle swipe = new CustomSpark(player.MountedCenter - shootDir * 4 * Projectile.scale, shootDir.RotatedBy(0.075f * (dir * (modplayer.swingNum % 2 == 0 ? 1 : -1))) * 1.22f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), scale * Projectile.scale, modplayer.swingNum % 2 == 0 ? Color.CornflowerBlue * 0.85f : Color.MediumPurple * 0.8f, new Vector2(1.1f, 1.3f), true, false, 0, false, false); GeneralParticleHandler.SpawnParticle(swipe); var fireDirection = Vector2.Normalize(mousePosition - player.MountedCenter); var helixSpeed = 12f; var helixVelocity = fireDirection * helixSpeed; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.MountedCenter + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - + Projectile attack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), player.MountedCenter + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + attack.ai[2] = Projectile.scale; + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltFire"); SoundEngine.PlaySound(projectile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); } diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index b10a3a2a49..03e7ec6d95 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -20,12 +20,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/MajesticGuard"; - public override float HitboxOutset => 105; - - public override Vector2 HitboxSize => new Vector2(140, 140); + public int size = 100 + 10; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size - 10); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-5, 100); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -46,7 +45,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Majestic Guard has no projectiles @@ -148,8 +146,8 @@ namespace CalamityMod.Projectiles.Melee CanHit = true; Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + GeneralParticleHandler.SpawnParticle(new AltLineParticle(particlePos, -particleVel.RotatedByRandom(0.2f), false, 19, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, Main.rand.NextBool(3) ? Color.Silver : Color.Goldenrod)); } else CanHit = false; @@ -166,7 +164,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 2; i++) { - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Silver : Color.Gold; diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index 72d110327a..f0ed376d31 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override Vector2 SpriteOrigin => new(0, 20); public override int AssignedItemID => ModContent.ItemType(); + public override bool IgnoreAutoScale => true; public float ClawOpenness = MathHelper.ToRadians(80); public float BubbleSize = 0f; @@ -39,6 +40,8 @@ namespace CalamityMod.Projectiles.Melee } public override void ResetStyle() { + if (Projectile.scale < 0.8f && m2KillTimer <= 0) + Projectile.active = false; if (AnimationCooldown) { if (NumberOfAnimations % 5 <= BlastChargeUses) @@ -137,6 +140,7 @@ namespace CalamityMod.Projectiles.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 2f, Owner.whoAmI); slash.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); + slash.localAI[0] = Owner.GetMeleeScale(); } SlashTimer++; diff --git a/Projectiles/Melee/MantisClawSlash.cs b/Projectiles/Melee/MantisClawSlash.cs index a0783efbce..a89a09ccf7 100644 --- a/Projectiles/Melee/MantisClawSlash.cs +++ b/Projectiles/Melee/MantisClawSlash.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Particles/SlashSmear"; + public float maxScale = 0; private const int TimerCap = 20; Color startColor; Color endColor; @@ -35,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnSpawn(IEntitySource source) { Projectile.scale = 0f; + Projectile.ai[2] = Main.rand.NextFloat(0.5f, 1.25f); if (Main.rand.NextBool(2)) dir = -1; @@ -53,14 +56,21 @@ namespace CalamityMod.Projectiles.Melee startColor = ColorList[Main.rand.Next(ColorList.Count)]; endColor = ColorList[Main.rand.Next(ColorList.Count)]; } - - public override void ModifyDamageHitbox(ref Rectangle hitbox) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - hitbox = new Rectangle((int)Projectile.Center.X - 65, (int)Projectile.Center.Y - 65, 130, 130); + int size = 60; + int scale = (int)(size * Math.Max(Projectile.ai[2], 1)); + Vector2 position = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * size / 2; + return CalamityUtils.CircularHitboxCollision(position, scale, targetHitbox); } public override void AI() { + if (maxScale == 0) + { + maxScale = Projectile.localAI[0]; + Projectile.ai[2] *= maxScale; + } Projectile.velocity *= 0.9f; if (Projectile.timeLeft > (TimerCap / 2)) @@ -88,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0; i < 1; i += 0.33f) { Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.Lerp(startColor, endColor, Projectile.ai[1] / TimerCap).MultiplyRGBA(new Color(255, 255, 255, 0f)), - Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Projectile.scale, dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); + Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Math.Min(Projectile.scale, maxScale), dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); } return false; } diff --git a/Projectiles/Melee/MawOfInfinityHoldout.cs b/Projectiles/Melee/MawOfInfinityHoldout.cs index cf7bf97d01..48323eefee 100644 --- a/Projectiles/Melee/MawOfInfinityHoldout.cs +++ b/Projectiles/Melee/MawOfInfinityHoldout.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class MawOfInfinityHoldout : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override bool useMeleeSize => true; public override int swingWidth => 270; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs index 73a23e9dfd..04a227f3c3 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -1,9 +1,11 @@ -using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -60,6 +62,12 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + if (Owner.HeldItem.ModItem is not TrueBiomeBlade || (Owner.HeldItem.ModItem as TrueBiomeBlade).mainAttunement != AttunementSystem.FindOrNull(AttunementID.TrueDefault)) + { + Projectile.Kill(); + return; + } + // If the player stops using the weapon after hitting with it three times, switch to lunge. if (Owner.CantUseHoldout()) { diff --git a/Projectiles/Melee/MirrorBladeProjectile.cs b/Projectiles/Melee/MirrorBladeProjectile.cs index 56cca4d246..fad5e53fa5 100644 --- a/Projectiles/Melee/MirrorBladeProjectile.cs +++ b/Projectiles/Melee/MirrorBladeProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override bool AlternateSwings => false; public bool SpawnShards = true; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override int swingTime { get; set; } = 8; diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 276bc0972a..4f5895fc64 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -71,38 +72,69 @@ namespace CalamityMod.Projectiles.Melee } return base.CanHitNPC(target); } - public override void AI() + + void SpawnLogic() { - player.Calamity().mouseWorldListener = true; - if (!hasSpawned) + Projectile.netUpdate = true; + //This is used when spawned by Evolution. + //Set here instead of on spawn so it all syncs in MP + if (Projectile.ai[0] != 0) { - Projectile.netUpdate = true; - if (Projectile.ai[0] != 0) + //Setting AP so high guarantees we get the full dmg of the projectile + //We also want to guarantee the proj doesn't crit ever + Projectile.ArmorPenetration = 1000; + Projectile.DamageType = DamageClass.Generic; + Projectile.CritChance = 0; + + //When not holding Mirror Blade, shards launch instantly + if (Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType()) { - //This is used when spawned by Evolution. - //Setting AP so high guarantees we get the full dmg of the projectile. - Projectile.ArmorPenetration = 1000; + shardShield = 10; hasSpawned = true; shardShield = 0; isShard = false; Projectile.timeLeft = 1200; Projectile.velocity = Projectile.DirectionTo(player.Center) * -20f; - Projectile.DamageType = DamageClass.Generic; - Projectile.CritChance = 0; return; } - shardNum = player.ownedProjectileCounts[Projectile.type]; - hasSpawned = true; - shardNum = 0; - foreach (var proj in Main.projectile) + //When holding Mirror Blade, the shards orbit the player like the blade shards. + //Evoultion shards insert themselves at the *end* of the shard list. This means they will launch themselves before any Mirror Blade shards are launched + //This is done because Evolution shards don't get the 2/3x dmg from shattering the mirror shield, so they're less valuable to be stored. + else { - if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) + + shardNum = player.ownedProjectileCounts[Projectile.type]; + hasSpawned = true; + shardNum = 0; + foreach (var proj in Main.projectile) { - (proj.ModProjectile as MirrorBlast).shardNum++; - proj.netUpdate = true; + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner && proj.ModProjectile().shardNum > -1) + { + shardNum++; + } } + return; } } + + //If not from The Evolution, run normal spawn logic + shardNum = player.ownedProjectileCounts[Projectile.type]; + hasSpawned = true; + shardNum = 0; + foreach (var proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) + { + (proj.ModProjectile as MirrorBlast).shardNum++; + proj.netUpdate = true; + } + } + } + public override void AI() + { + player.Calamity().mouseWorldListener = true; + if (!hasSpawned) + SpawnLogic(); if (isShield) { if (shardNum > 10 || Projectile.timeLeft < 2) diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 9db51e148c..79ca99264c 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -59,9 +59,10 @@ namespace CalamityMod.Projectiles.Melee { if (time == 0) { + Projectile.scale = Owner.GetMeleeScale(); if (Main.zenithWorld) { - Projectile.scale = 2; + Projectile.scale *= 2; Projectile.damage = (int)(Projectile.damage * 2); } Projectile.frame = Main.zenithWorld ? 6 : 10; @@ -93,15 +94,6 @@ namespace CalamityMod.Projectiles.Melee else Slashing = false; - if (Projectile.frame == 5 && Projectile.frameCounter % 3 == 0) - { - Projectile.damage = (int)(Projectile.damage * 2); - } - if (Projectile.frame == 7 && Projectile.frameCounter % 3 == 0) - { - Projectile.damage = (int)(Projectile.damage * 0.5f); - } - //Frames and crap Projectile.frameCounter++; if (Projectile.frameCounter % 3 == 0) @@ -179,6 +171,11 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Main.player[Projectile.owner].Center, lineEnd, lineWidth, ref _); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Slash3) + modifiers.SourceDamage *= 2f; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (target.Organic()) @@ -229,6 +226,6 @@ namespace CalamityMod.Projectiles.Melee } public override Color? GetAlpha(Color lightColor) => new Color(100, 0, 0, 0); - public override bool? CanDamage() => Slashing == false ? false : null; + public override bool? CanDamage() => Slashing ? null : false; } } diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index cf3264b909..71afbafc72 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -22,13 +22,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordClaymore"; - public float hitboxMult = 1.3f; - public override float HitboxOutset => 60; - - public override Vector2 HitboxSize => new Vector2(105, 105) * hitboxMult; + public int size = 76; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(-3, 70); + public override float AdditionalScale => 0.2f; public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -50,7 +49,6 @@ namespace CalamityMod.Projectiles.Melee { CanHit = false; Projectile.knockBack = 0; - Projectile.scale = 1.15f; // Needs to be slightly bigger for viablility Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; @@ -167,14 +165,15 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 4; i++) { - Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f)); + Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(95 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f) * Projectile.scale); dust.noGravity = true; dust.color = Main.rand.NextBool() ? Color.Orange :Color.OrangeRed; + dust.fadeIn = Projectile.scale - 1; } float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(95 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed)); } } } @@ -247,8 +246,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } - //Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Orange with { A = 0 } * (float)Math.Pow(fadeIn, 20) * 0.2f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(-Projectile.ai[1] * 95 * fadeIn) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.33f * hitboxMult, SpriteEffects.None); - Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.25f * hitboxMult, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.325f, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index 2e76546ddc..4c2405c290 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using Microsoft.Xna.Framework; @@ -30,11 +31,17 @@ namespace CalamityMod.Projectiles.Melee Projectile.ContinuouslyUpdateDamageStats = true; Projectile.ownerHitCheck = true; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 3; + Projectile.idStaticNPCHitCooldown = 5; + } + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + float scale = Owner.GetMeleeScale(); + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); } - public override void AI() { + Projectile.scale = Owner.GetMeleeScale(); Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 3; if (Projectile.frame >= Main.projFrames[Type]) @@ -51,16 +58,8 @@ namespace CalamityMod.Projectiles.Melee // Rotation and directioning. Projectile.rotation = Owner.gravDir == -1f ? MathHelper.Pi : 0f; - Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - - // Sprite and player directioning. - Projectile.spriteDirection = Projectile.direction * (int)(Owner.gravDir); - if (Projectile.direction == 1) - Projectile.Left = Owner.MountedCenter; - else - Projectile.Right = Owner.MountedCenter; - Projectile.position.X += (Projectile.spriteDirection == 1 ? -92f : 96f) * Owner.gravDir; - Projectile.position.Y -= 80f * Owner.gravDir; + Projectile.direction = Projectile.spriteDirection = MathF.Sign(Owner.Center.DirectionTo(Owner.ClampedMouseWorld()).X); + Projectile.Center = Owner.MountedCenter + new Vector2(Projectile.width * 0.1f * Projectile.scale * Projectile.direction, -Projectile.height * 0.5f * Projectile.scale); Owner.ChangeDir(Projectile.direction); // Prevents the projectile from dying diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index c184e5faaf..96fa3fea63 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player player = Main.player[Projectile.owner]; @@ -46,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); if (Projectile.timeLeft % 12 == 0 && targetDist < 1400f) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f * Projectile.scale, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); } time++; diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs index c75a37a4ae..14f1a81d43 100644 --- a/Projectiles/Melee/OrderbringerWaveProj.cs +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.Melee public float hitboxSize = 10; public Color mainColor; public float fade = 1; - public float damageMult = 1; public float fadeOut = 1; public override void SetDefaults() { @@ -36,8 +35,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190; - Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190; + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190 * Projectile.ai[1]; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190 * Projectile.ai[1]; Player player = Main.player[Projectile.owner]; mainColor = player.Calamity().lightRGB; @@ -66,26 +65,26 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f)* Projectile.ai[1] - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25 * Projectile.ai[1], ModContent.DustType()); + trailDust.scale = (Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f)) * Projectile.ai[1]; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); trailDust.color = mainColor; trailDust.noGravity = true; - trailDust.fadeIn = 2f; + trailDust.fadeIn = 2f * Projectile.ai[1]; } if (time % 9 == 0 && time < 200) { - Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f * Projectile.ai[1], mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); - Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f * Projectile.ai[1], mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(12)) { - Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f) * Projectile.ai[1], mainColor); GeneralParticleHandler.SpawnParticle(orb3); - Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f) * Projectile.ai[1], mainColor); GeneralParticleHandler.SpawnParticle(orb4); } } @@ -99,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee float waveFade = (float)Math.Pow(Utils.GetLerpValue(0, 250, Projectile.timeLeft, true), 2); float waveFade2 = (float)Math.Pow(Utils.GetLerpValue(0, 80, Projectile.timeLeft, true), 2); for (int i = 1; i < 15; i++) // Weird for loop because of squash code - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f * Projectile.ai[1], SpriteEffects.None, 0); return false; } @@ -107,12 +106,6 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 300); } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // Deal more damage on pierce - modifiers.SourceDamage *= damageMult; - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize * Projectile.ai[1], targetHitbox); } } diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index 2208750278..e50e1eeff4 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public Player Owner => Main.player[Projectile.owner]; public const float ZeroChargeDamageRatio = 0.36f; - public const float ToothDamageRatio = 0.1666667f; + public const float ToothDamageRatio = 0.5f; public const int ToothShootRate = 5; // One chainsaw tooth is emitted every this many frames. public const int ChargeUpTime = 150; public ref float Time => ref Projectile.ai[0]; @@ -63,6 +63,7 @@ namespace CalamityMod.Projectiles.Melee // Recalculate damage every frame for balance reasons, as this is a long-lasting holdout. // This is important because you could start using it while benefitting from Auric Tesla standstill bonus, for example. Projectile.damage = Owner.HeldItem is null ? 0 : Owner.GetWeaponDamage(Owner.HeldItem); + Projectile.scale = Owner.GetMeleeScale(); DetermineDamage(); PlayChainsawSounds(); @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation -= MathHelper.Pi; // Positioning close to the player's arm. - Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; + Projectile.position = playerRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f * Projectile.scale; // Update the position a tiny bit every frame at random to make it look like the saw is vibrating. // It is reset on the next frame. @@ -191,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { - Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 35f; + Vector2 spawnPosition = Projectile.Center + Projectile.velocity * 35f * Projectile.scale; // Spawn the dust a little bit on the chainsaw. X variance is less than Y variance to ensure that dust does not // spawn too far from the blade. @@ -235,7 +236,8 @@ namespace CalamityMod.Projectiles.Melee shootReach = 72f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + Projectile prismTooth = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + prismTooth.scale = Projectile.scale; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -243,9 +245,9 @@ namespace CalamityMod.Projectiles.Melee // Collision is done as a line to bypass the fact that hitboxes cannot rotate and that // this projectile is notably flat in terms of sprite shape. float _ = 0f; - float width = Projectile.scale * 36f; + float width = Projectile.scale * 36f * Projectile.scale; Vector2 start = Projectile.Center; - Vector2 end = Projectile.Center + Projectile.velocity * 70f; + Vector2 end = Projectile.Center + Projectile.velocity * 70f * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index 4f12c74fe9..21b08711b2 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override bool drawSwordTrail => false; public override bool AlternateSwings => false; - public override bool useMeleeSpeed => true; + public override bool useAttackSpeed => true; public override int swingTime { get; set; } = 8; diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index 686133e319..43171a0be7 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/SkytideDragoon"; - public override float HitboxOutset => 245; - - public override Vector2 HitboxSize => new Vector2(40, 40); // long thin hitbox for a spear is done in collision, the X here determines hitbox width + public int size = 140; + public override float HitboxOutset => size * 1.45f; + public override Vector2 HitboxSize => new Vector2(30, 30); // Has custom collision + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 135); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = 1; mousePos = Owner.Calamity().mouseWorld; @@ -151,18 +150,19 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) { Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); - Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); - Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 8f); - Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f)); + Vector2 pos = Owner.Center + (new Vector2(160 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)); + Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(1f, 4f); + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), vel, 0, default, Main.rand.NextFloat(1.85f, 2.2f) * Projectile.scale); dust.noGravity = true; dust.color = color; + dust.fadeIn = Projectile.scale - 1; - Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f), color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); + Particle spark2 = new BoltParticle(pos, -vel.RotatedBy(Owner.direction == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(-135)) * Main.rand.NextFloat(1.5f, 1.8f), false, 13, Main.rand.NextFloat(0.2f, 0.35f) * Projectile.scale, color * 0.8f, new Vector2(1.2f, 1f), true, true, false, 0.25f); GeneralParticleHandler.SpawnParticle(spark2); if (i % 2 == 0) { - Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, color * 0.75f, new Vector2(1f, 1)); + Particle orb = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f * Projectile.scale, color * 0.75f, new Vector2(1f, 1)); GeneralParticleHandler.SpawnParticle(orb); } } @@ -222,7 +222,8 @@ namespace CalamityMod.Projectiles.Melee SoundStyle sound = new("CalamityMod/Sounds/Item/SkytideBolt"); SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 0.5f); - proj.timeLeft = 45; + proj.timeLeft = (int)(45 / Projectile.scale); + proj.scale = Projectile.scale; swingCount = 0; attackPower = 6; } @@ -233,7 +234,8 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit"); SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2 * Projectile.scale, aimVel.SafeNormalize(Vector2.UnitX) * -10, ModContent.ProjectileType(), (int)(Projectile.damage * 10), Projectile.knockBack, Projectile.owner, 0, 1f); + proj.scale = Projectile.scale; swingCount = -1; attackPower = 0; } @@ -243,7 +245,8 @@ namespace CalamityMod.Projectiles.Melee { float rot = (0.1f * attackPower * i / 6f); Vector2 vel = rot.ToRotationVector2().RotatedBy(aimVel.ToRotation()) * -7; - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - aimVel * 2 * Projectile.scale, vel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0, rot); + proj.scale = Projectile.scale; } attackPower--; } @@ -267,12 +270,17 @@ namespace CalamityMod.Projectiles.Melee { Color color = Color.Lerp(Color.White, Main.rand.NextBool() ? color1 : color2, 0.65f); float bonus = (1 - (7 / (attackPower + 1))) * 0.3f; - Vector2 pos = Owner.Center + (new Vector2(160, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); + Vector2 pos = Owner.Center + (new Vector2(160 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.05f)); Vector2 vel = Projectile.rotation.ToRotationVector2().RotatedBy(MathHelper.ToRadians(-45)).RotatedByRandom(0.5f) * Main.rand.NextFloat(6f, 10f); - Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? 278 : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); - dust.noGravity = !(dust.type == 278); + Dust dust = Dust.NewDustPerfect(pos, Main.rand.NextBool(3) ? DustID.FireworksRGB : ModContent.DustType(), vel * (1 + bonus), 0, default, Main.rand.NextFloat(1.05f, 1.4f)); + dust.noGravity = dust.type != DustID.FireworksRGB; dust.color = color; dust.scale += bonus; + if (dust.type != DustID.FireworksRGB) + { + dust.scale *= Projectile.scale; + dust.fadeIn = Projectile.scale - 1; + } } } } @@ -285,7 +293,7 @@ namespace CalamityMod.Projectiles.Melee { // Perform an AABB line collision check to check the whole spear. float _ = float.NaN; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset, HitboxSize.X * Projectile.scale, ref _); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + ((Projectile.rotation - MathHelper.ToRadians(45)).ToRotationVector2() * HitboxOutset + tipOutset) * Projectile.scale, HitboxSize.X * Projectile.scale, ref _); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -342,15 +350,15 @@ namespace CalamityMod.Projectiles.Melee { // While not super visible here, this hitbox extention effect looks great and I'll use it on stuff like Terra Lance later Color tipColor = Color.Lerp(color2, color1, (i + 4) / 6) with { A = 0 } * 0.3f * fadeIn; - Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f); - Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); + Vector2 scale = new Vector2(0.25f - i * 0.04f, (1.5f + i * 0.15f) * colorFadeIn) * (0.75f * colorFadeIn * Main.rand.NextFloat(0.9f, 1.1f) + 0.25f) * Projectile.scale; + Main.EntitySpriteDraw(tex2.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 130 * Projectile.scale, null, tipColor, fxRot, tex2.Size() * 0.5f, scale, SpriteEffects.None); } for (int i = 0; i < 6; i++) { // the electric orb at the tip Color orbColor = Color.Lerp(Color.Lerp(color2, color1, (i + 2) / 6), Color.White, i / 6) with { A = 0 } * 0.5f; - Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2; - Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 180 + tipOutset, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); + Vector2 scale = new Vector2(Math.Abs(sine * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 2 * Projectile.scale; + Main.EntitySpriteDraw(orb.Value, Owner.Center - Main.screenPosition + fxPosRot.ToRotationVector2() * 188 * Projectile.scale + tipOutset * Projectile.scale, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); } } return false; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 5f67f8f6be..1293a2915c 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public class GildedProboscisProj : BaseSwordHoldoutProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override bool useMeleeSpeed => false; + public override bool useAttackSpeed => false; public override bool useMeleeSize => false; public override int swingWidth => 360; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs index b370747d9f..ba2e6a8a1b 100644 --- a/Projectiles/Melee/StarofJudgement.cs +++ b/Projectiles/Melee/StarofJudgement.cs @@ -21,6 +21,11 @@ namespace CalamityMod.Projectiles.Melee ProjectileID.Sets.TrailCacheLength[Type] = 12; ProjectileID.Sets.TrailingMode[Type] = 2; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void SetDefaults() { Projectile.width = 44; @@ -40,7 +45,8 @@ namespace CalamityMod.Projectiles.Melee if (time == 0) { mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); + if (Projectile.numHits == 0) + Projectile.scale *= (Projectile.ai[2] == 1 ? 0.75f : 0.5f); if (Projectile.ai[2] == 1) { Projectile.localNPCHitCooldown = -1; @@ -60,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = Projectile.velocity.RotatedBy(0.085f * Projectile.ai[1]); if (time % 2 == 0) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f) * Projectile.scale, true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } } @@ -70,10 +76,11 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, ModContent.DustType()); - trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.scale = Main.rand.NextFloat(0.9f, 1.05f) * Projectile.scale; trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; trailDust.noGravity = true; + trailDust.fadeIn = Projectile.scale - 1; } } diff --git a/Projectiles/Melee/StarofOrder.cs b/Projectiles/Melee/StarofOrder.cs index 958b843c75..8a794b9401 100644 --- a/Projectiles/Melee/StarofOrder.cs +++ b/Projectiles/Melee/StarofOrder.cs @@ -35,14 +35,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 7; } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float hitboxSize = Projectile.width * Projectile.scale; + return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } public override void AI() { Player player = Main.player[Projectile.owner]; mainColor = player.Calamity().lightRGB; - if (time == 0) + if (time == 0 && Projectile.numHits == 0) { - Projectile.scale = Main.rand.NextFloat(0.65f, 0.8f); + Projectile.scale *= Main.rand.NextFloat(0.65f, 0.8f); } float sine = (float)Math.Sin(time * 0.575f * Projectile.scale / MathHelper.Pi); @@ -59,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee } if (time % 2 == 0 && Projectile.numHits < 1) { - Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f) * Projectile.scale, true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } @@ -107,10 +111,10 @@ namespace CalamityMod.Projectiles.Melee { Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2, ModContent.DustType(), velocity * 8); - dust.scale = 3.5f; + dust.scale = 3.5f * Projectile.scale; dust.color = mainColor; dust.noGravity = true; - dust.fadeIn = 6f; + dust.fadeIn = 6f * Projectile.scale; } } } diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index d06ba14221..75277743b9 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -22,12 +22,11 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarStriker"; - public override float HitboxOutset => 90; - - public override Vector2 HitboxSize => new Vector2(130, 130); + public int size = 118; + public override float HitboxOutset => size * 0.85f; + public override Vector2 HitboxSize => new Vector2(size, size); + public override Vector2 SpriteOrigin => new(0, size); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - - public override Vector2 SpriteOrigin => new(0, 118); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -47,7 +46,6 @@ namespace CalamityMod.Projectiles.Melee public override void WhenSpawned() { Projectile.knockBack = 0; - Projectile.scale = 1; Projectile.ai[1] = -1; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Stellar Striker's projectile spawning @@ -161,24 +159,24 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); - Particle orb = new CustomPulse(particlePos, -particleVel * Main.rand.NextFloat(1.1f, 3.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/Sparkle", new Vector2(2f, 1f), particleVel.ToRotation(), Main.rand.NextFloat(0.4f, 1.1f), 0.2f, 23); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; + Particle orb = new CustomPulse(particlePos, -particleVel * Main.rand.NextFloat(1.1f, 3.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/Sparkle", new Vector2(2f, 1f), particleVel.ToRotation(), Main.rand.NextFloat(0.4f, 1.1f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); } for (int i = 0; i < 4; i++) { float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - Particle spark2 = new GlowSparkParticle(Owner.Center + (new Vector2(140, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.4f)), -dustVel, false, 20, Main.rand.NextFloat(0.007f, 0.012f), Color.Turquoise, new Vector2(1.3f, 0.5f), true, false, Main.rand.NextFloat(0.5f, 0.7f)); + Particle spark2 = new GlowSparkParticle(Owner.Center + (new Vector2(140 * Projectile.scale, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.4f)), -dustVel, false, 20, Main.rand.NextFloat(0.007f, 0.012f) * Projectile.scale, Color.Turquoise, new Vector2(1.3f, 0.5f), true, false, Main.rand.NextFloat(0.5f, 0.7f)); GeneralParticleHandler.SpawnParticle(spark2); } } else if (Main.rand.NextBool(3)) { Vector2 particleVel = new Vector2(0, 3 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(5, 130), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))) * Projectile.scale; - Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f), 0.2f, 23); + Particle orb = new CustomPulse(particlePos, particleVel * Main.rand.NextFloat(0.8f, 1.2f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, "CalamityMod/Particles/HealingPlus", new Vector2(1f, 1f), Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(0.8f, 1.2f) * Projectile.scale, 0.2f, 23); GeneralParticleHandler.SpawnParticle(orb); //GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 23, Main.rand.NextFloat(0.2f, 0.6f), 0.65f, 0, true)); @@ -220,7 +218,8 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + meteor.scale = Projectile.scale; spawnBoom = false; } diff --git a/Projectiles/Melee/StellarStrikerMeteor.cs b/Projectiles/Melee/StellarStrikerMeteor.cs index 0cfc50fec9..e187bb142b 100644 --- a/Projectiles/Melee/StellarStrikerMeteor.cs +++ b/Projectiles/Melee/StellarStrikerMeteor.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -67,28 +68,25 @@ namespace CalamityMod.Projectiles.Melee if (targetDist < 1400f) { - if (time % 11 == 0) - { - GlowSparkParticle orb = new(Projectile.Center + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * 2, false, 11, 0.03f, mainColor * Main.rand.NextFloat(0.7f, 1), new Vector2(1f, 1f), true, false, 0.6f); - GeneralParticleHandler.SpawnParticle(orb); - } if (time % 4 == 0) { - GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 6, Main.rand.NextFloat(0.3f, 0.7f), 0.65f, 0, true)); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.Turquoise, 6, Main.rand.NextFloat(0.3f, 0.7f) * Projectile.scale, 0.65f, 0, true)); } } - if (time % 2 == 0) - { - // Spawn in a helix-style pattern - float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); - Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * wavePower; + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * wavePower; - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset * direction, DustID.RainbowMk2, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.3f)); - dust.scale = Main.rand.NextFloat(0.85f, 0.95f); - dust.noGravity = true; - dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; - } + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity * 2, ModContent.DustType(), (Projectile.timeLeft % 2 == 0 ? -Projectile.velocity * 2 : offset * direction * 0.5f)); + dust.scale = Main.rand.NextFloat(1.15f, 1.25f) * Projectile.scale; + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; + dust.fadeIn = Projectile.scale * 1.25f; + dust.noLight = true; + dust.noLightEmittence = true; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; time++; @@ -97,7 +95,8 @@ namespace CalamityMod.Projectiles.Melee { spawnMet = false; Vector2 spawnSpot = Owner.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + Projectile meteor = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + meteor.scale = Projectile.scale; } } @@ -106,6 +105,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1, tex); + CalamityUtils.DrawProjectileWithBackglow(Projectile, Color.Turquoise with { A = 0 }, lightColor, 4 * Projectile.scale); return false; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee } for (int i = 0; i < 6; i++) { - Particle spark3 = new SparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 14), false, 20, Main.rand.NextFloat(0.3f, 0.8f), Main.rand.NextBool(5) ? Color.PaleTurquoise : Color.Turquoise); + Particle spark3 = new SparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 14), false, 20, Main.rand.NextFloat(0.3f, 0.8f) * Projectile.scale, Main.rand.NextBool(5) ? Color.PaleTurquoise : Color.Turquoise); GeneralParticleHandler.SpawnParticle(spark3); } for (int i = 0; i < 18; i++) @@ -149,10 +149,13 @@ namespace CalamityMod.Projectiles.Melee c.noGravity = true; c.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise; } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f, 1f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 0.3f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); + if (!CalamityClientConfig.Instance.Photosensitivity) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, mainColor * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 2f * Projectile.scale, 1f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f * Projectile.scale, 0.3f * Projectile.scale, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } } public override bool? CanCutTiles() => false; } diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index b62d82e9dd..f418a91a2b 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -28,7 +28,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.timeLeft = 300; } - + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + Player Owner = Main.player[Projectile.owner]; + float scale = Projectile.scale; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } public override void AI() { Projectile.frameCounter++; @@ -95,9 +101,9 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.Item21, Projectile.position); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X -= (float)(Projectile.width / 2); - Projectile.position.Y -= (float)(Projectile.height / 2); + Projectile.width *= (int)(2 * Projectile.scale); Projectile.height *= (int)(2 * Projectile.scale); + Projectile.position.X -= (float)(Projectile.width / (int)(2 * Projectile.scale)); + Projectile.position.Y -= (float)(Projectile.height / (int)(2 * Projectile.scale)); for (int i = 0; i < 2; i++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index e52c6e5d7f..6a4b295669 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Projectiles.Melee float rotationSpeed = -0.7853982f; Vector2 actualPosition = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 rotationPoint = Vector2.Zero; + Projectile.scale = player.GetMeleeScale(); if (player.dead) { @@ -141,6 +142,7 @@ namespace CalamityMod.Projectiles.Melee var source = Projectile.GetSource_FromThis(); Projectile bubble = CalamityUtils.ProjectileBarrage(source, Projectile.Center, player.Center, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack * 0.5f, Projectile.owner, true); bubble.ai[1] = Main.rand.NextFloat() + 0.5f; + bubble.scale = Projectile.scale; } } } @@ -161,7 +163,7 @@ namespace CalamityMod.Projectiles.Melee } float f = Projectile.rotation - 0.7853982f * (float)Math.Sign(Projectile.velocity.X); float rotationFactor = 0f; - float collisionRadius = 110f; + float collisionRadius = 110f * Projectile.scale; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + f.ToRotationVector2() * -collisionRadius, Projectile.Center + f.ToRotationVector2() * collisionRadius, 23f * Projectile.scale, ref rotationFactor)) { return true; diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index 104bca3d8a..7e4b87d2cd 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 1; - Projectile.scale = 1.2f; } public override void AI() diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index 6b82d56b3d..15b24a242b 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -62,6 +62,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + if (EndLag == 0) //Initialization { EndLag = (float)Math.Max(Owner.HeldItem.useTime - MaxTime, 1); @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation Projectile.Center = Owner.MountedCenter + OffsetFromPlayer; - Projectile.scale = 1f + (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.2f; //SWAGGER + Projectile.scale = Owner.GetMeleeScale() * 1f + (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.2f; //SWAGGER //Make the owner look like theyre holding the sword bla bla Owner.heldProj = Projectile.whoAmI; @@ -222,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee Rectangle frame = new Rectangle(0, (smearTex.Height / 3) * frameCount, smearTex.Width, smearTex.Height / 3); float opacity = 1 - (float)Math.Pow(LifetimeCompletion / 0.6f, 0.5f); - Main.spriteBatch.Draw(smearTex, Projectile.Center + Projectile.velocity * 67f - Main.screenPosition, frame, Color.White * opacity, Projectile.rotation, frame.Size() / 2f, 0.9f, 0, 0); + Main.spriteBatch.Draw(smearTex, Projectile.Center + Projectile.velocity * 67f * Projectile.scale - Main.screenPosition, frame, Color.White * opacity, Projectile.rotation, frame.Size() / 2f, 0.9f * Projectile.scale, 0, 0); } return false; } diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 3c7a6de762..8dc9e0ec37 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; @@ -20,12 +21,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public class ObliteratorYoyo : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - private static int DashStartup => 60; - private static int DashCooldown => 15; + private static int DashStartup => 90; + private static int DashCooldown => 30; public SlotId GFB; public int GFBCounter = 0; public int time = 0; + public int DashQueue = 0; + int dashTimer = 0; + int timerToStartDash = 0; public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; @@ -48,20 +52,30 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.localNPCHitCooldown = 7 * Projectile.MaxUpdates; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(DashQueue); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + DashQueue = reader.ReadInt32(); + } + public override bool PreAI() { if (Projectile.FinalExtraUpdate()) { - if (Projectile.localAI[1] != DashStartup) - Projectile.localAI[1]++; - if (Projectile.localAI[1] > DashStartup + DashCooldown) - Projectile.localAI[1] = 0; + timerToStartDash++; + if (timerToStartDash % DashStartup == DashStartup - 1) + DashQueue++; } - if (Projectile.localAI[1] <= DashStartup) + if (dashTimer <= 0) return true; Projectile.aiStyle = -1; Projectile.timeLeft++; + dashTimer--; return true; } @@ -94,8 +108,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Projectile.FinalExtraUpdate()) { - if (Projectile.localAI[1] == DashStartup) + if (DashQueue > 0 && dashTimer <= 0) { + DashQueue--; + List targets = new List(); float laserRange = 600f; foreach (NPC n in Main.ActiveNPCs) @@ -139,7 +155,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); GeneralParticleHandler.SpawnParticle(spark); } - Projectile.localAI[1]++; + dashTimer = DashCooldown; Projectile.ResetLocalNPCHitImmunity(); } } @@ -158,7 +174,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Vector2 origin = new Vector2(10f, 10f); Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 2f, SpriteEffects.None, 0); - if (Projectile.localAI[1] <= DashStartup) + if (dashTimer <= 0) return; var tex = ModContent.Request("CalamityMod/Particles/Jaws").Value; Main.spriteBatch.SetBlendState(BlendState.Additive); @@ -176,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.localAI[1] > DashStartup) + if (dashTimer > 0) { modifiers.SourceDamage *= 6; } @@ -186,7 +202,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Projectile.localAI[1] > DashStartup) { - Projectile.localAI[1] = 0; + dashTimer = 0; target.AddBuff(ModContent.BuffType(), 180); for (int i = 0; i < 10; i++) { diff --git a/Projectiles/Melee/Yoyos/PandemicYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs index 7c0eba0a05..dc542b50b9 100644 --- a/Projectiles/Melee/Yoyos/PandemicYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -1,5 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,12 +14,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public class PandemicYoyo : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public const int MaxUpdates = 2; + + List hitNPCs = []; public override void SetStaticDefaults() { - ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; + ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = Pandemic.Lifetime * 2f; ProjectileID.Sets.YoyosMaximumRange[Type] = Pandemic.Reach; - ProjectileID.Sets.YoyosTopSpeed[Type] = Pandemic.Speed / MaxUpdates; + ProjectileID.Sets.YoyosTopSpeed[Type] = Pandemic.Speed / 2f; } public override void SetDefaults() @@ -27,21 +30,36 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.penetrate = -1; - Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * MaxUpdates; + Projectile.localNPCHitCooldown = 20; + Projectile.MaxUpdates = 2; } public override void AI() { - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 180f, 5, ModContent.ProjectileType(), 0.75); if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); + Projectile.scale = Pandemic.SizeMultiplier(hitNPCs.Count); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= Pandemic.DamageMultiplier(hitNPCs.Count); + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + if (target.HasBuff(ModContent.BuffType())) + { + target.AddBuff(ModContent.BuffType(), 300); //Pandemic hits refresh Plague to 5 seconds + if (!hitNPCs.Contains(target)) + { + hitNPCs.Add(target); + Projectile.localAI[0] = 0; + + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green, Vector2.One, 0, 0f, 0.5f, 30); + GeneralParticleHandler.SpawnParticle(pulse); + } + } } public override bool PreDraw(ref Color lightColor) 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/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 6105c72c87..989ceead5a 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -60,8 +60,7 @@ namespace CalamityMod.Projectiles.Ranged Particle spark = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark2", false, 17, 0.052f, Color.Black, new Vector2(0.6f, 1.3f), false); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 17, 0.027f, Color.LightGreen, new Vector2(0.6f, 1.3f), true, false); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } if (Time == 9f) @@ -111,8 +110,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 3; i++) { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f, 0.52f, 38); - GeneralParticleHandler.SpawnParticle(blastRing); - blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing, false, GeneralDrawLayer.AfterEverything); } float numberOfDusts = 10; @@ -124,8 +122,6 @@ namespace CalamityMod.Projectiles.Ranged dust.scale = Main.rand.NextFloat(1.6f, 2.2f); dust.color = InnerColor; } - //Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0f, 0.1f, 15); - //GeneralParticleHandler.SpawnParticle(pulse); if (BounceHits == 0f) SoundEngine.PlaySound(DeadSunsWind.Ricochet, Projectile.Center); diff --git a/Projectiles/Ranged/DeadSunExplosion.cs b/Projectiles/Ranged/DeadSunExplosion.cs index 18d952eb85..06872fddbf 100644 --- a/Projectiles/Ranged/DeadSunExplosion.cs +++ b/Projectiles/Ranged/DeadSunExplosion.cs @@ -33,8 +33,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Particle explosion = new DetailedExplosion(Projectile.Center, Vector2.Zero, color1, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0065f + 0.1f, Main.rand.Next(15, 22)); - GeneralParticleHandler.SpawnParticle(explosion); - explosion.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(explosion, false, GeneralDrawLayer.AfterEverything); Particle explosion2 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0045f + 0.1f, Main.rand.Next(15, 22), false); GeneralParticleHandler.SpawnParticle(explosion2); Particle explosion3 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0030f + 0.1f, Main.rand.Next(15, 22), false); @@ -43,8 +42,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 4; i++) { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, color1, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, ExplosionRadius * 0.005f + 0.05f, 25); - GeneralParticleHandler.SpawnParticle(blastRing); - blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing, false, GeneralDrawLayer.AfterEverything); } float numberOfDusts = ExplosionRadius * 0.1f + 10; 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/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index d35823a7da..120b2934d0 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -109,8 +109,7 @@ namespace CalamityMod.Projectiles.Rogue Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 1.2f, Color.Black); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 0.9f, Color.LightGreen); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); if (Main.rand.NextBool() && !Projectile.Calamity().stealthStrike) { Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); @@ -127,8 +126,7 @@ namespace CalamityMod.Projectiles.Rogue Particle spark = new AltSparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.8f, Color.Black); GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen); - GeneralParticleHandler.SpawnParticle(spark2); - spark2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(spark2, false, GeneralDrawLayer.AfterEverything); } if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) { @@ -221,8 +219,7 @@ namespace CalamityMod.Projectiles.Rogue } Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.85f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1f, 18); - GeneralParticleHandler.SpawnParticle(bolt2); - bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt2, false, GeneralDrawLayer.AfterEverything); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); } diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index d5dd26b9c3..087f55c3ab 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -47,11 +47,9 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.rand.NextBool(4)) { - Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(70, 70), Vector2.UnitY * Main.rand.NextFloat(-3.5f, -5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(70, 70), Vector2.UnitY * Main.rand.NextFloat(-3.5f, -5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner,0,0,Projectile.Calamity().stealthStrike ? 1 : 0); if (bubble.whoAmI.WithinBounds(Main.maxProjectiles)) { - //We mark it as a stealth strike to change its dust - bubble.Calamity().stealthStrike = Projectile.Calamity().stealthStrike; bubble.DamageType = RogueDamageClass.Instance; bubble.timeLeft = 45; } diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index fbf4344802..45e56915f2 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.damage = (int)(Projectile.damage * 0.9f); + Projectile.damage = (int)(Projectile.damage * 0.8f); if (Projectile.Calamity().stealthStrike) { if (!hasHit) @@ -123,6 +123,7 @@ namespace CalamityMod.Projectiles.Rogue } Projectile.ResetLocalNPCHitImmunity(); Ricochet(); + Projectile.damage = (int)(Projectile.damage * 0.8f); if (Projectile.penetrate > 0) Projectile.penetrate--; return false; diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index d7f5e1c37c..9b6affec5e 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -106,8 +106,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 2; i++) { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.5f, Projectile.ai[1] * 0.3f, 15, false); - GeneralParticleHandler.SpawnParticle(blastRing); - blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(blastRing, false, GeneralDrawLayer.AfterEverything); } } else diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index f8aff95cac..7a12927668 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -157,11 +157,9 @@ namespace CalamityMod.Projectiles.Rogue float bigExplosionDamage = 3f; Player Owner = Main.player[Projectile.owner]; Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11); - GeneralParticleHandler.SpawnParticle(orb); - orb.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb, false, GeneralDrawLayer.AfterEverything); Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); - GeneralParticleHandler.SpawnParticle(orb2); - orb2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb2, false, GeneralDrawLayer.AfterEverything); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); @@ -187,16 +185,13 @@ namespace CalamityMod.Projectiles.Rogue } Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18); - GeneralParticleHandler.SpawnParticle(bolt2); - bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt2, false, GeneralDrawLayer.AfterEverything); Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * sizeBonus, 30); - GeneralParticleHandler.SpawnParticle(bolt3); - bolt3.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt3, false, GeneralDrawLayer.AfterEverything); Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f * sizeBonus, 30); - GeneralParticleHandler.SpawnParticle(bolt4); - bolt4.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(bolt4, false, GeneralDrawLayer.AfterEverything); for (int i = 0; i < 2; i++) { diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index 7f049480b7..9f43df61b9 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -137,12 +137,17 @@ namespace CalamityMod.Projectiles.Rogue float speedMult = (float)Math.Pow(Utils.GetLerpValue(1, 4, charge, true), 2) + 0.05f; float arcValue = hasReachedFullCharge ? 0 : (float)Math.Pow(Utils.Remap(speedMult, 0, 1f, 1f, 0.8f), 4); Projectile.ai[1] = arcValue; - Projectile.velocity = velocity * 9 * speedMult; + Projectile.velocity = velocity * 9 * speedMult * Owner.Calamity().rogueVelocity; SoundStyle w = new("CalamityMod/Sounds/Item/SwooshMid"); SoundEngine.PlaySound(w with { Volume = 1f, Pitch = 0.2f, MaxInstances = 6 }, Projectile.Center); if (hasReachedFullCharge) { + if (Owner.Calamity().StealthStrikeAvailable()) + { + Projectile.Calamity().stealthStrike = true; + Owner.Calamity().ConsumeStealthByAttacking(); + } rotSpeed *= 2; SoundStyle w2 = new("CalamityMod/Sounds/Item/SwooshMid"); SoundEngine.PlaySound(w2 with { Volume = 1f, Pitch = -0.4f, MaxInstances = 6 }, Projectile.Center); @@ -150,11 +155,7 @@ namespace CalamityMod.Projectiles.Rogue else Owner.Calamity().ConsumeStealthByAttacking(); - if (Owner.Calamity().StealthStrikeAvailable() && hasReachedFullCharge) - { - Projectile.Calamity().stealthStrike = true; - Owner.Calamity().ConsumeStealthByAttacking(); - } + Projectile.tileCollide = true; flung = true; @@ -427,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/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 40e64aea72..bf00a4951a 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -1,62 +1,67 @@ -using Terraria; +using System; +using System.Net.Http.Headers; +using CalamityMod.Dusts; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistExceptionAttribute] public class DuststormCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() => Main.projFrames[Type] = 4; public override void SetDefaults() { - Projectile.width = 38; - Projectile.height = 14; + Projectile.width = 128; + Projectile.height = 128; Projectile.friendly = true; Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 600; - Projectile.DamageType = DamageClass.Generic; + Projectile.timeLeft = 180; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; + Projectile.penetrate = -1; } + Color color = Color.White; + + public static Color RandomColor + { + get + { + switch (Main.rand.Next(4)) + { + case 0: return Color.SandyBrown; + case 1: return new Color(164, 118, 78); + case 2: return new Color(210, 183, 126); + case 3: return new Color(151, 130, 103); + } + return Color.White; + } + } public override void AI() { - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (color == Color.White) { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - { - Projectile.frame = 0; - } - Projectile.velocity *= 0.995f; - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 120f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - else if (Projectile.owner == Main.myPlayer) - { - Projectile.Kill(); - } - } - else if (Projectile.alpha > 80) - { - Projectile.alpha -= 30; - if (Projectile.alpha < 80) - { - Projectile.alpha = 80; - } + color = RandomColor; } + Projectile.velocity *= 0.97f; + Projectile.rotation += 0.05f; + Projectile.Opacity = (1- MathF.Pow(1-Projectile.timeLeft / 180f,2)) * 0.5f; + if (Projectile.timeLeft % 5 == 0) + Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(32,32), ModContent.DustType(),newColor: RandomColor, Scale: 0.75f).customData = Projectile.Opacity; + } + public override bool PreDraw(ref Color lightColor) + { + lightColor = color; + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center-Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, 0.08f * Projectile.scale, 0); + return false; } } } diff --git a/Projectiles/Rogue/DuststormCloud.png b/Projectiles/Rogue/DuststormCloud.png index b3ef97ca5a..f238522679 100644 Binary files a/Projectiles/Rogue/DuststormCloud.png and b/Projectiles/Rogue/DuststormCloud.png differ diff --git a/Projectiles/Rogue/DuststormCloudExplosion.cs b/Projectiles/Rogue/DuststormCloudExplosion.cs new file mode 100644 index 0000000000..bf6fa64f98 --- /dev/null +++ b/Projectiles/Rogue/DuststormCloudExplosion.cs @@ -0,0 +1,59 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormCloudExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + public override string Texture => "CalamityMod/Projectiles/Rogue/DuststormCloud"; + public override void SetDefaults() + { + Projectile.width = 150; + Projectile.height = 150; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 1; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; + } + + Color color = Color.White; + public override void AI() + { + if (color == Color.White) + { + color = DuststormCloud.RandomColor; + } + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact); + for (var i = 0; i < 80; i++) { + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(8, 8) * Main.rand.NextFloat(0.2f,1.2f), newColor: DuststormCloud.RandomColor, Scale: 0.75f); + d.customData = 0.75f; + } + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + modifiers.SourceDamage /= Main.masterMode ? 2f : Main.expertMode ? 1.5f : 1; + modifiers.SourceDamage *= 0.1f; + } + public override bool PreDraw(ref Color lightColor) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, color * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, 0.08f * Projectile.scale, 0); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width, targetHitbox); + } +} diff --git a/Projectiles/Rogue/DuststormCloudHitbox.cs b/Projectiles/Rogue/DuststormCloudHitbox.cs deleted file mode 100644 index a8e02d7678..0000000000 --- a/Projectiles/Rogue/DuststormCloudHitbox.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs; -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - [PierceResistExceptionAttribute(true)] - public class DuststormCloudHitbox : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetDefaults() - { - Projectile.width = 50; - Projectile.height = 50; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = DuststormInABottle.CloudLifetime; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 12; - } - - public override void AI() - { - if (Projectile.scale < (Projectile.ai[1] == 1 ? DuststormInABottle.MaxSizeStealth : DuststormInABottle.MaxSize)) - { - Projectile.scale += Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate; - Projectile.ExpandHitboxBy(1 + (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate)); - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width, targetHitbox); - } -} diff --git a/Projectiles/Rogue/DuststormInABottleHoldout.cs b/Projectiles/Rogue/DuststormInABottleHoldout.cs new file mode 100644 index 0000000000..194a525056 --- /dev/null +++ b/Projectiles/Rogue/DuststormInABottleHoldout.cs @@ -0,0 +1,126 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormInABottleHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + bool isChannelable = false; + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 22; Projectile.height = 28; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 10; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 24; + modplayer.swingNum = 0; + RotateInStartup = 1; + } + + public override void AdditionalAI() + { + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 1.1f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(2) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + if (Projectile.FinalExtraUpdate() && inStartup) + if (explodeTimer < explodeTimeGoal) + explodeTimer++; + else + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal, -1).hostile = true; + Projectile.Opacity = 0; + return; + } + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (player.channel && inStartup) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -12.5f * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 61d51c1462..4b3f248cf1 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -1,9 +1,6 @@ -using System; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -13,64 +10,100 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; - public override void SetDefaults() + int lifetime => AIState == 1 ? 300 : 150; + public override void SetStaticDefaults() { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.timeLeft = 180; - AIType = ProjectileID.ThrowingKnife; - Projectile.DamageType = RogueDamageClass.Instance; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } - public override void OnKill(int timeLeft) + public override void SetDefaults() { - bool stealth = Projectile.Calamity().stealthStrike; - SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - double cloudAmt = Main.rand.Next(40, 50); - if (stealth) + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = lifetime; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + ref float Timer => ref Projectile.ai[0]; + ref float TimerMax => ref Projectile.ai[1]; + ref float AIState => ref Projectile.ai[2]; + + int gravTimer = 0; + bool Stealth => Projectile.Calamity().stealthStrike; + + public override void AI() + { + Timer++; + gravTimer++; + + Projectile.rotation += 0.175f * Projectile.direction * Projectile.velocity.Length(); + if (gravTimer > 20) { - //DUST STORM - for (int dustexplode = 0; dustexplode < 180; dustexplode++) - { - Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius).RotatedBy(MathHelper.ToRadians(dustexplode * 2)); - - Particle dust = new SandyDustParticle(Projectile.Center, dustd * Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); - GeneralParticleHandler.SpawnParticle(dust); - - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool(5) ? 32 : 85, dustd.X, dustd.Y, 50, default, 2f); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= Main.rand.NextFloat(0.25f, 1f); - Main.dust[d].scale *= Main.rand.NextFloat(0.5f, 0.8f); - } - cloudAmt *= 2.75; - cloudAmt = Math.Round(cloudAmt); + Projectile.velocity.Y += 0.22f; } - else - { - //DUST STORM but smaller - for (int dustexplode = 0; dustexplode < 120; dustexplode++) - { - Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius - 2).RotatedBy(MathHelper.ToRadians(dustexplode * 3)); - Particle dust = new SandyDustParticle(Projectile.Center, dustd * Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); - GeneralParticleHandler.SpawnParticle(dust); + if (AIState == 1) + { + if (Timer % 10 == 0 && Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(5, 5), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); } } - if (Projectile.owner == Main.myPlayer) + if (Timer > TimerMax && AIState == 0) { - for (int index = 0; index < cloudAmt; index++) + if (!Stealth) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, stealth ? velocity * 1.2f : velocity, ModContent.ProjectileType(), 0, 0, Projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.Kill(); + return; } - int hitbox = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner); - if (hitbox.WithinBounds(Main.maxProjectiles) && Projectile.Calamity().stealthStrike) //Inherit stealth flag - Main.projectile[hitbox].ai[1] = 1; + AIState = 1; + Timer = 0; + Projectile.timeLeft = lifetime; } } + public override bool PreDraw(ref Color lightColor) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + return false; + } + + public override bool? CanHitNPC(NPC target) + { + return Projectile.velocity.Length() > 1f; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!Stealth) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.Kill(); + return; + } + if (Projectile.numHits == 0) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + return; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + if (gravTimer > 25) + fallThrough = false; + return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity *= 0.95f; + return false; + } } } diff --git a/Projectiles/Rogue/EclipseStealthBoom.cs b/Projectiles/Rogue/EclipseStealthBoom.cs deleted file mode 100644 index d258de5353..0000000000 --- a/Projectiles/Rogue/EclipseStealthBoom.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class EclipseStealthBoom : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - - public const int Lifetime = 35; // 7 animation frames, 12 FPS - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 7; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 102; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = -1; - Projectile.timeLeft = Lifetime; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 5; - - if (Projectile.frameCounter > Lifetime) - Projectile.Kill(); - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Rectangle frame = glow.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - } -} diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs deleted file mode 100644 index acae2f710c..0000000000 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ /dev/null @@ -1,78 +0,0 @@ -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class EclipsesFallMain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; - - // these also affect KB - public static float RainDamageMult = 0.4f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 40; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.MaxUpdates = 2; - Projectile.penetrate = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; - Projectile.timeLeft = 150 * Projectile.MaxUpdates; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.3f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Main.rand.NextBool(5)) - { - Vector2 trailPos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-16f, 16f); - float trailScale = Main.rand.NextFloat(0.8f, 1.2f); - Color trailColor = Main.rand.NextBool() ? Color.Indigo : Color.DarkOrange; - Particle eclipseTrail = new SparkParticle(trailPos, Projectile.velocity * 0.2f, false, 60, trailScale, trailColor); - GeneralParticleHandler.SpawnParticle(eclipseTrail); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnSpears(target); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnSpears(target); - - private void SpawnSpears(Entity target) - { - int spearAmt = Main.rand.Next(3, 4 + 1); // 3 or 4 spears - for (int n = 0; n < spearAmt; n++) - { - Vector2 spawnPos = target.Center - new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(500f, 800f)); - Vector2 spearVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, target, 29f, 2) + Vector2.UnitX * Main.rand.NextFloat(-6f, 6f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, spearVel, ModContent.ProjectileType(), (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - } -} diff --git a/Projectiles/Rogue/EclipseStealthBoom.png b/Projectiles/Rogue/EclipsesFall_LightExplosion.png similarity index 100% rename from Projectiles/Rogue/EclipseStealthBoom.png rename to Projectiles/Rogue/EclipsesFall_LightExplosion.png diff --git a/Projectiles/Rogue/EclipseStealthBoomGlow.png b/Projectiles/Rogue/EclipsesFall_LightExplosionGlow.png similarity index 100% rename from Projectiles/Rogue/EclipseStealthBoomGlow.png rename to Projectiles/Rogue/EclipsesFall_LightExplosionGlow.png diff --git a/Projectiles/Rogue/EclipsesFall_LightFragment.png b/Projectiles/Rogue/EclipsesFall_LightFragment.png new file mode 100644 index 0000000000..fc489108d0 Binary files /dev/null and b/Projectiles/Rogue/EclipsesFall_LightFragment.png differ diff --git a/Projectiles/Rogue/EclipsesFall_StealthSpear.png b/Projectiles/Rogue/EclipsesFall_StealthSpear.png new file mode 100644 index 0000000000..fe72281fb5 Binary files /dev/null and b/Projectiles/Rogue/EclipsesFall_StealthSpear.png differ diff --git a/Projectiles/Rogue/EclipsesFall_StealthSpearExplosion.png b/Projectiles/Rogue/EclipsesFall_StealthSpearExplosion.png new file mode 100644 index 0000000000..58635d492a Binary files /dev/null and b/Projectiles/Rogue/EclipsesFall_StealthSpearExplosion.png differ diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs deleted file mode 100644 index f9831d85bc..0000000000 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class EclipsesSmol : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = Projectile.height = 24; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.MaxUpdates = 2; - Projectile.timeLeft = 75 * Projectile.MaxUpdates; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.5f, 0.4f, 0.15f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 16f, 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - return false; - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - } -} diff --git a/Projectiles/Rogue/EclipsesSmol.png b/Projectiles/Rogue/EclipsesSmol.png deleted file mode 100644 index 96e05053b1..0000000000 Binary files a/Projectiles/Rogue/EclipsesSmol.png and /dev/null differ diff --git a/Projectiles/Rogue/EclipsesSmolGlow.png b/Projectiles/Rogue/EclipsesSmolGlow.png deleted file mode 100644 index 0539d70e64..0000000000 Binary files a/Projectiles/Rogue/EclipsesSmolGlow.png and /dev/null differ diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs deleted file mode 100644 index bdf017b9f2..0000000000 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ /dev/null @@ -1,129 +0,0 @@ -using CalamityMod.NPCs; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - [PierceResistException] - public class EclipsesStealth : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; - - // these also affect KB - public const float RainDamageMult = 0.2f; - public const float ExplosionDamageMult = 0.5f; - - private bool changedTimeLeft = false; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 40; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.MaxUpdates = 2; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.timeLeft = 150 * Projectile.MaxUpdates; - } - - // Uses localAI[1] to decide how many frames until the next spear drops. - public override void AI() - { - Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.3f); - // Behavior when not sticking to anything - if (Projectile.ai[0] == 0f) - { - // Keep the spear oriented in the correct direction - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Main.rand.NextBool(5)) - { - Vector2 trailPos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-16f, 16f); - float trailScale = Main.rand.NextFloat(0.8f, 1.2f); - Color trailColor = Main.rand.NextBool() ? Color.Indigo : Color.DarkOrange; - Particle eclipseTrail = new SparkParticle(trailPos, Projectile.velocity * 0.2f, false, 60, trailScale, trailColor); - GeneralParticleHandler.SpawnParticle(eclipseTrail); - } - } - - // Behavior when having impaled a target - else - { - // Eclipse's Fall is guaranteed to impale for 10 seconds, no more, no less - if (!changedTimeLeft) - { - Projectile.MaxUpdates = 1; - Projectile.timeLeft = 600; - changedTimeLeft = true; - } - - // Spawn spears. As this uses local AI, it's done client-side only. - if (Projectile.owner == Main.myPlayer) - { - Projectile.localAI[1] -= 1f; - if (Projectile.localAI[1] <= 0f) - { - // Set up the spear counter for next time. Used to be every 5 frames there was a 50% chance; now it's more reliable but slower. - Projectile.localAI[1] = Main.rand.Next(8, 10+1); // 8 to 10 frames between each spearfall - - int type = ModContent.ProjectileType(); - Vector2 spawnPos = Projectile.Center - new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(500f, 800f)); - Vector2 spearVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, Main.npc[(int)Projectile.ai[1]], 29f, 2) + Vector2.UnitX * Main.rand.NextFloat(-6f, 6f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, spearVel, type, (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); - } - } - } - - // Sticky behavior. Lets the projectile impale enemies and sticks to its impaled enemy automatically. - Projectile.StickyProjAI(10); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(1); - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override void PostDraw(Color lightColor) - { - Texture2D glow = ModContent.Request(Texture + "Glow").Value; - Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); - } - - public override bool? CanHitNPC(NPC target) => Projectile.ai[0] == 1f ? false : base.CanHitNPC(target); - - public override bool CanHitPvp(Player target) => Projectile.ai[0] != 1f; - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * ExplosionDamageMult), Projectile.knockBack * ExplosionDamageMult, Projectile.owner); - } - } -} 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..e2dcbb4116 --- /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 && !target.townNPC) + { + 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 = 5; + 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/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index dc34689d70..c7d160009e 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,17 +16,39 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.timeLeft = 90; - AIType = ProjectileID.WoodenArrowFriendly; + Projectile.penetrate = 4; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; + Projectile.timeLeft = 600; + AIType = ProjectileID.SpikyBall; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.localNPCHitCooldown = 15; + Projectile.usesLocalNPCImmunity = true; } - public override void AI() + public override bool PreAI() { - Projectile.rotation += Projectile.velocity.Y; - Projectile.velocity.Y *= 1.05f; + if (Projectile.originalDamage == 0) + { + Projectile.originalDamage = SpearofPaleolith.ShardBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; + } + + Projectile.velocity.X *= 0.975f; + var tile = Main.tile[(Projectile.Bottom + Vector2.UnitY).ToTileCoordinates()]; + if (tile.HasUnactuatedTile && tile.TileType == TileID.ConveyorBeltLeft) + { + Projectile.velocity.X = 2; + } + else if (tile.HasUnactuatedTile && tile.TileType == TileID.ConveyorBeltRight) + { + Projectile.velocity.X = -2; + } + return true; + } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index c30a3b9955..85c92357cc 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 8; i++) { Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/LemonNadeHoldout.cs b/Projectiles/Rogue/LemonNadeHoldout.cs new file mode 100644 index 0000000000..29dc08f584 --- /dev/null +++ b/Projectiles/Rogue/LemonNadeHoldout.cs @@ -0,0 +1,153 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class LemonNadeHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/LemonNade"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 22; Projectile.height = 28; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 10; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 24; + modplayer.swingNum = 0; + RotateInStartup = 1; + } + + public override void AdditionalAI() + { + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 0.5f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var stealthTime = CalamityUtils.SecondsToFrames(2) / avgStealth; + var explodeTimeGoal = stealthTime + 30; + + if (Projectile.FinalExtraUpdate() && inStartup) + if (explodeTimer < explodeTimeGoal) + explodeTimer++; + else + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -10, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal).hostile = true; + Projectile.Opacity = 0; + return; + } + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (timer == 1) + { + + + if (!Main.dedServ) + { + SoundEngine.PlaySound(SoundID.DD2_JavelinThrowersAttack with { pitch = 1f }); + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Vector2.UnitY * -8 + angle, Mod.Find("LemonNadePin").Type, 1); + } + } + + if (player.channel && inStartup) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + } + // Code copied from Violence / Chalice. + float bloodVelMult = 1; + if (Main.rand.NextFloat() < explodeTimer / explodeTimeGoal && Projectile.Opacity > 0 && Projectile.FinalExtraUpdate()) + { + int bloodLifetime = Main.rand.Next(5, 15); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.Goldenrod, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * bloodVelMult * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity.RotatedBy(Projectile.rotation + MathHelper.PiOver4 * Projectile.spriteDirection), bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -10 * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer - 25, explodeTimeGoal); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + Projectile.rotation += MathHelper.PiOver2 * Projectile.spriteDirection; + } + + public override float SwingFunction() + { + if (inStartup) + { + return swingWidth * -0.5f + (MathF.Sin(Main.GlobalTimeWrappedHourly * 30) * 0.2f); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/LemonNadeProjectile.cs b/Projectiles/Rogue/LemonNadeProjectile.cs new file mode 100644 index 0000000000..b34e7dceb8 --- /dev/null +++ b/Projectiles/Rogue/LemonNadeProjectile.cs @@ -0,0 +1,167 @@ +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class LemonNadeProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/LemonNade"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + ref float ExplodeTimer => ref Projectile.ai[0]; + ref float ExplodeTimeMax => ref Projectile.ai[1]; + ref float AIState => ref Projectile.ai[2]; + + public override void AI() + { + if (AIState == 1) + { + Projectile.idStaticNPCHitCooldown = 2; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.damage = 0; + } + + Projectile.rotation += 0.175f * Projectile.direction; + + if (Projectile.timeLeft < 280 && AIState != 1) + Projectile.velocity.Y += 0.22f; + + ExplodeTimer++; + //Copied from violence/chalice + if (Main.rand.NextFloat() < ExplodeTimer / ExplodeTimeMax && Projectile.FinalExtraUpdate()) + { + int bloodLifetime = Main.rand.Next(5, 15); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.Goldenrod, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity.RotatedBy(Projectile.rotation + MathHelper.PiOver4 * Projectile.spriteDirection), bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + + if (ExplodeTimer > ExplodeTimeMax || Projectile.timeLeft == 2) + { + if (AIState == 1) + Projectile.damage = Projectile.originalDamage; + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) + { + var frags = 6f; + for (var i = 0; i < frags; i++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitY.RotatedBy(i / frags * MathHelper.TwoPi) * -10, ModContent.ProjectileType(), Projectile.damage/2, Projectile.knockBack, Projectile.owner, 0, 20, 1); + } + Projectile.Resize(360, 360); + Projectile.ResetLocalNPCHitImmunity(); + Projectile.Damage(); + + for (var i = 0; i < 40; i++) + { + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, 1f), Scale: Main.rand.NextFloat(0.75f, 1.25f)); + } + var exactBloodCount = 10; + // Code copied from Violence/chalice. + float bloodVelMult = 6; + for (int i = 0; i < exactBloodCount; ++i) + { + int bloodLifetime = Main.rand.Next(22, 36); + float bloodScale = Main.rand.NextFloat(0.6f, 1.2f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.Goldenrod, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * bloodVelMult * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + + SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center); + Projectile.Kill(); + + } + } + + public override bool PreDraw(ref Color lightColor) + { + if (AIState == 1) + { + Main.instance.LoadItem(ItemID.PumpkinSeed); + var tex = TextureAssets.Item[ItemID.PumpkinSeed]; + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.velocity.ToRotation() - MathHelper.PiOver2, tex.Size() * 0.5f, Projectile.scale, 0); + return false; + } + return true; + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + modifiers.SourceDamage /= Main.masterMode ? 2f : Main.expertMode ? 1.5f : 1; + modifiers.SourceDamage *= 0.33f; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.width < 100) + modifiers.SourceDamage *= 0.1f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.velocity.X *= -0.65f; + Projectile.velocity.Y = -3f; + if (ExplodeTimeMax - ExplodeTimer < 30) + ExplodeTimer += 15; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + //Only make noises and particles if not an explosion + if (Projectile.width < 100) + { + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + } + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + Projectile.velocity *= 0.75f; + return false; + } + } + +} diff --git a/Projectiles/Rogue/LeviathanToothStealth.cs b/Projectiles/Rogue/LeviathanToothStealth.cs index 90da6945bf..e4527c2ca3 100644 --- a/Projectiles/Rogue/LeviathanToothStealth.cs +++ b/Projectiles/Rogue/LeviathanToothStealth.cs @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue if (hitTimer != 0) damageMult = 0.2f; bool jawsJustSlammed = (time >= jawSlamTime && time <= jawSlamTime + 8); - modifiers.SourceDamage *= (jawsJustSlammed ? 12 : 1) * damageMult; + modifiers.SourceDamage *= (jawsJustSlammed ? 4 : 1) * damageMult; if (hitTimer == 0) hitTimer = Projectile.localNPCHitCooldown; diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index dab49da486..4c0c259b7b 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.timeLeft = 360; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/PaleoShatterExplosion.cs b/Projectiles/Rogue/PaleoShatterExplosion.cs new file mode 100644 index 0000000000..d9366c8580 --- /dev/null +++ b/Projectiles/Rogue/PaleoShatterExplosion.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class PaleoShatterExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 7; + } + + public override void SetDefaults() + { + Projectile.width = 84; + Projectile.height = 152; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + } + + public override void AI() + { + if (Projectile.timeLeft == 60) + Projectile.Bottom = Projectile.Center + new Vector2(0,16); + if (Projectile.timeLeft % 3f == 2f) + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Type]) + Projectile.Kill(); + } + } +} diff --git a/Projectiles/Rogue/PaleoShatterExplosion.png b/Projectiles/Rogue/PaleoShatterExplosion.png new file mode 100644 index 0000000000..7740b1ff36 Binary files /dev/null and b/Projectiles/Rogue/PaleoShatterExplosion.png differ diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index ff48cd70d1..55b2aa78cd 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -30,10 +30,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; //Stealth strike behavior - if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.ai[2] >= 2) + if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.ai[2] > 0) return; Projectile.localAI[0]++; - if (Projectile.localAI[0] >= 12f) + if (Projectile.localAI[0] == 12f) { Vector2 vector2 = new Vector2(20f, 20f); for (int index1 = 0; index1 < 10; ++index1) @@ -47,14 +47,12 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Palladium, 0f, 0f, 0, default, 1f); } - int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] + 1); - int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] + 1); + int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: 1); + int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: 1); if (javelin.WithinBounds(Main.maxProjectiles)) Main.projectile[javelin].Calamity().stealthStrike = true; if (javelin2.WithinBounds(Main.maxProjectiles)) Main.projectile[javelin2].Calamity().stealthStrike = true; - - Projectile.Kill(); } } diff --git a/Projectiles/Rogue/ProfanedPartisanFlare.cs b/Projectiles/Rogue/ProfanedPartisanFlare.cs new file mode 100644 index 0000000000..67c7ae2fd4 --- /dev/null +++ b/Projectiles/Rogue/ProfanedPartisanFlare.cs @@ -0,0 +1,234 @@ +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ProfanedPartisanFlare : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public int timer = 0; + public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + public override void SetDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.penetrate = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + NPC target = null; + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Type]) + Projectile.frame = 0; + + if (Projectile.originalDamage == 0) + { + Projectile.originalDamage = ProfanedPartisan.StarBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; + } + if (target != null && Projectile.localNPCImmunity[target.whoAmI] <= 0 && target.active && !target.dontTakeDamage) + { + Projectile.Calamity().HomingTarget = target.whoAmI; + var dis = Projectile.Distance(target.Center); + Projectile.velocity = Projectile.velocity.ToRotation().AngleLerp(Projectile.DirectionTo(target.Center).ToRotation(), (Projectile.Distance(target.Center) < 160 ? 0.1f + (1 - dis / 160) * 0.4f : 0.1f)).ToRotationVector2() * Projectile.velocity.Length(); + } + else + { + target = GetTargetInRange(2000); + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public override void OnKill(int timeLeft) + { + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + } + public override bool PreDraw(ref Color lightColor) + { + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + Projectile.Opacity = 1; + Main.spriteBatch.End(out var ss); + var device = Main.instance.GraphicsDevice; + using var trailLease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth / 2, + Main.screenHeight / 2, + RenderTargetDescriptor.Default + ); + //Everything is drawn to this lease, which then is drawn to screen with the desired opacity. + //This is used to allow projectile opacity to scale nicely + using var mainLease = RenderTargetPool.Shared.Rent( + device, + Main.screenWidth, + Main.screenHeight, + RenderTargetDescriptor.Default + ); + + using (mainLease.Scope(clearColor: Color.Transparent)) + { + using (trailLease.Scope(clearColor: Color.Transparent)) + { + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos.Take(5).ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + Main.spriteBatch.Draw(trailLease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + + + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); + + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[ModContent.ProjectileType()].Value; + Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color baseColor = Color.Lerp(hiColor, loColor, 0.5f); + Color baseColor2 = hiColor; + baseColor.A = 0; + baseColor *= lerpMult; + baseColor2 *= lerpMult; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f) * 1.2f * Projectile.scale; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f); + + float upRight = MathHelper.PiOver4; + float up = MathHelper.PiOver2; + float upLeft = 3f * MathHelper.PiOver4; + float left = MathHelper.Pi; + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + + scale = new Vector2(1f, 1f); + texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; + using (Main.spriteBatch.Scope()) + { + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, baseColor2, 0, texture.Size() * 0.5f, 1f, 0, 0f); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f); + Main.spriteBatch.End(); + } + Main.spriteBatch.End(); + } + + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + Main.spriteBatch.Draw(mainLease.Target, Vector2.Zero, null, Color.White * Projectile.Opacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(ss); + return false; + } + public float FireWidthFunction(float completion, Vector2 pos) + { + float width; + float maxBodyWidth = 16f * Projectile.scale; + float curveRatio = 0.2f; + var positions = Projectile.oldPos.ToList(); + positions.RemoveAll(x => x == Vector2.Zero); + // Crop the tip of the trail into a conic shape. + if (completion < curveRatio) + width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth; + else + width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f); + + // Pulse inwards and outwards over time. + float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f; + float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant); + return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type]; + } + + public Color FireColorFunction(float completion, Vector2 pos) + { + Color mainColor = new Color(255, 155, 25, 255); + Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(mainColor, Color.Transparent, completion); + } + + NPC GetTargetInRange(float range) + { + var player = Main.player[Projectile.owner]; + { + NPC gotTarget = null; + float currentDistance = range; + foreach (var npc in Main.ActiveNPCs) + { + if (Projectile.localNPCImmunity[npc.whoAmI] > 0) + continue; + var myDistance = npc.Distance(Projectile.Center); + + if (npc.CanBeChasedBy() && myDistance < currentDistance) + { + currentDistance = myDistance; + gotTarget = npc; + } + } + return gotTarget; + } + } + } +} diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index b7c056a4ad..dbdfc2fb40 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -1,8 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -13,10 +17,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/ProfanedPartisan"; + + public static int Lifetime => 600; + public int ExplodeTime => 60 * Projectile.MaxUpdates; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 24; + ProjectileID.Sets.TrailingMode[Type] = 2; } public override void SetDefaults() @@ -24,47 +31,91 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.penetrate = 9; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; - Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + } + public float StuckEnemyID + { + get { return Projectile.ai[0]; } + set { Projectile.ai[0] = value; } + } + public float StuckEnemyDistance + { + get { return Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public float StuckEnemyRotation + { + get { return Projectile.ai[2]; } + set { Projectile.ai[2] = value; } } public override void AI() { - if (Projectile.ai[0] < 0.4f) + Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.2f); + if (StuckEnemyID > 0) { - Projectile.ai[0] += 0.1f; + Projectile.tileCollide = false; + if (!Main.npc[(int)StuckEnemyID - 1].active) + { + StuckEnemyID = 0; + Projectile.tileCollide = true; + Projectile.timeLeft = ExplodeTime; + return; + } + Projectile.Center = Main.npc[(int)StuckEnemyID - 1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; + return; } - else + else if (Projectile.damage == 0) //after running out of penetrate hits, if not impaled or dead { - Projectile.tileCollide = true; + Projectile.velocity *= 0.975f; + float intensity = 1 - Projectile.timeLeft / (float)ExplodeTime; + Projectile.position += Main.rand.NextVector2CircularEdge(intensity, intensity); + + if (Projectile.timeLeft == 1) + { + + Color hiColor = new Color(255, 155, 25, 255); + Color loColor = new Color(255, 0, 0, 0); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + for (var i = 0; i < 3; i++) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2().RotatedBy((i - 1) * 0.25f + Main.rand.NextFloat(-0.1f, 0.1f)) * 24f, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0f, 0f); + } + } + } + return; } - //Backwards projectile fix - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Rotating 45 degrees if shooting right - if (Projectile.spriteDirection == 1) - { - Projectile.rotation += MathHelper.ToRadians(45f); - DrawOffsetX = -26; - DrawOriginOffsetX = 13; - DrawOriginOffsetY = 2; - } - //Rotating 45 degrees if shooting right - if (Projectile.spriteDirection == -1) - { - Projectile.rotation -= MathHelper.ToRadians(45f); - DrawOffsetX = 2; - DrawOriginOffsetX = -13; - DrawOriginOffsetY = 2; - } + Projectile.velocity *= 0.998f; + if (Projectile.timeLeft < (Lifetime - 45)*Projectile.MaxUpdates) + Projectile.velocity.Y += 0.02f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; if (Main.rand.NextBool(3)) { int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); @@ -72,20 +123,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[d].velocity *= 0.3f; Main.dust[d].velocity += Projectile.velocity * 0.85f; } - Lighting.AddLight(Projectile.Center, 1f, 0.8f, 0.2f); - - if (Projectile.Calamity().stealthStrike) //Stealth strike - { - Vector2 spearPosition = new Vector2(Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f)); - Vector2 spearSpeed = Projectile.velocity; - if (Projectile.timeLeft % 18 == 0) - { - int projID = ModContent.ProjectileType(); - int spearDamage = (int)(Projectile.damage * 0.4f); - float spearKB = 1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spearPosition, spearSpeed, projID, spearDamage, spearKB, Projectile.owner); - } - } } public override void OnKill(int timeLeft) @@ -95,20 +132,48 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 50, default, 2.6f); } SoundEngine.PlaySound(SoundID.Item45, Projectile.position); - - int projID = ModContent.ProjectileType(); - int explosionDamage = (int)(Projectile.damage * 0.8f); - float explosionKB = 8f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, Projectile.owner); } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + + for (var i = 0; i < ProjectileID.Sets.TrailCacheLength[Type]; i += 3) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition, null, lightColor * Projectile.Opacity * (i > 0 ? (1 - i / (float)ProjectileID.Sets.TrailCacheLength[Type]) * 0.25f : 1), Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + } + + float glowIntensity = Projectile.damage == 0 && StuckEnemyID == 0 ? 4f * (1-(Projectile.timeLeft/(float)ExplodeTime)) : 0f; + Projectile.DrawProjectileWithBackglow(Color.Yellow, lightColor, glowIntensity); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.tileCollide = false; + if (Projectile.Calamity().stealthStrike) + { + StuckEnemyID = target.whoAmI + 1; + StuckEnemyDistance = Projectile.Distance(target.Center); + StuckEnemyRotation = Projectile.DirectionFrom(target.Center).ToRotation(); + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; + } + else + { + Projectile.timeLeft = ExplodeTime; + } + bool strongSplit = Main.projectile.Any(x => x.active && x.owner == Projectile.owner && x.type == Projectile.type && x.ai[0] == (target.whoAmI + 1)); + if (!strongSplit) + for (var i = 0; i < 3; i++) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2().RotatedBy((i-1)*0.25f + Main.rand.NextFloat(-0.1f,0.1f)) * 10, ModContent.ProjectileType(), 0, Projectile.knockBack, Projectile.owner, 0f, 0f); + p.localNPCImmunity[target.whoAmI] = 60; + } + target.AddBuff(ModContent.BuffType(), 180); + if (!strongSplit) + { + Projectile.Kill(); + } + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Rogue/ProfanedPartisanSpear.cs b/Projectiles/Rogue/ProfanedPartisanSpear.cs index 0f9ab63c40..ae6f980748 100644 --- a/Projectiles/Rogue/ProfanedPartisanSpear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,88 +11,81 @@ namespace CalamityMod.Projectiles.Rogue public class ProfanedPartisanSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public int timer = 0; - - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { + ProjectileID.Sets.TrailCacheLength[Type] = 6; + ProjectileID.Sets.TrailingMode[Type] = 2; Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = -1; - Projectile.extraUpdates = 3; + Projectile.penetrate = 5; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 600; + Projectile.tileCollide = false; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.ai[1] != 1f) - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - Projectile.ai[1] = 1f; - Projectile.ai[0] = 1f; - Projectile.extraUpdates = 2; - if (Projectile.timeLeft > 280) - Projectile.timeLeft = 280; - } - return false; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffects(); - } - - private void OnHitEffects() - { - if (Projectile.ai[1] != 1f) - { - Projectile.velocity.X *= -1f; - Projectile.velocity.Y *= -1f; - Projectile.ai[1] = 1f; - Projectile.ai[0] = 1f; - Projectile.extraUpdates = 2; - if (Projectile.timeLeft > 280) - Projectile.timeLeft = 280; - } } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - - if (Projectile.ai[0] == 1f) - timer++; - if (timer >= 5) - Projectile.penetrate = 1; - if (timer >= 10) + if (Projectile.originalDamage == 0) { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 7f, 20f); + Projectile.originalDamage = ProfanedPartisan.SpearBaseDamage; + Projectile.ContinuouslyUpdateDamageStats = true; } + + float timeGateValue = 30f; + if (Projectile.ai[0] <= 0f) //Copied from HolySpear.cs + { + Projectile.ai[1] += 1f; + + float slowGateValue = 25f; + float fastGateValue = 10f; + float minVelocity = 2f; + float maxVelocity = minVelocity * 5f; + float extremeVelocity = maxVelocity * 2f; + float deceleration = 0.9f; + float acceleration = 2f; + + if (Projectile.localAI[1] >= timeGateValue) + { + if (Projectile.velocity.Length() < extremeVelocity) + Projectile.velocity *= acceleration; + } + else + { + 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; + } + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, 2, Color.White); return false; } } diff --git a/Projectiles/Rogue/PumpkaboomBig.cs b/Projectiles/Rogue/PumpkaboomBig.cs index 310ecffa27..dad826b9be 100644 --- a/Projectiles/Rogue/PumpkaboomBig.cs +++ b/Projectiles/Rogue/PumpkaboomBig.cs @@ -254,8 +254,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localAI[1] = 5; // Reset firing state if (flungState != -1f) { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center); - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.5f }, Projectile.Center); if (Main.myPlayer == Projectile.owner) { @@ -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..8ad1266778 100644 --- a/Projectiles/Rogue/PumpkaboomSmall.cs +++ b/Projectiles/Rogue/PumpkaboomSmall.cs @@ -224,7 +224,7 @@ namespace CalamityMod.Projectiles.Rogue if (flungState != -1f) { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.4f }, Projectile.Center); if (Main.myPlayer == Projectile.owner) @@ -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/RadiationRain.cs b/Projectiles/Rogue/RadiationRain.cs index 5938658b73..7a7740025e 100644 --- a/Projectiles/Rogue/RadiationRain.cs +++ b/Projectiles/Rogue/RadiationRain.cs @@ -45,18 +45,15 @@ namespace CalamityMod.Projectiles.Rogue Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor * 0.7f, "CalamityMod/ExtraTextures/GreyscaleVortex", new Vector2(1, 1), Projectile.ai[2] * 0.45f, orbScale, orbScale * 1.1f, 12, false); GeneralParticleHandler.SpawnParticle(orb); Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.8f, 0.4f, 18); - GeneralParticleHandler.SpawnParticle(orb3); - orb3.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb3, false, GeneralDrawLayer.AfterEverything); Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.2f, 18); - GeneralParticleHandler.SpawnParticle(orb2); - orb2.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(orb2, false, GeneralDrawLayer.AfterEverything); for (int i = 0; i < 2; i++) { int dir = (i == 0 ? 1 : -1); Particle pulse3 = new GlowSparkParticle(Projectile.Center + new Vector2(20 * dir, 0), new Vector2(10 * dir, 0), false, 12, 0.087f, Color.Chartreuse, new Vector2(1.7f, 0.8f), true, true, 0.8f); - GeneralParticleHandler.SpawnParticle(pulse3); - pulse3.DrawLayer = GeneralDrawLayer.AfterEverything; + GeneralParticleHandler.SpawnParticle(pulse3, false, GeneralDrawLayer.AfterEverything); } for (int i = 0; i < 3; i++) diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index 98bd094a7b..b5fd912cb6 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -269,7 +269,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - Vector2 drawPos = Projectile.Center - Main.screenPosition; + Vector2 drawPos = Projectile.Center - Main.screenPosition + (!spinning ? new Vector2(0, Owner.gfxOffY) : Vector2.Zero); Asset tex = ModContent.Request(Texture); Main.EntitySpriteDraw(tex.Value, drawPos, null, spinning ? Color.White : Color.Lerp(lightColor, Color.White, Utils.GetLerpValue(0, ChargeupTime, time, true)), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 336cacc18b..609b6cc694 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -24,20 +24,24 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 45; Projectile.width = 108; Projectile.height = 108; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; + Projectile.penetrate = 5; Projectile.tileCollide = false; Projectile.timeLeft = 300; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + if (Projectile.timeLeft == 300 && Projectile.Calamity().stealthStrike) + Projectile.penetrate = 1; + Lighting.AddLight(Projectile.Center, 0.55f, 0.25f, 0f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; @@ -52,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike && Projectile.oldPos.Length != 6) Projectile.oldPos = new Vector2[6]; - if ((ShootTimer %= 5f) == 0f && !Projectile.Calamity().stealthStrike) + if ((ShootTimer %= 4f) == 0f && !Projectile.Calamity().stealthStrike) { if (Projectile.owner == Main.myPlayer) GenerateSideBullets(2, MathHelper.ToRadians(15f)); @@ -66,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 perturbedSpeed = new Vector2(-Projectile.velocity.X / 3, -Projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotationalOffset, rotationalOffset, i / (totalBullets - 1))); for (int j = 0; j < 2; j++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.03), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.035), 0f, Projectile.owner, 0f, 0f); perturbedSpeed *= 1.05f; } } @@ -97,7 +101,7 @@ namespace CalamityMod.Projectiles.Rogue nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / pointsOnStar; Vector2 start = angle.ToRotationVector2(); Vector2 end = nextAngle.ToRotationVector2(); - int pointsOnStarSegment = 18; + int pointsOnStarSegment = 12; for (int j = 0; j < pointsOnStarSegment; j++) { Vector2 shootVelocity = Vector2.Lerp(start, end, j / (float)pointsOnStarSegment) * starSpeed; @@ -122,7 +126,9 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Projectile.ExpandHitboxBy(150); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (Projectile.numHits == 0) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.0075), 0f, Projectile.owner); + if (!Projectile.Calamity().stealthStrike) return; diff --git a/Projectiles/Rogue/SealedSingularityBlackhole.cs b/Projectiles/Rogue/SealedSingularityBlackhole.cs deleted file mode 100644 index 2ca31c17bd..0000000000 --- a/Projectiles/Rogue/SealedSingularityBlackhole.cs +++ /dev/null @@ -1,100 +0,0 @@ -using CalamityMod.NPCs; -using CalamityMod.NPCs.NormalNPCs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SealedSingularityBlackhole : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 7; - } - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 40; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.tileCollide = false; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); - return false; - } - - public override void AI() - { - // Update animation - if (Projectile.timeLeft % 5 == 0) - { - Projectile.frame++; - } - if (Projectile.frame >= Main.projFrames[Type]) - { - Projectile.frame = 0; - } - - //Succcc - float projCenX = Projectile.Center.X; - float projCenY = Projectile.Center.Y; - float maxDistance = Projectile.Calamity().stealthStrike ? 1000f : 500f; - float succPower = Projectile.Calamity().stealthStrike ? 0.25f : 0.1f; - for (int index = 0; index < Main.maxNPCs; index++) - { - NPC npc = Main.npc[index]; - if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1)) - { - if (CalamityGlobalNPC.ShouldAffectNPC(npc) || npc.type == ModContent.NPCType()) - { - float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) - { - if (npc.position.X < projCenX) - { - npc.velocity.X += succPower; - } - else - { - npc.velocity.X -= succPower; - } - if (npc.position.Y < projCenY) - { - npc.velocity.Y += succPower; - } - else - { - npc.velocity.Y -= succPower; - } - } - } - } - } - - Projectile.ai[0]++; - if (Projectile.ai[0] > 300f) - { - Projectile.scale *= 0.95f; - Projectile.Opacity *= 0.95f; - Projectile.height = (int)(Projectile.height * Projectile.scale); - Projectile.width = (int)(Projectile.width * Projectile.scale); - } - if (Projectile.scale <= 0.05f) - { - Projectile.Kill(); - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Blackout, 300); - } -} diff --git a/Projectiles/Rogue/SealedSingularityHoldout.cs b/Projectiles/Rogue/SealedSingularityHoldout.cs new file mode 100644 index 0000000000..69a975c80d --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityHoldout.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 22; Projectile.height = 28; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 10; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 24; + modplayer.swingNum = 0; + RotateInStartup = 1; + } + + public override void AdditionalAI() + { + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 1.2f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(2) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + if (Projectile.FinalExtraUpdate() && inStartup) + if (explodeTimer < explodeTimeGoal) + explodeTimer++; + else + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -10, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal, 1).hostile = true; + Projectile.Opacity = 0; + return; + } + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (player.channel && inStartup) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -15 * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer - 30, explodeTimeGoal); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/SealedSingularityProj.cs b/Projectiles/Rogue/SealedSingularityProj.cs deleted file mode 100644 index 559f9d3a3f..0000000000 --- a/Projectiles/Rogue/SealedSingularityProj.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SealedSingularityProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; - - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.friendly = true; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = 1; - Projectile.timeLeft = 180; - } - - public override void AI() - { - Projectile.ai[0] += 1f; - - if (Projectile.ai[0] >= 70f) - { - Projectile.velocity *= 0.96f; - } - else - { - Projectile.rotation += 0.3f * (float)Projectile.direction; - } - } - - public override void OnKill(int timeLeft) - { - if (Projectile.owner != Main.myPlayer) - return; - - //glass-pot break sound - SoundEngine.PlaySound(SoundID.Shatter, Projectile.position); - - int blackhole = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.Calamity().stealthStrike ? -180f : 0f, 0f); - if (blackhole.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[blackhole].Center = Projectile.Center; - Main.projectile[blackhole].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; - } - - for (int index = 0; index < 3; ++index) - { - float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, index, 0f); - } - } - } -} diff --git a/Projectiles/Rogue/SealedSingularityProjectile.cs b/Projectiles/Rogue/SealedSingularityProjectile.cs new file mode 100644 index 0000000000..a3d2e00f8f --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityProjectile.cs @@ -0,0 +1,376 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.Particles; +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.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; + + //Trans flag colors with name containing "girlswag" or having a gender change pot in inventory at donor request + public static bool DonorColor => Main.LocalPlayer.name.Contains("girlswag") || Main.LocalPlayer.HasItemInAnyInventory(ItemID.GenderChangePotion); + public static Color BorderColor => DonorColor ? Color.Lerp(Color.Pink, Color.LightBlue, (MathF.Sin(Main.GlobalTimeWrappedHourly * 3) + 1) * 0.5f) : new Color(59, 2, 120); + + public static Color RandomColor + { + get + { + if (DonorColor) + { + switch (Main.rand.Next(3)) + { + case 0: return Color.Pink; + case 1: return Color.LightBlue; + case 2: return Color.White; + } + } + + switch (Main.rand.Next(4)) + { + case 0: return new Color(91, 47, 113); + case 1: return new Color(119, 74, 165); + case 2: return new Color(58, 58, 58); + case 3: return new Color(123, 115, 142); + } + return Color.White; + } + } + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; + OutlineTexVoid = null; //this ensures the outline tex is gotten properly + } + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 300; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + int targetID = -1; + + NPC target => Main.npc[targetID]; + ref float Timer => ref Projectile.ai[0]; + ref float TimerMax => ref Projectile.ai[1]; + ref float AIState => ref Projectile.ai[2]; + bool Stealth => Projectile.Calamity().stealthStrike; + + int bounceCooldown = 0; + public override void AI() + { + if (AIState == 1) + Lighting.AddLight(Projectile.Center, BorderColor.ToVector3() * (Stealth ? 4 : 2) * Timer / TimerMax); + else if (AIState == 2) + Lighting.AddLight(Projectile.Center, BorderColor.ToVector3() * (Stealth ? 4 : 2)); + Timer++; + bounceCooldown--; + + if (AIState == 0) + { + Projectile.rotation += 0.175f * Projectile.direction; + if (Projectile.timeLeft < 280) + Projectile.velocity.Y += 0.22f; + + if (TimerMax - Timer < 30) + Projectile.velocity *= 0.925f; + } + if (AIState == 1) + { + Projectile.timeLeft++; + Projectile.rotation += 0.175f * Projectile.direction; + Projectile.velocity = new Vector2( + MathF.Sin(Timer), + MathF.Sin(Timer * 0.7f) + ); + if (Stealth) + { + Projectile.velocity *= 1 + Math.Clamp(Timer / TimerMax, 0f, 1f) * 2f; + } + if (Timer % 10 == 0 && Main.myPlayer == Projectile.owner && Timer < TimerMax - (Stealth ? 120 : 90)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + new Vector2(Stealth ? 380 : 255, 0).RotatedByRandom(MathHelper.TwoPi), Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner, Projectile.whoAmI); + var v = new Vector2(Stealth ? 380 : 255, 0).RotatedByRandom(MathHelper.TwoPi); + Dust.NewDustPerfect(Projectile.Center + v, DustID.Clentaminator_Purple, -v / 100f); + } + if (TimerMax - Timer == 330) + { + SoundEngine.PlaySound(CeaselessVoid.BuildupSound with { pitch = 0.75f, MaxInstances = 10, Volume = 0.2f }, Projectile.Center); + } + + } + + if (AIState == 2) + { + if (targetID == -1 || !target.active || !target.CanBeChasedBy()) + { + Timer = TimerMax; + } + else + { + Projectile.velocity = Projectile.DirectionTo(target.Center) * MathHelper.Clamp(MathF.Pow((Timer - 30) / 8f, 2), 0f, 32f) * (Timer - 30).DirectionalSign(); + } + } + + if (Timer > TimerMax && AIState == 0) + { + var sizee = Stealth ? 900 : 600; + Projectile.localNPCHitCooldown = 30; + Projectile.ResetLocalNPCHitImmunity(); + Projectile.tileCollide = false; + Timer = 0; + TimerMax = Stealth ? 600 : 300; + Projectile.timeLeft += 180; + AIState = 1; + } + if (Timer > TimerMax && AIState == 1) + { + AIState = 2; + Timer = 0; + TimerMax = 300; + Projectile.ResetLocalNPCHitImmunity(); + if (Main.myPlayer == Projectile.owner) + for (int index = 0; index < 3; ++index) + { + float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), 20, 0f, Projectile.owner, index, 0f); + } + Projectile.velocity = Vector2.Zero; + SoundEngine.PlaySound(CeaselessVoid.DeathSound with { pitch = 1f, Volume = Stealth ? 0.5f : 0.2f }, Projectile.Center); + } + + if (Timer >= TimerMax && AIState == 2) + { + Projectile.Resize(300, 300); + Projectile.ResetLocalNPCHitImmunity(); + Projectile.Damage(); + + for (var i = 0; i < (Stealth ? 80 : 40); i++) + { + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, Stealth ? 1.5f : 1f), Scale: Main.rand.NextFloat(0.5f, 1.5f), newColor: RandomColor); + } + var ringTimer = Stealth ? 50 : 35; + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, RandomColor, "CalamityMod/Particles/BloomRing", new Vector2(0.1f, 0.85f), MathHelper.PiOver2, -4f, 4f, ringTimer)); + if (Stealth) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, RandomColor, "CalamityMod/Particles/BloomRing", new Vector2(0.2f, 0.7f), MathHelper.PiOver4, -4f, 4f, ringTimer - 15)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, RandomColor, "CalamityMod/Particles/BloomRing", new Vector2(0.2f, 0.7f), -MathHelper.PiOver4, -4f, 4f, ringTimer - 15)); + } + + SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center); + + Projectile.Kill(); + } + } + + private static Texture2D OutlineTex + { + get + { + if (field == null) + { + var texture = TextureAssets.Projectile[ModContent.ProjectileType()].Value; + field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[field.Width * field.Height]; + var ColorArray = new Color[field.Width * field.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + field.SetData(ColorArray); + } + return field; + } + set; + } + + private static Texture2D OutlineTexVoid + { + get + { + if (field == null) + { + var texture = ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityBlackhole", AssetRequestMode.ImmediateLoad).Value; + field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[field.Width * field.Height]; + var ColorArray = new Color[field.Width * field.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + field.SetData(ColorArray); + } + return field; + } + set; + } + private static Asset VoidTex => field ??= ModContent.Request("CalamityMod/Projectiles/Rogue/SealedSingularityBlackhole"); + public override bool PreDraw(ref Color lightColor) + { + if (AIState == 1) + { + for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2) + { + var pos = Projectile.Center - Main.screenPosition; + float rot = Projectile.rotation; + var frame = TextureAssets.Projectile[Type].Frame(1, 1, 0, 0); + float scale = 1f; + float borderOp = MathF.Pow(Projectile.Opacity, 2); + Main.spriteBatch.Draw(OutlineTex, pos + new Vector2(6 * Timer / TimerMax, 0).RotatedBy(i), frame, BorderColor * borderOp, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); + } + PixelationManager.AddPixelatedDrawer((matrix) => DrawAuraOutside(this, matrix), Enums.GeneralDrawLayer.AfterNPCs); + } + if (AIState == 2) + { + var frame = VoidTex.Frame(1, 7, 0, (int)(Timer * 0.2f % 7)); + for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2) + { + Main.EntitySpriteDraw(OutlineTexVoid, Projectile.Center - Main.screenPosition + new Vector2(2, 0).RotatedBy(i), frame, BorderColor, 0, frame.Size() * 0.5f, Projectile.scale, 0); + } + Main.EntitySpriteDraw(VoidTex.Value, Projectile.Center - Main.screenPosition, frame, Color.White, 0, frame.Size() * 0.5f, Projectile.scale, 0); + return false; + } + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + return false; + } + private static void DrawAuraOutside(SealedSingularityProjectile mproj, Matrix matrix) + { + + Vector2 drawPosition = mproj.Projectile.Center - Main.screenPosition; + + //Draw the outer particles + Main.spriteBatch.EnterShaderRegion(matrix: matrix); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseOpacity((mproj.Stealth ? 4 : 2) * (mproj.Timer / mproj.TimerMax)); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseSaturation(0.1f); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1); + GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].Apply(); + Texture2D telegraphBase = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.White * mproj.Projectile.Opacity * 0.25f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0); + Main.EntitySpriteDraw(telegraphBase, drawPosition, null, BorderColor * mproj.Projectile.Opacity * 0.5f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0); + Main.spriteBatch.ExitShaderRegion(matrix: matrix); + } + + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + modifiers.SourceDamage /= Main.masterMode ? 2f : Main.expertMode ? 1.5f : 1; + modifiers.SourceDamage *= 0.044f; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + + switch (AIState) + { + case 0: + { + if (bounceCooldown <= 0) + { + Projectile.velocity *= -1f; + bounceCooldown = 5; + } + if (TimerMax - Timer > 30) + Timer = TimerMax - 30; + goto case 1; + } + case 1: + { + if (target.Calamity().IsArmored()) + return; + if (targetID == -1 || !this.target.active || !this.target.CanBeChasedBy()) + { + targetID = target.whoAmI; + } + else + { + if (this.target.life < target.life) + { + targetID = target.whoAmI; + } + } + if (AIState == 1) + { + target.MoveNPC(target.DirectionTo(Projectile.Center), Stealth ? 18 : 4, true); + } + return; + } + case 2: + { + if (targetID == target.whoAmI) + Timer = TimerMax; + return; + } + } + return; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + switch (AIState) + { + case 1: + modifiers.SourceDamage /= 20; + return; + case 2: + modifiers.SourceDamage *= 2; + return; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (AIState == 1) + { + return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), (Stealth ? 900 : 600) * 0.4f, targetHitbox); + } + return base.Colliding(projHitbox, targetHitbox); + } + + // Make it bounce on tiles. + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.width < 100) + { + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + } + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + Projectile.velocity *= 0.75f; + return false; + } + } + +} diff --git a/Projectiles/Rogue/SealedSingularityRock.cs b/Projectiles/Rogue/SealedSingularityRock.cs new file mode 100644 index 0000000000..5d3acd74db --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityRock.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using CalamityMod.NPCs; +using CalamityMod.Utilities.Daybreak; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityRock : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.Opacity = 0; + Projectile.hide = true; + Projectile.scale = 0.75f; + } + private static Texture2D OutlineTex + { + get + { + if (field == null) + { + var texture = TextureAssets.Projectile[ProjectileID.DeerclopsRangedProjectile].Value; + field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[field.Width * field.Height]; + var ColorArray = new Color[field.Width * field.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + field.SetData(ColorArray); + } + return field; + } + set; + } = null; + + public override bool PreDraw(ref Color lightColor) + { + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + + var tex = TextureAssets.Projectile[ProjectileID.DeerclopsRangedProjectile]; + var pos = Projectile.Center - Main.screenPosition; + float rot = Projectile.rotation; + var frame = tex.Frame(3, 4, 0, 1); + float scale = Projectile.scale; + float borderOp = MathF.Pow(Projectile.Opacity, 2); + for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2) + { + Main.spriteBatch.Draw(OutlineTex, pos + new Vector2(2, 0).RotatedBy(i), frame, SealedSingularityProjectile.BorderColor * borderOp, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); + + } + Main.spriteBatch.Draw(tex.Value, pos, frame, Lighting.GetColor(Projectile.Center.ToTileCoordinates()) * Projectile.Opacity, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); + Main.spriteBatch.End(); + } + return false; + } + + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindProjectiles.Add(index); + } + + Vector2? goaloffset; + public override void AI() + { + var goal = Main.projectile[(int)Projectile.ai[0]]; + goaloffset ??= Projectile.Center - goal.Center; + + Projectile.Opacity += 0.1f; + if (Projectile.Opacity >= 1f) + { + Projectile.velocity += Projectile.DirectionTo(goal.Center) * 0.4f; + } + Projectile.rotation += 0.1f; + + if (Projectile.Distance(goal.Center) < 16) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/OtherworldlyHit") with { PitchVariance = 0.4f, Volume = 0.2f, MaxInstances = 1 }, Projectile.Center); + Projectile.Kill(); + } + } + } +} diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index 1ddf1453bf..a6f3267548 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -1,6 +1,11 @@ -using CalamityMod.Buffs.StatDebuffs; +using System.Linq; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,14 +16,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SpearofPaleolith"; - private bool stealthInit = false; + public static int Lifetime => 600; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; + ProjectileID.Sets.TrailCacheLength[Type] = 24; + ProjectileID.Sets.TrailingMode[Type] = 2; } - public override void SetDefaults() { Projectile.width = 12; @@ -26,50 +30,115 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.StickProjectile; - Projectile.timeLeft = 600; - AIType = ProjectileID.BoneJavelin; + Projectile.extraUpdates = 5; + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; Projectile.DamageType = RogueDamageClass.Instance; } - + public float StuckEnemyID + { + get { return Projectile.ai[0]; } + set { Projectile.ai[0] = value; } + } + public float StuckEnemyDistance + { + get { return Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public float StuckEnemyRotation + { + get { return Projectile.ai[2]; } + set { Projectile.ai[2] = value; } + } public override void AI() { - if (Projectile.Calamity().stealthStrike && !stealthInit) + if (StuckEnemyID > 0) { - Projectile.velocity *= 0.5f; - Projectile.timeLeft = 1800; - stealthInit = true; + Projectile.tileCollide = false; + if (!Main.npc[(int)StuckEnemyID - 1].active) + { + StuckEnemyID = 0; + Projectile.velocity = -Vector2.UnitY.RotatedByRandom(0.25f) * Main.rand.NextFloat(0, 1f); + Projectile.tileCollide = true; + return; + } + Projectile.Center = Main.npc[(int)StuckEnemyID - 1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; + return; } - if (Main.rand.NextBool(4)) + Projectile.velocity *= 0.998f; + if (Projectile.timeLeft < (Lifetime - 25) * Projectile.MaxUpdates) + Projectile.velocity.Y += 0.02f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Main.rand.NextBool(20)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (Projectile.timeLeft % 3 == 0) - { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + for (var i = 0; i < ProjectileID.Sets.TrailCacheLength[Type]; i += 3) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition, null, lightColor * Projectile.Opacity * (i>0 ? (1 - i / (float)ProjectileID.Sets.TrailCacheLength[Type]) * 0.25f : 1), Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + } return false; } public override void OnKill(int timeLeft) { - for (int i = 0; i <= 10; i++) + for (int i = 0; i <= 5; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X*2.5f, Projectile.oldVelocity.Y*2.5f); } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.Calamity().stealthStrike) + { + Projectile.stopsDealingDamageAfterPenetrateHits = true; + StuckEnemyID = target.whoAmI + 1; + StuckEnemyDistance = Projectile.Distance(target.Center); + StuckEnemyRotation = Projectile.DirectionFrom(target.Center).ToRotation(); + Projectile.timeLeft = Lifetime * Projectile.MaxUpdates; + } + + bool strongSplit = Main.projectile.Any(x => x.active && x.owner == Projectile.owner && x.type == Projectile.type && x.ai[0] == (target.whoAmI + 1)); + int shardCount = strongSplit ? SpearofPaleolith.ImpaledShardCount : SpearofPaleolith.NormalShardCount; + for (var i = 0; i < shardCount; i++) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0,-1).RotatedByRandom(1) * (strongSplit ? 10 : 7.5f) * Main.rand.NextFloat(0.9f,1.1f), ModContent.ProjectileType(), 0 /*Shard dmg is set in its AI*/, Projectile.knockBack, Projectile.owner, 0f, 0f); + p.localNPCImmunity[target.whoAmI] = 30; + } + if (strongSplit) + { + + SoundEngine.PlaySound(SoundID.DeerclopsRubbleAttack with { PitchVariance = 0.5f}, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + else + { + for (int i = 0; i < shardCount; i++) + { + int sparkLifetime = Main.rand.Next(8, 22); + float sparkScale = Main.rand.NextFloat(0.5f, 1f); + var sparkColor = Main.rand.NextBool() ? Color.DarkGoldenrod : Color.SandyBrown; + + if (Main.rand.NextBool(5)) + sparkScale *= 1.4f; + + Vector2 sparkVelocity = Vector2.UnitY.RotatedByRandom(1) * MathHelper.Lerp(-7.5f, -15, Main.rand.NextFloat()); + SparkParticle spark = new SparkParticle(target.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + SoundEngine.PlaySound(SoundID.DeerclopsStep with { Pitch = 0.5f, PitchVariance = 0.5f, Volume = 1f, }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact with { Pitch = -0.5f, PitchVariance = 0.5f, Volume = 1f, }, Projectile.Center); + + target.AddBuff(ModContent.BuffType(), 120); + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Rogue/SupernovaHoldout.cs b/Projectiles/Rogue/SupernovaHoldout.cs new file mode 100644 index 0000000000..534df7e545 --- /dev/null +++ b/Projectiles/Rogue/SupernovaHoldout.cs @@ -0,0 +1,130 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SupernovaHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova"; + public override bool useAttackSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 106; + Projectile.height = 112; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + + public Color randomColor => Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 50; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 48; + modplayer.swingNum = 0; + RotateInStartup = 1; + Projectile.scale = 0.4f; + } + + public override void AdditionalAI() + { + Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1)); + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 1.3f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(Supernova.StealthTimeInSeconds) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (player.channel && inStartup) + { + + if (timer >= StartupTime - 1) + { + if (Projectile.FinalExtraUpdate() && explodeTimer < explodeTimeGoal) + explodeTimer++; + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -16 * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/VegaStar.cs b/Projectiles/Rogue/VegaStar.cs index 4c2240f9f7..0986d31102 100644 --- a/Projectiles/Rogue/VegaStar.cs +++ b/Projectiles/Rogue/VegaStar.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public class VegaStar : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public static int lifetime = 300; + public static int lifetime => 600; public override void SetStaticDefaults() { @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 5; - lifetime = 600; Projectile.timeLeft = lifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.localAI[0] = 20f; diff --git a/Projectiles/Summon/DoGWeaponTeleportRift.cs b/Projectiles/Summon/DoGWeaponTeleportRift.cs index 2e8bbed414..1ca8c9ccb2 100644 --- a/Projectiles/Summon/DoGWeaponTeleportRift.cs +++ b/Projectiles/Summon/DoGWeaponTeleportRift.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Projectile.scale = Projectile.ai[1]; + if (Projectile.ai[1] != 0) + Projectile.scale = Projectile.ai[1]; if (Projectile.ai[0] == 0f) Projectile.ai[0] = 45f; diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index 2574c58132..ed411b6930 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -37,7 +37,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 9; - Projectile.minionSlots = 5f; + if (!Main.gameMenu && Main.player[Projectile.owner].Calamity().fadedIdolatry) + Projectile.minionSlots = 4f; + else + Projectile.minionSlots = 5f; Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -64,6 +67,12 @@ namespace CalamityMod.Projectiles.Summon // Perform minion checks. PerformMinionChecks(); + //Update slots to match Faded Idolatry equip state + if (Main.player[Projectile.owner].Calamity().fadedIdolatry) + Projectile.minionSlots = 4f; + else + Projectile.minionSlots = 5f; + // Handle frame logic. if (Projectile.FinalExtraUpdate()) Projectile.frameCounter++; diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 408e4982e2..aa69a548bf 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.rareSandElemental && !modPlayer.allElementals && !modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.oasisElemental && !modPlayer.allElementals && !modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Summon { if (player.dead) { - modPlayer.rareSandEleBuff = false; + modPlayer.oasisEleBuff = false; } - if (modPlayer.rareSandEleBuff) + if (modPlayer.oasisEleBuff) { Projectile.timeLeft = 2; } @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = -Projectile.direction; } - if (!modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) + if (!modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) { float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; lightScalar *= Main.essScale; @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.localAI[0] += 1f; } - if (Projectile.ai[0] == 0f && !modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) + if (Projectile.ai[0] == 0f && !modPlayer.oasisElementalVanity && !modPlayer.allElementalsVanity) { int healProj = ModContent.ProjectileType(); if (Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rareSandElementalVanity || modPlayer.allElementalsVanity) + if (modPlayer.oasisElementalVanity || modPlayer.allElementalsVanity) { return false; } diff --git a/Projectiles/Summon/SarosEclipseBeam.cs b/Projectiles/Summon/SarosEclipseBeam.cs index 430ead2ec3..b9442ce2e6 100644 --- a/Projectiles/Summon/SarosEclipseBeam.cs +++ b/Projectiles/Summon/SarosEclipseBeam.cs @@ -55,6 +55,8 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.timeLeft == 5 && Owner.channel) Projectile.timeLeft++; Owner.Calamity().sarosEclipseBeamUsage += 2; + if (Owner.itemTime <= 1) + Owner.itemTime++; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index be18d29396..3e3ef793e6 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -428,7 +428,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.buffImmune[ModContent.BuffType()] = target.Calamity().DR >= 0.99f; target.AddBuff(ModContent.BuffType(), 600000); } 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/Summon/SmallAresArms/ExoskeletonPanel.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs index 1637fc380c..5b90e55e62 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs @@ -251,7 +251,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms bool hoveringOverAnySlot = false; bool clickedAnIconOnPanel = false; - bool sufficientSlots = Main.LocalPlayer.maxMinions > AresExoskeleton.MinionSlotsPerCannon; + bool sufficientSlots = Main.LocalPlayer.maxMinions >= AresExoskeleton.MinionSlotsPerCannon; // Draw icon and handle hover behaviors. // If an arm needs to be destroyed or spawned, it will happen on the next frame in the AI update loop. diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 7e07cc5f9a..ec1669addd 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Tools; using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -19,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref float time => ref Projectile.ai[0]; - public bool orbiting => Projectile.ai[1] == 0; + public bool orbiting => (Projectile.ai[1] == 0 || (Projectile.ai[1] == 1 && burstTimer > 0)); public Player Owner => Main.player[Projectile.owner]; public Vector2 goalPosition; @@ -31,53 +33,90 @@ namespace CalamityMod.Projectiles.Typeless public float speedMult = 1; public float placementMult = 1; public float orbitRot = 0; - public bool isAttacking => (burstTimer == 0 && !orbiting && Projectile.ai[1] != -1); + public float shardNumMult = 1; + public Vector2 lastPos; + public Color bColor = Color.Sienna; + public ref float debuffMult => ref Projectile.localAI[0]; + public bool isAttacking => (burstTimer <= 0 && !orbiting && Projectile.ai[1] != -1); + public override void SetStaticDefaults() // remove this + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 3; + } public override void SetDefaults() { Projectile.width = 50; Projectile.height = 50; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 4; + Projectile.extraUpdates = 3; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 230; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; Projectile.ContinuouslyUpdateDamageStats = true; } public override void AI() { + float orbitMult = Utils.Remap(Owner.ownedProjectileCounts[ModContent.ProjectileType()], + 0, 30, 0.8f, 1.35f, false); + float attackMult = MathF.Pow(1 + (Projectile.ai[1] == 1 ? (MathF.Pow(1 - Utils.GetLerpValue(0, 280, burstTimer, true), 4)) : 0) * 5, 2); + float orbit = Projectile.ai[1] == 1 ? (1 - MathF.Pow(Utils.GetLerpValue(280, 0, burstTimer, true), 4)) : 1; + float sine = (float)Math.Sin(time * 0.03f * speedMult / MathHelper.Pi); float sine2 = (float)Math.Sin(time * (0.03f * 0.5f * speedMult) / MathHelper.Pi); - float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); + // Sine number three, surely we need a third sine. You will not regret a third sine + float angleDisplacementSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * attackMult + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi); + + float rate = time * 0.004f; + List eColors = new List() + { + Color.Sienna, + Color.Peru + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2)); - float shardNumMult = Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * (Owner.Calamity().profanedSoulRelicBuff ? 2 : 1); + float goalMult = (Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * orbitMult); + shardNumMult = MathHelper.Lerp(shardNumMult, goalMult, 0.01f); - float displace = new Vector2(25, 0).RotatedBy(sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine * 0.5f).ToRotation(); + float displace = new Vector2(25, 0).RotatedBy(angleDisplacementSine * 0.5f).ToRotation(); orbitRot = Utils.AngleLerp(orbitRot, displace, 0.01f); - goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult, (125 * orbitSine - 45) * shardNumMult * placementMult)).RotatedBy(orbitRot); + goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult * orbit, (125 * orbitSine - 45) * shardNumMult * placementMult * orbit)).RotatedBy(orbitRot); Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, Color.Sienna, 0.5f).ToVector3() * 0.8f); if (Owner.Calamity().rOfResilienceCooldown > 0 && Projectile.ai[1] == 0) { - burstTimer = 120; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Projectile.type && projectile.owner == Owner.whoAmI && projectile.localAI[0] == 0) + { + projectile.localAI[0] = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, RelicOfResilience.maxPowerTime, 1, 8, true); + } + } + Owner.Calamity().rOfResilienceEffect = 0; + burstTimer = 280; Projectile.ai[1] = 1; Projectile.netUpdate = true; } - if (Owner.Calamity().rOfResilienceEffect == 0 && Projectile.ai[1] == 0) + if ((Owner.Calamity().rOfResilienceEffect == 0 || (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.baseTimeMax && Owner.HeldItem.type != ModContent.ItemType())) && Projectile.ai[1] == 0) { Projectile.ai[1] = -1; - Projectile.timeLeft = 95; Projectile.velocity = Utils.DirectionTo(Projectile.Center, goalPosition) * Main.rand.NextFloat(1f, 3f); } if (time == 0) { + lastPos = Projectile.Center; relicType = Main.rand.Next(1, 6 + 1); - speedMult = (Owner.Calamity().profanedSoulRelicBuff ? Main.rand.NextFloat(0.6f, 1.5f) : Main.rand.NextFloat(0.8f, 1.2f)); + speedMult = Main.rand.NextFloat(0.8f, 1.2f); placementMult = Main.rand.NextFloat(0.75f, 1.15f); } @@ -107,63 +146,55 @@ namespace CalamityMod.Projectiles.Typeless Projectile.Opacity = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); if (Projectile.ai[1] == -1) { + if (Projectile.timeLeft > 95) + Projectile.timeLeft = 95; Projectile.velocity *= 0.98f; } else { - if (burstTimer > 0) + if (burstTimer == 0) { - Projectile.extraUpdates = 1; - Projectile.velocity *= 0.9f; - if (Utils.Distance(Projectile.Center, Owner.Center) < 15) + Projectile.Opacity = 1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()]; + + Projectile.velocity = (((MathHelper.TwoPi / projNum) * Projectile.ai[2]).ToRotationVector2()) * 15 * speedMult * Main.rand.NextFloat(0.6f, 1.2f); + Owner.SetScreenshake(5f); + + if (Projectile.ai[2] == 1) { - behind = true; - Projectile.Center = Owner.Center; + SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); + SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); } - else + for (int i = 0; i < 3; i++) { - Projectile.Center += Utils.DirectionTo(Projectile.Center, Owner.Center) * 40f * Utils.GetLerpValue(90, 0, burstTimer); - if (time % 8 == 0) - { - Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 8), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(20, 32 + 1), Main.rand.NextFloat(0.65f, 1.1f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); - GeneralParticleHandler.SpawnParticle(spark); - } + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); + dust.noGravity = Main.rand.NextBool(); + dust.scale = Main.rand.NextFloat(1.35f, 2.8f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; } burstTimer--; - if (burstTimer == 0) - { - Projectile.Opacity = 1; - - int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()] - 4; - - Projectile.velocity = ((MathHelper.TwoPi * Projectile.ai[2] / projNum).ToRotationVector2()) * 15 * speedMult; - Owner.SetScreenshake(5f); - - if (Projectile.ai[2] == 1) - { - SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); - SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); - SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); - SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); - } - for (int i = 0; i < 3; i++) - { - Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); - GeneralParticleHandler.SpawnParticle(spark); - - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); - dust.noGravity = Main.rand.NextBool(); - dust.scale = Main.rand.NextFloat(1.35f, 2.8f); - dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; - } - } - } - else - { - Projectile.velocity *= 0.97f; } + Projectile.velocity *= 0.97f; } } + + Vector2 vel = lastPos.DirectionTo(Projectile.Center); + float trailMult = MathF.Pow(Utils.GetLerpValue(15, 60, Owner.ownedProjectileCounts[ModContent.ProjectileType()], false), 0.5f); + if (trailMult > 0 && Projectile.timeLeft > 130) + { + Particle spark = new CustomSpark(Projectile.Center, vel * 3, "CalamityMod/Particles/BloomCircle", false, 5, 0.365f * Projectile.scale * trailMult, bColor * Projectile.Opacity * MathF.Min(trailMult, 1), new Vector2(1f, 1f), true, true, colorFadeSpeed: 10, glowCenterScale: 0.6f, glowOpacity: 0.8f * Projectile.Opacity * trailMult, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(spark); + spark.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles; + } + if (isAttacking && Main.rand.NextBool(4)) { Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 8f)); @@ -171,8 +202,11 @@ namespace CalamityMod.Projectiles.Typeless dust.scale = Main.rand.NextFloat(0.55f, 1.1f) * Projectile.Opacity; dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; } - - time++; + if (Projectile.FinalExtraUpdate()) + lastPos = Projectile.Center; + if (burstTimer > 0) + burstTimer--; + time += 1f * orbitMult * attackMult; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { @@ -180,13 +214,11 @@ namespace CalamityMod.Projectiles.Typeless if (crit) modifiers.SetCrit(); - modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f); + float damageMultBase = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, RelicOfResilience.maxPowerTime, RelicOfResilience.orbitDamageMult / 2, RelicOfResilience.orbitDamageMult); + modifiers.SourceDamage *= (isAttacking ? 1 : damageMultBase); + int baseDebuffTime = 150; if (isAttacking) - target.AddBuff(ModContent.BuffType(), 520); - } - public override void OnKill(int timeLeft) - { - + target.AddBuff(ModContent.BuffType(), (int)(baseDebuffTime * debuffMult)); } public override bool PreDraw(ref Color lightColor) { @@ -200,9 +232,9 @@ namespace CalamityMod.Projectiles.Typeless _ => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6").Value }; if (isAttacking) - Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); + Projectile.DrawProjectileWithBackglow(bColor with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); else - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -213,7 +245,7 @@ namespace CalamityMod.Projectiles.Typeless else overPlayers.Add(index); } - public override bool? CanDamage() => (Projectile.ai[1] == -1 || burstTimer > 0) ? false : null; + public override bool? CanDamage() => (Projectile.ai[1] == -1) ? false : null; public override void SendExtraAI(BinaryWriter writer) { diff --git a/Projectiles/Typeless/DebuffSpreadEffect.cs b/Projectiles/Typeless/DebuffSpreadEffect.cs index 8ab5c80f30..7412cefad9 100644 --- a/Projectiles/Typeless/DebuffSpreadEffect.cs +++ b/Projectiles/Typeless/DebuffSpreadEffect.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Typeless for (int index = 0; index < npc.buffType.Length; index++) { int type = npc.buffType[index]; - var debuffData = BuffDatasets.DebuffDataset[type]; + var debuffData = CalamityBuffSets.DebuffDataset[type]; // Calculate the Bane damage to see if the debuffs can be transfered int bDamage = Math.Max((int)(Bane.debuffData.EnemyLostRegen * bestDamage), (int)Bane.debuffData.EnemyLostRegen); diff --git a/Projectiles/Typeless/Elumphant.cs b/Projectiles/Typeless/Elumphant.cs new file mode 100644 index 0000000000..f3e16d1e25 --- /dev/null +++ b/Projectiles/Typeless/Elumphant.cs @@ -0,0 +1,759 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class Elumphant : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public static Color color1 = new Color(60, 103, 207); + public static Color color2 = new Color(103, 188, 214); + public Color usedColor = Color.White; + public ref float time => ref Projectile.ai[0]; + public float squashTimerX = 0; public float squashTimerY = 0; // Adjusts the X and Y centric squash effects + public float fallTimer = 0; // How long the Elumphant has been falling + public int maxFallTimer = 120; + public int lastHighestFallTimer = 0; + public ref float attackTimer => ref Projectile.ai[1]; // Timer for cycling between attack and cooldown phases + public ref float mistShootTimer => ref Projectile.ai[2]; // Timer for the frames that it fires mist + + public float fxFade = 0; // The glow visuals multiplier + + public float verticalSquash = 0; public float horizontalSquash = 0; // The Elumphant's current X and Y squash + + public float trunkRotation = 0; // Rotation for the trunk, and also the direction that it's mist will be fired in + public bool dashing = false; // If the Elumphant is performing its jumping bonk attack + public NPC targeted; // The currently targeted NPC for either of it's attacks + public bool hitHead = true; // If the Elumphant has landed on its back when falling back to the player's head + public int blinkTime = 1; public int cryTime = 1; // Timers for doing its idle animations + public bool mammothFlip = false; // If the Elumphant is spinning as it falls back to the player + public bool mammothOops = false; // If the Elumphant is doing its mistake animation after bonking the player's head + public int hopTimer = 0; // Timer for the little hop after bonking its head + public bool attackedThisFrame = false; + public int attackDirection = 1; + public int attacksDone = 0; + public bool recoiling = false; // If the Elumphant has finished bonking enemies and is returning to the player + public float maxTargetingDistance = 0; + public float maxTrunkRot => -MathHelper.PiOver2 * 1.1f; + public int attackTime => (int)(FrozenCube.baseAttackSpeed); + public int attackTimeAdjusted = 0; // Attack speed adjusted for the slam attack + public float damageScaling = 0; // The damage scaling on the mist and slam attacks + public int cooldownTime = 0; // The cooldown between attacks + public List hitNPCs = new List(); + public Vector2 lastHitNPCPos; + public Vector2 lastProjPos; + public bool spawnJumpDusts = true; + public float frozenCubePower = 0; // The base power boost gained from defense before scaling adjustments + public bool vis => Owner.Calamity().frozenCubeVisuals; + + Vector2 goalPosition; + public SlotId soundSlot; + public static Asset TrunkTexture { get; private set; } + public override void Load() + { + if (Main.dedServ) + return; + + TrunkTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/ElumphantTrunk"); + } + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 25; + ProjectileID.Sets.TrailingMode[Type] = 2; + Main.projFrames[Type] = 3; + } + public override void SetDefaults() + { + Projectile.width = 46; + Projectile.height = 34; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Generic; + } + public float WidthFunction(float completion, Vector2 _) + { + float width; + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6); + float newSine = 0.7f - sine * 0.1f; + float cutPoint = 0.1f; + float baseFade = (MathF.Pow((1 - completion), 2)); + float compFade = completion > cutPoint ? baseFade : baseFade * (1 - MathF.Pow((Utils.GetLerpValue(cutPoint, 0, completion)), 3)); + width = (completion == 0 ? 0 : 45 * newSine * compFade); + + return width; + } + public Color ColorFunction(float completion, Vector2 _) + { + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6); + Color clr = Color.Lerp(usedColor, Color.DodgerBlue, 0.6f + 0.2f * sine); + Color tipColor = Color.Lerp(clr, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true)); + return Color.Lerp(clr, tipColor, completion) * fxFade; + } + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) + { + if (vis) + { + // Render the main trail + string shader = "CalamityMod:TrailStreak"; + Vector2[] length = Projectile.oldPos.Take((int)(Math.Max(10 - Projectile.numHits, 5))).ToArray(); + GameShaders.Misc[shader].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/DoubleTrail")); + PrimitiveRenderer.RenderTrail(length, new(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, true, true, GameShaders.Misc[shader]), length.Length * 6); + } + } + public void SetStats() + { + maxTargetingDistance = (float)(500 * GetPower(0.25f)); + attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / (GetPower(0.5f))); + damageScaling = (float)GetPower(0.015f, 22 * (1 + frozenCubePower)); + cooldownTime = (int)(FrozenCube.baseAttackCooldown / GetPower(0.5f)); + } + public void SetElumphantPower() + { + int usedDefense = Owner.Calamity().frozenCubeUsedDefense; + if (time == 0) // Show the player how much defense is being used + CombatText.NewText(Projectile.Hitbox, color2, -usedDefense,false, true); + + frozenCubePower = usedDefense * 0.05f; // 1 point of defense = 5% effectiveness + + float power = (float)(GetPower(0.0185f, 13f * (1 + frozenCubePower)) - 1); + Owner.Calamity().frozenCubeDebuffBoost = power; + Owner.Calamity().frozenCubeElumphantBoost = damageScaling - 1; + Owner.Calamity().ColdDebuffMultiplier += power; // Boost cold debuff damage + } + public double GetPower(float efficiency, float intenseScaling = 1) + { + double defensePower = frozenCubePower; + return Math.Pow(1 + defensePower * efficiency, intenseScaling); + } + + public void GetColor() + { + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + color1, + color2 + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), Color.White, 0.7f); + } + public void ManageSquash() + { + float resolutionSpeed = 0.02f / Projectile.MaxUpdates; + verticalSquash = MathHelper.Lerp(verticalSquash, 0, resolutionSpeed); + horizontalSquash = MathHelper.Lerp(horizontalSquash, 0, resolutionSpeed); + } + public void SetDirection(int newDirection) + { + if (newDirection == 0) + { + Projectile.spriteDirection = Owner.direction; + return; + } + if (Projectile.spriteDirection != newDirection) + { + trunkRotation *= -1; + Projectile.rotation *= -1; + } + Projectile.spriteDirection = newDirection; + } + public void GetTarget(bool excludeHitNPCs, float distanceMult = 1, bool leaveBossesLast = false) // Target closest NPC to mouse, unless they're too far, then do closest to Elumphant + { + if (excludeHitNPCs) + { + NPC chosenTarget = null; + float distance = 0; + if (leaveBossesLast && targeted != null) + targeted = null; + + for (int u = 0; u < ((leaveBossesLast && targeted == null) ? 2 : 1); u++) + { + bool ignoreBosses = (u == 0) && leaveBossesLast; + + for (int index = 0; index < Main.npc.Length; index++) // look for a target that isnt one it has already hit + { + NPC searchedTarget = Main.npc[index]; + bool bossCheck = !(searchedTarget.boss && ignoreBosses); + if (searchedTarget.CanBeChasedBy(null, false) && searchedTarget.HasBuff(FrozenCube.debuff) && !hitNPCs.Contains(searchedTarget) && searchedTarget.active && searchedTarget.life > 0 && bossCheck) + { + float targetDistance = Projectile.Center.Distance(new Vector2(searchedTarget.Center.X, Projectile.Center.Y)); + if (targetDistance > distance) + { + distance = targetDistance; + chosenTarget = searchedTarget; + } + } + } + targeted = chosenTarget; + } + } + else + { + bool targetFar = (distanceMult != -1); + + NPC chosenTarget = null; + if (leaveBossesLast && targeted != null) + targeted = null; + float distance = (targetFar ? 0 : maxTargetingDistance); + + for (int u = 0; u < ((leaveBossesLast && targeted == null) ? 2 : 1); u++) + { + bool ignoreBosses = (u == 0) && leaveBossesLast; + for (int index = 0; index < Main.npc.Length; index++) + { + NPC searchedTarget = Main.npc[index]; + if (searchedTarget.CanBeChasedBy(null, false) && searchedTarget.active && searchedTarget.life > 0) + { + bool canHit = Collision.CanHit(Owner.Center, 1, 1, searchedTarget.Center, 1, 1); + + float targetDistance = Owner.Center.Distance(new Vector2(searchedTarget.Center.X, Owner.Center.Y)); + // Checks most distant target first, then closest if that fails + bool inRange = (targetFar ? (targetDistance > distance) : (targetDistance < distance)); + bool bossCheck = !(searchedTarget.boss && ignoreBosses); + if (inRange && canHit && targetDistance < maxTargetingDistance && bossCheck) + { + distance = targetDistance; + chosenTarget = searchedTarget; + } + } + } + if (chosenTarget != null) + targeted = chosenTarget; + } + + if (!ValidDistance()) + targeted = null; + } + } + public void ScaleOpacity(float endAt) + { + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, endAt, 0.12f); + } + public bool ValidDistance(float distanceCheckMult = 1) => (targeted != null && targeted.Distance(Owner.Center) < (maxTargetingDistance * distanceCheckMult)); + public void HopAttack(Vector2 originalPosition) + { + if (!vis) + ScaleOpacity(0.4f); + + float attackLerp = Utils.GetLerpValue((int)(Math.Max(attackTimeAdjusted, 2) / 2), Math.Max(attackTimeAdjusted, 2), attackTimer, true); + + if (attackTimer == 0 && Projectile.numHits == 0) + { + GetTarget(true, 10, true); + } + + if (targeted == null || (targeted != null && (targeted.life <= 0 || !targeted.active))) + { + if (attackLerp > 0 && !recoiling) + { + lastHitNPCPos = Projectile.Center; + attackTimer = attackTimeAdjusted; + } + recoiling = true; + targeted = null; + } + + if (attacksDone != 0) + Projectile.frame = 2; + if (recoiling) + { + attackTimeAdjusted = (int)(FrozenCube.baseAttackSpeed / GetPower(0.5f)); + if (Projectile.numHits > 1) + attackTimer = attackTimeAdjusted; + Projectile.numHits = 1; + } + + + int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : (Owner.direction); + if (!recoiling) + fxFade = (attackLerp <= 0.2f ? 0 : Math.Max(attackLerp, MathHelper.Lerp(fxFade, 1, 0.15f))); + else + fxFade = MathHelper.Lerp(0f, 1, MathF.Pow(attackLerp, 4)); + + Vector2 basePosition = recoiling ? originalPosition : Projectile.numHits == 0 ? originalPosition : (lastHitNPCPos); + Vector2 targetPos = recoiling ? lastHitNPCPos : targeted.Center - (Vector2.UnitY * targeted.height / 2); + + float jumpHeight = 250;// Math.Max(250 - Projectile.numHits * 10, recoiling ? 250 : 60); + float jumpLerp = attackLerp > 0.5f ? 1 - (MathF.Pow(Utils.GetLerpValue(0.5f, 1f, attackLerp), 4)) : 1 - (MathF.Pow(Utils.GetLerpValue(0.5f, 0f, attackLerp), 2)); + float jumpOffsetY = MathHelper.Lerp(basePosition.Y, targetPos.Y, attackLerp) - jumpHeight * jumpLerp; + float jumpOffsetX = MathHelper.Lerp(basePosition.X, targetPos.X, attackLerp); + goalPosition = new Vector2(jumpOffsetX, jumpOffsetY); + + Projectile.Center = goalPosition; + + if (attackLerp > 0f && spawnJumpDusts && vis) + { + bool clrChoose = Main.rand.NextBool(); + int halfDusts = 14; + for (int i = -halfDusts; i <= halfDusts; i++) + { + Vector2 dustVel = -Vector2.UnitY.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 1.8f); + Vector2 dustPos = Owner.Center + Vector2.UnitY * -(Owner.height / 2 + Projectile.height / 2.5f * Projectile.scale) + dustVel * 1.5f; + Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), + dustVel.RotatedByRandom(0.55f) * (Math.Abs(i) * 0.2f) * (Main.rand.NextBool(5) ? 3 : 1), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * 2.5f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color1 : color2; + dust2.customData = new Vector2(0.6f, 1.5f); + dust2.fadeIn = -0.7f; + + if (i == -1) + i = 1; + } + spawnJumpDusts = false; + } + + float goalAngle = (attackLerp > 0.5f ? basePosition.DirectionTo(Projectile.Center) : Projectile.Center.DirectionTo(targetPos)).ToRotation() + (attackLerp > 0.5f ? MathHelper.PiOver2 : -MathHelper.PiOver2); + if (!recoiling) + Projectile.rotation = MathHelper.WrapAngle(Utils.Remap(attackLerp, 0, 1, -MathHelper.PiOver2 * Projectile.spriteDirection, MathHelper.PiOver2 * Projectile.spriteDirection)) * (1 - MathF.Pow(1 - attackLerp, 3)); + else + Projectile.rotation = MathHelper.WrapAngle(Utils.Remap(attackLerp, 0, 1, MathHelper.TwoPi * 2 * Projectile.spriteDirection, 0)); + trunkRotation = Utils.AngleLerp(trunkRotation, 0, 0.11f); + + int attemptDir = Math.Sign((recoiling ? basePosition.X : targetPos.X) - Projectile.Center.X); + SetDirection(attemptDir); + + if (attackTimer <= (int)(Math.Max(attackTimeAdjusted, 2) / 2) && recoiling) + { + Projectile.frame = 0; + hitNPCs.Clear(); + Projectile.velocity = Vector2.Zero; + recoiling = false; + dashing = false; + Projectile.numHits = 0; + attackTimer = (int)(cooldownTime / 2); + attacksDone = 0; + spawnJumpDusts = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + GetTarget(true); + } + } + public void MistAttack(float fallLerp) + { + Projectile.frame = 1; + float angleSweep = MathF.Sin(attackTimer * 0.085f) * attackDirection; + float goalAngle = Projectile.Center.DirectionTo(targeted.Center).ToRotation() - MathHelper.PiOver2; + if (attackTimer == cooldownTime + 1) // Make start attack sound + { + if (vis) + SoundEngine.PlaySound(FrozenCube.noise with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center); + + Projectile.soundDelay = 0; + Projectile.frameCounter = 1; + } + SetDirection(Math.Sign(Projectile.Center.DirectionTo(targeted.Center).X)); + horizontalSquash = 0.5f; + Projectile.rotation = Projectile.rotation.AngleLerp((goalAngle + MathHelper.PiOver2 * Projectile.spriteDirection), 0.07f) * MathF.Pow(fallLerp, 0.2f); + float angleMax = MathHelper.PiOver4 * 0.75f * Utils.GetLerpValue(maxTargetingDistance, 30, Projectile.Center.Distance(targeted.Center), true); + if (hopTimer <= 0) + trunkRotation = trunkRotation.AngleLerp(goalAngle - Projectile.rotation - angleMax * angleSweep, 0.23f); + + if (attackTimer > (cooldownTime * 1.1f)) + { + if (!vis) + ScaleOpacity(0.4f); + if (mistShootTimer == 0 && Main.myPlayer == Projectile.owner) + { + Vector2 shootVel = (trunkRotation + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2(); + int damage = (int)Owner.GetTotalDamage().ApplyTo((float)(FrozenCube.mistBaseDamage * damageScaling)); + int projectile = ModContent.ProjectileType(); + Vector2 shootPosition = Projectile.Center + shootVel * 5 * Projectile.scale; + Projectile mist = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), shootPosition, (shootVel * shootPosition.Distance(targeted.Center) / 25) * Main.rand.NextFloat(0.9f, 1.1f), projectile, damage, 0, Owner.whoAmI, 0, Owner.ownedProjectileCounts[projectile] % 3, (float)GetPower(1)); + } + mistShootTimer += (float)(0.35f * GetPower(0.25f)); + if (mistShootTimer >= 2f) + mistShootTimer = 0; + } + mammothFlip = false; + + attackedThisFrame = true; + if (!ValidDistance()) + { + GetTarget(false, -1); + if (!ValidDistance()) + { + attackTimer = cooldownTime + attackTime; + targeted = null; + } + } + if (attackTimer == cooldownTime + attackTime) + { + attackDirection *= -1; + Projectile.frame = 0; + attacksDone++; + if (attacksDone >= 2) // Every 2 attacks, do a dash slam + { + dashing = true; + attackTimer = -1; + } + } + } + public void Idle() + { + if (!vis) + ScaleOpacity(0); + targeted = null; + if (Owner.StandingStill()) // If standing still, let the player mess with the mammoth squash for fun + { + if (Owner.controlDown) + horizontalSquash = 0.5f; + if (Owner.controlUp) + verticalSquash = 0.5f; + } + if (Math.Abs(Owner.velocity.X) > 4 && fallTimer == 0) + verticalSquash = 0.25f * Utils.GetLerpValue(4, 10, Math.Abs(Owner.velocity.X)); + if (targeted == null && attackTimer > cooldownTime) // If can attack but there is no target, wait to decrease the timer until a target is found + attackTimer--; + int cryStart = (int)(cryTime - 65); + if (Projectile.soundDelay >= cryStart) + { + if (Projectile.soundDelay == cryStart) // Sound + { + verticalSquash = 0.3f; + if (vis) + soundSlot = SoundEngine.PlaySound(FrozenCube.cry with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center); + } + trunkRotation = Utils.AngleLerp(trunkRotation, maxTrunkRot * Projectile.spriteDirection, 0.025f); + } + else if (hopTimer <= 0) + trunkRotation = Utils.AngleLerp(trunkRotation, 0, 0.11f); + if (Projectile.soundDelay >= cryTime) + { + SetRandCry(); + } + + if (Projectile.frameCounter >= blinkTime) + { + Projectile.frame = 1; + Projectile.frameCounter = -6; + } + if (Projectile.frameCounter == 0) + { + Projectile.frame = 0; + SetRandBlink(); + } + if (vis) + { + Projectile.frameCounter++; + Projectile.soundDelay += 2; // Naturally decreases by 1, so to make it count up, increases it by 2 + } + } + public override void AI() + { + if (time == 0) + { + lastHitNPCPos = lastProjPos = Owner.Center; + Projectile.Opacity = 0; + } + if (vis && Projectile.Opacity < 1) + ScaleOpacity(1); + Projectile.timeLeft++; + SetStats(); + GetColor(); + SetElumphantPower(); + ManageSquash(); + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying) + sound.Position = Projectile.Center; + + if (targeted != null && (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy(Projectile))) + GetTarget(false); + + float sine = MathF.Sin(time * 0.04f); + float sine2 = MathF.Sin(time * 0.08f); + float sine3 = MathF.Sin(time * 0.1f); + float fallLerp = Utils.GetLerpValue(0, maxFallTimer, fallTimer, true); + + int hopTimerMax = 16; + float hop = 1 + (mammothOops ? 1 - MathF.Pow(Utils.GetLerpValue(hopTimerMax, 0, hopTimer, true), 2.5f) : MathF.Pow(Utils.GetLerpValue(0, hopTimerMax, hopTimer, true), 1.0f)) * 1.55f; + if (hopTimer >= hopTimerMax) + mammothOops = false; + else if (mammothOops) + Projectile.rotation = Projectile.rotation.AngleLerp(0, Utils.GetLerpValue(0, hopTimerMax, hopTimer, true)); + else if (hopTimer > 0) + trunkRotation = MathHelper.WrapAngle(MathHelper.Lerp(0, maxTrunkRot * Projectile.spriteDirection - Projectile.rotation, MathF.Pow(Utils.GetLerpValue(0, hopTimerMax / 2, hopTimer, true), mammothOops ? 1f : 1f))); + + Vector2 offsetY = -Vector2.UnitY * (Owner.height / 2 + Projectile.height / 2.5f * Projectile.scale) * (1 + 0.4f * sine2 * fallLerp + 5 * CalamityUtils.EaseInOutExp(fallLerp, 2f, 2f)) * hop; + Vector2 offsetX = Vector2.UnitX * ((3 * Projectile.spriteDirection) + 17 * sine3 * fallLerp) * Projectile.scale; + goalPosition = Owner.Center + offsetX + offsetY; + + if (dashing) // Hop Attack + { + HopAttack(goalPosition); + } + else + { + Projectile.Center = goalPosition; + if (targeted == null) + GetTarget(false); + + if (attackTimer > cooldownTime && targeted != null) // Mist Attack + { + MistAttack(fallLerp); + } + else // Idle + { + int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : Owner.direction; + if (fallTimer == 0) + SetDirection(direction); + Idle(); + } + + if (hopTimer <= 0 && !attackedThisFrame) + { + if (mammothFlip) + { + Projectile.rotation = MathHelper.WrapAngle(Projectile.rotation - 0.11f * Projectile.spriteDirection * fallLerp); + } + else + Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.PiOver2 * 0.7f * sine * fallLerp, 0.015f); + } + } + + if (Owner.velocity.Y > 8 && !dashing && vis) // If the player is falling at close to max normal downward velocity + { + if (fallTimer == 0) + mammothFlip = Main.rand.NextBool(3); + hitHead = false; + SetRandCry(); + SetRandBlink(); + if (fallTimer < maxFallTimer) + fallTimer++; + } + else if (fallTimer > 0) + fallTimer -= 7 - Math.Min(Owner.velocity.Y, 0); if (fallTimer < 0) fallTimer = 0; + if (fallTimer <= 0 && !hitHead) + { + float landPower = (Utils.GetLerpValue(0, maxFallTimer, lastHighestFallTimer, true)); + verticalSquash = 1f * landPower; + lastHighestFallTimer = 0; + hitHead = true; + float rotation = MathHelper.WrapAngle(Projectile.rotation + MathHelper.Pi); + if (mammothFlip && rotation < MathHelper.PiOver2 && rotation > -MathHelper.PiOver2 && landPower > 0.2f) + { + int halfDusts = 7; + Projectile.frame = 1; + SetRandBlink(); + if (vis) + { + Owner.SetScreenshake(2); + SoundEngine.PlaySound(FrozenCube.jokeBonk with { Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); + for (int i = -halfDusts; i <= halfDusts; i++) + { + Vector2 dustVel = Vector2.UnitX.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.6f, 1.8f); + Vector2 dustPos = Owner.Center - (Vector2.UnitY * Owner.height / 2) + dustVel * 1.5f; + Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), + dustVel * (i * 0.4f), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * 3); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color1 : color2; + dust2.customData = new Vector2(0.6f, 1.5f); + dust2.fadeIn = -0.4f; + if (i == -1) + i = 1; + } + SoundEngine.PlaySound(FrozenCube.noise with { Pitch = Main.rand.NextFloat(0.4f, 0.6f), volume = 0.6f }, Projectile.Center); + CombatText.NewText(Projectile.Hitbox, usedColor, "!"); + } + + trunkRotation = maxTrunkRot * Projectile.spriteDirection; + verticalSquash = 1.5f * landPower; + mammothOops = true; + } + else + { + Projectile.rotation = 0; + } + mammothFlip = false; + } + + if (fxFade > 0 && vis) + Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.6f * fxFade); + + if (fallTimer > lastHighestFallTimer) + lastHighestFallTimer = (int)fallTimer; + + if (attackTimer >= attackTime + cooldownTime) + attackTimer = 0; + + attackTimer += recoiling ? -0.75f : 1 + 0.4f * Projectile.numHits; + time++; + if (mammothOops) + hopTimer++; + else if (hopTimer > 0) + hopTimer--; + + squashTimerX += 0.1f + horizontalSquash; + squashTimerY += 0.1f + verticalSquash; + + attackedThisFrame = false; + + lastProjPos = Projectile.Center; + + if (!Owner.Calamity().frozenCube) + { + if (SoundEngine.TryGetActiveSound(soundSlot, out var sound2) && sound2.IsPlaying) + sound2?.Stop(); + Projectile.Kill(); + return; + } + } + public void SetRandBlink() + { + Projectile.frameCounter = Projectile.frameCounter > 0 ? 1 : 0; + blinkTime = Main.rand.Next(55, 90 + 1); + } + public void SetRandCry() + { + Projectile.soundDelay = 0; + cryTime = Main.rand.Next(800, 1200 + 1); + } + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + Asset tex = ModContent.Request(Texture); + Texture2D trunk = TrunkTexture.Value; + + Color bodyColor = lightColor * Projectile.Opacity; + Rectangle frame = tex.Value.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + + float squashSineV = MathF.Sin(squashTimerY * 0.55f) * verticalSquash; + float squashSineH = -MathF.Sin(squashTimerX * 0.55f) * horizontalSquash; + float power = 0.35f; + float squashX = 1 - power * squashSineV + power * 1.25f * squashSineH; + float squashY = 1 + power * 1.25f * squashSineV - power * squashSineH; + Vector2 elumphantSquash = new Vector2(squashX, squashY); + Vector2 elumphantLocation = new Vector2(Projectile.Center.X, Projectile.Center.Y + ((tex.Height() / 5) * (1 - squashY))) + new Vector2(0f, Owner.gfxOffY); + + float trunkDistX = 10; + float trunkPosX = (trunkDistX - trunkDistX * (1 - squashX)) * Projectile.spriteDirection; + Vector2 trunkPos = new Vector2(trunkPosX * Projectile.scale, 0); + + if (vis) + { + for (int i = 0; i < 18; i++) // Backglow + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 4 * fxFade; + Main.EntitySpriteDraw(tex.Value, elumphantLocation - Main.screenPosition + drawOffset, frame, usedColor with { A = 0 } * 0.2f * fxFade, Projectile.rotation, frame.Size() * 0.5f, elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + Main.EntitySpriteDraw(trunk, elumphantLocation - Main.screenPosition + trunkPos.RotatedBy(Projectile.rotation), null, usedColor with { A = 0 } * 0.2f * fxFade * Projectile.Opacity, Projectile.rotation + trunkRotation, new Vector2(trunk.Width / 2, 0), elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + } + + // Main body + Main.EntitySpriteDraw(tex.Value, elumphantLocation - Main.screenPosition, frame, bodyColor, Projectile.rotation, frame.Size() * 0.5f, elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + Main.EntitySpriteDraw(trunk, elumphantLocation - Main.screenPosition + trunkPos.RotatedBy(Projectile.rotation), null, bodyColor, Projectile.rotation + trunkRotation, new Vector2(trunk.Width / 2, 0), elumphantSquash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (dashing) + { + float attackMult = (float)(0.7f * GetPower(0.5f)); + target.MoveNPC(Vector2.UnitY, 8, false, Owner); + + hitNPCs.Add(target); + GetTarget(true, 1, true); + lastHitNPCPos = target.Center - Vector2.UnitY * (target.height / 2); + + bool lastHit = false; + if (targeted == null) + { + attackMult *= 1.25f; + if (vis) + Owner.SetScreenshake(3 * attackMult); + lastHit = true; + recoiling = true; + modifiers.SourceDamage *= (float)(1.5f * damageScaling); + } + else + { + attackTimer = (int)(attackTimeAdjusted / 2); + float minMult = 0.25f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (float)(damageMult * damageScaling); + } + + if (lastHit && vis) + { + SoundEngine.PlaySound(FrozenCube.noise with { Pitch = -0.5f, volume = 0.8f }, Projectile.Center); + } + verticalSquash = lastHit ? 0.85f : 0.5f; + + if (vis) + { + SoundEngine.PlaySound(FrozenCube.hit with { Pitch = -0.2f + 0.05f * Projectile.numHits, volume = 1f, MaxInstances = -1 }, Projectile.Center); + int halfDusts = (int)((lastHit ? 12 : 8) * attackMult); + for (int i = -halfDusts; i <= halfDusts; i++) + { + Vector2 dustVel = Vector2.UnitX * Main.rand.NextFloat(0.6f, 1.8f) * attackMult; + Vector2 dustPos = Projectile.Center + dustVel * 1.5f; + Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), + dustVel.RotatedByRandom(0.35f) * (i * 0.4f), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * (lastHit ? 5 : 3.5f) * attackMult); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color1 : color2; + dust2.customData = new Vector2(0.6f, 1.5f); + dust2.fadeIn = -0.4f / attackMult; + + float opacity = 0.7f; + if (i % 2 == 0) + { + bool clrChoose = Main.rand.NextBool(); + Particle smoke = new CustomColorChangeSpark(dustPos, dustVel.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 0.45f) * i * (lastHit ? 2 : 1), Main.rand.NextBool(3) ? "CalamityMod/Particles/WaterFoam" : "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(22, 27), Main.rand.NextFloat(0.45f, 0.65f) * Projectile.scale * (lastHit ? 2 : 1) * attackMult, (clrChoose ? color1 : color2) * opacity, (clrChoose ? color2 : color1) * opacity, new Vector2(0.25f, 1.2f)); + GeneralParticleHandler.SpawnParticle(smoke, true); + } + + if (lastHit) + { + bool clrChoose = Main.rand.NextBool(); + float velMult = Main.rand.NextFloat(1.2f, 1.35f) * i; + Vector2 velocity = dustVel.RotatedByRandom(0.3f) * velMult; + Particle mist = new CustomPulsingSpark(dustPos, velocity, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 55, Main.rand.NextFloat(1.05f, 1.45f) * Projectile.scale * attackMult, (clrChoose ? color1 : color2) * opacity, (clrChoose ? color2 : color1) * opacity, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: 0, shrinkSpeed: 0.1f, turnRate: (Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.0028f, 0.0035f) * velMult, + sineRate: Main.rand.NextFloat(0.09f, 0.12f), sineIntensity: (int)(4 + Main.rand.Next(15, 20 + 1)) * Projectile.scale, sineRotation: MathHelper.PiOver2 + velocity.ToRotation()); + GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs); + } + + if (i == -1) + i = 1; + } + } + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox); + } + public override bool? CanHitNPC(NPC target) + { + if (targeted == null) + return false; + // These extra frames before the hit allow for a bit of "hitstop" on the jump attack + return (dashing && attackTimer >= attackTimeAdjusted + 3 && target == targeted) ? null : false; + } + } +} diff --git a/Projectiles/Typeless/Elumphant.png b/Projectiles/Typeless/Elumphant.png new file mode 100644 index 0000000000..b6c7ca8cd2 Binary files /dev/null and b/Projectiles/Typeless/Elumphant.png differ diff --git a/Projectiles/Typeless/ElumphantMist.cs b/Projectiles/Typeless/ElumphantMist.cs new file mode 100644 index 0000000000..9cf18c4ac7 --- /dev/null +++ b/Projectiles/Typeless/ElumphantMist.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Renderers; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ElumphantMist : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public ref float time => ref Projectile.ai[0]; + public int textureChoice = 0; + public float fade = 1; + public int lifetime = 90; + public float originalScale = 0; + public Color mistColor = Color.White; + public bool vis => Owner.Calamity().frozenCubeVisuals; + public static Asset SmokeTexture1 { get; private set; } + public static Asset SmokeTexture2 { get; private set; } + public static Asset SmokeTexture3 { get; private set; } + public override void Load() + { + if (Main.dedServ) + return; + + SmokeTexture1 = ModContent.Request("CalamityMod/Projectiles/Typeless/SmokePuff1"); + SmokeTexture2 = ModContent.Request("CalamityMod/Projectiles/Typeless/SmokePuff2"); + SmokeTexture3 = ModContent.Request("CalamityMod/Projectiles/Typeless/SmokePuff3"); + } + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 38; + Projectile.ignoreWater = true; + Projectile.timeLeft = lifetime; + Projectile.extraUpdates = 2; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = DamageClass.Generic; + } + public override void AI() + { + if (time == 0) + { + textureChoice = (int)Projectile.ai[1]; + originalScale = Main.rand.NextFloat(0.7f, 1.1f); + mistColor = Main.rand.NextBool() ? Elumphant.color1 : Elumphant.color2; + } + Projectile.velocity *= 0.96f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + fade = 1 - MathF.Pow(Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true), 3 / Projectile.ai[2]); + Projectile.scale = (1 + (1 - fade) * Projectile.ai[2]) * originalScale; + + float inverseFade = Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true); + float opacity = 0.4f * fade * (1.2f - inverseFade); + if (Main.rand.NextBool(3) && vis) // Effects + { + Particle trail = new CustomColorChangeSpark(Projectile.Center + Main.rand.NextVector2Circular(40, 40) * Projectile.scale * (1 - fade) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * (-35 + 65 * inverseFade) * Projectile.scale, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(3, 4), Main.rand.NextBool(3) ? "CalamityMod/Particles/WaterFoam" : "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(9, 12), Main.rand.NextFloat(0.75f, 1f) * Projectile.scale, (mistColor == Elumphant.color1 ? mistColor : Elumphant.color2) * opacity, (mistColor == Elumphant.color2 ? mistColor : Elumphant.color1) * opacity, new Vector2(0.15f + 0.85f * inverseFade, 1.4f - 0.4f * inverseFade)); + GeneralParticleHandler.SpawnParticle(trail, true); + } + if (Main.rand.NextBool(12) && vis) + { + float rotation = 0; + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(7f, 14f); + Particle mist = new CustomPulsingSpark(Projectile.Center, velocity, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 35, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(Projectile.scale, 0.3f), (mistColor == Elumphant.color1 ? mistColor : Elumphant.color2) * opacity, (mistColor == Elumphant.color2 ? mistColor : Elumphant.color1) * opacity, + new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: rotation, shrinkSpeed: 0.1f, turnRate: (Main.rand.NextBool() ? -1 : 1) * Main.rand.NextFloat(0.06f, 0.085f), + sineRate: Main.rand.NextFloat(0.15f, 0.35f), sineIntensity: (int)(8 + Main.rand.Next(35, 55 + 1) * inverseFade) * Projectile.scale, sineRotation: MathHelper.PiOver2 + velocity.ToRotation()); + GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs); + } + + Lighting.AddLight(Projectile.Center, mistColor.ToVector3() * 0.3f * Projectile.scale); + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(FrozenCube.debuff, (int)(300 * Projectile.ai[2])); + float minMult = 0.25f; + int hitsToMinMult = 3; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15 * Projectile.scale, 50 * Projectile.scale, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + Texture2D bTexture = (textureChoice == 0 ? SmokeTexture1.Value : textureChoice == 1 ? SmokeTexture2.Value : SmokeTexture3.Value); + float inverseFade = Utils.GetLerpValue(lifetime, 0, Projectile.timeLeft, true); + + PixelationManager.AddPixelatedDrawer((_) => + { + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, mistColor with { A = 0 } * fade * (vis ? 1 : 0.5f), Projectile.rotation, new Vector2(bTexture.Width / 2, bTexture.Height * (MathHelper.Lerp(0.7f, 0.4f, inverseFade))), new Vector2(0.3f + 0.7f * inverseFade, 1.4f - 0.4f * inverseFade) * Projectile.scale, SpriteEffects.None); + }, Enums.GeneralDrawLayer.AfterProjectiles, default); + return false; + } + public override bool? CanDamage() => null; + } +} diff --git a/Projectiles/Typeless/ElumphantTrunk.png b/Projectiles/Typeless/ElumphantTrunk.png new file mode 100644 index 0000000000..b62b97c0b3 Binary files /dev/null and b/Projectiles/Typeless/ElumphantTrunk.png 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/JewelSpike.cs b/Projectiles/Typeless/JewelSpike.cs index aec3719911..5fcbe77d02 100644 --- a/Projectiles/Typeless/JewelSpike.cs +++ b/Projectiles/Typeless/JewelSpike.cs @@ -6,9 +6,6 @@ namespace CalamityMod.Projectiles.Typeless public class JewelSpike : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public ref float RealPenetrate => ref Projectile.ai[0]; - public const int MaxPenetrate = 2; - public override void SetStaticDefaults() { Main.projFrames[Type] = 5; @@ -19,12 +16,14 @@ namespace CalamityMod.Projectiles.Typeless Projectile.width = 36; Projectile.height = 44; Projectile.friendly = true; - Projectile.penetrate = -1; // For the animation, only hits up to 3 times though + Projectile.penetrate = 3; Projectile.tileCollide = false; Projectile.timeLeft = 80; Projectile.DamageType = DamageClass.Generic; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.stopsDealingDamageAfterPenetrateHits = true; + Projectile.appliesImmunityTimeOnSingleHits = true; } public override void AI() @@ -47,10 +46,6 @@ namespace CalamityMod.Projectiles.Typeless Projectile.frame = 0; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => RealPenetrate++; - - public override bool? CanHitNPC(NPC target) => RealPenetrate > MaxPenetrate - 1f ? false : (bool?)null; - public override void OnKill(int timeLeft) { if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs index 8df2d4245f..11971b2105 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -114,9 +114,13 @@ namespace CalamityMod.Projectiles.Typeless target.AddBuff(ModContent.BuffType(), 480); Player player = Main.player[Projectile.owner]; - player.statMana += 25; - player.ManaEffect(25); Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), (int)Math.Round(hit.Damage * 0.1), 0.75f); + int manaHeal = Math.Clamp(player.statManaMax2 - player.statMana, 0, 20); + if (manaHeal > 0) + { + player.statMana += manaHeal; + player.ManaEffect(manaHeal); + } } public override void OnKill(int timeLeft) 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/RelicGuard.cs b/Projectiles/Typeless/RelicGuard.cs index f12b5ee889..a80392ccd3 100644 --- a/Projectiles/Typeless/RelicGuard.cs +++ b/Projectiles/Typeless/RelicGuard.cs @@ -6,6 +6,7 @@ using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -23,6 +24,10 @@ namespace CalamityMod.Projectiles.Typeless public float rot2 = 0; public Vector2 aimVel; public float xLerp = 0; + public bool fullPower = false; + public bool maxPower = false; + public Vector2 goalPos; + public float chargeScaling = 1; public override void SetDefaults() { Projectile.width = Projectile.height = 1; @@ -36,6 +41,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { float sine = (float)Math.Sin(time * 0.13f / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.13f / 2 / MathHelper.Pi); float rate = Main.GlobalTimeWrappedHourly * 2; List eColors = new List() { @@ -49,22 +55,41 @@ namespace CalamityMod.Projectiles.Typeless bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); xLerp = MathHelper.Lerp(xLerp, (30 + 10 * sine) * Math.Sign(aimVel.X), 0.05f); - Projectile.Center = Owner.MountedCenter + new Vector2(xLerp, -25 + 12 * sine); + Vector2 startPos = new Vector2(xLerp, -25 + 12 * sine); + Vector2 endPos = new Vector2(40 * sine, -125 + 40 * sine2); + goalPos = Vector2.Lerp(goalPos, fullPower ? endPos : startPos, 0.03f); + Projectile.Center = Owner.MountedCenter + goalPos; Owner.direction = Math.Sign(aimVel.X); - if (Owner.HeldItem.type == ModContent.ItemType()) + if (!Owner.dead && (Owner.HeldItem.type == ModContent.ItemType() || (Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.baseTimeMax))) Projectile.timeLeft++; else + { Projectile.Kill(); - if (Owner.dead) - Projectile.Kill(); + return; + } + + if ((!fullPower && Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.baseTimeMax) || (Owner.Calamity().rOfResilienceEffect >= RelicOfResilience.maxPowerTime && !maxPower)) + { + if (fullPower) + maxPower = true; + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit"); + SoundEngine.PlaySound(sound with { Volume = 0.85f, Pitch = maxPower ? 0.8f : 0.6f }, Projectile.Center); + fullPower = true; + } + else if (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.baseTimeMax) + fullPower = false; + if (Owner.Calamity().rOfResilienceEffect < RelicOfResilience.maxPowerTime) + maxPower = false; + + chargeScaling = MathHelper.Lerp(chargeScaling, maxPower ? 1.4f : fullPower ? 1.2f : 1, 0.02f); // Emit some light Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; - if (time % 2 == 0 && false) + if (time % 2 == 0 && maxPower) { Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); @@ -79,10 +104,12 @@ namespace CalamityMod.Projectiles.Typeless float adjustedRot = aimVel.ToRotation(); Projectile.rotation = Utils.AngleLerp(Projectile.rotation, adjustedRot + (MathHelper.ToRadians(90)), 0.05f); - float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); - + if (!fullPower || Owner.HeldItem.type == ModContent.ItemType()) + { + float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); + } time++; } public override bool PreDraw(ref Color lightColor) @@ -91,14 +118,16 @@ namespace CalamityMod.Projectiles.Typeless Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; Color drawColor = bColor; float CDScale = Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + float overPowerScale = Utils.GetLerpValue(RelicOfResilience.baseTimeMax, RelicOfResilience.maxPowerTime, Owner.Calamity().rOfResilienceEffect, true); + float bScale2 = 0.35f * (chargeScaling + overPowerScale * 0.5f); - for (int i = 0; i < 2; i++) + Vector2 drawPos = Projectile.Center + new Vector2(0, Owner.gfxOffY); + for (int i = 0; i < (maxPower ? 6 : fullPower ? 4 : 2); i++) { - float bScale2 = 0.55f; - Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * CDScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, drawPos - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, MathHelper.PiOver4 * (i % 2 == 0 ? 1 : -1), bTexture.Size() * 0.5f, new Vector2(1 - 0.4f * overPowerScale * (1 + i * 0.3f), 1 + 0.7f * overPowerScale * (1 + i * 0.3f)) * bScale2 * rot2 * CDScale, SpriteEffects.None, 0); } - Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale * bScale2, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, xPos: drawPos.X, yPos: drawPos.Y); return false; } public override bool? CanDamage() => false; diff --git a/Projectiles/Typeless/SmokePuff1.png b/Projectiles/Typeless/SmokePuff1.png new file mode 100644 index 0000000000..af5fa26c40 Binary files /dev/null and b/Projectiles/Typeless/SmokePuff1.png differ diff --git a/Projectiles/Typeless/SmokePuff2.png b/Projectiles/Typeless/SmokePuff2.png new file mode 100644 index 0000000000..abaa344582 Binary files /dev/null and b/Projectiles/Typeless/SmokePuff2.png differ diff --git a/Projectiles/Typeless/SmokePuff3.png b/Projectiles/Typeless/SmokePuff3.png new file mode 100644 index 0000000000..409d98bb81 Binary files /dev/null and b/Projectiles/Typeless/SmokePuff3.png differ diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index 3a187f0a0a..3af9fac9fc 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); int inc; //For use with Contaminated Bile's Stealth Strike - if (Projectile.Calamity().stealthStrike) + if (Projectile.ai[2] > 0) { for (int k = 0; k < 15; k++) { 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/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs b/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs new file mode 100644 index 0000000000..0d26e280e9 --- /dev/null +++ b/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.ILEditing; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Melee.Yoyos; +using MonoMod; +using MonoMod.Cil; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.VanillaProjectileOverrides +{ + public class CounterweightEffects : GlobalProjectile + { + public override bool InstancePerEntity => true; + bool runInitialization = false; + public override bool AppliesToEntity(Projectile entity, bool lateInstantiation) + { + //All counterweights fall within this range. + if (entity.type >= ProjectileID.BlackCounterweight && entity.type <= ProjectileID.YellowCounterweight) + return true; + return false; + } + + public override bool PreAI(Projectile projectile) + { + var player = Main.player[projectile.owner]; + int id = player.HeldItem.type; + + if (!runInitialization) + { + if (id == ModContent.ItemType()) + projectile.MaxUpdates++; + runInitialization = true; + } + return true; + } + + public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) + { + var player = Main.player[projectile.owner]; + int id = player.HeldItem.type; + if ( id == ModContent.ItemType()) + target.AddBuff(ModContent.BuffType(), 300); + if (id == ModContent.ItemType()) + { + foreach (var item in Main.ActiveProjectiles) + { + if (item.owner == player.whoAmI && item.ModProjectile is ObliteratorYoyo o) + { + o.DashQueue++; + item.netUpdate = true; + } + } + } + } + } +} 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/Bonk.ogg b/Sounds/Item/Bonk.ogg new file mode 100644 index 0000000000..c915c274ac Binary files /dev/null and b/Sounds/Item/Bonk.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/ElumphantBop.ogg b/Sounds/Item/ElumphantBop.ogg new file mode 100644 index 0000000000..5f5cc86872 Binary files /dev/null and b/Sounds/Item/ElumphantBop.ogg differ diff --git a/Sounds/Item/ElumphantCry.ogg b/Sounds/Item/ElumphantCry.ogg new file mode 100644 index 0000000000..685de9abef Binary files /dev/null and b/Sounds/Item/ElumphantCry.ogg differ diff --git a/Sounds/Item/ElumphantSound.ogg b/Sounds/Item/ElumphantSound.ogg new file mode 100644 index 0000000000..f2aaf9ae5e Binary files /dev/null and b/Sounds/Item/ElumphantSound.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..6537b0421c 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using CalamityMod.Buffs; +using CalamityMod.Buffs; using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; @@ -8,6 +7,9 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.DataStructures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Summon; using ReLogic.Reflection; using Terraria.ID; using Terraria.ModLoader; @@ -18,24 +20,26 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityBuffSets { - public static SetFactory Factory = new SetFactory(BuffLoader.BuffCount, "CalamityMod/BuffID", Search); - public static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = new SetFactory(BuffLoader.BuffCount, "CalamityMod/BuffID", Search); + private static IdDictionary Search = IdDictionary.Create(); /// /// If for a buff type, then that buff will have its duration extended with The Amalgam equipped.
/// Also used to remove buffs when contacting the Whispering Maelstrom in the Get fixed boi seed.
/// Defaults to . ///
- public static bool[] BuffedByAmalgam = Factory.CreateBoolSet(BuffID.ObsidianSkin, BuffID.Regeneration, BuffID.Swiftness, BuffID.Gills, BuffID.Ironskin, BuffID.ManaRegeneration, - BuffID.MagicPower, BuffID.Featherfall, BuffID.Spelunker, BuffID.Invisibility, BuffID.Shine, BuffID.NightOwl, BuffID.Battle, BuffID.Thorns, BuffID.WaterWalking, - BuffID.Archery, BuffID.Hunter, BuffID.Gravitation, BuffID.Tipsy, BuffID.WellFed, BuffID.WellFed2, BuffID.WellFed3, BuffID.Honey, BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold, BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, - BuffID.WeaponImbuePoison, BuffID.Lucky, BuffID.Mining, BuffID.Heartreach, BuffID.Calm, BuffID.Builder, BuffID.Titan, BuffID.Flipper, BuffID.Summoning, BuffID.Dangersense, - BuffID.AmmoReservation, BuffID.Lifeforce, BuffID.Endurance, BuffID.Rage, BuffID.Inferno, BuffID.Wrath, BuffID.Lovestruck, BuffID.Stinky, BuffID.Fishing, BuffID.Sonar, - 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(), + public static bool[] BuffedByAmalgam = Factory.CreateNamedSet("BuffedByAmalgam") + .Description("Allows this buff to have its duration extended with The Amalgam equipped. Also used to remove buffs when contacting the Whispering Maelstrom in Get fixed boi.") + .RegisterBoolSet(BuffID.ObsidianSkin, BuffID.Regeneration, BuffID.Swiftness, BuffID.Gills, BuffID.Ironskin, BuffID.ManaRegeneration, BuffID.MagicPower, BuffID.Featherfall, + BuffID.Spelunker, BuffID.Invisibility, BuffID.Shine, BuffID.NightOwl, BuffID.Battle, BuffID.Thorns, BuffID.WaterWalking, BuffID.Archery, BuffID.Hunter, BuffID.Gravitation, + BuffID.Tipsy, BuffID.WellFed, BuffID.WellFed2, BuffID.WellFed3, BuffID.Honey, BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, + BuffID.WeaponImbueGold, BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffID.Lucky, BuffID.Mining, + BuffID.Heartreach, BuffID.Calm, BuffID.Builder, BuffID.Titan, BuffID.Flipper, BuffID.Summoning, BuffID.Dangersense, BuffID.AmmoReservation, BuffID.Lifeforce, BuffID.Endurance, + BuffID.Rage, BuffID.Inferno, BuffID.Wrath, BuffID.Lovestruck, BuffID.Stinky, BuffID.Fishing, BuffID.Sonar, 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()); @@ -45,83 +49,142 @@ namespace CalamityMod.Systems.Collections /// Used by The Amalgam to prevent removing their persistence when the accessory is unequipped.
/// Defaults to . ///
- 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()); + public static bool[] IsPersistentBuff = Factory.CreateNamedSet("IsPersistentBuff") + .Description("Prevents persistent buffs from having their persistence removed by The Amalgam when it is unequipped.") + .RegisterBoolSet(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()); /// /// If for a buff type, then that buff is considered to be a debuff.
- /// This general-purpose set has several different uses, including reducing buff duration with Radiance, Crown Jewel and its upgrades' debuff effects, and removing debuffs with Cleansing Jelly and its upgrades' auras.
+ /// This general-purpose set has several different uses, including Crown Jewel and its upgrades' debuff effects, and removing debuffs with Cleansing Jelly and its upgrades' auras.
/// Defaults to . ///
- public static bool[] IsDebuff = Factory.CreateBoolSet(BuffID.Poisoned, BuffID.Darkness, BuffID.Cursed, BuffID.OnFire, BuffID.Bleeding, BuffID.Confused, BuffID.Slow, BuffID.Weak, - BuffID.Silenced, BuffID.BrokenArmor, BuffID.CursedInferno, BuffID.Frostburn, BuffID.Chilled, BuffID.Frozen, BuffID.Burning, BuffID.Suffocation, BuffID.Ichor, - BuffID.Venom, BuffID.Blackout, BuffID.Electrified, BuffID.Rabies, BuffID.Webbed, BuffID.Stoned, BuffID.Dazed, BuffID.VortexDebuff, BuffID.WitheredArmor, BuffID.WitheredWeapon, BuffID.ShadowFlame, - BuffID.OgreSpit, BuffID.BetsysCurse, BuffID.Wet, BuffID.Slimed, BuffID.OnFire3, BuffID.Frostburn2, 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()); + public static bool[] IsDebuff = Factory.CreateNamedSet("IsDebuff") + .Description("General-purpose set with several different uses, including Crown Jewel line regen, removal via Cleansing Jelly line aura, etc.") + .RegisterBoolSet(BuffID.Poisoned, BuffID.Darkness, BuffID.Cursed, BuffID.OnFire, BuffID.Bleeding, BuffID.Confused, BuffID.Slow, BuffID.Weak, BuffID.Silenced, BuffID.BrokenArmor, + BuffID.CursedInferno, BuffID.Frostburn, BuffID.Chilled, BuffID.Frozen, BuffID.Burning, BuffID.Suffocation, BuffID.Ichor, BuffID.Venom, BuffID.Blackout, BuffID.Electrified, + BuffID.Rabies, BuffID.Webbed, BuffID.Stoned, BuffID.Dazed, BuffID.VortexDebuff, BuffID.WitheredArmor, BuffID.WitheredWeapon, BuffID.ShadowFlame, BuffID.OgreSpit, BuffID.BetsysCurse, + BuffID.Wet, BuffID.Slimed, BuffID.OnFire3, BuffID.Frostburn2, 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()); /// /// If for a buff type, then that buff is a whip tag buff on the player.
/// Used to prevent "whip stacking", the ability to grant the player multiple whip buff effects at once.
/// Defaults to . ///
- public static bool[] IsSummonTagBuff = Factory.CreateBoolSet(BuffID.CoolWhipPlayerBuff, BuffID.ScytheWhipPlayerBuff, BuffID.SwordWhipPlayerBuff, BuffID.ThornWhipPlayerBuff, BuffType()); + public static bool[] IsSummonTagBuff = Factory.CreateNamedSet("IsSummonTagBuff") + .Description("Whip tag buffs for the player, used to prevent whip stacking.") + .RegisterBoolSet(BuffID.CoolWhipPlayerBuff, BuffID.ScytheWhipPlayerBuff, BuffID.SwordWhipPlayerBuff, BuffID.ThornWhipPlayerBuff, BuffType()); /// /// Associates a buff type with its structure. If a buff type is not a key in this dictionary, then it has no associated .
/// Used for several different effects, such as applying tag effects to NPCs, preventing "whip stacking" on NPCs, and drawing the tag effect icon below the NPC. ///
- public static Dictionary SummonTagDebuff = new Dictionary - { - { BuffID.BlandWhipEnemyDebuff, SummonTag.LeatherWhip }, - { BuffID.BoneWhipNPCDebuff, SummonTag.SpinalTap }, - { BuffID.CoolWhipNPCDebuff, SummonTag.CoolWhip }, - { BuffID.FlameWhipEnemyDebuff, SummonTag.Firecracker }, - { BuffID.MaceWhipNPCDebuff, SummonTag.MorningStar }, - { BuffID.RainbowWhipNPCDebuff, SummonTag.Kaleidoscope }, - { BuffID.ScytheWhipEnemyDebuff, SummonTag.DarkHarvest }, - { BuffID.SwordWhipNPCDebuff, SummonTag.Durendal }, - { BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn }, - { BuffType(), ProfanedSoulCrystal.SummonTag } - }; + public static SummonTag[] SummonTagDebuff = Factory.CreateNamedSet("SummonTagDebuff") + .Description("Associates a buff type with its SummonTag structure. Used for several different effects, such as applying tag effects to NPCs, preventing whip stacking on NPCs, and drawing the tag effect icon below the NPC.") + .RegisterCustomSet(null, + BuffID.BlandWhipEnemyDebuff, SummonTag.LeatherWhip, + BuffID.BoneWhipNPCDebuff, SummonTag.SpinalTap, + BuffID.CoolWhipNPCDebuff, SummonTag.CoolWhip, + BuffID.FlameWhipEnemyDebuff, SummonTag.Firecracker, + BuffID.MaceWhipNPCDebuff, SummonTag.MorningStar, + BuffID.RainbowWhipNPCDebuff, SummonTag.Kaleidoscope, + BuffID.ScytheWhipEnemyDebuff, SummonTag.DarkHarvest, + BuffID.SwordWhipNPCDebuff, SummonTag.Durendal , + BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn, + BuffType(), Cnidarian.summonTag, + BuffType(), ForbiddenCirclet.summonTag, + BuffType(), ProfanedSoulCrystal.SummonTag, + BuffType(), VoidConcentrationStaff.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 + 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, + BuffID.OnFire, DebuffData.OnFire, + BuffID.OnFire3, DebuffData.Hellfire, + BuffID.CursedInferno, DebuffData.CursedInferno, + BuffID.ShadowFlame, DebuffData.Shadowflame, + BuffID.Daybreak, DebuffData.Daybroken, + BuffID.Burning, DebuffData.Burning, + BuffID.Frostburn, DebuffData.Frostburn, + BuffID.Frostburn2, DebuffData.Frostbite, + BuffID.Poisoned, DebuffData.Poisoned, + BuffID.Venom, DebuffData.AcidVenom, + BuffID.Electrified, DebuffData.Electrified, + BuffID.Oiled, DebuffData.Oiled, + + BuffID.Tipsy, Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + BuffType(), Alch(1), + + BuffType(), Alch(2), + BuffType(), Alch(3) + ); + public static int GetBuffIDFromAlcoholType(AlcoholType type) { - { 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 } - }; + return type switch + { + AlcoholType.BaconOil => BuffType(), + AlcoholType.BloodyMary => BuffType(), + AlcoholType.CaribbeanRum => BuffType(), + AlcoholType.CinnamonRoll => BuffType(), + AlcoholType.Everclear => BuffType(), + AlcoholType.EvergreenGin => BuffType(), + AlcoholType.Fireball => BuffType(), + AlcoholType.GrapeBeer => BuffType(), + AlcoholType.Manhattan => BuffType(), + AlcoholType.Margarita => BuffType(), + AlcoholType.Moonshine => BuffType(), + AlcoholType.MoscowMule => BuffType(), + AlcoholType.OldFashioned => BuffType(), + AlcoholType.PurpleHaze => BuffType(), + AlcoholType.RedWine => BuffType(), + AlcoholType.Rum => BuffType(), + AlcoholType.Screwdriver => BuffType(), + AlcoholType.StarBeamRye => BuffType(), + AlcoholType.Tequila => BuffType(), + AlcoholType.TequilaSunrise => BuffType(), + AlcoholType.Vodka => BuffType(), + AlcoholType.Whiskey => BuffType(), + AlcoholType.WhiteWine => BuffType(), + + // Vanilla treats both Ale and Sake as the "Tipsy" buff + AlcoholType.Ale => BuffID.Tipsy, + AlcoholType.Sake => BuffID.Tipsy, + + _ => -1 + }; + } } } diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 7cd1742e0d..529e6a3d9c 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -1,22 +1,10 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.Fishing.FishingRods; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Placeables.Furniture.BossRelics; -using CalamityMod.Items.Placeables.Furniture.Monoliths; -using CalamityMod.Items.Placeables.Furniture.Paintings; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Potions; +using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Tools; -using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.DraedonsArsenal; 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 ReLogic.Reflection; using Terraria; using Terraria.ID; @@ -28,71 +16,76 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityItemSets { - public static SetFactory Factory = new SetFactory(ItemLoader.ItemCount, "CalamityMod/ItemID", Search); - public static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = new SetFactory(ItemLoader.ItemCount, "CalamityMod/ItemID", Search); + private static IdDictionary Search = IdDictionary.Create(); /// /// If for an item type, prevents an item from removing Calamity's summon damage penalty mechanic despite having tool power.
/// Defaults to . ///
- public static bool[] WeaponWithToolPowerAffectedBySummonPenalty = Factory.CreateBoolSet(ItemID.ButchersChainsaw, ItemID.LucyTheAxe, ItemID.Rockfish, - ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] WeaponWithToolPowerAffectedBySummonPenalty = Factory.CreateNamedSet("WeaponWithToolPowerAffectedBySummonPenalty") + .Description("Makes items with tool power still trigger the summon damage penalty.") + .RegisterBoolSet(ItemID.ButchersChainsaw, ItemID.LucyTheAxe, ItemID.Rockfish, ItemType(), ItemType(), ItemType(), + ItemType(), ItemType()); /// /// If for an item type, manually disables Calamity's summon damage penalty mechanic while that item type is held.
/// Unused by Calamity itself, and is only used for external mods to add to through mod calls.
/// Defaults to . ///
- public static bool[] ItemWhichDisablesSummonerNerf = Factory.CreateBoolSet(); + public static bool[] ItemWhichDisablesSummonerNerf = Factory.CreateNamedSet("ItemWhichDisablesSummonerNerf") + .Description("Makes holding this item manually disable the summon damage penalty.") + .RegisterBoolSet(); /// /// If for an item type, holding the item sets to true, preventing fishing lines from breaking.
/// Should only be set on fishing poles.
/// Defaults to . ///
- public static bool[] FishingPoleThatNeverBreaks = Factory.CreateBoolSet(ItemID.GoldenFishingRod, ItemType(), ItemType()); - - /// - /// If for an item type, forces a dropped item of this type to remain within the bounds of the world if it is spawned outside of it.
- /// Set this for items which are dropped by enemies or bosses which spawn on the edges of the world.
- /// Defaults to . - ///
- public static bool[] ItemForcedInsideWorld = Factory.CreateBoolSet(ItemID.FishronWings, ItemID.Flairon, ItemID.Tsunami, ItemID.BubbleGun, ItemID.RazorbladeTyphoon, - ItemID.TempestStaff, ItemID.FishronBossBag, ItemID.GreaterHealingPotion, ItemID.SoulofFlight, ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] FishingPoleThatNeverBreaks = Factory.CreateNamedSet("FishingPoleThatNeverBreaks") + .Description("Makes holding this item set Player.accFishingLine, preventing fishing lines from breaking.") + .RegisterBoolSet(ItemID.GoldenFishingRod, ItemType(), ItemType()); /// /// If for an item type, prevents this rogue weapon from triggering Venerated Locket's clone projectile effect when used.
/// Primarily used for weapons which shoot short-distance projectiles.
/// Defaults to . ///
- public static bool[] DisablesVeneratedLocketEffect = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType()); + public static bool[] DisablesVeneratedLocketEffect = Factory.CreateNamedSet("DisablesVeneratedLocketEffect") + .Description("Prevents this item from triggering Venerated Locket's clone projectiles.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a magic gun.
/// Used for applying Calamity's reworked Meteor armor set bonus.
/// Defaults to . ///
- public static bool[] MagicGun = Factory.CreateBoolSet(ItemID.BeeGun, ItemID.BubbleGun, ItemID.ChargedBlasterCannon, ItemID.HeatRay, ItemID.LaserMachinegun, ItemID.LaserRifle, - ItemID.LeafBlower, ItemID.RainbowGun, ItemID.SpaceGun, ItemID.WaspGun, ItemID.ZapinatorGray, ItemID.ZapinatorOrange, ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] MagicGun = Factory.CreateNamedSet("MagicGun") + .Description("Labels this item as a magic gun, for Meteor armor's set bonus.") + .RegisterBoolSet(ItemID.BeeGun, ItemID.BubbleGun, ItemID.ChargedBlasterCannon, ItemID.HeatRay, ItemID.LaserMachinegun, ItemID.LaserRifle, ItemID.LeafBlower, ItemID.RainbowGun, + ItemID.SpaceGun, ItemID.WaspGun, ItemID.ZapinatorGray, ItemID.ZapinatorOrange, ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + + /// + /// If for an item type, this item is guaranteed to critically strike and converts critical strike chance boosts into extra damage.
+ /// Used to replace the item's critical strike chance tooltip line with one about critical damage.
+ /// Defaults to . + ///
+ public static bool[] ShowScalingCritDamageTooltip = Factory.CreateNamedSet("ShowScalingCritDamageTooltip") + .Description("Replaces the item's critical strike chance tooltip line with a line about critical damage.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue bomb.
/// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBomb = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + public static bool[] RogueBomb = Factory.CreateNamedSet("RogueBomb") + .Description("Labels this item as a rogue bomb, only exists for objective classification.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); @@ -101,8 +94,10 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + public static bool[] RogueBoomerang = Factory.CreateNamedSet("RogueBoomerang") + .Description("Labels this item as a rogue boomerang, only exists for objective classification.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); @@ -111,9 +106,11 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueDagger = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + public static bool[] RogueDagger = Factory.CreateNamedSet("RogueDagger") + .Description("Labels this item as a rogue dagger, only exists for objective classification.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); @@ -123,22 +120,19 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . /// - public static bool[] RogueJavelin = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType()); + public static bool[] RogueJavelin = Factory.CreateNamedSet("RogueJavelin") + .Description("Labels this item as a rogue javelin, only exists for objective classification.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue spiky ball.
/// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueSpikyBall = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType()); - - public static bool[] ShowScalingCritDamageTooltip = Factory - .CreateNamedSet("ShowScalingCritDamageTooltip") - .Description("Replaces Crit Chance tooltip line with Crit Damage, getting 2% crit dmg per 1% crit chance") - .RegisterBoolSet(); + public static bool[] RogueSpikyBall = Factory.CreateNamedSet("RogueSpikyBall") + .Description("Labels this item as a rogue spiky ball, only exists for objective classification.") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); } } diff --git a/Systems/Collections/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs index b6d5a71376..502d723b75 100644 --- a/Systems/Collections/CalamityNPCSets.cs +++ b/Systems/Collections/CalamityNPCSets.cs @@ -48,95 +48,103 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityNPCSets { - public static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCID", Search); - public static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCID", Search); + private static IdDictionary Search = IdDictionary.Create(); /// /// If for an NPC type, makes this NPC be susceptible to .
/// Defaults to . ///
- public static bool[] CalamityNPCNotImmuneToConfused = Factory.CreateBoolSet(NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType()); + public static bool[] CalamityNPCNotImmuneToConfused = Factory.CreateNamedSet("CalamityNPCNotImmuneToConfused") + .Description("Makes this NPC be susceptible to Confused.") + .RegisterBoolSet(NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType()); /// /// If for an NPC type, forces this NPC to draw Calamity's debuff display, even if it is not a boss.
/// Defaults to . ///
- public static bool[] ForceDrawDebuffDisplay = Factory.CreateBoolSet(NPCID.TargetDummy, NPCID.WallofFleshEye, NPCType()); + public static bool[] ForceDrawDebuffDisplay = Factory.CreateNamedSet("ForceDrawDebuffDisplay") + .Description("Allows drawing Calamity's debuff display, even if not a boss.") + .RegisterBoolSet(NPCID.TargetDummy, NPCID.WallofFleshEye, NPCType()); + + /// + /// If for an NPC type, then that NPC is a bound Town NPC.
+ /// Used to make them immune to enemy damage.
+ /// Defaults to . + ///
+ public static bool[] BoundTownNPC = Factory.CreateNamedSet("BoundTownNPC") + .Description("Labels this NPC as a bound town NPC, to prevent them from taking hostile damage.") + .RegisterBoolSet(NPCID.BoundGoblin, NPCID.BoundWizard, NPCID.BoundMechanic, NPCID.SleepingAngler, NPCID.BartenderUnconscious, NPCID.WebbedStylist, NPCID.GolferRescue); /// /// If for an NPC type, then that NPC will not provide increased Rage generation despite being considered a boss.
/// Primarily used by worm boss body and tail segments to prevent Rage being extraordinarily easy to get.
/// Defaults to . ///
- public static bool[] BossSegmentThatDoesNotGenerateRageFaster = Factory.CreateBoolSet(NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType()); + public static bool[] BossSegmentThatDoesNotGenerateRageFaster = Factory.CreateNamedSet("BossSegmentThatDoesNotGenerateRageFaster") + .Description("Prevent this boss NPC from generating Rage faster.") + .RegisterBoolSet(NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType()); /// /// If for an NPC type, allows the NPC to scale its health based on the Boss Health Boost Percentage config option, even if it is not a boss.
/// Also allows the NPC to receive health scaling from having multiple players in Expert+.
/// Defaults to . ///
- public static bool[] ScalesHealthLikeBoss = Factory.CreateBoolSet(NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.SkeletronHand, - NPCID.WallofFleshEye, NPCID.TheDestroyerBody, NPCID.TheDestroyerTail, NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.PrimeSaw, NPCID.GolemHead, - NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.Sharkron, NPCID.Sharkron2, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType()); + public static bool[] ScalesHealthLikeBoss = Factory.CreateNamedSet("ScalesHealthLikeBoss") + .Description("Allows scaling health from vanilla Expert+ multiplayer scaling and Boss Health Boost Percentage config, even if not a boss.") + .RegisterBoolSet(NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.SkeletronHand, NPCID.WallofFleshEye, NPCID.TheDestroyerBody, NPCID.TheDestroyerTail, + NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.PrimeSaw, NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.Sharkron, + NPCID.Sharkron2, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType()); /// /// 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.CreateNamedSet("DealsZeroContactDamage") + .Description("Makes this NPC deal 0 contact damage.") + .RegisterBoolSet(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.
/// Defaults to . ///
- public static bool[] NerfDamageInHardmode = Factory.CreateBoolSet(NPCID.AnglerFish, NPCID.AngryTrapper, NPCID.Arapaima, NPCID.BlackRecluse, NPCID.BlackRecluseWall, - NPCID.BloodJelly, NPCID.FungoFish, NPCID.GreenJellyfish, NPCID.Clinger, NPCID.ArmoredSkeleton, NPCID.ArmoredViking, NPCID.Mummy, NPCID.DarkMummy, NPCID.LightMummy, - NPCID.BloodFeeder, NPCID.DesertBeast, NPCID.ChaosElemental, NPCID.BloodMummy, NPCID.CorruptSlime, NPCID.Corruptor, NPCID.Crimslime, NPCID.CrimsonAxe, NPCID.CursedHammer, - NPCID.Derpling, NPCID.Herpling, NPCID.DiggerHead, NPCID.DesertGhoul, NPCID.DesertGhoulCorruption, NPCID.DesertGhoulCrimson, NPCID.DesertGhoulHallow, NPCID.DuneSplicerHead, - NPCID.EnchantedSword, NPCID.FloatyGross, NPCID.GiantBat, NPCID.GiantFlyingFox, NPCID.FungiSpore, NPCID.GiantTortoise, NPCID.IceTortoise, NPCID.HoppinJack, NPCID.Mimic, - NPCID.IlluminantBat, NPCID.IlluminantSlime, NPCID.JungleCreeper, NPCID.JungleCreeperWall, NPCID.DesertLamiaDark, NPCID.DesertLamiaLight, NPCID.MossHornet, NPCID.Moth, - NPCID.PigronCorruption, NPCID.PigronCrimson, NPCID.PigronHallow, NPCID.Pixie, NPCID.PossessedArmor, NPCID.RockGolem, NPCID.DesertScorpionWalk, NPCID.DesertScorpionWall, - NPCID.Slimer, NPCID.ToxicSludge, NPCID.Unicorn, NPCID.WanderingEye, NPCID.Werewolf, NPCID.Wolf, NPCID.SeekerHead, NPCID.Wraith, NPCID.ChatteringTeethBomb, NPCID.IceGolem, - NPCID.RainbowSlime, NPCID.SandShark, NPCID.SandsharkCorrupt, NPCID.SandsharkCrimson, NPCID.SandsharkHallow, NPCID.ShadowFlameApparition, NPCID.Parrot, NPCID.PirateCorsair, - NPCID.PirateDeckhand, NPCID.PirateGhost, NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBonesSword, NPCID.BoneLee, NPCID.DungeonSpirit, NPCID.FlyingSnake, NPCID.HellArmoredBones, - NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBonesSword, NPCID.MisterStabby, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.DeadlySphere, NPCID.Frankenstein, - NPCID.Fritz, NPCID.Psycho, NPCID.Reaper, NPCID.SwampThing, NPCID.ThePossessed, NPCID.Vampire, NPCID.VampireBat, NPCID.HeadlessHorseman, NPCID.Hellhound, NPCID.Poltergeist, - NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, - NPCID.Splinterling, NPCID.Flocko, NPCID.GingerbreadMan, NPCID.Krampus, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.PresentMimic, NPCID.Yeti, NPCID.ZombieElf, NPCID.ZombieElfBeard, + public static bool[] NerfDamageInHardmode = Factory.CreateNamedSet("NerfDamageInHardmode") + .Description("Makes this NPC have its contact damage reduced by 25% if the world is in Hardmode.") + .RegisterBoolSet(NPCID.AnglerFish, NPCID.AngryTrapper, NPCID.Arapaima, NPCID.BlackRecluse, NPCID.BlackRecluseWall, NPCID.BloodJelly, NPCID.FungoFish, NPCID.GreenJellyfish, + NPCID.Clinger, NPCID.ArmoredSkeleton, NPCID.ArmoredViking, NPCID.Mummy, NPCID.DarkMummy, NPCID.LightMummy, NPCID.BloodFeeder, NPCID.DesertBeast, NPCID.ChaosElemental, + NPCID.BloodMummy, NPCID.CorruptSlime, NPCID.Corruptor, NPCID.Crimslime, NPCID.CrimsonAxe, NPCID.CursedHammer, NPCID.Derpling, NPCID.Herpling, NPCID.DiggerHead, + NPCID.DesertGhoul, NPCID.DesertGhoulCorruption, NPCID.DesertGhoulCrimson, NPCID.DesertGhoulHallow, NPCID.DuneSplicerHead, NPCID.EnchantedSword, NPCID.FloatyGross, + NPCID.GiantBat, NPCID.GiantFlyingFox, NPCID.FungiSpore, NPCID.GiantTortoise, NPCID.IceTortoise, NPCID.HoppinJack, NPCID.Mimic, NPCID.IlluminantBat, NPCID.IlluminantSlime, + NPCID.JungleCreeper, NPCID.JungleCreeperWall, NPCID.DesertLamiaDark, NPCID.DesertLamiaLight, NPCID.MossHornet, NPCID.Moth, NPCID.PigronCorruption, NPCID.PigronCrimson, + NPCID.PigronHallow, NPCID.Pixie, NPCID.PossessedArmor, NPCID.RockGolem, NPCID.DesertScorpionWalk, NPCID.DesertScorpionWall, NPCID.Slimer, NPCID.ToxicSludge, NPCID.Unicorn, + NPCID.WanderingEye, NPCID.Werewolf, NPCID.Wolf, NPCID.SeekerHead, NPCID.Wraith, NPCID.ChatteringTeethBomb, NPCID.IceGolem, NPCID.RainbowSlime, NPCID.SandShark, + NPCID.SandsharkCorrupt, NPCID.SandsharkCrimson, NPCID.SandsharkHallow, NPCID.ShadowFlameApparition, NPCID.Parrot, NPCID.PirateCorsair, NPCID.PirateDeckhand, NPCID.PirateGhost, + NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBonesSword, NPCID.BoneLee, NPCID.DungeonSpirit, NPCID.FlyingSnake, NPCID.HellArmoredBones, NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBonesSword, NPCID.MisterStabby, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.DeadlySphere, NPCID.Frankenstein, NPCID.Fritz, NPCID.Psycho, NPCID.Reaper, + NPCID.SwampThing, NPCID.ThePossessed, NPCID.Vampire, NPCID.VampireBat, NPCID.HeadlessHorseman, NPCID.Hellhound, NPCID.Poltergeist, NPCID.Scarecrow1, NPCID.Scarecrow2, + NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, NPCID.Splinterling, + NPCID.Flocko, NPCID.GingerbreadMan, NPCID.Krampus, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.PresentMimic, NPCID.Yeti, NPCID.ZombieElf, NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.BloodEelHead, NPCID.GoblinShark, NPCID.EyeballFlyingFish, NPCID.ZombieMerman); /// @@ -145,52 +153,59 @@ namespace CalamityMod.Systems.Collections /// Second, it multiplies their max health by 2.5x and increases their damage by a flat 30 if Moon Lord has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedDungeonEnemy = Factory.CreateBoolSet(NPCID.SkeletonSniper, NPCID.TacticalSkeleton, NPCID.SkeletonCommando, NPCID.Paladin, NPCID.GiantCursedSkull, - NPCID.BoneLee, NPCID.DiabolistWhite, NPCID.DiabolistRed, NPCID.NecromancerArmored, NPCID.Necromancer, NPCID.RaggedCasterOpenCoat, NPCID.RaggedCaster, - NPCID.HellArmoredBonesSword, NPCID.HellArmoredBonesMace, NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBones, NPCID.BlueArmoredBonesSword, NPCID.BlueArmoredBonesNoPants, - NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBones, NPCID.RustyArmoredBonesSwordNoArmor, NPCID.RustyArmoredBonesSword, NPCID.RustyArmoredBonesFlail, NPCID.RustyArmoredBonesAxe); + public static bool[] IsBuffedDungeonEnemy = Factory.CreateNamedSet("IsBuffedDungeonEnemy") + .Description("Makes this NPC directly drop Ectoplasm on death, and buffs its health and damage after defeating Moon Lord.") + .RegisterBoolSet(NPCID.SkeletonSniper, NPCID.TacticalSkeleton, NPCID.SkeletonCommando, NPCID.Paladin, NPCID.GiantCursedSkull, NPCID.BoneLee, NPCID.DiabolistWhite, + NPCID.DiabolistRed, NPCID.NecromancerArmored, NPCID.Necromancer, NPCID.RaggedCasterOpenCoat, NPCID.RaggedCaster, NPCID.HellArmoredBonesSword, NPCID.HellArmoredBonesMace, + NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBones, NPCID.BlueArmoredBonesSword, NPCID.BlueArmoredBonesNoPants, NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBones, + NPCID.RustyArmoredBonesSwordNoArmor, NPCID.RustyArmoredBonesSword, NPCID.RustyArmoredBonesFlail, NPCID.RustyArmoredBonesAxe); /// /// If for an NPC type, then that NPC is spawned in the Pumpkin Moon.
/// This will multiply their max health by 3.5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedPumpkinMoonEnemy = Factory.CreateBoolSet(NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, - NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, NPCID.HeadlessHorseman, NPCID.MourningWood, NPCID.Splinterling, NPCID.Pumpking, - NPCID.PumpkingBlade, NPCID.Hellhound, NPCID.Poltergeist); + public static bool[] IsBuffedPumpkinMoonEnemy = Factory.CreateNamedSet("IsBuffedPumpkinMoonEnemy") + .Description("Makes this Pumpkin Moon enemy have buffed health and damage after defeating Devourer of Gods.") + .RegisterBoolSet(NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, + NPCID.Scarecrow10, NPCID.HeadlessHorseman, NPCID.MourningWood, NPCID.Splinterling, NPCID.Pumpking, NPCID.PumpkingBlade, NPCID.Hellhound, NPCID.Poltergeist); /// /// If for an NPC type, then that NPC is spawned in the Frost Moon.
/// This will multiply their max health by 2.5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedFrostMoonEnemy = Factory.CreateBoolSet(NPCID.ZombieElf, NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.PresentMimic, NPCID.GingerbreadMan, - NPCID.Yeti, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.ElfCopter, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.ElfArcher, NPCID.Krampus, NPCID.Flocko); + public static bool[] IsBuffedFrostMoonEnemy = Factory.CreateNamedSet("IsBuffedFrostMoonEnemy") + .Description("Makes this Frost Moon enemy have buffed health and damage after defeating Devourer of Gods.") + .RegisterBoolSet(NPCID.ZombieElf, NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.PresentMimic, NPCID.GingerbreadMan, NPCID.Yeti, NPCID.Everscream, NPCID.IceQueen, + NPCID.SantaNK1, NPCID.ElfCopter, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.ElfArcher, NPCID.Krampus, NPCID.Flocko); /// /// If for an NPC type, then that NPC is spawned in the Solar Eclipse.
/// This will multiply their max health by 5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedSolarEclipseEnemy = Factory.CreateBoolSet(NPCID.Eyezor, NPCID.Reaper, NPCID.Frankenstein, NPCID.SwampThing, NPCID.Vampire, NPCID.VampireBat, - NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.Fritz, NPCID.Nailhead, NPCID.Psycho, NPCID.DeadlySphere, NPCID.DrManFly, NPCID.ThePossessed, NPCID.Mothron, - NPCID.MothronEgg, NPCID.MothronSpawn); + public static bool[] IsBuffedSolarEclipseEnemy = Factory.CreateNamedSet("IsBuffedSolarEclipseEnemy") + .Description("Makes this Solar Eclipse enemy have buffed health and damage after defeating Devourer of Gods.") + .RegisterBoolSet(NPCID.Eyezor, NPCID.Reaper, NPCID.Frankenstein, NPCID.SwampThing, NPCID.Vampire, NPCID.VampireBat, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.Fritz, + NPCID.Nailhead, NPCID.Psycho, NPCID.DeadlySphere, NPCID.DrManFly, NPCID.ThePossessed, NPCID.Mothron, NPCID.MothronEgg, NPCID.MothronSpawn); /// /// If for an NPC type, then the NPC will not be affected by slowing debuffs.
/// Also used to prevent weapon pulling effects and Anarchy Blade's ability to instantly kill enemies that are below 50% health.
/// Defaults to . ///
- public static bool[] ImmuneToSlowsAndOtherSpecialEffects = Factory.CreateBoolSet(NPCID.KingSlime, NPCType(), - NPCID.EyeofCthulhu, NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, - NPCID.QueenBee, NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, NPCID.PirateShipCannon, NPCID.QueenSlimeBoss, - NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.Plantera, - NPCID.PlanterasTentacle, NPCType(), NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, NPCID.MourningWood, NPCID.Pumpking, NPCID.Mothron, - NPCID.Golem, NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.MartianSaucerCore, NPCID.MartianSaucerCannon, NPCID.MartianSaucerTurret, - NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, NPCID.HallowBoss, NPCID.CultistBoss, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, NPCID.CultistDragonBody4, NPCID.CultistDragonTail, NPCID.AncientCultistSquidhead, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, NPCID.DD2WyvernT1, NPCID.DD2WyvernT2, NPCID.DD2WyvernT3, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2SkeletonT1, NPCID.DD2SkeletonT3, - NPCID.DD2WitherBeastT2, NPCID.DD2WitherBeastT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2KoboldFlyerT2, + public static bool[] ImmuneToSlowsAndOtherSpecialEffects = Factory.CreateNamedSet("ImmuneToSlowsAndOtherSpecialEffects") + .Description("Makes this NPC immune to slowing debuffs and specific weapon effects.") + .RegisterBoolSet(NPCID.KingSlime, NPCType(), NPCID.EyeofCthulhu, NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, + NPCID.BrainofCthulhu, NPCID.Creeper, NPCID.QueenBee, NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, + NPCID.PirateShipCannon, NPCID.QueenSlimeBoss, NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeLaser, + NPCID.PrimeVice, NPCID.Plantera, NPCID.PlanterasTentacle, NPCType(), NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, NPCID.MourningWood, + NPCID.Pumpking, NPCID.Mothron, NPCID.Golem, NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.MartianSaucerCore, NPCID.MartianSaucerCannon, + NPCID.MartianSaucerTurret, NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, NPCID.HallowBoss, NPCID.CultistBoss, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, NPCID.CultistDragonBody3, NPCID.CultistDragonBody4, NPCID.CultistDragonTail, NPCID.AncientCultistSquidhead, NPCID.MoonLordHead, NPCID.MoonLordHand, + NPCID.MoonLordCore, NPCID.MoonLordFreeEye, NPCID.DD2WyvernT1, NPCID.DD2WyvernT2, NPCID.DD2WyvernT3, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2SkeletonT1, + NPCID.DD2SkeletonT3, NPCID.DD2WitherBeastT2, NPCID.DD2WitherBeastT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2KoboldFlyerT2, NPCID.DD2KoboldFlyerT3, NPCID.DD2OgreT2, NPCID.DD2OgreT3, NPCID.DD2Betsy, NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), @@ -206,13 +221,17 @@ namespace CalamityMod.Systems.Collections /// /// If for an NPC type, or will be called on this NPC even if is set. /// - public static bool[] DoCheckDeadRegardlessRealLife = Factory.CreateBoolSet(NPCType(), NPCType()); + public static bool[] DoCheckDeadRegardlessRealLife = Factory.CreateNamedSet("DoCheckDeadRegardlessRealLife") + .Description("Makes this NPC always call CheckDead, even if it sets realLife.") + .RegisterBoolSet(NPCType(), NPCType()); /// /// If for an NPC type, will not count this NPC as an enemy.
/// Defaults to . ///
- public static bool[] DontCountAsEnemy = Factory.CreateBoolSet(NPCID.TargetDummy, NPCType()); + public static bool[] DontCountAsEnemy = Factory.CreateNamedSet("DontCountAsEnemy") + .Description("Prevents Calamity's IsAnEnemy method from considering this NPC an enemy.") + .RegisterBoolSet(NPCID.TargetDummy, NPCType()); /// /// Associates an NPC type with the base value of their max health in Boss Rush.
diff --git a/Systems/Collections/CalamityNPCTypeSets.cs b/Systems/Collections/CalamityNPCTypeSets.cs index 3985e71ee1..5d8e4a555b 100644 --- a/Systems/Collections/CalamityNPCTypeSets.cs +++ b/Systems/Collections/CalamityNPCTypeSets.cs @@ -20,23 +20,20 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityNPCTypeSets { - public static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCType", Search); - public static IdDictionary Search = IdDictionary.Create(); - - public static bool[] AngryBones = Factory.CreateBoolSet(NPCID.AngryBones, NPCID.AngryBonesBig, NPCID.AngryBonesBigMuscle, NPCID.AngryBonesBigHelmet); - - public static bool[] BoundTownNPC = Factory.CreateBoolSet(NPCID.BoundGoblin, NPCID.BoundWizard, NPCID.BoundMechanic, NPCID.SleepingAngler, NPCID.BartenderUnconscious, - NPCID.WebbedStylist, NPCID.GolferRescue); - - public static bool[] Hornet = Factory.CreateBoolSet(NPCID.Hornet, NPCID.HornetFatty, NPCID.HornetHoney, NPCID.HornetLeafy, NPCID.HornetSpikey, NPCID.HornetStingy); + private static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCType", Search); + private static IdDictionary Search = IdDictionary.Create(); // Used for dropping Ancient Bone Dust, vanilla has a Skeleton NPCID set which has more unwanted enemies in it - public static bool[] Skeleton = Factory.CreateBoolSet(NPCID.Skeleton, NPCID.HeadacheSkeleton, NPCID.MisassembledSkeleton, NPCID.PantlessSkeleton, NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, NPCID.BoneThrowingSkeleton3, NPCID.BoneThrowingSkeleton4, NPCID.SkeletonTopHat, NPCID.SkeletonAstonaut, NPCID.SkeletonAlien, - NPCID.ArmoredSkeleton, NPCID.SkeletonArcher, NPCID.GreekSkeleton, NPCID.SporeSkeleton); + public static bool[] Skeleton = Factory.CreateNamedSet("Skeleton") + .Description("Contains different IDs from vanilla's Skeleton set. Used for dropping Ancient Bone Dust.") + .RegisterBoolSet(NPCID.Skeleton, NPCID.HeadacheSkeleton, NPCID.MisassembledSkeleton, NPCID.PantlessSkeleton, NPCID.BoneThrowingSkeleton, NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, NPCID.BoneThrowingSkeleton4, NPCID.SkeletonTopHat, NPCID.SkeletonAstonaut, NPCID.SkeletonAlien, NPCID.ArmoredSkeleton, NPCID.SkeletonArcher, + NPCID.GreekSkeleton, NPCID.SporeSkeleton); // Unused, though is more restrictive than the vanilla Zombie NPCID set - public static bool[] Zombie = Factory.CreateBoolSet(NPCID.Zombie, NPCID.ArmedZombie, NPCID.BaldZombie, NPCID.PincushionZombie, NPCID.ArmedZombiePincussion, NPCID.SlimedZombie, + public static bool[] Zombie = Factory.CreateNamedSet("Zombie") + .Description("Contains different IDs from vanilla's Zombie set. Unused.") + .RegisterBoolSet(NPCID.Zombie, NPCID.ArmedZombie, NPCID.BaldZombie, NPCID.PincushionZombie, NPCID.ArmedZombiePincussion, NPCID.SlimedZombie, NPCID.ArmedZombieSlimed, NPCID.SwampZombie, NPCID.ArmedZombieSwamp, NPCID.TwiggyZombie, NPCID.ArmedZombieTwiggy, NPCID.FemaleZombie, NPCID.ArmedZombieCenx, NPCID.ZombieRaincoat, NPCID.ZombieEskimo, NPCID.ArmedZombieEskimo, NPCID.MaggotZombie, NPCType()); diff --git a/Systems/Collections/CalamityProjectileSets.cs b/Systems/Collections/CalamityProjectileSets.cs index 7d2b6166a1..76747a373c 100644 --- a/Systems/Collections/CalamityProjectileSets.cs +++ b/Systems/Collections/CalamityProjectileSets.cs @@ -14,40 +14,47 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityProjectileSets { - public static SetFactory Factory = new SetFactory(ProjectileLoader.ProjectileCount, "CalamityMod/ProjectileID", Search); - public static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = new SetFactory(ProjectileLoader.ProjectileCount, "CalamityMod/ProjectileID", Search); + private static IdDictionary Search = IdDictionary.Create(); /// /// If for a projectile type, then that minion will completely ignore Calamity's summon damage penalty mechanic with no exceptions.
/// Unused by Calamity itself, and is only used for external mods to add to through mod calls.
/// Defaults to . ///
- public static bool[] MinionWhichIgnoresSummonerNerf = Factory.CreateBoolSet(); + public static bool[] MinionWhichIgnoresSummonerNerf = Factory.CreateNamedSet("MinionWhichIgnoresSummonerNerf") + .Description("Makes this minion ignore the summon damage penalty.") + .RegisterBoolSet(); /// /// If for a projectile type, then that projectile is spawned by a post-Plantera Dungeon enemy.
/// This increases the projectile's damage by a flat 30 if Moon Lord has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedDungeonProjectile = Factory.CreateBoolSet(ProjectileID.PaladinsHammerHostile, ProjectileID.ShadowBeamHostile, ProjectileID.InfernoHostileBolt, - ProjectileID.InfernoHostileBlast, ProjectileID.LostSoulHostile, ProjectileID.SniperBullet, ProjectileID.RocketSkeleton, ProjectileID.BulletDeadeye, ProjectileID.Shadowflames); + public static bool[] IsBuffedDungeonProjectile = Factory.CreateNamedSet("IsBuffedDungeonProjectile") + .Description("Makes this Dungeon projectile get a damage buff after defeating Moon Lord.") + .RegisterBoolSet(ProjectileID.PaladinsHammerHostile, ProjectileID.ShadowBeamHostile, ProjectileID.InfernoHostileBolt, ProjectileID.InfernoHostileBlast, + ProjectileID.LostSoulHostile, ProjectileID.SniperBullet, ProjectileID.RocketSkeleton, ProjectileID.BulletDeadeye, ProjectileID.Shadowflames); /// /// If for a projectile type, then that projectile is spawned by a Solar Eclipse, Pumpkin Moon, or Frost Moon enemy.
/// This increases the projectile's damage by a flat 15 during those events if Devourer of Gods has been defeated.
/// Defaults to . ///
- public static bool[] IsBuffedEventProjectile = Factory.CreateBoolSet(ProjectileID.FlamingWood, ProjectileID.GreekFire1, ProjectileID.GreekFire2, ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, ProjectileID.FlamingArrow, ProjectileID.PineNeedleHostile, ProjectileID.OrnamentHostile, ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, ProjectileID.FrostShard, ProjectileID.Missile, ProjectileID.Present, ProjectileID.Spike, ProjectileID.BulletDeadeye, ProjectileID.EyeLaser, - ProjectileID.Nail, ProjectileID.DrManFlyFlask); + public static bool[] IsBuffedEventProjectile = Factory.CreateNamedSet("IsBuffedEventProjectile") + .Description("Makes this Pumpkin Moon, Frost Moon, or Solar Eclipse projectile get a damage buff after defeating Devourer of Gods.") + .RegisterBoolSet(ProjectileID.FlamingWood, ProjectileID.GreekFire1, ProjectileID.GreekFire2, ProjectileID.GreekFire3, ProjectileID.FlamingScythe, ProjectileID.FlamingArrow, + ProjectileID.PineNeedleHostile, ProjectileID.OrnamentHostile, ProjectileID.OrnamentHostileShrapnel, ProjectileID.FrostWave, ProjectileID.FrostShard, ProjectileID.Missile, + ProjectileID.Present, ProjectileID.Spike, ProjectileID.BulletDeadeye, ProjectileID.EyeLaser, ProjectileID.Nail, ProjectileID.DrManFlyFlask); /// /// If for a projectile type, then that projectile is considered a friendly bee.
/// Used to allow the projectile to inflict Plague while wearing the Plaguebringer armor.
/// Defaults to . ///
- public static bool[] IsFriendlyBeeProjectile = Factory.CreateBoolSet(ProjectileID.GiantBee, ProjectileID.Bee, ProjectileID.Wasp, ProjectileID.Hornet,ProjectileID.HornetStinger, ProjectileType(), + public static bool[] IsFriendlyBeeProjectile = Factory.CreateNamedSet("IsFriendlyBeeProjectile") + .Description("Labels this projectile as a friendly bee, used to make it inflict Plague with Plaguebringer armor.") + .RegisterBoolSet(ProjectileID.GiantBee, ProjectileID.Bee, ProjectileID.Wasp, ProjectileID.Hornet,ProjectileID.HornetStinger, ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType()); /// @@ -55,9 +62,11 @@ namespace CalamityMod.Systems.Collections /// Used to provide early-game worm bosses a resistance to their explosive damage.
/// Defaults to . ///
- public static bool[] ResistedExplosiveProjectile = Factory.CreateBoolSet(ProjectileID.Grenade, ProjectileID.StickyGrenade, ProjectileID.BouncyGrenade, ProjectileID.Bomb, - ProjectileID.StickyBomb, ProjectileID.BouncyBomb, ProjectileID.Dynamite, ProjectileID.StickyDynamite, ProjectileID.BouncyDynamite, ProjectileID.Explosives, - ProjectileID.ExplosiveBunny, ProjectileID.PartyGirlGrenade, ProjectileID.BombFish, ProjectileID.ScarabBomb, ProjectileID.TNTBarrel, ProjectileType()); + public static bool[] ResistedExplosiveProjectile = Factory.CreateNamedSet("ResistedExplosiveProjectile") + .Description("Makes this grenade/bomb/dynamite projectile be resisted by earlygame worm bosses.") + .RegisterBoolSet(ProjectileID.Grenade, ProjectileID.StickyGrenade, ProjectileID.BouncyGrenade, ProjectileID.Bomb, ProjectileID.StickyBomb, ProjectileID.BouncyBomb, + ProjectileID.Dynamite, ProjectileID.StickyDynamite, ProjectileID.BouncyDynamite, ProjectileID.Explosives, ProjectileID.ExplosiveBunny, ProjectileID.PartyGirlGrenade, + ProjectileID.BombFish, ProjectileID.ScarabBomb, ProjectileID.TNTBarrel, ProjectileType()); /// /// If for a projectile type, then that projectile will never be reflected by armor or accessory effects.
@@ -65,24 +74,37 @@ namespace CalamityMod.Systems.Collections /// Only needs to be set for hostile projectiles, as these effects already have a check to ensure they never trigger in PvP.
/// Defaults to . ///
- public static bool[] ShouldNotBeReflected = Factory.CreateBoolSet(ProjectileID.SaucerDeathray, ProjectileID.PhantasmalDeathray, ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType()); + public static bool[] ShouldNotBeReflected = Factory.CreateNamedSet("ShouldNotBeReflected") + .Description("Prevents this projectile from being reflected by armor or accessory effects.") + .RegisterBoolSet(ProjectileID.SaucerDeathray, ProjectileID.PhantasmalDeathray, ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType()); /// /// If for a projectile type, then that projectile will be blacklisted from receiving the homing effect of Grape Beer.
/// Defaults to . ///
- public static bool[] DoesNotGetHomingWithGrapeBeer = Factory.CreateBoolSet(ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType()); + public static bool[] DoesNotGetHomingWithGrapeBeer = Factory.CreateNamedSet("DoesNotGetHomingWithGrapeBeer") + .Description("Prevents this projectile from receiving homing from Grape Beer.") + .RegisterBoolSet(ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType()); + + /// + /// If for a projectile type, then that projectile will be unable to trigger Daawnlight Spirit Origin's bullseyes.
+ /// Defaults to . + ///
+ public static bool[] DaawnlightBlacklist = Factory.CreateNamedSet("DaawnlightBlacklist") + .Description("Prevents this projectile from triggering Daawnlight Spirit Origin's bullseyes.") + .RegisterBoolSet(ProjectileType(), ProjectileType(), ProjectileType()); /// /// Determines what other projectiles this projectile will share ID-static immunity frames with. Defaults to -1, which means that it does not share immunity frames.
/// Each "set" of projectile which shares immunity frames is registered to point to the same ID reference, usually the first projectile in the set. If a projectile with this reference hits an NPC, all other projectiles with that reference also have their ID-static immunity cooldown set for that NPC. ///
- public static int[] SharedIDStaticIFrames = Factory.CreateIntSet(-1, + public static int[] SharedIDStaticIFrames = Factory.CreateNamedSet("SharedIDStaticIFrames") + .Description("Determines what other projectiles this projectile will share ID-static immunity frames with. Defaults to -1, which means that it does not share immunity frames.") + .RegisterIntSet(-1, // Vanilla bees ProjectileID.Bee, ProjectileID.Bee, ProjectileID.GiantBee, ProjectileID.Bee, diff --git a/Systems/Collections/CalamityTileSets.cs b/Systems/Collections/CalamityTileSets.cs index 2000210565..45d1e37afc 100644 --- a/Systems/Collections/CalamityTileSets.cs +++ b/Systems/Collections/CalamityTileSets.cs @@ -11,26 +11,34 @@ namespace CalamityMod.Systems.Collections [ReinitializeDuringResizeArrays] public static class CalamityTileSets { - public static SetFactory Factory = new SetFactory(TileLoader.TileCount, "CalamityMod/TileID", Search); - public static IdDictionary Search = IdDictionary.Create(); + private static SetFactory Factory = new SetFactory(TileLoader.TileCount, "CalamityMod/TileID", Search); + private static IdDictionary Search = IdDictionary.Create(); /// /// Should only contain modded tiles. If for a tile type, then that tile can be replaced by the Abyss during world generation.
- /// Unused by Calamity itself, and is only used for external mods to add to through reflection.
+ /// Unused by Calamity itself, and is only used for external mods.
/// Defaults to . ///
- public static bool[] CanBeReplacedByAbyssGeneration = Factory.CreateBoolSet(); + internal static bool[] CanBeReplacedByAbyssGeneration = Factory.CreateNamedSet("CanBeReplacedByAbyssGeneration") + .Description("Allows the tile to be replaced by the Abyss during world generation.") + .RegisterBoolSet(); /// /// If for a tile type, it will not perform its BlendMerge in the PostDraw hook, and instead will be drawn after every solid tile has been drawn to the screen.
/// Defaults to . ///
- public static bool[] DrawBlendMergeAfterSolidTile = Factory.CreateBoolSet(TileType()); + internal static bool[] DrawBlendMergeAfterSolidTile = Factory.CreateNamedSet("DrawBlendMergeAfterSolidTile") + .Description("Causes this tile to have blending be drawn after all solid tiles.") + .RegisterBoolSet(TileType()); /// - /// If for a tile type, it will be considered an Abyss background wall for various effects. - /// Defaults to + /// If for a tile type, it will be considered an Abyss background wall.
+ /// Used for spawning water when breaking Abyss tiles, discouraging Teleportation Potion teleporting, and spawning Primordial Wyrm when using Potion of Return.
+ /// Defaults to . ///
- public static bool[] IsAbyssWall = Factory.CreateBoolSet(WallType(), WallType(), WallType(), WallType(), WallType(), WallType()); + internal static bool[] IsAbyssWall = Factory.CreateNamedSet("IsAbyssWall") + .Description("Labels this wall as an Abyss wall.") + .RegisterBoolSet(WallType(), WallType(), WallType(), WallType(), + WallType(), WallType()); } } diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index 78c5a9789f..27f2b46595 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -739,6 +739,7 @@ namespace CalamityMod.Systems { { Vanilla(ItemID.MiniNukeI), Disable }, { Vanilla(ItemID.MiniNukeII), Disable }, + { Vanilla(ItemID.ReconScope), Disable }, // Make various things cheaper (sorted by progression) { Vanilla(ItemID.Leather), ChangeIngredientStack(ItemID.RottenChunk, 2) }, @@ -1725,6 +1726,13 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); + // Tiershift Recon Scope to post Plantera. + r = Recipe.Create(ItemID.ReconScope); + r.AddIngredient(ItemID.RifleScope); + r.AddIngredient(ItemID.PutridScent); + r.AddTile(TileID.TinkerersWorkbench); + r.Register(); + // Tiershift Mini Nuke 1s to post Moon Lord. r = Recipe.Create(ItemID.MiniNukeI, 333); r.AddIngredient(ItemID.RocketIII, 333); 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/ProgressionAndEvent/DownedBossSystem.cs b/Systems/ProgressionAndEvent/DownedBossSystem.cs index d8e5081616..656e5d0534 100644 --- a/Systems/ProgressionAndEvent/DownedBossSystem.cs +++ b/Systems/ProgressionAndEvent/DownedBossSystem.cs @@ -563,9 +563,9 @@ namespace CalamityMod downedBossRush = false; } - public override void OnWorldLoad() => ResetAllFlags(); + //public override void OnWorldLoad() => ResetAllFlags(); - public override void OnWorldUnload() => ResetAllFlags(); + //public override void OnWorldUnload() => ResetAllFlags(); public override void SaveWorldData(TagCompound tag) { diff --git a/Systems/UIManagementSystem.cs b/Systems/UIManagementSystem.cs index 337623ac94..3d5fe5e27d 100644 --- a/Systems/UIManagementSystem.cs +++ b/Systems/UIManagementSystem.cs @@ -43,6 +43,12 @@ namespace CalamityMod.Systems // For these layers, InterfaceScaleType.Game tells the game that this UI should take zoom into account. // These must be separate layers or they will malfunction when hovering one at non-100% zoom. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Fish Stocks", () => + { + FishStocksUI.Draw(Main.spriteBatch, Main.LocalPlayer); + return true; + }, InterfaceScaleType.None)); + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charging Station UI", () => { ChargingStationUI.Draw(Main.spriteBatch); diff --git a/Systems/World/MiscWorldStateSystem.cs b/Systems/World/MiscWorldStateSystem.cs index ba62fb4ff6..4bf79cb76b 100644 --- a/Systems/World/MiscWorldStateSystem.cs +++ b/Systems/World/MiscWorldStateSystem.cs @@ -56,6 +56,7 @@ namespace CalamityMod spawnedBandit = false; foundHomePermafrost = false; + unlockedTownPig = false; catName = false; dogName = false; @@ -69,6 +70,7 @@ namespace CalamityMod AcidRainEvent.CountdownUntilForcedAcidRain = 0; HasGeneratedLuminitePlanetoids = false; //Allow generating planetoids in other worlds + DownedBossSystem.ResetAllFlags(); } #endregion @@ -92,6 +94,8 @@ namespace CalamityMod downed.Add("bandit"); if (foundHomePermafrost) downed.Add("archmageHome"); + if (unlockedTownPig) + downed.Add("townPig"); #region Save Pet Names if (catName) @@ -143,6 +147,7 @@ namespace CalamityMod AcidRainEvent.AcidRainEventIsOngoing = downed.Contains("acidRain"); spawnedBandit = downed.Contains("bandit"); foundHomePermafrost = downed.Contains("archmageHome"); + unlockedTownPig = downed.Contains("townPig"); #region Load Pet Names catName = downed.Contains("catName"); @@ -295,6 +300,7 @@ namespace CalamityMod flags12[2] = downedNuclearTerror; flags12[3] = downedBossRush; flags12[4] = DraedonMechdusa; + flags12[5] = unlockedTownPig; writer.Write(flags); writer.Write(flags2); @@ -449,6 +455,7 @@ namespace CalamityMod downedNuclearTerror = flags12[2]; downedBossRush = flags12[3]; DraedonMechdusa = flags12[4]; + unlockedTownPig = flags12[5]; RecipeUnlockHandler.ReceiveData(reader); 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/BlueCandle.cs b/Tiles/Furniture/BlueCandle.cs index 9475eadbcd..416eb1ea39 100644 --- a/Tiles/Furniture/BlueCandle.cs +++ b/Tiles/Furniture/BlueCandle.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/BlueCandle.png b/Tiles/Furniture/BlueCandle.png index 5fe20f8f8b..0e1b6c7678 100644 Binary files a/Tiles/Furniture/BlueCandle.png and b/Tiles/Furniture/BlueCandle.png differ diff --git a/Tiles/Furniture/BlueCandle_Highlight.png b/Tiles/Furniture/BlueCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/BlueCandle_Highlight.png and b/Tiles/Furniture/BlueCandle_Highlight.png differ diff --git a/Tiles/Furniture/CorruptionEffigy.png b/Tiles/Furniture/CorruptionEffigy.png index 4389f81731..665d755fd0 100644 Binary files a/Tiles/Furniture/CorruptionEffigy.png and b/Tiles/Furniture/CorruptionEffigy.png differ diff --git a/Tiles/Furniture/CorruptionEffigy_Highlight.png b/Tiles/Furniture/CorruptionEffigy_Highlight.png index 00449db10a..bd91211397 100644 Binary files a/Tiles/Furniture/CorruptionEffigy_Highlight.png and b/Tiles/Furniture/CorruptionEffigy_Highlight.png differ diff --git a/Tiles/Furniture/GluttonyBlender.cs b/Tiles/Furniture/GluttonyBlender.cs new file mode 100644 index 0000000000..286f731e27 --- /dev/null +++ b/Tiles/Furniture/GluttonyBlender.cs @@ -0,0 +1,257 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class GluttonyBlenderTile : ModTile + { + public const int Width = 2; + public const int Height = 3; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.CoordinateHeights = [16, 16, 18]; + ModTileEntity entity = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(entity.Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + + AddMapEntry(new Color(128, 128, 128), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) => false; + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + if (TileEntity.TryGet(new(i, j), out var entity)) + { + frameXOffset = 36 * entity.CurrentFrame; + } + } + + public override void MouseOver(int i, int j) + { + Player p = Main.LocalPlayer; + // You shouldn't be able to put the slop or something better than it back into the blender + if (BuffID.Sets.IsWellFed[p.HeldItem.buffType] && !(p.HeldItem.buffType == BuffID.WellFed3 && p.HeldItem.buffTime >= CalamityUtils.MinutesToFrames(30))) + { + p.noThrow = 2; + p.cursorItemIconEnabled = true; + p.cursorItemIconID = p.HeldItem.type; + } + } + } + + public class GluttonyBlenderTE : ModTileEntity + { + public Vector2 BlenderTop => Position.ToWorldCoordinates(8 * GluttonyBlenderTile.Width, 0f); + public int CurrentFrame = 0; + private ushort FrameCounter = 0; + private const ushort TotalAnimFrames = 6; + + public override bool IsTileValidForEntity(int x, int y) + { + Tile tile = Main.tile[x, y]; + return tile.HasTile && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; + } + + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, GluttonyBlenderTile.Width, GluttonyBlenderTile.Height); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + return Place(i, j); + } + + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + public override void NetSend(BinaryWriter writer) + { + writer.Write(CurrentFrame); + writer.Write(FrameCounter); + } + public override void NetReceive(BinaryReader reader) + { + CurrentFrame = reader.ReadInt32(); + FrameCounter = reader.ReadUInt16(); + } + + public override void Update() + { + bool blenderAnim = Main.projectile.Any(i => i.active && i.type == ModContent.ProjectileType() && + i.ai[1] >= GluttonyBlenderAnimation.TimeToReachBlender && Vector2.DistanceSquared(BlenderTop, i.Center) < 256f); + if (blenderAnim) + { + if (CurrentFrame < 1) + CurrentFrame = 1; + FrameCounter++; + if (FrameCounter >= 4) + { + FrameCounter = 0; + CurrentFrame++; + if (CurrentFrame > TotalAnimFrames) + CurrentFrame = 1; + + if (Main.dedServ) + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + } + else + { + if (CurrentFrame > 0) + { + CurrentFrame = 0; + FrameCounter = 0; + + if (Main.dedServ) + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + } + } + } + + public class GluttonyBlenderGlobalItem : GlobalItem + { + public override bool InstancePerEntity => true; + + internal bool FromGluttonyBlender = false; + + public override bool CanUseItem(Item item, Player player) + { + // Exit early if anyone of the following are true: + // * Running on client that is not the local player + // * The item is not a food, is not consumable, or is Quality Slop/better than Quality Slop (you cannot feed the slop back into the blender) + // * The Gluttony Blender tile entity doesn't exist for some reason + // * The player isn't within the tile's interaction range + if (Main.LocalPlayer.whoAmI != player.whoAmI) + return true; + if (!BuffID.Sets.IsWellFed[item.buffType] || !item.consumable || (item.buffType == BuffID.WellFed3 && item.buffTime >= CalamityUtils.MinutesToFrames(30))) + return true; + + Point mouseTile = Main.MouseWorld.ToTileCoordinates(); + GluttonyBlenderTE entity = CalamityUtils.FindTileEntity(mouseTile.X, mouseTile.Y, GluttonyBlenderTile.Width, GluttonyBlenderTile.Height); + if (entity == null) + return true; + if (!player.IsInTileInteractionRange(mouseTile.X, mouseTile.Y, TileReachCheckSettings.Simple)) + return true; + + // Spawns a projectile to handle the visual animation of the food moving into the blender and the conversion to slop + // The projectile doesn't use velocity, so the top of the blender tile is passed in as the velocity + Projectile.NewProjectile(player.GetSource_TileInteraction(mouseTile.X, mouseTile.Y), player.Center, entity.BlenderTop, ModContent.ProjectileType(), + 0, 0f, player.whoAmI, item.type); + if (ItemLoader.ConsumeItem(item, player)) + { + item.stack--; + if (item.stack <= 0) + item.TurnToAir(); + } + return false; + } + + public override bool CanStackInWorld(Item destination, Item source) + { + return !destination.GetGlobalItem().FromGluttonyBlender || !destination.GetGlobalItem().FromGluttonyBlender; + } + } + + public class GluttonyBlenderAnimation : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private const int Lifetime = 120; + public const int TimeToReachBlender = 60; + private int ItemType => (int)Projectile.ai[0]; + private ref float Timer => ref Projectile.ai[1]; + private ref float ArcVelocity => ref Projectile.ai[2]; + private Vector2 Start; + private Vector2 Destination => Projectile.velocity; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.scale = 0f; + } + + public override bool ShouldUpdatePosition() => false; + public override void AI() + { + // Initialization + if (Timer == 0) + { + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Start = Projectile.Center; + ArcVelocity = Main.rand.NextFloat(2.2f, 4.4f); + } + + if (Timer < TimeToReachBlender) + { + Vector2 moveDistBeforeArc = Destination - Start; + // The second half of this applies an arcing motion as the projectile moves + Projectile.Center += (moveDistBeforeArc / (float)TimeToReachBlender) - Vector2.UnitY * (ArcVelocity - (ArcVelocity / 30f * Timer)); + Projectile.rotation = moveDistBeforeArc.X * 0.005f; + + if (Timer < 4) + Projectile.scale += 0.25f; + if (Timer >= TimeToReachBlender - 4) + Projectile.scale -= 0.25f; + } + else + { + Projectile.Center = Destination; + if (Timer == TimeToReachBlender) + SoundEngine.PlaySound(SoundID.Item22, Projectile.Center); + + Color[] dustArray = ItemID.Sets.FoodParticleColors[ItemType]; + if (dustArray == null || dustArray.Length == 0) + dustArray = ItemID.Sets.DrinkParticleColors[ItemType]; + if (dustArray != null && dustArray.Length != 0 && Main.rand.NextBool(4)) + { + Vector2 dustVel = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 5f) * 2f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FoodPiece, dustVel, 0, dustArray[Main.rand.Next(dustArray.Length)], Main.rand.NextFloat(1.3f, 1.75f)); + dust.fadeIn = 0f; + } + } + + if (Projectile.timeLeft == 1) + { + Item dummy = new Item(); + dummy.SetDefaults(ItemType); + int goodPercent = (int)(dummy.buffTime * (dummy.buffType == BuffID.WellFed3 ? 2f : dummy.buffType == BuffID.WellFed2 ? 1.5f : 1f) / 3600); + + int itemDrop = Main.rand.Next(100) < goodPercent ? ModContent.ItemType() : ModContent.ItemType(); + int i = Item.NewItem(Projectile.GetItemSource_DropAsItem(), Projectile.Center, itemDrop); + Main.item[i].GetGlobalItem().FromGluttonyBlender = true; + } + Timer++; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Timer >= TimeToReachBlender) + return false; + + Texture2D tex = TextureAssets.Item[ItemType].Value; + Rectangle frame = tex.Frame(1, Main.itemAnimations[ItemType].FrameCount, 0, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Tiles/Furniture/GluttonyBlenderTile.png b/Tiles/Furniture/GluttonyBlenderTile.png new file mode 100644 index 0000000000..c296b47ccc Binary files /dev/null and b/Tiles/Furniture/GluttonyBlenderTile.png differ diff --git a/Tiles/Furniture/PinkCandle.cs b/Tiles/Furniture/PinkCandle.cs index f2b8f483c8..5c356fc82e 100644 --- a/Tiles/Furniture/PinkCandle.cs +++ b/Tiles/Furniture/PinkCandle.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/PinkCandle.png b/Tiles/Furniture/PinkCandle.png index e22cef9737..7a3873cfc3 100644 Binary files a/Tiles/Furniture/PinkCandle.png and b/Tiles/Furniture/PinkCandle.png differ diff --git a/Tiles/Furniture/PinkCandle_Highlight.png b/Tiles/Furniture/PinkCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/PinkCandle_Highlight.png and b/Tiles/Furniture/PinkCandle_Highlight.png differ diff --git a/Tiles/Furniture/PurpleCandle.cs b/Tiles/Furniture/PurpleCandle.cs index dd2a5e9886..d9dba7ab79 100644 --- a/Tiles/Furniture/PurpleCandle.cs +++ b/Tiles/Furniture/PurpleCandle.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/PurpleCandle.png b/Tiles/Furniture/PurpleCandle.png index 41e2f749a3..0b4b460a3b 100644 Binary files a/Tiles/Furniture/PurpleCandle.png and b/Tiles/Furniture/PurpleCandle.png differ diff --git a/Tiles/Furniture/PurpleCandle_Highlight.png b/Tiles/Furniture/PurpleCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/PurpleCandle_Highlight.png and b/Tiles/Furniture/PurpleCandle_Highlight.png differ diff --git a/Tiles/Furniture/ShroombleCageTile.cs b/Tiles/Furniture/ShroombleCageTile.cs new file mode 100644 index 0000000000..52c6d36633 --- /dev/null +++ b/Tiles/Furniture/ShroombleCageTile.cs @@ -0,0 +1,98 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class ShroombleCageTile : ModTile + { + public static Asset topTexture; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + topTexture = ModContent.Request("CalamityMod/Tiles/Furniture/TransparentCageTile_Top"); + } + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileTable[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); + TileObjectData.addTile(Type); + AnimationFrameHeight = 54; + AddMapEntry(new Color(122, 217, 232), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Glass, 0f, 0f, 0, new Color(), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + 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 AnimateTile(ref int frame, ref int frameCounter) + { + int frameAmt = 39; + frameCounter++; + if (frameCounter >= 6) + { + frame++; + frameCounter = 0; + } + if (frame >= frameAmt) + { + frame = 0; + } + } + + // Since this uses a custom top sprite, all drawing must be redone + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + + Tile tile = Main.tile[i, j]; + var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); + var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; + var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; + var height = 16; + var finalColor = CalamityUtils.ApplyPaint(tile.TileColor, Lighting.GetColor(i, j), false); + + var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); + + if (rect.Y % 54 == 0) + { + Vector2 position = drawPos; + position.Y += 8f; + Rectangle drawRectangle = rect; + drawRectangle.Y += 8; + drawRectangle.Height -= 8; + Main.spriteBatch.Draw(TextureAssets.Tile[Type].Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + position = drawPos; + position.Y -= 2f; + drawRectangle = rect; + drawRectangle.Y = 0; + drawRectangle.Height = 10; + spriteBatch.Draw(topTexture.Value, position, drawRectangle, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + else + { + spriteBatch.Draw(TextureAssets.Tile[Type].Value, drawPos, rect, finalColor, 0f, zero, 1f, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Tiles/Furniture/ShroombleCageTile.png b/Tiles/Furniture/ShroombleCageTile.png new file mode 100644 index 0000000000..a826b6f099 Binary files /dev/null and b/Tiles/Furniture/ShroombleCageTile.png 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/Tiles/Furniture/YellowCandle.cs b/Tiles/Furniture/YellowCandle.cs index d9780550bc..e43f389700 100644 --- a/Tiles/Furniture/YellowCandle.cs +++ b/Tiles/Furniture/YellowCandle.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.Furniture frameCounter++; if (frameCounter >= 6) { - frame = (frame + 1) % 5; + frame = (frame + 1) % 10; frameCounter = 0; } } diff --git a/Tiles/Furniture/YellowCandle.png b/Tiles/Furniture/YellowCandle.png index 74f2a263aa..1ccebda4e8 100644 Binary files a/Tiles/Furniture/YellowCandle.png and b/Tiles/Furniture/YellowCandle.png differ diff --git a/Tiles/Furniture/YellowCandle_Highlight.png b/Tiles/Furniture/YellowCandle_Highlight.png index 02427f1b60..9d1cc638ea 100644 Binary files a/Tiles/Furniture/YellowCandle_Highlight.png and b/Tiles/Furniture/YellowCandle_Highlight.png differ diff --git a/Tiles/FurnitureAuric/AuricToiletTile.cs b/Tiles/FurnitureAuric/AuricToiletTile.cs index ab4dd204e9..194b950492 100644 --- a/Tiles/FurnitureAuric/AuricToiletTile.cs +++ b/Tiles/FurnitureAuric/AuricToiletTile.cs @@ -1,7 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables.FurnitureAuric; +using CalamityMod.Items.Placeables.FurnitureExo; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -11,6 +15,7 @@ namespace CalamityMod.Tiles.FurnitureAuric { public class AuricToiletTile : ModTile { + public const int NextStyleHeight = 40; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -36,11 +41,38 @@ namespace CalamityMod.Tiles.FurnitureAuric // Toilets count as chairs AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; TileID.Sets.DisableSmartCursor[Type] = true; AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Toilet")); AdjTiles = new int[] { TileID.Chairs }; } + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, NextStyleHeight, true, shitter: true); + + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType(), true); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void HitWire(int i, int j) + { + Tile tile = Main.tile[i, j]; + + int spawnX = i; + int spawnY = j - (tile.TileFrameY % NextStyleHeight) / 18; + + Wiring.SkipWire(spawnX, spawnY); + Wiring.SkipWire(spawnX, spawnY + 1); + + if (Wiring.CheckMech(spawnX, spawnY, 60)) + { + Projectile.NewProjectile(Wiring.GetProjectileSource(spawnX, spawnY), spawnX * 16 + 8, spawnY * 16 + 12, 0f, 0f, ProjectileID.ToiletEffect, 0, 0f, Main.myPlayer); + } + } public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/GreedPotTile.cs b/Tiles/GreedPotTile.cs new file mode 100644 index 0000000000..8a58ad248d --- /dev/null +++ b/Tiles/GreedPotTile.cs @@ -0,0 +1,390 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.DataStructures; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Particles; +using CalamityMod.Utilities.Daybreak; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class GreedPotTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + + ModTileEntity te = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); + + TileObjectData.addTile(Type); + + DustType = DustID.Iron; + + AddMapEntry(new Color(250, 142, 4)); + } + + public override void MouseOver(int i, int j) + { + List availableOres = GreedTransmutation.GreedChain.Where(p => p.Value.Availability.Invoke()).Select(p => p.Key).ToList(); + + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = availableOres[(int)((Main.GlobalTimeWrappedHourly * 2) % availableOres.Count)]; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + if (TileEntity.TryGet(new(i, j), out var greedPotTE)) + { + frameXOffset = 18 * 3 * greedPotTE.MyFrame; + } + } + } + + public class GreedPotTE : ModTileEntity + { + internal bool Activated = false; + internal ushort TimeSinceActivation = 0; + private ushort FrameTime = 0; + private byte CurrentFrame = 0; + public int MyFrame => (int)CurrentFrame; + + private const byte FullActiveFrame = 4; + private const byte FrameRate = 3; + private const byte FrameTotal = 8; + + public override bool IsTileValidForEntity(int x, int y) + { + Tile tile = Main.tile[x, y]; + + if (!tile.HasTile || tile.TileType != ModContent.TileType()) + return false; + + int style = 0, alt = 0; + TileObjectData.GetTileInfo(tile, ref style, ref alt); + TileObjectData data = TileObjectData.GetTileData(tile.TileType, style, alt); + + if (data == null) + return false; + + int sheetSquare = 16 + data.CoordinatePadding; + int FrameX = tile.TileFrameX / sheetSquare % data.Width; + int FrameY = tile.TileFrameY / sheetSquare % data.Height; + + return tile.HasTile && tile.TileType == ModContent.TileType() && FrameX == 0 && FrameY == 0; + } + + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 3, 3); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + return Place(i, j); + } + + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + public override void Update() + { + if(Activated) + { + if(CurrentFrame != 3) + { + FrameTime++; + if(FrameTime % FrameRate == 0) + { + FrameTime = 0; + CurrentFrame = (byte)((CurrentFrame + 1) % FrameTotal); + } + } + + if (TimeSinceActivation >= 150) + { + Activated = false; + TimeSinceActivation = 0; + return; + } + + if(TimeSinceActivation % 5 == 0) + { + HeavySmokeParticle p = new(Position.ToWorldCoordinates(24 + Main.rand.Next(-10, 11), 2), Vector2.UnitY * -2, Color.Crimson, 90, Main.rand.NextFloat(0.2f, 0.3f), 0.75f, Main.rand.NextFloat(-0.05f, 0.05f), true); + GeneralParticleHandler.SpawnParticle(p); + } + + TimeSinceActivation++; + } + else + { + if (CurrentFrame != 0) + { + FrameTime++; + if (FrameTime % FrameRate == 0) + { + FrameTime = 0; + CurrentFrame = (byte)((CurrentFrame + 1) % FrameTotal); + } + } + } + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(Activated); + writer.Write(FrameTime); + writer.Write(TimeSinceActivation); + writer.Write(CurrentFrame); + } + public override void NetReceive(BinaryReader reader) + { + Activated = reader.ReadBoolean(); + FrameTime = reader.ReadUInt16(); + TimeSinceActivation = reader.ReadUInt16(); + CurrentFrame = reader.ReadByte(); + } + } + + public class GreedTransmutation : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + static bool twoMechsDowned() => + NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3 || + NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1 || + NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2 || + NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3; + + GreedChain = new() + { + { ItemID.CopperOre, (ItemID.IronOre, () => true) }, + { ItemID.IronOre, (ItemID.SilverOre, () => true) }, + { ItemID.SilverOre, (ItemID.GoldOre, () => true) }, + { ItemID.TinOre, (ItemID.LeadOre, () => true) }, + { ItemID.LeadOre, (ItemID.TungstenOre, () => true) }, + { ItemID.TungstenOre, (ItemID.PlatinumOre, () => true) }, + { ItemID.GoldOre, (ModContent.ItemType(), () => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator) }, + { ItemID.PlatinumOre, (ModContent.ItemType(), () => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator) }, + { ModContent.ItemType(), (ItemID.PalladiumOre, () => Main.hardMode) }, + { ItemID.CobaltOre, (ItemID.MythrilOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBossAny : Main.hardMode) }, + { ItemID.MythrilOre, (ItemID.AdamantiteOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? twoMechsDowned() : Main.hardMode) }, + { ItemID.PalladiumOre, (ItemID.OrichalcumOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBossAny : Main.hardMode) }, + { ItemID.OrichalcumOre, (ItemID.TitaniumOre, () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? twoMechsDowned() : Main.hardMode) }, + { ItemID.AdamantiteOre, (ModContent.ItemType(), () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 : NPC.downedMechBossAny) }, + { ItemID.TitaniumOre, (ModContent.ItemType(), () => CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 : NPC.downedMechBossAny) }, + { ModContent.ItemType(), (ItemID.ChlorophyteOre, () => NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3) }, + { ItemID.ChlorophyteOre, (ModContent.ItemType(), () => NPC.downedPlantBoss) }, + { ModContent.ItemType(), (ModContent.ItemType(), () => NPC.downedAncientCultist) }, + { ModContent.ItemType(), (ItemID.LunarOre, () => NPC.downedMoonlord) }, + { ItemID.LunarOre, (ModContent.ItemType(), () => NPC.downedMoonlord) }, + { ModContent.ItemType(), (ModContent.ItemType(), () => DownedBossSystem.downedProvidence) }, + { ModContent.ItemType(), (ModContent.ItemType(), () => DownedBossSystem.downedCalamitas || DownedBossSystem.downedExoMechs) }, + }; + } + + internal static Dictionary Availability)> GreedChain; + + private int InputItemType => (int)Projectile.ai[0]; + private int SuccessOutputItemType => (int)Projectile.ai[1]; + + private Vector2 PotPosition = Vector2.Zero; + private Vector2 StartPosition = Vector2.Zero; + + BezierCurve path = null; + private bool Success = false; + + public override void SetDefaults() + { + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + } + + public override void OnSpawn(IEntitySource source) + { + StartPosition = Projectile.Center; + PotPosition = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + Success = Main.rand.NextBool(3); + Projectile.netUpdate = true; + } + + + public override void AI() + { + if(path == null) + { + Vector2 startPoint = StartPosition; + Vector2 endPoint = PotPosition - Vector2.UnitY * 64; + + Vector2 direction = endPoint - startPoint; + float curveIntensity = Main.rand.NextFloat(0.2f, 0.4f); + Vector2 perpindicular = direction.RotatedBy(MathHelper.PiOver2); + if (direction.X > 0) + curveIntensity *= -1; + + Vector2 controlPoint1 = startPoint + (direction * 0.25f) + (perpindicular * curveIntensity); + Vector2 controlPoint2 = startPoint + (direction * 0.75f) + (perpindicular * curveIntensity); + + path = new BezierCurve(startPoint, controlPoint1, controlPoint2, endPoint); + } + + float lerp = 1 - MathHelper.Clamp(((Projectile.timeLeft - 60) / 60f), 0f, 1f); + + Projectile.Center = path.Evaluate(CalamityUtils.CircOutEasing(lerp, 1)); + + if (Projectile.timeLeft == 1) + { + int i = Item.NewItem(Projectile.GetItemSource_DropAsItem(), Projectile.Center, Success ? SuccessOutputItemType : ItemID.StoneBlock); + Main.item[i].GetGlobalItem().FromGreedPot = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + //Anim Plan + //Moving to Pos: 0 -> 60 + //Darken: 70 -> 80 + //Transform: 90 -> 100 + //Undarken: 110 -> 120 + + int animTime = 120 - Projectile.timeLeft; + bool beforeDarken = animTime < 50; + bool darken = animTime < 90; + bool transform = animTime < 110; + + if(beforeDarken) + { + Texture2D tex = TextureAssets.Item[InputItemType].Value; + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, lightColor, Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + } + else if (darken) + { + Main.spriteBatch.End(out var snap); + + var newSnap = snap with { BlendState = BlendState.Additive }; + Main.spriteBatch.Begin(newSnap); + + float glowLerp = MathHelper.Clamp((animTime - 45) / 10f, 0f, 1f); + glowLerp = CalamityUtils.SineInEasing(glowLerp, 1); + + Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson * glowLerp, Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, glowLerp), 0, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(snap); + + float darkenLerp = MathHelper.Clamp((animTime - 50) / 10f, 0f, 1f); + darkenLerp = CalamityUtils.CircInEasing(darkenLerp, 1); + + Texture2D tex = TextureAssets.Item[InputItemType].Value; + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Lerp(lightColor, Color.Black, darkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + } + else if(transform) + { + Main.spriteBatch.End(out var snap); + + var newSnap = snap with { BlendState = BlendState.Additive }; + Main.spriteBatch.Begin(newSnap); + + Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson, Projectile.rotation, glow.Size() * 0.5f, 0.15f, 0, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(snap); + + Texture2D inputTex = TextureAssets.Item[InputItemType].Value; + Texture2D outputTex = TextureAssets.Item[Success ? SuccessOutputItemType : ItemID.StoneBlock].Value; + float transformLerp = MathHelper.Clamp((animTime - 90) / 10f, 0f, 1f); + //transformLerp = CalamityUtils.SineInOutEasing(transformLerp, 1); + + Main.spriteBatch.Draw(inputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, 1 - transformLerp, 0, 0); + Main.spriteBatch.Draw(outputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, transformLerp, 0, 0); + } + else + { + float undarkenLerp = MathHelper.Clamp((animTime - 110) / 10f, 0f, 1f); + undarkenLerp = CalamityUtils.SineOutEasing(undarkenLerp, 1); + + Main.spriteBatch.End(out var snap); + + var newSnap = snap with { BlendState = BlendState.Additive }; + Main.spriteBatch.Begin(newSnap); + + Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson * (1 - undarkenLerp), Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, (1 - undarkenLerp)), 0, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(snap); + + Texture2D tex = TextureAssets.Item[Success ? SuccessOutputItemType : ItemID.StoneBlock].Value; + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Lerp(Color.Black, lightColor, undarkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + } + return false; + } + } + + public class GreedTransmutationGlobalItem : GlobalItem + { + public override bool InstancePerEntity => true; + + internal bool FromGreedPot = false; + + public override bool? UseItem(Item item, Player player) + { + if (Main.LocalPlayer.whoAmI != player.whoAmI) + return null; + + if (!GreedTransmutation.GreedChain.TryGetValue(item.type, out var transmutation)) + return null; + + if (!transmutation.Availability()) + return null; + + Point mouseTile = Main.MouseWorld.ToTileCoordinates(); + + GreedPotTE greedPotTE = CalamityUtils.FindTileEntity(mouseTile.X, mouseTile.Y, 3, 3, 18); + if (greedPotTE == null) + return null; + + if (!player.IsInTileInteractionRange(mouseTile.X, mouseTile.Y, TileReachCheckSettings.Simple)) + return null; + + Projectile.NewProjectile(Projectile.GetSource_NaturalSpawn(), Main.LocalPlayer.Center, greedPotTE.Position.ToWorldCoordinates(24, 24) + Main.rand.NextVector2Circular(12, 32), ModContent.ProjectileType(), 0, 0, Main.LocalPlayer.whoAmI, item.type, transmutation.Result, Main.rand.Next(120)); + greedPotTE.Activated = true; + greedPotTE.TimeSinceActivation = 0; + player.ApplyItemTime(item, 0.5f, false); + + return false; + } + + public override bool CanStackInWorld(Item destination, Item source) + { + return !destination.GetGlobalItem().FromGreedPot || !source.GetGlobalItem().FromGreedPot; + } + } +} diff --git a/Tiles/GreedPotTile.png b/Tiles/GreedPotTile.png new file mode 100644 index 0000000000..1e8745c33a Binary files /dev/null and b/Tiles/GreedPotTile.png differ diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index 435b3b19fd..b5413ddaa0 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Tiles.Ores { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileOreFinderPriority[Type] = 690; diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index a26a343c5f..8e6a090e63 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.Ores { Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileOreFinderPriority[Type] = 710; Main.tileShine[Type] = 2500; @@ -38,10 +37,6 @@ namespace CalamityMod.Tiles.Ores this.RegisterBlendMergeWith(TileID.Mud); } - - - - public override bool CanExplode(int i, int j) { return false; diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 297c26c2bd..c55a2abf39 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -198,6 +198,7 @@ namespace CalamityMod.UI.CalamitasEnchants float y = costDrawPositionTopLeft.Y + 54f * Main.UIScale; for (int i = 0; i < 4; i++) { + Main.instance.LoadItem(ItemID.PlatinumCoin - i); Vector2 drawPosition = new Vector2(costDrawPositionTopLeft.X + (ChatManager.GetStringSize(FontAssets.MouseText.Value, costText, Vector2.One, -1f).X + ((24 * i) - 24f)) * Main.UIScale, y); spriteBatch.Draw(TextureAssets.Item[ItemID.PlatinumCoin - i].Value, drawPosition, null, Color.White, 0f, TextureAssets.Item[ItemID.PlatinumCoin - i].Size() * 0.5f, Main.UIScale, SpriteEffects.None, 0f); Utils.DrawBorderStringFourWay(spriteBatch, FontAssets.ItemStack.Value, coinsArray[3 - i].ToString(), drawPosition.X - 11f, drawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), 0.75f * Main.UIScale); diff --git a/UI/FishStocks/FishStocksGraphOverlay.png b/UI/FishStocks/FishStocksGraphOverlay.png new file mode 100644 index 0000000000..43308b867b Binary files /dev/null and b/UI/FishStocks/FishStocksGraphOverlay.png differ diff --git a/UI/FishStocks/FishStocksOverlay.png b/UI/FishStocks/FishStocksOverlay.png new file mode 100644 index 0000000000..f4391b9a9b Binary files /dev/null and b/UI/FishStocks/FishStocksOverlay.png differ diff --git a/UI/FishStocks/FishStocksOverlayBorder.png b/UI/FishStocks/FishStocksOverlayBorder.png new file mode 100644 index 0000000000..9dad4f9229 Binary files /dev/null and b/UI/FishStocks/FishStocksOverlayBorder.png differ diff --git a/UI/FishStocks/FishStocksScreenOverlay.png b/UI/FishStocks/FishStocksScreenOverlay.png new file mode 100644 index 0000000000..82da43ba00 Binary files /dev/null and b/UI/FishStocks/FishStocksScreenOverlay.png differ diff --git a/UI/FishStocks/FishStocksUI.cs b/UI/FishStocks/FishStocksUI.cs new file mode 100644 index 0000000000..0bad391d92 --- /dev/null +++ b/UI/FishStocks/FishStocksUI.cs @@ -0,0 +1,187 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Systems.Graphic.PixelationSystem; +using CalamityMod.Utilities.Daybreak.Buffers; +using Microsoft.Build.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities.Terraria.Utilities; + +namespace CalamityMod.UI +{ + public class FishStocksUI : ModSystem + { + private static Asset lineTex, overlayGraphTex, overlayTex, overlayBorderTex, screenTex, fishyPoint1Tex, fishyPoint2Tex, fishyHappy1Tex, fishyHappy2Tex, fishyPanic1Tex, fishyPanic2Tex, fishyBye1Tex, fishyBye2Tex, fishyWhatTex; + private static int time = 0; + + private static RenderTargetLease PixelationLease; + + private static Color normalColor => Color.Cyan; + private static Color goodColor => Color.Lime; + private static Color badColor => Color.Red; + private static Color shiftColor = goodColor; + private static float jumpMult = 0; + private static float shakeMult = 0; + private static float screenFlicker = 1; + private static bool waving = true; + + public override void OnModLoad() + { + if (Main.dedServ) + return; + + string folder = "CalamityMod/UI/FishStocks/"; + lineTex = ModContent.Request("CalamityMod/Particles/LineThick"); + overlayGraphTex = ModContent.Request(folder + "FishStocksGraphOverlay"); + overlayTex = ModContent.Request(folder + "FishStocksOverlay"); + overlayBorderTex = ModContent.Request(folder + "FishStocksOverlayBorder"); + screenTex = ModContent.Request(folder + "FishStocksScreenOverlay"); + fishyPoint1Tex = ModContent.Request(folder + "FishyPoint1"); + fishyPoint2Tex = ModContent.Request(folder + "FishyPoint2"); + fishyHappy1Tex = ModContent.Request(folder + "FishyHappy1"); + fishyHappy2Tex = ModContent.Request(folder + "FishyHappy2"); + fishyPanic1Tex = ModContent.Request(folder + "FishyPanic1"); + fishyPanic2Tex = ModContent.Request(folder + "FishyPanic2"); + fishyBye1Tex = ModContent.Request(folder + "FishyBye1"); + fishyBye2Tex = ModContent.Request(folder + "FishyBye2"); + fishyWhatTex = ModContent.Request(folder + "FishyWhat"); + + Main.QueueMainThreadAction(() => PixelationLease = ScreenspaceTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, (width, height) => (width / 2, height / 2))); + } + + public override void UpdateUI(GameTime gameTime) + { + Player player = Main.LocalPlayer; + time++; + float power = Math.Clamp(MathF.Pow((Math.Abs(player.Calamity().fishStockSlidingPower) / 2), 1.8f), 0, 1); + + bool dead = player.dead; + + Color attemptColor = dead ? Color.Gray : (player.Calamity().fishStockSlidingPower >= 0 ? Color.Lerp(normalColor, goodColor, power) : Color.Lerp(normalColor, badColor, power)); + shiftColor = Color.Lerp(shiftColor, attemptColor, 0.03f); + + bool doingBad = player.Calamity().fishStockPower <= -1; + if (time % 60 < 10 && !doingBad && !waving && !dead) + jumpMult = MathHelper.Lerp(jumpMult, player.Calamity().fishStockPower >= 1 ? 2.5f : 1, 0.17f); + if (jumpMult > 0) + jumpMult = MathHelper.Lerp(jumpMult, 0, 0.09f); + + shakeMult = MathHelper.Lerp(shakeMult, (doingBad && !dead) ? 1 : 0, 0.08f); + + screenFlicker = MathHelper.Lerp(0.6f, 1f, MathF.Abs(MathF.Sin(time * 0.0125f))); + } + + public static void Draw(SpriteBatch spriteBatch, Player player) + { + if (Main.hideUI || Main.gameMenu || Main.playerInventory || player.Calamity().fishStockVisual <= 0.001f) + return; + + // Fishy waves at the screen if the UI is entering or leaving. + float fishStocksSlideValue = MathF.Pow(1 - player.Calamity().fishStockVisual, player.Calamity().fishStocks ? 1.2f : 20); + waving = (!player.Calamity().fishStocks && player.Calamity().fishStockPower >= 0) || fishStocksSlideValue > 0.002f; + + float baseScale = 0.65f; + float fishStocksUIScale = baseScale * Main.UIScale; + + Vector2 screenPos = new Vector2(Main.screenWidth / 1920, Main.screenHeight / 1080) * fishStocksUIScale; + Vector2 baseUIPosition = (screenPos + new Vector2(overlayBorderTex.Width() * 0.342f * Main.UIScale - (1000 * fishStocksSlideValue), overlayBorderTex.Height() * 0.566f * MathHelper.Lerp(Main.UIScale, 1, 0.5f) + 54 * MathF.Ceiling(player.CountBuffs() / 11f))); + Vector2 fishyDrawPos = baseUIPosition + new Vector2(112, 40) * fishStocksUIScale; + Vector2 leftEdgePos = baseUIPosition - Vector2.UnitX * overlayTex.Width(); + Vector2 rightEdgePos = baseUIPosition - Vector2.UnitX * overlayTex.Width() / 2.7f; + float fullDist = leftEdgePos.Distance(rightEdgePos) * 0.748f * fishStocksUIScale; + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, default, SamplerState.PointClamp, default, default, default, Main.UIScaleMatrix); + + // Overlay + spriteBatch.Draw(overlayTex.Value, baseUIPosition, null, shiftColor, 0f, overlayTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + + // The stock graph. + Vector2 xAdjust = (-Vector2.UnitX * overlayTex.Width() / 2.565f) * fishStocksUIScale; + float yAdjust = (overlayTex.Height() / 4.4f) * fishStocksUIScale; + int backgroundLines = 12; + float scroll = (time * 0.23f) % ((fullDist / backgroundLines)); + for (int i = 1; i <= backgroundLines; i++) // background grid + { + Vector2 start = new Vector2(15 * fishStocksUIScale + (fullDist / backgroundLines * (i - 1)) - scroll, -yAdjust); + Vector2 end = new Vector2(15 * fishStocksUIScale + (fullDist / backgroundLines * i) - scroll, yAdjust); + Vector2 scale = new Vector2(0.1f * fishStocksUIScale, 0.0103f * start.Distance(end)) * 0.05f; + spriteBatch.Draw(lineTex.Value, baseUIPosition + xAdjust + start, null, shiftColor * 0.2f, 0, new Vector2(lineTex.Width() / 2, 0), scale, SpriteEffects.None, 0f); + } + spriteBatch.Draw(lineTex.Value, baseUIPosition + xAdjust, null, shiftColor * 0.3f, -MathHelper.PiOver2, new Vector2(lineTex.Width() / 2, 0), new Vector2(0.15f * fishStocksUIScale, 0.0103f * fullDist * 0.99f) * 0.05f, SpriteEffects.None, 0f); + + // Graph overlay + spriteBatch.Draw(overlayGraphTex.Value, baseUIPosition, null, shiftColor, 0f, overlayGraphTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + + // Draw Fishy and the stcok graph line to a downscaled render target so that it can be redrawn at 2x for a pixelated effect. + spriteBatch.End(); + using (PixelationLease.Scope(clearColor: Color.Transparent)) + { + Matrix pixelationMatrix = Matrix.CreateScale(0.5f, 0.5f, 1f); + spriteBatch.Begin(SpriteSortMode.Deferred, default, SamplerState.PointClamp, default, default, default, pixelationMatrix); + + int lines = 5; + for (int i = 1; i <= lines; i++) // The stock graph + { + float maxHeight = 36f * fishStocksUIScale; + Vector2 start = new Vector2((fullDist / lines) * (i - 1), maxHeight * GetHeight(i - 1, player)); + Vector2 end = new Vector2((fullDist / lines) * i, maxHeight * GetHeight(i, player)); + Vector2 scale = new Vector2(0.2f * fishStocksUIScale, 0.0103f * start.Distance(end)) * 0.05f; + spriteBatch.Draw(lineTex.Value, baseUIPosition + xAdjust + start - Vector2.UnitY * 1f, null, shiftColor, start.DirectionTo(end).ToRotation() - MathHelper.PiOver2, new Vector2(lineTex.Width() / 2, 0), scale, SpriteEffects.None, 0f); + } + + // Fishy :D + Vector2 positionOffset = new Vector2(4 * MathF.Sin(time * 0.65f) * shakeMult, -25 * jumpMult) * fishStocksUIScale; + float fishyScale = 1.45f * fishStocksUIScale; + Texture2D fishyTexture = GetFishyTexture(player); + spriteBatch.Draw(fishyTexture, fishyDrawPos + positionOffset, null, Color.Lerp(shiftColor, Color.White, 0.35f), 0f, fishyTexture.Size() / 2, fishyScale, SpriteEffects.None, 0f); + + spriteBatch.End(); + } + + // Redraw the now-pixelated target. + spriteBatch.Begin(SpriteSortMode.Deferred, default, SamplerState.PointClamp, default, default, default, Main.UIScaleMatrix); + spriteBatch.Draw(PixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f); + + string fishStocksPower = (player.Calamity().fishStockPower > -0 ? "+" : "") + Math.Round(player.Calamity().fishStockPower, 2).ToString() + "x"; + Vector2 textPos = baseUIPosition + new Vector2(-148 - (3.5f * fishStocksPower.Length), -118.5f) * fishStocksUIScale; + + // Text + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, fishStocksPower, textPos, Color.Lerp(shiftColor, Color.White, 0.35f), Color.Black, 1.4f * fishStocksUIScale); + + // Screen overlay + if (!CalamityClientConfig.Instance.Photosensitivity) + spriteBatch.Draw(screenTex.Value, baseUIPosition, null, shiftColor * 0.166f * screenFlicker, 0f, screenTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + + // Overlay Border + spriteBatch.Draw(overlayBorderTex.Value, baseUIPosition, null, Color.White, 0f, overlayBorderTex.Size() / 2, fishStocksUIScale, SpriteEffects.None, 0f); + } + + private static Texture2D GetFishyTexture(Player player) + { + float stockPower = player.Calamity().fishStockPower; + bool panic = stockPower <= -1f; + bool happy = stockPower >= 1f; + bool frame2 = time % 60 < 30; + Texture2D fishyTexture = player.dead ? fishyWhatTex.Value : (waving ? frame2 ? fishyBye2Tex.Value : fishyBye1Tex.Value : happy ? frame2 ? fishyHappy2Tex.Value : fishyHappy1Tex.Value : + panic ? frame2 ? fishyPanic2Tex.Value : fishyPanic1Tex.Value : frame2 ? fishyPoint2Tex.Value : fishyPoint1Tex.Value); + + return fishyTexture; + } + + public static float GetHeight(int point, Player player) + { + (float, float, float, float, float) oldHeights = player.Calamity().fishStockOldPower; + float height = point == 0 ? oldHeights.Item5 : + point == 1 ? oldHeights.Item4 : point == 2 ? oldHeights.Item3 : + point == 3 ? oldHeights.Item2 : point == 4 ? oldHeights.Item1 : player.Calamity().fishStockSlidingPower; + return -height; + } + } +} diff --git a/UI/FishStocks/FishyBye1.png b/UI/FishStocks/FishyBye1.png new file mode 100644 index 0000000000..f4e10ac69b Binary files /dev/null and b/UI/FishStocks/FishyBye1.png differ diff --git a/UI/FishStocks/FishyBye2.png b/UI/FishStocks/FishyBye2.png new file mode 100644 index 0000000000..88892c42da Binary files /dev/null and b/UI/FishStocks/FishyBye2.png differ diff --git a/UI/FishStocks/FishyHappy1.png b/UI/FishStocks/FishyHappy1.png new file mode 100644 index 0000000000..f4accf38e9 Binary files /dev/null and b/UI/FishStocks/FishyHappy1.png differ diff --git a/UI/FishStocks/FishyHappy2.png b/UI/FishStocks/FishyHappy2.png new file mode 100644 index 0000000000..a9973a11ee Binary files /dev/null and b/UI/FishStocks/FishyHappy2.png differ diff --git a/UI/FishStocks/FishyPanic1.png b/UI/FishStocks/FishyPanic1.png new file mode 100644 index 0000000000..74fa4d6080 Binary files /dev/null and b/UI/FishStocks/FishyPanic1.png differ diff --git a/UI/FishStocks/FishyPanic2.png b/UI/FishStocks/FishyPanic2.png new file mode 100644 index 0000000000..eb49b8d4d1 Binary files /dev/null and b/UI/FishStocks/FishyPanic2.png differ diff --git a/UI/FishStocks/FishyPoint1.png b/UI/FishStocks/FishyPoint1.png new file mode 100644 index 0000000000..06bea79a18 Binary files /dev/null and b/UI/FishStocks/FishyPoint1.png differ diff --git a/UI/FishStocks/FishyPoint2.png b/UI/FishStocks/FishyPoint2.png new file mode 100644 index 0000000000..80fd156f85 Binary files /dev/null and b/UI/FishStocks/FishyPoint2.png differ diff --git a/UI/FishStocks/FishyWhat.png b/UI/FishStocks/FishyWhat.png new file mode 100644 index 0000000000..eb121329b9 Binary files /dev/null and b/UI/FishStocks/FishyWhat.png differ diff --git a/Utilities/DustExtensions.cs b/Utilities/DustExtensions.cs index 93df499dfb..3688285a1f 100644 --- a/Utilities/DustExtensions.cs +++ b/Utilities/DustExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using Terraria; namespace CalamityMod.Utilities @@ -7,6 +8,13 @@ namespace CalamityMod.Utilities { extension(Dust dust) { + public float dataAsFloat + { + get => (float)dust.customData; + set => dust.customData = value; + } + + [Obsolete("DO NOT USE. It is an unsafe fix to an even more unsafe vanilla method.")] public static Dust BetterCloneDust(Dust rf) { diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 7ad793f3ad..848c00118a 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod { @@ -160,17 +161,17 @@ namespace CalamityMod // Color debuffs based on their element type in the vulnerability and resistance system // If a debuff has multiple types, the colors are mixed // If a debuff is typeless, is gets the typeless color - else if (BuffDatasets.DebuffDataset[debuffId] is not null) + else if (CalamityBuffSets.DebuffDataset[debuffId] is not null) { if (!debuffColorWeightsCache.TryGetValue(debuffId, out var weights)) { weights = [ - (SicknessDebuffColor, BuffDatasets.DebuffDataset[debuffId].SicknessDebuffScaling), - (FireDebuffColor, BuffDatasets.DebuffDataset[debuffId].HeatDebuffScaling), - (WaterDebuffColor, BuffDatasets.DebuffDataset[debuffId].WaterDebuffScaling), - (ElectricDebuffColor, BuffDatasets.DebuffDataset[debuffId].ElectricDebuffScaling), - (ColdDebuffColor, BuffDatasets.DebuffDataset[debuffId].ColdDebuffScaling), + (SicknessDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].SicknessDebuffScaling), + (FireDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].HeatDebuffScaling), + (WaterDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].WaterDebuffScaling), + (ElectricDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].ElectricDebuffScaling), + (ColdDebuffColor, CalamityBuffSets.DebuffDataset[debuffId].ColdDebuffScaling), ]; } diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index aacef829b0..e18faa6de9 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -279,7 +279,7 @@ namespace CalamityMod { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.OnFire, ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.OnFire, ModContent.BuffType(), ModContent.BuffType() }) }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 0db89dd408..8d3a4e0e50 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -147,10 +147,10 @@ namespace CalamityMod // Xyk 3MARCH2026: Will be implemented better by Doze eventually if (addHeldItemScale) baseScale += (player.HeldItem.scale - 1); - if (player.HasBuff(BuffID.Tipsy)) - baseScale += 0.15f; - + baseScale += 0.25f; + if (player.GetModPlayer().HasAlcohol(AlcoholType.Ale) || player.GetModPlayer().HasAlcohol(AlcoholType.Sake)) + baseScale += 0.25f; return baseScale; } diff --git a/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/CalamityWorld.cs b/World/CalamityWorld.cs index 8a789c3fd0..3ffb533837 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -79,6 +79,8 @@ namespace CalamityMod.World public static bool spawnedBandit = false; /// If true, the Archmage has lived in a house in this world. Solely used as a condition for dialogue. public static bool foundHomePermafrost = false; + /// If true, the Town Pig is able to move in. + public static bool unlockedTownPig = false; /// Used for allowing custom Town Cat patreon names. public static bool catName = false; 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) diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index a1e3b2c1b4..1f37a9c1d9 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -537,7 +537,7 @@ namespace CalamityMod.World public static void GenerateAuricLandMines() { int landMineID = ModContent.TileType(); - int landMineChance = Main.zenithWorld ? 150 : 300; + int landMineChance = Main.zenithWorld ? 125 : 300; float maxDepth = Main.maxTilesY * (Main.zenithWorld ? 0.75f : 0.5f); // depth increased in gfb due to the evil columns that extend further downward for (int x = 0; x < Main.maxTilesX; x++) { diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 2ecd592b96..510e655dc5 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -433,7 +433,7 @@ namespace CalamityMod.World int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie); List contents = new List() { - new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -446,7 +446,7 @@ namespace CalamityMod.World { contents = new List() { - new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)),